summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjg0 <yyj9ob3v@anonaddy.com>2025-03-25 16:02:50 -0400
committerjg0 <yyj9ob3v@anonaddy.com>2025-03-25 16:02:50 -0400
commitef452571894a1c75805cfa9f58f8ccde28cd76e6 (patch)
treef4c7a6f8f62c2b20884eb980f6133698785a44af
parent5ba90a29a3b539ead01f5c252722185c0ee33b9e (diff)
Fibonacci assembly code and machine code
-rw-r--r--fibonacci.s17
-rw-r--r--riscvtest_rom_image.txt37
2 files changed, 33 insertions, 21 deletions
diff --git a/fibonacci.s b/fibonacci.s
new file mode 100644
index 0000000..3e8ddd0
--- /dev/null
+++ b/fibonacci.s
@@ -0,0 +1,17 @@
1main: addi x3, x0, 0x0
2 sw x0, 0x0(x3)
3 addi x5, x0, 1
4 sw x5, 0x4(x3)
5 addi x5, x0, 4
6 addi x9, x0, 0x3C
7
8loop: addi x5, x5, 4
9 addi x6, x5, -4
10 addi x7, x5, -8
11 lw x28, 0(x6)
12 lw x29, 0(x7)
13 add x30, x28, x29
14 sw x30, 0(x5)
15 beq x5, x9, done
16 beq x5, x5 loop
17done: beq x5, x5 done \ No newline at end of file
diff --git a/riscvtest_rom_image.txt b/riscvtest_rom_image.txt
index 43e784b..da8099b 100644
--- a/riscvtest_rom_image.txt
+++ b/riscvtest_rom_image.txt
@@ -1,21 +1,16 @@
100500113 100000193
200C00193 20001a023
3FF718393 300100293
40023E233 40051a223
50041F2B3 500400293
6004282B3 603c00493
702728863 700428293
80041A233 8ffc28313
900020463 9ff828393
1000000293 1000032e03
110023A233 110003ae83
12005203B3 1201de0f33
13402383B3 1301e2a023
140471AA23 1400928463
1506002103 15fe5280e3
16005104B3 1600528063
17008001EF
1800100113
1900910133
200221A023
2100210063 \ No newline at end of file