This repository has been archived on 2025-06-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
simple-risc-v32i-cpu/cpu_rv32i.srcs/sources_1/ip/instr_ram/raw 测试代码.txt
2023-02-28 09:10:42 +08:00

15 lines
632 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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执行