I need to have my RISC-V assembly write instructions on the fly - (this is Forth so users can extend the language). When I was using a 32 bit ISA this was relatively simple, say I wanted to get an offset from the address I am currently writing at i’d do something like write out the op codes for:
lui s8, [upper 20 bits of address]
addi s8, s8, [offset]
This no longer works when I have 64 bit addresses and as I have to write out the actual op codes and not just use assembly tricks like
li s8, address
I am puzzled as to how to do it. What is the correct way?