commit ef452571894a1c75805cfa9f58f8ccde28cd76e6
parent 5ba90a29a3b539ead01f5c252722185c0ee33b9e
Author: jg0 <yyj9ob3v@anonaddy.com>
Date: Tue, 25 Mar 2025 16:02:50 -0400
Fibonacci assembly code and machine code
Diffstat:
2 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/fibonacci.s b/fibonacci.s
@@ -0,0 +1,17 @@
+main: addi x3, x0, 0x0
+ sw x0, 0x0(x3)
+ addi x5, x0, 1
+ sw x5, 0x4(x3)
+ addi x5, x0, 4
+ addi x9, x0, 0x3C
+
+loop: addi x5, x5, 4
+ addi x6, x5, -4
+ addi x7, x5, -8
+ lw x28, 0(x6)
+ lw x29, 0(x7)
+ add x30, x28, x29
+ sw x30, 0(x5)
+ beq x5, x9, done
+ beq x5, x5 loop
+done: beq x5, x5 done
+\ No newline at end of file
diff --git a/riscvtest_rom_image.txt b/riscvtest_rom_image.txt
@@ -1,21 +1,16 @@
-00500113
-00C00193
-FF718393
-0023E233
-0041F2B3
-004282B3
-02728863
-0041A233
-00020463
-00000293
-0023A233
-005203B3
-402383B3
-0471AA23
-06002103
-005104B3
-008001EF
-00100113
-00910133
-0221A023
-00210063
-\ No newline at end of file
+00000193
+0001a023
+00100293
+0051a223
+00400293
+03c00493
+00428293
+ffc28313
+ff828393
+00032e03
+0003ae83
+01de0f33
+01e2a023
+00928463
+fe5280e3
+00528063