This commit is contained in:
2023-02-28 09:10:42 +08:00
commit a657a360bf
68 changed files with 5025 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
lw x3, 0x0(x0) # 00002183 读取主存地址0x0000处的n到x3
add x3, x3, x3 # 003181B3
slt x4, x0 ,x3 # 00302233 将x4的值通过比较指令赋为 1
ori x5, x1, 0x1 # 00106293 x5内容循环变量i为1
ori x2, x1, 0x1 # 00106113 x2内容循环增量为1
loop:
add x4, x4, x5 # 00520233 将i加到x4累加
beq x5, x3, finish # 00328663 若x5=n则跳出循环
add x5, x5, x2 # 002282b3 x5=x5+1
jal x0, loop # FF5FF06F 无条件跳转到loop执行
finish:
sw x4, 0x4(x0) # 00402223 将累加结果保存到0x0001单元
end:
jal x0, end # 0000006F 无条件跳转到end执行