Initial
This commit is contained in:
14
cpu_rv32i.srcs/sources_1/ip/instr_ram/raw 测试代码.txt
Normal file
14
cpu_rv32i.srcs/sources_1/ip/instr_ram/raw 测试代码.txt
Normal 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执行
|
||||
Reference in New Issue
Block a user