RISC-V shift instructions


#1

Hello,

in the documentation, I found this info in the mnemonics table about the shift instructions:

Shift left logical imm : ($slli a0 'a1 imm) : r0 = r1 >> 3

What’s that “3”? it should be “imm”, or not?

thanks,
Fausto


#2

Thanks for spotting that - good to know someone’s reading it! There were many mistakes in that section of the table which I hope I’ve corrected now.

For definitive information I recommend:

riscv-spec-v2.2.pdf


#3

Thanks a lot!
Is there a way to call a defcode’d function in another defcode’d function? :)


#4

I don’t think there is a way to get the memory address of the function from uLisp code. If you had that, it should be no problem. That said, it kinda opens the same questions about calling conventions we discussed earlier.


#5

I could provide a uLisp function to return the address of a machine code function defined with defcode, but note that the address could change if you delete and create other machine code functions.

Alternatively, you can create several functions within one defcode and make calls between them. For an example see:

ARM assembler examples - factor

The same would be possible on RISC-V.