diff options
| author | jg0 <yyj9ob3v@anonaddy.com> | 2025-03-25 16:02:50 -0400 |
|---|---|---|
| committer | jg0 <yyj9ob3v@anonaddy.com> | 2025-03-25 16:02:50 -0400 |
| commit | ef452571894a1c75805cfa9f58f8ccde28cd76e6 (patch) | |
| tree | f4c7a6f8f62c2b20884eb980f6133698785a44af | |
| parent | 5ba90a29a3b539ead01f5c252722185c0ee33b9e (diff) | |
Fibonacci assembly code and machine code
| -rw-r--r-- | fibonacci.s | 17 | ||||
| -rw-r--r-- | riscvtest_rom_image.txt | 37 |
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 @@ | |||
| 1 | main: 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 | |||
| 8 | loop: 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 | ||
| 17 | done: 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 @@ | |||
| 1 | 00500113 | 1 | 00000193 |
| 2 | 00C00193 | 2 | 0001a023 |
| 3 | FF718393 | 3 | 00100293 |
| 4 | 0023E233 | 4 | 0051a223 |
| 5 | 0041F2B3 | 5 | 00400293 |
| 6 | 004282B3 | 6 | 03c00493 |
| 7 | 02728863 | 7 | 00428293 |
| 8 | 0041A233 | 8 | ffc28313 |
| 9 | 00020463 | 9 | ff828393 |
| 10 | 00000293 | 10 | 00032e03 |
| 11 | 0023A233 | 11 | 0003ae83 |
| 12 | 005203B3 | 12 | 01de0f33 |
| 13 | 402383B3 | 13 | 01e2a023 |
| 14 | 0471AA23 | 14 | 00928463 |
| 15 | 06002103 | 15 | fe5280e3 |
| 16 | 005104B3 | 16 | 00528063 |
| 17 | 008001EF | ||
| 18 | 00100113 | ||
| 19 | 00910133 | ||
| 20 | 0221A023 | ||
| 21 | 00210063 \ No newline at end of file | ||
