RARS下载及启动


方便起见,使用RARS(一款汇编器和运行时模拟器)

<font size=1>

还有一款 在线模拟器emulsiV,简单易上手,对指令的走向更加直观,但该网站目前好像不可用了

</font>

RARS -- RISC-V Assembler and Runtime Simulator

可以下载最新的稳定版本,当前为1.6 https://github.com/TheThirdOne/rars/releases/tag/v1.6


使用Java编写,所以还需要有Java环境


启动: java -jar rars1_6.jar




编写


这段复制数组内容的代码为例:

#将y[]中的值copy到x[]中
.data
x:
    .byte  0
    .space 13   
y:
    .byte '0','1','2','3','4','5','6','F','a','d','f',0
    .space 13 
       
.text
strcpy:
       la a0,x
       la a1,y
       addi sp,sp,-8
       sw   s3,0(sp)
       add  s3,zero,zero
L1:    
       add  t0,s3,a1
       lbu  t1,0(t0)
       add  t2,s3,a0
       sb   t1,0(t2)
       beq  t1,zero,L2
       addi s3,s3,1
       jal  zero,L1
L2:    
       lw   s3,0(sp)
       addi sp,sp,8
       jalr zero,0(ra)


再如1到100 数字之和

# 设置寄存器 a0 为 1
li a0, 1
# 设置寄存器 a1 为 100
li a1, 100
# 设置寄存器 t0 为 0,用于累加和
li t0, 0

# 循环开始,使用寄存器 t1 存储循环变量
addi t1, zero, 0 # t1 = 0
loop:
    add t0, t0, a0   # 累加 a0 的值到 t0
    addi a0, a0, 1   # a0 自增 1
    addi t1, t1, 1   # t1 自增 1
    bne t1, a1, loop # 如果 t1 不等于 a1 则跳转回 loop

# 程序结束,t0 中存储了 1 到 100 的和

首先使用 li 指令将 1 和 100 分别存储到寄存器 a0 和 a1 中,然后使用 li 指令将寄存器 t0 的初始值设为 0,用于累加和。
接下来进入循环,使用寄存器 t1 存储循环变量,初始值设为 0。在每次循环中,使用 add 指令将 a0 的值加到 t0 中,
然后使用 addi 指令将 a0 加 1,t1 加 1,继续下一次循环。最后使用 bne 指令判断 t1 是否等于 a1,如果不相等则跳转回循环开始处,

继续循环。如果相等则跳出循环,程序结束,t0 中存储了 1 到 100 的和。




详细使用


RISC-V一共有32个寄存器

RARS-riscv模拟器使用介绍

单步调试,断点运行




指令


来自 RARS 汇编模拟器支持的RISC-V指令

原作者的github


常用基础指令:

Example Usage中文描述Description
add t1,t2,t3加法:设 t1 为(t2 加 t3)Addition: set t1 to (t2 plus t3)
addi t1,t2,-100加法立即数:将 t1 设置为(t2 加上带符号的 12 位立即数)Addition immediate: set t1 to (t2 plus signed 12-bit immediate)
sub t1,t2,t3减法:将 t1 设置为(t2 减去 t3)Subtraction: set t1 to (t2 minus t3)
mul t1,t2,t3乘法:将t1设为t2*t3的低32位Multiplication: set t1 to the lower 32 bits of t2*t3
div t1,t2,t3除法:将 t1 设置为 t2/t3 的结果Division: set t1 to the result of t2/t3
lw t1, -100(t2)将 t1 设置为有效内存字地址的内容Set t1 to contents of effective memory word address
sw t1, -100(t2)Store word:将t1的内容存入有效内存字地址Store word : Store contents of t1 into effective memory word address
beq t1,t2,labelBranch if equal : 如果 t1 和 t2 相等则分支到标签地址处的语句Branch if equal : Branch to statement at label's address if t1 and t2 are equal
bne t1,t2,labelBranch if not equal : 如果 t1 和 t2 不相等则分支到标签地址处的语句Branch if not equal : Branch to statement at label's address if t1 and t2 are not equal
blt t1,t2,labelBranch if less than:如果 t1 小于 t2,则分支到标签地址处的语句Branch if less than: Branch to statement at label's address if t1 is less than t2
bge t1,t2,labelBranch if greater than or equal:如果 t1 大于或等于 t2,则分支到标签地址处的语句Branch if greater than or equal: Branch to statement at label's address if t1 is greater than or equal to t2


常用伪指令:

Example Usage中文描述Description
la t1,label加载地址:将 t1 设置为标签的地址Load Address : Set t1 to label's address
li t1,-100立即加载:将 t1 设置为 12 位立即数(符号扩展)Load Immediate : Set t1 to 12-bit immediate (sign-extended)
li t1,10000000立即加载:将 t1 设置为 32 位立即数Load Immediate : Set t1 to 32-bit immediate
mv t1,t2MoVe:将 t1 设置为 t2 的内容MoVe : Set t1 to contents of t2
neg t1,t2NEGate :将 t1 设置为 t2 的否定NEGate : Set t1 to negation of t2
j label跳转:跳转到标签处的语句Jump : Jump to statement at label
jr t0跳转寄存器:跳转到 t0 中的地址Jump Register: Jump to address in t0
nop无操作NO OPeration
ret返回:从子程序返回Return: return from a subroutine


RARS 汇编模拟器支持的RISC-V指令:

