ChibiAkumas, "RISC-V Assembly Programming"

siiky

2023/05/05

2023/05/05

2023/05/12

video,programming

Set of videos on RISC-V assembly programming.

Instructions

Addressing

Stack

The RISC-V has no instructions to manipulate the stack specifically, one has to load/store and update the sp in two instructions.

Note on load immediate

If I'm understanding this right, because of how instructions are encoded (fixed size? as opposed to variable size as in x86), a "load immediate" instruction can't load a full word in a single "command"(?), because each instruction, including its arguments, is encoded as a word (again, if I'm understanding this right).

Because of that, the li instruction must be decomposed in two (generally I suppose; probably by the assembler). For example (assuming rv32):

li a0, 0xABCD0123

Must be something like:

lhi a0, 0x123 # this doesn't actually exist
lui a0, 0xABCD0