Closed rbartosr closed 5 months ago
Thanks for contribution. It can be used and it is elegant how small modification is but on the other hand it has limitation, because it cannot be used the way %hi(something) + some value etc. I am not sure if the GNU assembler allows to use modifiers as normal functions inside expression. If not then this approach is correct. If it is allowed to use %hi a %lo inside expressions then it would worth to implement them as part of the https://github.com/cvut/qtrvsim/blob/master/src/assembler/fixmatheval.cpp as variant of FmeNodeUnaryOp. It was my initial idea. Problem with proposed approach will be to combine %hi and %lo with lw and sw arguments because there is math_eexpression(register) evaluated as single field value...
Detail easy to resolve is that QString.last is Qt6 feature.
I fixed the Make error, I also tested the implementation on some test code using the web evaluator project. Works well for the simple syntax, but does not work on more complicated (which is to be expected, it has not yet been implemented), so I am just adding this log from the evaluation for future reference:
Error in integrated assembly.
On line 67 in your code:
argument does not match instruction template
here -->lw s1, %lo(table)+16(t3)
On line 77 in your code:
argument does not match instruction template
here -->lw s3, %lo(table)+16(t3)
Thanks for the contribution!
Full implementation in https://github.com/cvut/qtrvsim/blob/master/src/assembler/fixmatheval.cpp was merged by #115.
The update is as minimal as possible therefore the syntax of these functions is fixed to "%hi(" and "%lo(" - i.e. spaces between the function and the parenthesis is not allowed.
It allows to use function %lo and %hi in internal assembler. Example: ... .text lui a0,%hi(value) addi a0,a0,%lo(value) lw t0,0(a0) .... value: .word 0x1234