Example Usage中文描述DescriptionExample Usage
add t1,t2,t3加法:设 t1 为(t2 加 t3)Addition: set t1 to (t2 plus t3)add t1,t2,t3
addi t1,t2,-100加法立即数:将 t1 设置为(t2 加上带符号的 12 位立即数)Addition immediate: set t1 to (t2 plus signed 12-bit immediate)addi t1,t2,-100
and t1,t2,t3按位与:将 t1 设置为 t2 和 t3 的按位与Bitwise AND : Set t1 to bitwise AND of t2 and t3and t1,t2,t3
andi t1,t2,-100按位与立即数:将 t1 设置为 t2 的按位与和符号扩展的 12 位立即数Bitwise AND immediate : Set t1 to bitwise AND of t2 and sign-extended 12-bit immediateandi t1,t2,-100
auipc t1,10000将高位立即数添加到 pc:将 t1 设置为(pc 加上高位 20 位立即数)Add upper immediate to pc: set t1 to (pc plus an upper 20-bit immediate)auipc t1,10000
beq t1,t2,labelBranch if equal : 如果 t1 和 t2 相等则分支到标签地址处的语句Branch if equal : Branch to statement at label's address if t1 and t2 are equalbeq t1,t2,label
bge t1,t2,labelBranch if greater than or equal:如果 t1 大于或等于 t2,则分支到标签地址处的语句Branch if greater than or equal: Branch to statement at label's address if t1 is greater than or equal to t2bge t1,t2,label
bgeu t1,t2,labelBranch if greater than or equal to (unsigned):如果 t1 大于或等于 t2,则分支到标签地址处的语句(无符号解释)Branch if greater than or equal to (unsigned): Branch to statement at label's address if t1 is greater than or equal to t2 (with an unsigned interpretation)bgeu t1,t2,label
blt t1,t2,labelBranch if less than:如果 t1 小于 t2,则分支到标签地址处的语句Branch if less than: Branch to statement at label's address if t1 is less than t2blt t1,t2,label
bltu t1,t2,labelBranch if less than (unsigned):如果 t1 小于 t2,则分支到标签地址处的语句(无符号解释)Branch if less than (unsigned): Branch to statement at label's address if t1 is less than t2 (with an unsigned interpretation)bltu t1,t2,label
bne t1,t2,labelBranch if not equal : 如果 t1 和 t2 不相等则分支到标签地址处的语句Branch if not equal : Branch to statement at label's address if t1 and t2 are not equalbne t1,t2,label
csrrc t0, fcsr, t1原子读取/清除 CSR:从 CSR 读取到 t0 并根据 t1 清除 CSR 的位Atomic Read/Clear CSR: read from the CSR into t0 and clear bits of the CSR according to t1csrrc t0, fcsr, t1
csrrci t0, fcsr, 10立即原子读取/清除 CSR:从 CSR 读取到 t0 并根据常量清除 CSR 的位Atomic Read/Clear CSR Immediate: read from the CSR into t0 and clear bits of the CSR according to a constantcsrrci t0, fcsr, 10
csrrs t0, fcsr, t1原子读取/设置 CSR:从 CSR 读取到 t0 并将逻辑或 t1 读取到 CSRAtomic Read/Set CSR: read from the CSR into t0 and logical or t1 into the CSRcsrrs t0, fcsr, t1
csrrsi t0, fcsr, 10立即原子读取/设置 CSR:从 CSR 读取到 t0 并将逻辑或常量读取到 CSRAtomic Read/Set CSR Immediate: read from the CSR into t0 and logical or a constant into the CSRcsrrsi t0, fcsr, 10
csrrw t0, fcsr, t1原子读/写 CSR:从 CSR 读入 t0 并将 t1 写入 CSRAtomic Read/Write CSR: read from the CSR into t0 and write t1 into the CSRcsrrw t0, fcsr, t1
csrrwi t0, fcsr, 10原子读/写 CSR 立即:从 CSR 读取到 t0 并将常量写入 CSRAtomic Read/Write CSR Immediate: read from the CSR into t0 and write a constant into the CSRcsrrwi t0, fcsr, 10
div t1,t2,t3除法:将 t1 设置为 t2/t3 的结果Division: set t1 to the result of t2/t3div t1,t2,t3
divu t1,t2,t3除法:使用无符号除法将 t1 设置为 t2/t3 的结果Division: set t1 to the result of t2/t3 using unsigned divisiondivu t1,t2,t3
ebreak暂停执行Pause executionebreak
ecall发出系统调用:执行a7中值指定的系统调用Issue a system call : Execute the system call specified by value in a7ecall
fadd.d f1, f2, f3, dyn浮动 ADD(64 位):将 f1 分配给 f2 + f3Floating ADD (64 bit): assigns f1 to f2 + f3fadd.d f1, f2, f3, dyn
fadd.s f1, f2, f3, dyn浮动 ADD:将 f1 分配给 f2 + f3Floating ADD: assigns f1 to f2 + f3fadd.s f1, f2, f3, dyn
fclass.d t1, f1对一个浮点数(64位)进行分类Classify a floating point number (64 bit)fclass.d t1, f1
fclass.s t1, f1对一个浮点数进行分类Classify a floating point numberfclass.s t1, f1
fcvt.d.s t1, f1, dyn将 float 转换为 double:将 f2 的值分配给 f1Convert a float to a double: Assigned the value of f2 to f1fcvt.d.s t1, f1, dyn
fcvt.d.w f1, t1, dyn从整数转换为双精度:将 t1 的值赋给 f1Convert double from integer: Assigns the value of t1 to f1fcvt.d.w f1, t1, dyn
fcvt.d.wu f1, t1, dyn从无符号整数转换双精度数:将 t1 的值赋给 f1Convert double from unsigned integer: Assigns the value of t1 to f1fcvt.d.wu f1, t1, dyn
fcvt.s.d t1, f1, dyn将双精度型转换为浮点型:将 f2 的值分配给 f1Convert a double to a float: Assigned the value of f2 to f1fcvt.s.d t1, f1, dyn
fcvt.s.w f1, t1, dyn从整数转换为浮点数:将 t1 的值赋给 f1Convert float from integer: Assigns the value of t1 to f1fcvt.s.w f1, t1, dyn
fcvt.s.wu f1, t1, dyn从无符号整数转换浮点数:将 t1 的值赋给 f1Convert float from unsigned integer: Assigns the value of t1 to f1fcvt.s.wu f1, t1, dyn
fcvt.w.d t1, f1, dyn从双精度转换整数:将 f1 的值(四舍五入)分配给 t1Convert integer from double: Assigns the value of f1 (rounded) to t1fcvt.w.d t1, f1, dyn
fcvt.w.s t1, f1, dyn从浮点数转换整数:将 f1 的值(四舍五入)赋值给 t1Convert integer from float: Assigns the value of f1 (rounded) to t1fcvt.w.s t1, f1, dyn
fcvt.wu.d t1, f1, dyn从 double 转换未签名的整数:将 f1 的值(四舍五入)分配给 t1Convert unsinged integer from double: Assigns the value of f1 (rounded) to t1fcvt.wu.d t1, f1, dyn
fcvt.wu.s t1, f1, dyn将浮点数转换为无符号整数:将 f1 的值(四舍五入)赋值给 t1Convert unsinged integer from float: Assigns the value of f1 (rounded) to t1fcvt.wu.s t1, f1, dyn
fdiv.d f1, f2, f3, dyn浮动 DIVide(64 位):将 f1 分配给 f2 / f3Floating DIVide (64 bit): assigns f1 to f2 / f3fdiv.d f1, f2, f3, dyn
fdiv.s f1, f2, f3, dyn浮动 DIVide:将 f1 分配给 f2 / f3Floating DIVide: assigns f1 to f2 / f3fdiv.s f1, f2, f3, dyn
fence 1, 1确保围栏之前的 IO 和内存访问发生在不同线程查看的以下 IO 和内存访问之前Ensure that IO and memory accesses before the fence happen before the following IO and memory accesses as viewed by a different threadfence 1, 1
fence.i确保指令存储器的存储对指令提取可见Ensure that stores to instruction memory are visible to instruction fetchesfence.i
feq.d t1, f1, f2Floating EQuals(64 位):如果 f1 = f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating EQuals (64 bit): if f1 = f2, set t1 to 1, else set t1 to 0feq.d t1, f1, f2
feq.s t1, f1, f2浮动相等:如果 f1 = f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating EQuals: if f1 = f2, set t1 to 1, else set t1 to 0feq.s t1, f1, f2
fld f1, -100(t1)从内存中加载一个 doubleLoad a double from memoryfld f1, -100(t1)
fle.d t1, f1, f2小于或等于浮动(64 位):如果 f1 <= f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Less than or Equals (64 bit): if f1 <= f2, set t1 to 1, else set t1 to 0fle.d t1, f1, f2
fle.s t1, f1, f2浮动小于或等于:如果 f1 <= f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Less than or Equals: if f1 <= f2, set t1 to 1, else set t1 to 0fle.s t1, f1, f2
flt.d t1, f1, f2小于浮动(64 位):如果 f1 < f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Less Than (64 bit): if f1 < f2, set t1 to 1, else set t1 to 0flt.d t1, f1, f2
flt.s t1, f1, f2浮动小于:如果 f1 < f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Less Than: if f1 < f2, set t1 to 1, else set t1 to 0flt.s t1, f1, f2
flw f1, -100(t1)从内存中加载一个浮点数Load a float from memoryflw f1, -100(t1)
fmadd.d f1, f2, f3, f4, dyn融合乘加(64 位):将 f2*f3+f4 分配给 f1Fused Multiply Add (64 bit): Assigns f2*f3+f4 to f1fmadd.d f1, f2, f3, f4, dyn
fmadd.s f1, f2, f3, f4, dyn融合乘加:将 f2*f3+f4 分配给 f1Fused Multiply Add: Assigns f2*f3+f4 to f1fmadd.s f1, f2, f3, f4, dyn
fmax.d f1, f2, f3Floating MAXimum(64 位):将 f1 分配给 f1 和 f3 中的较大者Floating MAXimum (64 bit): assigns f1 to the larger of f1 and f3fmax.d f1, f2, f3
fmax.s f1, f2, f3Floating MAXimum:将 f1 分配给 f1 和 f3 中的较大者Floating MAXimum: assigns f1 to the larger of f1 and f3fmax.s f1, f2, f3
fmin.d f1, f2, f3Floating MINimum(64 位):将 f1 分配给 f1 和 f3 中的较小者Floating MINimum (64 bit): assigns f1 to the smaller of f1 and f3fmin.d f1, f2, f3
fmin.s f1, f2, f3Floating MINimum:将 f1 分配给 f1 和 f3 中较小的一个Floating MINimum: assigns f1 to the smaller of f1 and f3fmin.s f1, f2, f3
fmsub.d f1, f2, f3, f4, dyn融合乘子:将 f2*f3-f4 分配给 f1Fused Multiply Subatract: Assigns f2*f3-f4 to f1fmsub.d f1, f2, f3, f4, dyn
fmsub.s f1, f2, f3, f4, dyn融合乘子:将 f2*f3-f4 分配给 f1Fused Multiply Subatract: Assigns f2*f3-f4 to f1fmsub.s f1, f2, f3, f4, dyn
fmul.d f1, f2, f3, dynFloating MULtiply(64 位):将 f1 分配给 f2 * f3Floating MULtiply (64 bit): assigns f1 to f2 * f3fmul.d f1, f2, f3, dyn
fmul.s f1, f2, f3, dynFloating MULtiply:将 f1 分配给 f2 * f3Floating MULtiply: assigns f1 to f2 * f3fmul.s f1, f2, f3, dyn
fmv.s.x f1, t1移动浮点数:从整数寄存器中移动表示浮点数的位Move float: move bits representing a float from an integer registerfmv.s.x f1, t1
fmv.x.s t1, f1移动浮点数:将表示浮点数的位移动到整数寄存器Move float: move bits representing a float to an integer registerfmv.x.s t1, f1
fnmadd.d f1, f2, f3, f4, dynFused Negate Multiply Add(64 位):将 -(f2*f3+f4) 分配给 f1Fused Negate Multiply Add (64 bit): Assigns -(f2*f3+f4) to f1fnmadd.d f1, f2, f3, f4, dyn
fnmadd.s f1, f2, f3, f4, dynFused Negate Multiply Add:将 -(f2*f3+f4) 分配给 f1Fused Negate Multiply Add: Assigns -(f2*f3+f4) to f1fnmadd.s f1, f2, f3, f4, dyn
fnmsub.d f1, f2, f3, f4, dyn融合取反乘法减法:将 -(f2*f3-f4) 赋值给 f1Fused Negated Multiply Subatract: Assigns -(f2*f3-f4) to f1fnmsub.d f1, f2, f3, f4, dyn
fnmsub.s f1, f2, f3, f4, dyn融合取反乘法减法:将 -(f2*f3-f4) 赋值给 f1Fused Negated Multiply Subatract: Assigns -(f2*f3-f4) to f1fnmsub.s f1, f2, f3, f4, dyn
fsd f1, -100(t1)将双精度存储到内存Store a double to memoryfsd f1, -100(t1)
fsgnj.d f1, f2, f3浮点符号注入(64位):将f2的符号位替换为f3的符号位赋值给f1Floating point sign injection (64 bit): replace the sign bit of f2 with the sign bit of f3 and assign it to f1fsgnj.d f1, f2, f3
fsgnj.s f1, f2, f3浮点符号注入:将f2的符号位替换为f3的符号位赋值给f1Floating point sign injection: replace the sign bit of f2 with the sign bit of f3 and assign it to f1fsgnj.s f1, f2, f3
fsgnjn.d f1, f2, f3浮点符号注入(反转64位):将f2的符号位替换为f3的相反符号位赋值给f1Floating point sign injection (inverted 64 bit): replace the sign bit of f2 with the opposite of sign bit of f3 and assign it to f1fsgnjn.d f1, f2, f3
fsgnjn.s f1, f2, f3浮点符号注入(倒置):将f2的符号位替换为f3的相反符号位赋值给f1Floating point sign injection (inverted): replace the sign bit of f2 with the opposite of sign bit of f3 and assign it to f1fsgnjn.s f1, f2, f3
fsgnjx.d f1, f2, f3浮点符号注入(xor 64 bit):将f2的符号位与f3的符号位异或赋值给f1Floating point sign injection (xor 64 bit): xor the sign bit of f2 with the sign bit of f3 and assign it to f1fsgnjx.d f1, f2, f3
fsgnjx.s f1, f2, f3浮点符号注入(xor):将f2的符号位与f3的符号位异或赋值给f1Floating point sign injection (xor): xor the sign bit of f2 with the sign bit of f3 and assign it to f1fsgnjx.s f1, f2, f3
fsqrt.d f1, f2, dyn浮动平方根(64 位):将 f1 分配给 f2 的平方根Floating SQuare RooT (64 bit): Assigns f1 to the square root of f2fsqrt.d f1, f2, dyn
fsqrt.s f1, f2, dyn浮动平方根:将 f1 分配给 f2 的平方根Floating SQuare RooT: Assigns f1 to the square root of f2fsqrt.s f1, f2, dyn
fsub.d f1, f2, f3, dyn浮动减法(64 位):将 f1 分配给 f2 - f3Floating SUBtract (64 bit): assigns f1 to f2 - f3fsub.d f1, f2, f3, dyn
fsub.s f1, f2, f3, dyn浮动减法:将 f1 分配给 f2 - f3Floating SUBtract: assigns f1 to f2 - f3fsub.s f1, f2, f3, dyn
fsw f1, -100(t1)将浮点数存储到内存中Store a float to memoryfsw f1, -100(t1)
jal t1, target跳转和链接:将 t1 设置为程序计数器(返回地址),然后跳转到目标地址处的语句Jump and link : Set t1 to Program Counter (return address) then jump to statement at target addressjal t1, target
jalr t1, t2, -100跳转和链接寄存器:将 t1 设置为程序计数器(返回地址),然后跳转到 t2 + 立即数处的语句Jump and link register: Set t1 to Program Counter (return address) then jump to statement at t2 + immediatejalr t1, t2, -100
lb t1, -100(t2)将 t1 设置为有效内存字节地址的符号扩展 8 位值Set t1 to sign-extended 8-bit value from effective memory byte addresslb t1, -100(t2)
lbu t1, -100(t2)将 t1 设置为从有效内存字节地址开始的零扩展 8 位值Set t1 to zero-extended 8-bit value from effective memory byte addresslbu t1, -100(t2)
lh t1, -100(t2)将 t1 设置为有效内存半字地址的符号扩展 16 位值Set t1 to sign-extended 16-bit value from effective memory halfword addresslh t1, -100(t2)
lhu t1, -100(t2)将 t1 设置为有效内存半字地址的零扩展 16 位值Set t1 to zero-extended 16-bit value from effective memory halfword addresslhu t1, -100(t2)
lui t1,10000加载高立即数:将 t1 设置为 20 位后跟 12 个 0Load upper immediate: set t1 to 20-bit followed by 12 0slui t1,10000
lw t1, -100(t2)将 t1 设置为有效内存字地址的内容Set t1 to contents of effective memory word addresslw t1, -100(t2)
mul t1,t2,t3乘法:将t1设为t2*t3的低32位Multiplication: set t1 to the lower 32 bits of t2*t3mul t1,t2,t3
mulh t1,t2,t3乘法:使用有符号乘法将 t1 设置为 t2*t3 的高 32 位Multiplication: set t1 to the upper 32 bits of t2*t3 using signed multiplicationmulh t1,t2,t3
mulhsu t1,t2,t3乘法:将 t1 设置为 t2*t3 的高 32 位,其中 t2 是有符号的,t3 是无符号的Multiplication: set t1 to the upper 32 bits of t2*t3 where t2 is signed and t3 is unsignedmulhsu t1,t2,t3
mulhu t1,t2,t3乘法:使用无符号乘法将 t1 设置为 t2*t3 的高 32 位Multiplication: set t1 to the upper 32 bits of t2*t3 using unsigned multiplicationmulhu t1,t2,t3
or t1,t2,t3按位或:将 t1 设置为 t2 和 t3 的按位或Bitwise OR : Set t1 to bitwise OR of t2 and t3or t1,t2,t3
ori t1,t2,-100按位或立即数:将 t1 设置为 t2 和符号扩展的 12 位立即数的按位或Bitwise OR immediate : Set t1 to bitwise OR of t2 and sign-extended 12-bit immediateori t1,t2,-100
rem t1,t2,t3余数:将 t1 设置为 t2/t3 的余数Remainder: set t1 to the remainder of t2/t3rem t1,t2,t3
remu t1,t2,t3余数:使用无符号除法将 t1 设置为 t2/t3 的余数Remainder: set t1 to the remainder of t2/t3 using unsigned divisionremu t1,t2,t3
sb t1, -100(t2)Store byte : 将t1的低8位存入有效内存字节地址Store byte : Store the low-order 8 bits of t1 into the effective memory byte addresssb t1, -100(t2)
sh t1, -100(t2)Store halfword : 将t1的低16位存入有效内存半字地址Store halfword : Store the low-order 16 bits of t1 into the effective memory halfword addresssh t1, -100(t2)
sll t1,t2,t3左移逻辑:将 t1 设置为将 t2 左移 t3 的低 5 位中的值指定的位数的结果Shift left logical: Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3sll t1,t2,t3
slli t1,t2,10左移逻辑:将 t1 设置为将 t2 左移 immediate 指定的位数的结果Shift left logical : Set t1 to result of shifting t2 left by number of bits specified by immediateslli t1,t2,10
slt t1,t2,t3设置小于:如果 t2 小于 t3,则将 t1 设置为 1,否则将 t1 设置为 0Set less than : If t2 is less than t3, then set t1 to 1 else set t1 to 0slt t1,t2,t3
slti t1,t2,-100设置小于立即数:如果 t2 小于符号扩展的 12 位立即数,则将 t1 设置为 1,否则将 t1 设置为 0Set less than immediate : If t2 is less than sign-extended 12-bit immediate, then set t1 to 1 else set t1 to 0slti t1,t2,-100
sltiu t1,t2,-100设置小于无符号立即数:如果 t2 小于使用无符号比较进行符号扩展的 16 位立即数,则将 t1 设置为 1,否则将 t1 设置为 0Set less than immediate unsigned : If t2 is less than sign-extended 16-bit immediate using unsigned comparison, then set t1 to 1 else set t1 to 0sltiu t1,t2,-100
sltu t1,t2,t3设置小于:如果使用无符号比较 t2 小于 t3,则将 t1 设置为 1,否则将 t1 设置为 0Set less than : If t2 is less than t3 using unsigned comparision, then set t1 to 1 else set t1 to 0sltu t1,t2,t3
sra t1,t2,t3右移算法:将 t1 设置为将 t2 符号扩展右移的结果,其位数由 t3 的低 5 位中的值指定Shift right arithmetic: Set t1 to result of sign-extended shifting t2 right by number of bits specified by value in low-order 5 bits of t3sra t1,t2,t3
srai t1,t2,10右移算术:将 t1 设置为将 t2 符号扩展右移立即数指定的位数的结果Shift right arithmetic : Set t1 to result of sign-extended shifting t2 right by number of bits specified by immediatesrai t1,t2,10
srl t1,t2,t3右移逻辑:将 t1 设置为将 t2 右移 t3 的低 5 位中的值指定的位数的结果Shift right logical: Set t1 to result of shifting t2 right by number of bits specified by value in low-order 5 bits of t3srl t1,t2,t3
srli t1,t2,10右移逻辑:将 t1 设置为将 t2 右移 immediate 指定的位数的结果Shift right logical : Set t1 to result of shifting t2 right by number of bits specified by immediatesrli t1,t2,10
sub t1,t2,t3减法:将 t1 设置为(t2 减去 t3)Subtraction: set t1 to (t2 minus t3)sub t1,t2,t3
sw t1, -100(t2)Store word:将t1的内容存入有效内存字地址Store word : Store contents of t1 into effective memory word addresssw t1, -100(t2)
uret从处理中断或异常返回(到 uepc)Return from handling an interrupt or exception (to uepc)uret
wfi等待中断Wait for Interruptwfi
xor t1,t2,t3按位异或:将 t1 设置为 t2 和 t3 的按位异或Bitwise XOR : Set t1 to bitwise XOR of t2 and t3xor t1,t2,t3
xori t1,t2,-100按位异或立即数:将 t1 设置为 t2 和符号扩展的 12 位立即数的按位异或Bitwise XOR immediate : Set t1 to bitwise XOR of t2 and sign-extended 12-bit immediatexori t1,t2,-100
Supported psuedo-instructions (支持的伪指令)Supported psuedo-instructions (支持的伪指令)Supported psuedo-instructions (支持的伪指令)Supported psuedo-instructions (支持的伪指令)
Example Usage中文描述DescriptionExample Usage
addi t1,t2,%lo(label)Load Lower Address : 设置 t1 到 t2 + 低 12 位标签地址Load Lower Address : Set t1 to t2 + lower 12-bit label's addressaddi t1,t2,%lo(label)
b labelBranch : 无条件分支到标签处的语句Branch : Branch to statement at label unconditionallyb label
beqz t1,labelBranch if EQual Zero :如果 t1 == 0 则分支到标签处的语句Branch if EQual Zero : Branch to statement at label if t1 == 0beqz t1,label
bgez t1,labelBranch if Greater than or Equal to Zero :如果 t1 >= 0,则分支到标签处的语句Branch if Greater than or Equal to Zero : Branch to statement at label if t1 >= 0bgez t1,label
bgt t1,t2,labelBranch if Greater Than :如果 t1 > t2 则分支到标签处的语句Branch if Greater Than : Branch to statement at label if t1 > t2bgt t1,t2,label
bgtu t1,t2,labelBranch if Greater Than Unsigned:如果 t1 > t2(无符号比较)则分支到标签处的语句Branch if Greater Than Unsigned: Branch to statement at label if t1 > t2 (unsigned compare)bgtu t1,t2,label
bgtz t1,labelBranch if Greater Than:如果 t1 > 0,则分支到标签处的语句Branch if Greater Than: Branch to statement at label if t1 > 0bgtz t1,label
ble t1,t2,labelBranch if Less or Equal :如果 t1 <= t2 则分支到标签处的语句Branch if Less or Equal : Branch to statement at label if t1 <= t2ble t1,t2,label
bleu t1,t2,labelBranch if Less or Equal Unsigned:如果 t1 <= t2(无符号比较),则分支到标签处的语句Branch if Less or Equal Unsigned : Branch to statement at label if t1 <= t2 (unsigned compare)bleu t1,t2,label
blez t1,labelBranch if Less than or Equal to Zero:如果 t1 <= 0,则分支到标签处的语句Branch if Less than or Equal to Zero : Branch to statement at label if t1 <= 0blez t1,label
bltz t1,label如果小于零则分支:如果 t1 < 0,则分支到标签处的语句Branch if Less Than Zero : Branch to statement at label if t1 < 0bltz t1,label
bnez t1,labelBranch if Not Equal Zero:如果 t1 != 0,则分支到标签处的语句Branch if Not Equal Zero : Branch to statement at label if t1 != 0bnez t1,label
call labelCALL:调用远处的子程序CALL: call a far-away subroutinecall label
csrc t1, fcsr清除控制和状态寄存器中的位Clear bits in control and status registercsrc t1, fcsr
csrci fcsr, 100清除控制和状态寄存器中的位Clear bits in control and status registercsrci fcsr, 100
csrr t1, fcsr读取控制和状态寄存器Read control and status registercsrr t1, fcsr
csrs t1, fcsr设置控制和状态寄存器中的位Set bits in control and status registercsrs t1, fcsr
csrsi fcsr, 100设置控制和状态寄存器中的位Set bits in control and status registercsrsi fcsr, 100
csrw t1, fcsr写控制和状态寄存器Write control and status registercsrw t1, fcsr
csrwi fcsr, 100写控制和状态寄存器Write control and status registercsrwi fcsr, 100
fabs.d f1, f2将 f1 设置为 f2 的绝对值(64 位)Set f1 to the absolute value of f2 (64 bit)fabs.d f1, f2
fabs.s f1, f2将 f1 设置为 f2 的绝对值Set f1 to the absolute value of f2fabs.s f1, f2
fadd.d f1, f2, f3浮动 ADD(64 位):将 f1 分配给 f2 + f3Floating ADD (64 bit): assigns f1 to f2 + f3fadd.d f1, f2, f3
fadd.s f1, f2, f3浮动 ADD:将 f1 分配给 f2 + f3Floating ADD: assigns f1 to f2 + f3fadd.s f1, f2, f3
fcvt.d.s f1, f2将float转为double:将f2的值赋值给f1Convert float to double: Assigned the value of f2 to f1fcvt.d.s f1, f2
fcvt.d.w f1, t1从有符号整数转换双精度数:将 t1 的值赋给 f1Convert double from signed integer: Assigns the value of t1 to f1fcvt.d.w f1, t1
fcvt.d.wu f1, t1从无符号整数转换双精度数:将 t1 的值赋给 f1Convert double from unsigned integer: Assigns the value of t1 to f1fcvt.d.wu f1, t1
fcvt.s.d f1, f2double转float:将f2的值赋值给f1Convert double to float: Assigned the value of f2 to f1fcvt.s.d f1, f2
fcvt.s.w f1, t1从有符号整数转换浮点数:将 t1 的值赋给 f1Convert float from signed integer: Assigns the value of t1 to f1fcvt.s.w f1, t1
fcvt.s.wu f1, t1从无符号整数转换浮点数:将 t1 的值赋给 f1Convert float from unsigned integer: Assigns the value of t1 to f1fcvt.s.wu f1, t1
fcvt.w.d t1, f1从双精度转换有符号整数:将 f1 的值(四舍五入)分配给 t1Convert signed integer from double: Assigns the value of f1 (rounded) to t1fcvt.w.d t1, f1
fcvt.w.s t1, f1从浮点数转换有符号整数:将 f1 的值(四舍五入)赋值给 t1Convert signed integer from float: Assigns the value of f1 (rounded) to t1fcvt.w.s t1, f1
fcvt.wu.d t1, f1从双精度转换无符号整数:将 f1 的值(四舍五入)分配给 t1Convert unsigned integer from double: Assigns the value of f1 (rounded) to t1fcvt.wu.d t1, f1
fcvt.wu.s t1, f1从浮点数转换无符号整数:将 f1 的值(四舍五入)赋值给 t1Convert unsigned integer from float: Assigns the value of f1 (rounded) to t1fcvt.wu.s t1, f1
fdiv.d f1, f2, f3浮动 DIVide(64 位):将 f1 分配给 f2 / f3Floating DIVide (64 bit): assigns f1 to f2 / f3fdiv.d f1, f2, f3
fdiv.s f1, f2, f3浮动 DIVide:将 f1 分配给 f2 / f3Floating DIVide: assigns f1 to f2 / f3fdiv.s f1, f2, f3
fge.d t1, f2, f3浮动大于或等于(64 位):如果 f1 >= f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Greater Than or Equal (64 bit): if f1 >= f2, set t1 to 1, else set t1 to 0fge.d t1, f2, f3
fge.s t1, f2, f3浮动大于或等于:如果 f1 >= f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Greater Than or Equal: if f1 >= f2, set t1 to 1, else set t1 to 0fge.s t1, f2, f3
fgt.d t1, f2, f3浮动大于(64 位):如果 f1 > f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Greater Than (64 bit): if f1 > f2, set t1 to 1, else set t1 to 0fgt.d t1, f2, f3
fgt.s t1, f2, f3浮动大于:如果 f1 > f2,则将 t1 设置为 1,否则将 t1 设置为 0Floating Greater Than: if f1 > f2, set t1 to 1, else set t1 to 0fgt.s t1, f2, f3
fld f1,(t2)Load Word:将f1设置为从有效内存字地址开始的64位值Load Word: Set f1 to 64-bit value from effective memory word addressfld f1,(t2)
fld f1,-100Load Word:将f1设置为从有效内存字地址开始的64位值Load Word: Set f1 to 64-bit value from effective memory word addressfld f1,-100
fld f1,10000000,t3Load Word:使用 t3 作为临时地址,将 f1 设置为有效内存字地址的 64 位值Load Word: Set f1 to 64-bit value from effective memory word address using t3 as a temporaryfld f1,10000000,t3
fld f1,label, t3Load Word:使用 t3 作为临时地址,将 f1 设置为有效内存字地址的 64 位值Load Word: Set f1 to 64-bit value from effective memory word address using t3 as a temporaryfld f1,label, t3
flw f1,%lo(label)(t2)从地址加载Load from Addressflw f1,%lo(label)(t2)
flw f1,(t2)加载字协处理器 1:将 f1 设置为有效内存字地址的 32 位值Load Word Coprocessor 1 : Set f1 to 32-bit value from effective memory word addressflw f1,(t2)
flw f1,-100加载字协处理器 1:将 f1 设置为有效内存字地址的 32 位值Load Word Coprocessor 1 : Set f1 to 32-bit value from effective memory word addressflw f1,-100
flw f1,10000000,t3加载字协处理器 1:使用 t3 作为临时地址,将 f1 设置为有效内存字地址的 32 位值Load Word Coprocessor 1 : Set f1 to 32-bit value from effective memory word address using t3 as a temporaryflw f1,10000000,t3
flw f1,label, t3加载字协处理器 1:使用 t3 作为临时地址,将 f1 设置为有效内存字地址的 32 位值Load Word Coprocessor 1 : Set f1 to 32-bit value from effective memory word address using t3 as a temporaryflw f1,label, t3
flwd f1,%lo(label)(t2)从地址加载Load from Addressflwd f1,%lo(label)(t2)
fmadd.d f1, f2, f3, f4融合乘加(64 位):将 f2*f3+f4 分配给 f1Fused Multiply Add (64 bit): Assigns f2*f3+f4 to f1fmadd.d f1, f2, f3, f4
fmadd.s f1, f2, f3, f4融合乘加:将 f2*f3+f4 分配给 f1Fused Multiply Add: Assigns f2*f3+f4 to f1fmadd.s f1, f2, f3, f4
fmsub.d f1, f2, f3, f4融合乘法减法(64 位):将 f2*f3-f4 分配给 f1Fused Multiply Subatract (64 bit): Assigns f2*f3-f4 to f1fmsub.d f1, f2, f3, f4
fmsub.s f1, f2, f3, f4融合乘子:将 f2*f3-f4 分配给 f1Fused Multiply Subatract: Assigns f2*f3-f4 to f1fmsub.s f1, f2, f3, f4
fmul.d f1, f2, f3Floating MULtiply(64 位):将 f1 分配给 f2 * f3Floating MULtiply (64 bit): assigns f1 to f2 * f3fmul.d f1, f2, f3
fmul.s f1, f2, f3Floating MULtiply:将 f1 分配给 f2 * f3Floating MULtiply: assigns f1 to f2 * f3fmul.s f1, f2, f3
fmv.d f1, f2将 f2 的值移动到 f1(64 位)Move the value of f2 to f1 (64 bit)fmv.d f1, f2
fmv.s f1, f2将 f2 的值移动到 f1Move the value of f2 to f1fmv.s f1, f2
fmv.w.x t1, f1移动浮点数(新助记符):从整数寄存器中移动表示浮点数的位Move float (New mnemonic): move bits representing a float from an integer registerfmv.w.x t1, f1
fmv.x.w t1, f1移动浮点数(新助记符):将表示浮点数的位移动到整数寄存器Move float (New mnemonic): move bits representing a float to an integer registerfmv.x.w t1, f1
fneg.d f1, f2将 f1 设置为 f2 的否定(64 位)Set f1 to the negation of f2 (64 bit)fneg.d f1, f2
fneg.s f1, f2将 f1 设置为 f2 的否定Set f1 to the negation of f2fneg.s f1, f2
fnmadd.d f1, f2, f3, f4Fused Negate Multiply Add(64 位):将 -(f2*f3+f4) 分配给 f1Fused Negate Multiply Add (64 bit): Assigns -(f2*f3+f4) to f1fnmadd.d f1, f2, f3, f4
fnmadd.s f1, f2, f3, f4Fused Negate Multiply Add:将 -(f2*f3+f4) 分配给 f1Fused Negate Multiply Add: Assigns -(f2*f3+f4) to f1fnmadd.s f1, f2, f3, f4
fnmsub.d f1, f2, f3, f4融合取反乘法减法(64 位):将 -(f2*f3-f4) 分配给 f1Fused Negated Multiply Subatract (64 bit): Assigns -(f2*f3-f4) to f1fnmsub.d f1, f2, f3, f4
fnmsub.s f1, f2, f3, f4融合取反乘法减法:将 -(f2*f3-f4) 赋值给 f1Fused Negated Multiply Subatract: Assigns -(f2*f3-f4) to f1fnmsub.s f1, f2, f3, f4
frcsr t1读取 FP 控制/状态寄存器Read FP control/status registerfrcsr t1
frflags t1读取 FP 异常标志Read FP exception flagsfrflags t1
frrm t1读取 FP 舍入模式Read FP rounding modefrrm t1
frsr t1frcsr t1 的别名Alias for frcsr t1frsr t1
fscsr t1写 FP 控制/状态寄存器Write FP control/status registerfscsr t1
fscsr t1, t2交换 FP 控制/状态寄存器Swap FP control/status registerfscsr t1, t2
fsd f1,(t2)Store Word:将f1中的64位值存储到有效内存字地址Store Word: Store 64-bit value from f1 to effective memory word addressfsd f1,(t2)
fsd f1,-100Store Word:将f1中的64位值存储到有效内存字地址Store Word: Store 64-bit value from f1 to effective memory word addressfsd f1,-100
fsd f1,10000000,t3Store Word:将64位值从f1存储到有效内存字地址,使用t3作为临时地址Store Word: Store 64-bit value from f1 to effective memory word address using t3 as a temporaryfsd f1,10000000,t3
fsd f1,label, t3Store Word:将64位值从f1存储到有效内存字地址,使用t3作为临时地址Store Word: Store 64-bit value from f1 to effective memory word address using t3 as a temporaryfsd f1,label, t3
fsflags t1写入 FP 异常标志Write FP exception flagsfsflags t1
fsflags t1, t2交换 FP 异常标志Swap FP exception flagsfsflags t1, t2
fsflagsi 100立即写入 FP 异常标志Write FP exception flags, immediatefsflagsi 100
fsflagsi t1, 100立即交换 FP 异常标志Swap FP exception flags, immediatefsflagsi t1, 100
fsqrt.d f1, f2浮动平方根(64 位):将 f1 分配给 f2 的平方根Floating SQuare RooT (64 bit): Assigns f1 to the square root of f2fsqrt.d f1, f2
fsqrt.s f1, f2浮动平方根:将 f1 分配给 f2 的平方根Floating SQuare RooT: Assigns f1 to the square root of f2fsqrt.s f1, f2
fsrm t1写入 FP 舍入模式Write FP rounding modefsrm t1
fsrm t1, t2交换 FP 舍入模式Swap FP rounding modefsrm t1, t2
fsrmi 100写入 FP 舍入模式,立即数Write FP rounding mode, immediatefsrmi 100
fsrmi t1, 100交换 FP 舍入模式,立即数Swap FP rounding mode, immediatefsrmi t1, 100
fssr t1fscsr t1 的别名Alias for fscsr t1fssr t1
fssr t1, t2fscsr t1、t2 的别名Alias for fscsr t1, t2fssr t1, t2
fsub.d f1, f2, f3浮动减法(64 位):将 f1 分配给 f2 - f3Floating SUBtract (64 bit): assigns f1 to f2 - f3fsub.d f1, f2, f3
fsub.s f1, f2, f3浮动减法:将 f1 分配给 f2 - f3Floating SUBtract: assigns f1 to f2 - f3fsub.s f1, f2, f3
fsw f1,(t2)Store Word Coprocessor 1 : 将 f1 的 32 位值存储到有效内存字地址Store Word Coprocessor 1 : Store 32-bit value from f1 to effective memory word addressfsw f1,(t2)
fsw f1,-100Store Word Coprocessor 1 : 将 f1 的 32 位值存储到有效内存字地址Store Word Coprocessor 1 : Store 32-bit value from f1 to effective memory word addressfsw f1,-100
fsw f1,10000000,t3存储字协处理器 1:将 f1 的 32 位值存储到有效内存字地址,使用 t3 作为临时地址Store Word Coprocessor 1 : Store 32-bit value from f1 to effective memory word address using t3 as a temporaryfsw f1,10000000,t3
fsw f1,label, t3存储字协处理器 1:将 f1 的 32 位值存储到有效内存字地址,使用 t3 作为临时地址Store Word Coprocessor 1 : Store 32-bit value from f1 to effective memory word address using t3 as a temporaryfsw f1,label, t3
j label跳转:跳转到标签处的语句Jump : Jump to statement at labelj label
jal labelJump And Link:跳转到标号处的语句并将返回地址设置为raJump And Link: Jump to statement at label and set the return address to rajal label
jalr t0Jump And Link Register:跳转到t0中的地址并将返回地址设置为raJump And Link Register: Jump to address in t0 and set the return address to rajalr t0
jalr t0, -100Jump And Link Register:跳转到t0中的地址并将返回地址设置为raJump And Link Register: Jump to address in t0 and set the return address to rajalr t0, -100
jr t0跳转寄存器:跳转到 t0 中的地址Jump Register: Jump to address in t0jr t0
jr t0, -100跳转寄存器:跳转到 t0 中的地址Jump Register: Jump to address in t0jr t0, -100
la t1,label加载地址:将 t1 设置为标签的地址Load Address : Set t1 to label's addressla t1,label
lb t1,(t2)加载字节:将 t1 设置为有效内存字节地址的符号扩展 8 位值Load Byte : Set t1 to sign-extended 8-bit value from effective memory byte addresslb t1,(t2)
lb t1,-100加载字节:将 $1 设置为有效内存字节地址的符号扩展 8 位值Load Byte : Set $1 to sign-extended 8-bit value from effective memory byte addresslb t1,-100
lb t1,10000000加载字节:将 $t1 设置为有效内存字节地址的符号扩展 8 位值Load Byte : Set $t1 to sign-extended 8-bit value from effective memory byte addresslb t1,10000000
lb t1,label加载字节:将 $t1 设置为有效内存字节地址的符号扩展 8 位值Load Byte : Set $t1 to sign-extended 8-bit value from effective memory byte addresslb t1,label
lbu t1,(t2)加载无符号字节:将 $t1 设置为有效内存字节地址的零扩展 8 位值Load Byte Unsigned : Set $t1 to zero-extended 8-bit value from effective memory byte addresslbu t1,(t2)
lbu t1,-100加载无符号字节:将 $t1 设置为有效内存字节地址的零扩展 8 位值Load Byte Unsigned : Set $t1 to zero-extended 8-bit value from effective memory byte addresslbu t1,-100
lbu t1,10000000Load Byte Unsigned:将 t1 设置为有效内存字节地址的零扩展 8 位值Load Byte Unsigned : Set t1 to zero-extended 8-bit value from effective memory byte addresslbu t1,10000000
lbu t1,labelLoad Byte Unsigned:将 t1 设置为有效内存字节地址的零扩展 8 位值Load Byte Unsigned : Set t1 to zero-extended 8-bit value from effective memory byte addresslbu t1,label
lh t1,(t2)加载半字:将 t1 设置为有效内存半字地址的符号扩展 16 位值Load Halfword : Set t1 to sign-extended 16-bit value from effective memory halfword addresslh t1,(t2)
lh t1,-100加载半字:将 t1 设置为有效内存半字地址的符号扩展 16 位值Load Halfword : Set t1 to sign-extended 16-bit value from effective memory halfword addresslh t1,-100
lh t1,10000000加载半字:将 t1 设置为有效内存半字地址的符号扩展 16 位值Load Halfword : Set t1 to sign-extended 16-bit value from effective memory halfword addresslh t1,10000000
lh t1,label加载半字:将 t1 设置为有效内存半字地址的符号扩展 16 位值Load Halfword : Set t1 to sign-extended 16-bit value from effective memory halfword addresslh t1,label
lhu t1,(t2)加载无符号半字:将 t1 设置为有效内存半字地址的零扩展 16 位值Load Halfword Unsigned : Set t1 to zero-extended 16-bit value from effective memory halfword addresslhu t1,(t2)
lhu t1,-100加载无符号半字:将 t1 设置为有效内存半字地址的零扩展 16 位值Load Halfword Unsigned : Set t1 to zero-extended 16-bit value from effective memory halfword addresslhu t1,-100
lhu t1,10000000加载无符号半字:将 t1 设置为有效内存半字地址的零扩展 16 位值Load Halfword Unsigned : Set t1 to zero-extended 16-bit value from effective memory halfword addresslhu t1,10000000
lhu t1,label加载无符号半字:将 t1 设置为有效内存半字地址的零扩展 16 位值Load Halfword Unsigned : Set t1 to zero-extended 16-bit value from effective memory halfword addresslhu t1,label
li t1,-100立即加载:将 t1 设置为 12 位立即数(符号扩展)Load Immediate : Set t1 to 12-bit immediate (sign-extended)li t1,-100
li t1,10000000立即加载:将 t1 设置为 32 位立即数Load Immediate : Set t1 to 32-bit immediateli t1,10000000
lui t1,%hi(label)Load Upper Address : 将 t1 设置为标签的高 20 位地址Load Upper Address : Set t1 to upper 20-bit label's addresslui t1,%hi(label)
lw t1,%lo(label)(t2)从地址加载Load from Addresslw t1,%lo(label)(t2)
lw t1,(t2)加载字:将 t1 设置为有效内存字地址的内容Load Word : Set t1 to contents of effective memory word addresslw t1,(t2)
lw t1,-100加载字:将 t1 设置为有效内存字地址的内容Load Word : Set t1 to contents of effective memory word addresslw t1,-100
lw t1,10000000加载字:将 t1 设置为有效内存字地址的内容Load Word : Set t1 to contents of effective memory word addresslw t1,10000000
lw t1,label加载字:将 t1 设置为标签地址处内存字的内容Load Word : Set t1 to contents of memory word at label's addresslw t1,label
mv t1,t2MoVe:将 t1 设置为 t2 的内容MoVe : Set t1 to contents of t2mv t1,t2
neg t1,t2NEGate :将 t1 设置为 t2 的否定NEGate : Set t1 to negation of t2neg t1,t2
nop无操作NO OPerationnop
not t1,t2按位非(位反转)Bitwise NOT (bit inversion)not t1,t2
rdcycle t1从循环中读取Read from cyclerdcycle t1
rdcycleh t1从 cycleh 读取Read from cyclehrdcycleh t1
rdinstret t1从instret读取Read from instretrdinstret t1
rdinstreth t1从 instreth 读取Read from instrethrdinstreth t1
rdtime t1从时间读Read from timerdtime t1
rdtimeh t1从时间读取Read from timehrdtimeh t1
ret返回:从子程序返回Return: return from a subroutineret
sb t1,(t2)Store Byte : 将t1的低8位存入有效内存字节地址Store Byte : Store the low-order 8 bits of t1 into the effective memory byte addresssb t1,(t2)
sb t1,-100Store Byte : 将$t1的低8位存入有效内存字节地址Store Byte : Store the low-order 8 bits of $t1 into the effective memory byte addresssb t1,-100
sb t1,10000000,t2Store Byte : 将$t1的低8位存入有效内存字节地址Store Byte : Store the low-order 8 bits of $t1 into the effective memory byte addresssb t1,10000000,t2
sb t1,label,t2Store Byte : 将$t1的低8位存入有效内存字节地址Store Byte : Store the low-order 8 bits of $t1 into the effective memory byte addresssb t1,label,t2
seqz t1,t2将 EQual 设置为零:如果 t2 == 0,则将 t1 设置为 1,否则为 0Set EQual to Zero : if t2 == 0 then set t1 to 1 else 0seqz t1,t2
sgt t1,t2,t3设置大于:如果 t2 大于 t3,则将 t1 设置为 1,否则为 0Set Greater Than : if t2 greater than t3 then set t1 to 1 else 0sgt t1,t2,t3
sgtu t1,t2,t3设置大于无符号:如果 t2 大于 t3(无符号比较)则将 t1 设置为 1,否则为 0Set Greater Than Unsigned : if t2 greater than t3 (unsigned compare) then set t1 to 1 else 0sgtu t1,t2,t3
sgtz t1,t2设置大于零:如果 t2 > 0,则将 t1 设置为 1,否则为 0Set Greater Than Zero : if t2 > 0 then set t1 to 1 else 0sgtz t1,t2
sh t1,(t2)Store Halfword : 将$1的低16位存入有效内存半字地址Store Halfword : Store the low-order 16 bits of $1 into the effective memory halfword addresssh t1,(t2)
sh t1,-100Store Halfword : 将$t1的低16位存入有效内存半字地址Store Halfword : Store the low-order 16 bits of $t1 into the effective memory halfword addresssh t1,-100
sh t1,10000000,t2Store Halfword : 将t1的低16位以t2为临时存储到有效内存半字地址Store Halfword : Store the low-order 16 bits of t1 into the effective memory halfword address using t2 as a temporarysh t1,10000000,t2
sh t1,label,t2Store Halfword : 将t1的低16位以t2为临时存储到有效内存半字地址Store Halfword : Store the low-order 16 bits of t1 into the effective memory halfword address using t2 as a temporarysh t1,label,t2
sltz t1,t2设置小于零:如果 t2 < 0,则将 t1 设置为 1,否则为 0Set Less Than Zero : if t2 < 0 then set t1 to 1 else 0sltz t1,t2
snez t1,t2设置不等于零:if t2 != 0 then set t1 to 1 else 0Set Not Equal to Zero : if t2 != 0 then set t1 to 1 else 0snez t1,t2
sw t1,(t2)Store Word : 将 t1 的内容存入有效内存字地址Store Word : Store t1 contents into effective memory word addresssw t1,(t2)
sw t1,-100Store Word : 将$t1内容存入有效内存字地址Store Word : Store $t1 contents into effective memory word addresssw t1,-100
sw t1,10000000,t2Store Word:将$t1的内容存储到有效的内存字地址中,使用t2作为临时地址Store Word : Store $t1 contents into effective memory word address using t2 as a temporarysw t1,10000000,t2
sw t1,label,t2Store Word:将$t1 的内容存储到标签地址处的内存字中,使用t2 作为临时地址Store Word : Store $t1 contents into memory word at label's address using t2 as a temporarysw t1,label,t2
tail labelTAIL call:尾调用(call without saved return address)a far-away subroutineTAIL call: tail call (call without saving return address)a far-away subroutinetail label

本文由mdnice多平台发布


好文收藏
38 声望6 粉丝

好文收集


« 上一篇
Go slog