八、c.lui
c.lui rd, imm //x[rd] = sext(imm[17:12] << 12)
高位立即数加载 (Load Upper Immediate). RV32IC and RV64IC.
扩展形式为 lui rd, imm. 当 rd=x2 或 imm=0 时非法。
| | | | | imm | | | | | | imm | | |
| | func3 | 17 | rd | 16 | 15 | 14 | 13 | 12 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.lui | CI | 0 | 1 | 1 | | | | | | | | | | | | 0 | 1 |
示例:
to do
九、c.srli
c.srli rd’, uimm //x[8+rd’] = x[8+rd’] >>u uimm
立即数逻辑右移 (Shift Right Logical Immediate). RV32IC and RV64IC.
扩展形式为 srli rd, rd, uimm, 其中 rd=8+rd’
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | | | rd' | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.srli | CA | 1 | 0 | 0 | | 0 | 0 | | | | | | | | | 0 | 1 |
示例:
to do
十、c.srai
c.srai rd’, uimm //x[8+rd’] = x[8+rd’] >>s uimm
立即数算术右移 (Shift Right Arithmetic Immediate). RV32IC and RV64IC.
扩展形式为 srai rd, rd, uimm, 其中 rd=8+rd’.
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | | | rd' | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.srai | CA | 1 | 0 | 0 | | 0 | 1 | | | | | | | | | 0 | 1 |
示例:
to do
十一、c.andi
c.andi rd’, imm //x[8+rd’] = x[8+rd’] & sext(imm)
与立即数 (AND Immediate). RV32IC and RV64IC.
扩展形式为 andi rd, rd, imm, 其中 rd=8+rd’.
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | | | rd' | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.andi | CA | 1 | 0 | 0 | | 1 | 0 | | | | | | | | | 0 | 1 |
示例:
to do
十二、c.sub
c.sub rd’, rs2’ //x[8+rd’] = x[8+rd’] - x[8+rs2’]
减 (Subtract). RV32IC and RV64IC.
扩展形式为 sub rd, rd, rs2. 其中 rd=8+rd’, rs2=8+rs2’.
| | | | | | | | | | | | | |
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.sub | CA | 1 | 0 | 0 | 0 | 1 | 1 | | | | 0 | 0 | | | | 0 | 1 |
示例:
to do
十三、c.xor
c.xor rd’, rs2’ //x[8+rd’] = x[8+rd’] ^ x[8+rs2’]
异或 (Exclusive-OR). RV32IC and RV64IC.
扩展形式为 xor rd, rd, rs2, 其中 rd=8+rd’, rs2=8+rs2’.
| | | | | | | | | | | | | |
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.xor | CA | 1 | 0 | 0 | 0 | 1 | 1 | | | | 0 | 1 | | | | 0 | 1 |
示例:
to do
十四、c.or
c.or rd’, rs2’ //x[8+rd’] = x[8+rd’] | x[8+rs2’]
或 (OR). RV32IC and RV64IC.
扩展形式为 or rd, rd, rs2, 其中 rd=8+rd’, rs2=8+rs2’.
| | | | | | | | | | | | | |
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.or | CA | 1 | 0 | 0 | 0 | 1 | 1 | | | | 1 | 0 | | | | 0 | 1 |
示例:
to do
十五、c.and
c.and rd’, rs2’ //x[8+rd’] = x[8+rd’] & x[8+rs2’]
与 (AND). RV32IC and RV64IC.
扩展形式为 and rd, rd, rs2, 其中 rd=8+rd’, rs2=8+rs2’
| | | | | | | | | | | | | |
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.and | CA | 1 | 0 | 0 | 0 | 1 | 1 | | | | 1 | 1 | | | | 0 | 1 |
示例:
to do
十六、c.subw
c.subw rd’, rs2’ //x[8+rd’] = sext((x[8+rd’] - x[8+rs2’])[31:0])
减字 (Subtract Word). RV64IC.
扩展形式为 subw rd, rd, rs2. 其中 rd=8+rd’, rs2=8+rs2’. .
| | | | | | | | | | | | | |
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.subw | CA | 1 | 0 | 0 | 1 | 1 | 1 | | | | 0 | 0 | | | | 0 | 1 |
示例:
to do
十七、c.addw
c.addw rd’, rs2’ //x[8+rd’] = sext((x[8+rd’] + x[8+rs2’])[31:0])
加字 (Add Word). RV64IC.
扩展形式为 addw rd, rd, rs2, 其中 rd=8+rd’, rs2=8+rs2’.
| | | rd' | | | rs2' | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.addw | CA | 1 | 0 | 0 | 1 | 1 | 1 | | | | 0 | 1 | | | | 0 | 1 |
示例:
to do
十八、c.j
c.j offset //pc += sext(offset)
跳转 (Jump). RV32IC and RV64IC.
扩展形式为 jal x0, offset.
| | | | | imm | | |
| | func3 | 11 | 4 | 9 | 8 | 10 | 6 | 7 | 3 | 2 | 1 | 5 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.j | CJ | 1 | 0 | 1 | | | | | | | | | | | | 0 | 1 |
示例:
to do
十九、c.bnez
c.bnez rs1’, offset //if (x[8+rs1’] ≠ 0) pc += sext(offset)
不等于零时分支 (Branch if Not Equal to Zero). RV32IC and RV64IC.
扩展形式为 bne rs1, x0, offset, 其中 rs1=8+rs1’.
| | | | | imm | | | | imm | | |
| | func3 | 8 | 4 | 3 | rs1' | 7 | 6 | 2 | 1 | 5 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.bnez | CI | 1 | 1 | 1 | | | | | | | | | | | | 0 | 1 |
示例:
to do
二十、c.beqz
c.beqz rs1’, offset //if (x[8+rs1’] == 0) pc += sext(offset)
等于零时分支 (Branch if Equal to Zero). RV32IC and RV64IC.
扩展形式为 beq rs1, x0, offset, 其中 rs1=8+rs1’.
| | | | | imm | | | | imm | | |
| | func3 | 8 | 4 | 3 | rs1' | 7 | 6 | 2 | 1 | 5 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.beqz | CI | 1 | 1 | 0 | | | | | | | | | | | | 0 | 1 |
示例:
to do
二十一、c.slli
c.slli rd, uimm //x[rd] = x[rd] << uimm
立即数逻辑左移 (Shift Left Logical Immediate). RV32IC and RV64IC.
扩展形式为 slli rd, rd, uimm.
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.slli | CI | 0 | 0 | 0 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十二、c.fldsp
c.fldsp rd, uimm(x2) //f[rd] = M[x[2] + uimm][63:0]
栈指针相关浮点双字加载 (Floating-point Load Doubleword, Stack-Pointer Relative). RV32DC
and RV64DC.
扩展形式为 fld rd, uimm(x2).
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 8 | 7 | 6 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.fldsp | CI | 0 | 0 | 1 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十三、c.lwsp
c.lwsp rd, uimm(x2) //x[rd] = sext(M[x[2] + uimm][31:0])
栈指针相关字加载 (Load Word, Stack-Pointer Relative). RV32IC and RV64IC.
扩展形式为 lw rd, uimm(x2). rd=x0 时非法。
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 2 | 7 | 6 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.lwsp | CI | 0 | 1 | 0 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十四、c.flwsp
c.flwsp rd, uimm(x2) //f[rd] = M[x[2] + uimm][31:0]
栈指针相关浮点字加载 (Floating-point Load Word, Stack-Pointer Relative). RV32FC.
扩展形式为 flw rd, uimm(x2).
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 2 | 7 | 6 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.flwsp | CI | 0 | 1 | 1 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十五、c.mv
c.mv rd, rs2 //x[rd] = x[rs2]
移动 (Move). RV32IC and RV64IC.
扩展形式为 add rd, x0, rs2. rs2=x0 时非法
| | | | | | | | | | | | | |
| | | | | | rd | rs2 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.mv | CA | 1 | 0 | 0 | 0 | | | | | | | | | | | 1 | 0 |
示例:
to do
二十六、c.fsdsp
c.fsdsp rs2, uimm(x2) //M[x[2] + uimm][63:0] = f[rs2]
栈指针相关浮点双字存储 (Floating-point Store Doubleword, Stack-Pointer Relative). RV32DC and RV64DC.
扩展形式为 fsd rs2, uimm(x2).
| | | | | imm | | | | |
| | | | | 5 | 4 | 3 | 8 | 7 | 6 | rs2 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.fsdsp | CSS | 1 | 0 | 1 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十七、c.fswsp
c.fswsp rs2, uimm(x2) //M[x[2] + uimm][31:0] = f[rs2]
栈指针相关浮点字存储 (Floating-point Store Word, Stack-Pointer Relative). RV32FC.
扩展形式为 fsw rs2, uimm(x2)
| | | | | imm | | | | |
| | | | | 5 | 4 | 3 | 2 | 7 | 6 | rs2 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.fswsp | CSS | 1 | 1 | 1 | | | | | | | | | | | | 1 | 0 |
示例:
to do
二十八、c.nop
空操作,只增加PC值。对应 addi x0,x0,0
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.nop | CI | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
示例:
to do
二十九、c.ebreak
c.ebreak RaiseException(Breakpoint)
环境断点 (Environment Breakpoint). RV32IC and RV64IC.
扩展形式为 ebreak.
| | | | | imm | | | | | | imm | | |
| | func3 | 5 | rd | 4 | 3 | 2 | 1 | 0 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.nop | CI | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
示例:
to do
三十、c.addi16sp
c.addi16sp imm //x[2] = x[2] + sext(imm)
加 16 倍立即数到栈指针 (Add Immediate, Scaled by 16, to Stack Pointer). RV32IC and RV64IC.
扩展形式为 addi x2, x2, imm. imm=0 时非法。
| | | | |
| | | | | |
| | |
| | func3 | 9 | | | | | | 4 | 6 | 8 | 7 | 5 | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.addi16spn | CIW | 0 | 1 | 1 | | 0 | 0 | 0 | 1 | 0 | | | | | | 0 | 1 |
示例:
to do
三十一、c.jr
c.jr rs1 //pc = x[rs1]
寄存器跳转 (Jump Register). RV32IC and RV64IC.
扩展形式为 jalr x0, 0(rs1). 当 rs1=x0 时非法。
| | | | | | | | | | | | | |
| | func3 | 9 | rs1 | | | | | | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.jr | CI | 1 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
示例:
to do
三十二、c.jalr
c.jalr rs1 t = pc+2; pc = x[rs1]; x[1] = t
寄存器链接跳转 (Jump and Link Register). RV32IC and RV64IC.
扩展形式为 jalr x1, 0(rs1). 当 rs1=x0 时非法
| | | | | | | | | | | | | |
| | func3 | 9 | rs1 | | | | | | opcode |
name | type | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
c.jalr | CI | 1 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
示例:
to do
xxxxx
示例:
to do
xxxxx
示例:
to do
完