Closed tpambor closed 9 years ago
The eval[dhb]()
macros are able to handle a single constant name as their argument and substitute its value but as you've found that doesn't work if the argument is an expression. The documentation should be clearer on this. Your workaround is fine. The warnings are from m4 complaining that the optional 2nd and 3rd arguments to evalc()
are missing even though they are referenced in the expansion. You can use the const2m4()
macro instead to get the same effect without any warnings. You can also just declare foo
and bar
as m4 macros and get a cleaner expression:
define(`foo', 0x55)
define(`bar', 0xAA)
load s5, evalh(foo | bar)
Expansion:
load s5, ff ; 0x55 | 0xAA
When this is done, these constants are no longer visible to the assembler itself and won't be listed in the log. You have to remember to convert them back to PicoBlaze format with one of the eval*() helpers.
First of all I am relatively new to opbasm but I really like the already huge feature set.
As to my problem I have tried using multiple constants in an eval expression with the simple testcase below but unfortunately I stumbled across some problems.
The code generated by m4 is:
with telling me:
My expectation was that
load s3, evalh(evalc(foo) | evalc(bar))
would be evaluated toload s3, ff
. I tried to workaround by usingload s4, evalh(evalc(foo) | evalc(bar))
which actually resulted in the correct output but creates two warnings. Are there any negative side effects on using this workaround beside the warnings? Is there another macro that I should prefer?Nevertheless supporting the syntax in line 7 would greatly increase readability of the code.