-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macro expansion problem, RARS limitation or just me #102
Comments
It makes sense to me that your first example compiles whereas your second does not. I can't think of any macro system that would allow the second examples. I don't think the expansion More concretely in MARS (and consequently in RARS) all arguments to a macro must be single tokens so
I don't quite know what you want your actual macro to do. If your goal is to offset A macro like the following is possible though.
|
Hi, and thanks fro the swift response. I should say that the macro was not originally in the form I showed; I've had to transform the code a little in order to accommodate other aspects of the RARS assembler syntax (I am not sure which assembler the original code used) I think the intention is to cause the two numbers to be added, so not I agree that the way things were originally written here implies a more intelligent macro processor than just simple substitution. Since this particular bit of code only occurs at the end of the macro, I think I have a workaround (untested). I will split that part off and write a set of four 'postamble' macros:
And then put the 'correct' one of those in place after the full body of the larger macro is invoked. Thanks, J^n |
RARS doesn't support any form of arithmetic as part of arguments. That is a feature I would like to introduce some time in the future though.
That seems like probably the best workaround that exists currently. |
Hi there - FYI I got things going with a variant of the 'multiple macros' approach I suggest above. Thanks! One followup - question really, not an issue, sorry; I am using RARS in this way to try to get an idea of time taken for a critical function. I have no hardware as yet and I don't think QEMU can be used to get meaningful results for this. The 'cycle' CSR shown in RARS is giving me good answers(!). Can I trust this to be cycle-accurate? Thanks once again for RARS, it is proving useful to me. |
I would be cautious of reading too much into the cycles CSR. In RARS, cycles is equivalent to instret, so effectively RARS is a single cycle cpu with a fixed frequency. However if you would be using a single cycle cpu, RARS should be accurate. I am happy RARS has been useful to you. |
Hi there - thanks for RARS, I'm finding it useful getting going with RISC-V. I am having trouble converting the macro syntax of a source file I want to assemble, not sure if it's me or if the macro language needs a bit of work.
A minimal case with a contrived macro:
Then this assembles:
but neither of these do
(I get an error "forward reference or invalid parameters for macro "mactest"")
Is there a workaround I could use?
Thanks a lot, J^n
The text was updated successfully, but these errors were encountered: