注册在 RISC-V 中的使用

Register Uses in RISC-V

我是不是加载错寄存器了!!!

RISC-V 错误信息是:

Error in line 8: "t1" operand is of incorrect type

密码是:

         .data
 var_a:   .byte 23 52 63 72
  var_b:   .word 235 263 722 352
          .text
  main:  lui  s0, 0x10010
         lw   t0, 4(s0)
         lb   t1, 2(s0)
         addi t2, t0, t1
        lb   t3, 3(s0)
         sub t4, t2, t3
         sw   t4, 22(s0)
 exit:   ori  a7, zero, 10
            ecall

addi 用于添加一个寄存器和一个立即数(因此最后的“i”),一个常量值;例如 addi t2, t0, 5 (t2 = t0 + 5)。使用 add 代替; add t2, t0, t1