简体   繁体   中英

What does `addi a0, zero, 2` mean in pseudocode?

What does addi a0, zero, 2 mean in pseudocode? Is it a0=a0+2 ??

I am not sure because we do not have explicit register in this instruction to tell us where goes our result.

There is not so much pseudo code in this risc-v assembly line :

addi a0, zero, 2
  • addi : mean add i mmediate. First argument is the register number for result, second is an argument and last is the immediate value (2 here).

But a0 and zero are ABI name of RISC-V register ( see this pdf page 3 ).

  • a0 : correspond to register x10. The addition result will be stored here.
  • zero : correspond to register x0. That is a special register «hardwired» to 0 (always 0 value)

Then the assembly line given will do this :

x10 = 0 + 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM