summaryrefslogtreecommitdiff
path: root/input/adjacent-adder.asm
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-04-12 13:06:51 -0400
committerGitHub <noreply@github.com>2025-04-12 13:06:51 -0400
commitfc20e7e7276b712f1e8db773b9215f900e877169 (patch)
treecaecdd1499d2e391cd5bd2dcde3aebfade002a09 /input/adjacent-adder.asm
parent5dbf0b63988b42c112ca0087cbbbb090566df5c1 (diff)
parent639098b1ea82be82bd18a4af415458fcbaf5e20b (diff)
Merge pull request #8 from bdunahu/bdunahu
Add write raw bytes stage
Diffstat (limited to 'input/adjacent-adder.asm')
-rw-r--r--input/adjacent-adder.asm25
1 files changed, 25 insertions, 0 deletions
diff --git a/input/adjacent-adder.asm b/input/adjacent-adder.asm
new file mode 100644
index 0000000..35704d2
--- /dev/null
+++ b/input/adjacent-adder.asm
@@ -0,0 +1,25 @@
+;;;;;;;;
+;;; adds adjacent elements of a 4-element vector together,
+;;; storing the result in place.
+
+.data
+ arr 1 2 3 4
+ s 3
+ i 0
+
+.text
+ addi $5 $5 s
+ addi $10 $10 arr
+ addi $6 $6 i
+ jrl CMP
+L:
+ add $9 $10 $6
+ load $7 0($9)
+ load $8 1($9)
+ add $7 $7 $8
+
+ store $7 0($9)
+ addi $6 $6 0x1
+CMP:
+ cmp $5 $6
+ bgt L