summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-18 00:04:33 -0400
committerbd <bdunahu@operationnull.com>2025-04-18 00:04:33 -0400
commit60dde60b71c8514aa8365a67cda8f86ecb636089 (patch)
tree7c12e01790a87e40f5f534eaf1a9643c97464886
parent7ad6093d69afa90de243e72868f0d463dcd5eae7 (diff)
Fix matrix multiplication with simulator feedback
-rw-r--r--input/identity.asm29
1 files changed, 20 insertions, 9 deletions
diff --git a/input/identity.asm b/input/identity.asm
index e6d9260..bb6af17 100644
--- a/input/identity.asm
+++ b/input/identity.asm
@@ -13,10 +13,10 @@
.text
addi $8 $0 0x4 ; dimensions
addi $9 $0 0x0 ; tracks the rows
- addi $10 $0 0x0 ; tracks the columns
jrl ROWCOND
ROW:
+ addi $10 $0 0x0 ; tracks the columns
jrl COLCOND
COL:
addi $11 $0 0x0 ; tracks the element being added
@@ -28,32 +28,43 @@ COL:
addi $6 $0 m2 ; setup the index into m2
add $6 $6 $10
+ addi $15 $5 0 ; setup a base address into both
+ addi $7 $6 0
+
jrl ELECOND
ELE:
- add $5 $5 $11 ; increment m1
+ add $5 $15 $11 ; increment m1
mul $13 $11 $8 ; increment m2
- add $6 $6 $13
+ add $6 $7 $13
load $13 0($5) ; retrieve and accumulate
load $14 0($6)
- add $12 $14 $13
+ mul $13 $14 $13
+ add $12 $12 $13
addi $11 $11 0x1
ELECOND:
cmp $8 $11
bgt ELE
- addi $10 $10 0x1
-COLCOND:
- cmp $8 $10
- bgt COL
- add $7 $7 $10 ; setup the index into r
+ mul $7 $9 $8
+ add $7 $7 $10
addi $7 $7 r
store $12 0($7)
+ addi $10 $10 0x1
+COLCOND:
+ cmp $8 $10
+ bgt COL
+
addi $9 $9 0x1
ROWCOND:
cmp $8 $9
bgt ROW
+ nop
+ nop
+ nop
+ nop
+ nop