-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtentativa_1.ass
52 lines (41 loc) · 1.69 KB
/
tentativa_1.ass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.data
matrixA: .word32 1,1,1, 1,1,1, 1,1,1
matrixB: .word32 1,1,1, 1,1,1, 1,1,1
matrixR: .word32 0,0,0,0,0,0,0,0,0
ordem: .byte 3
.code
LB $s0, ordem($zero) ; ordem da matrix
ADDI $t1, $zero, 0x4
MULT $s0, $t1
MFLO $t1
MULT $s0, $s0
MFLO $s0
ADDI $s2, $zero, 0x4
MULT $s0, $s2 ; Tamanho total da matriz
MFLO $s1 ; tam==s1
ADD $s2, $zero, $zero ; so para dizer q (column_control==s2) recebe zero
ADD $s3, $zero, $t1 ; loop_control==s3
ADD $s4, $zero, $zero ; so para dizer q (i_start==s4) recebe zero
ADD $s5, $zero, $zero ; so para dizer q (b_control==s5) recebe zero
ADD $s6, $zero, $zero ; so para dizer q (a_control==s6) recebe zero
secondWhileStart:
SLT $a0, $s6, $s1 ; a_control < tam
BEQZ $a0, secondWhileEnd ; while
ADD $t0, $zero, $s4 ; i = i_start
fistWhileStart:
SLT $a0, $t0, $s3 ; i < loop_control
BEQZ $a0, firstWhileEnd ; while
LB $a1, matrixA($s6) ; matrixA[a_control]
LB $a2, matrixB($s5) ; matrixB[b_control]
MULT $a1, $a2
MFLO $a1
LB $a2, matrixR($t0)
ADD $a2, $a2, $a1
SW $a2, matrixR($t0)
ADDI $s6, $s6, 0x4 ; a_control += 4
ADDI $t0, $t0, 0x4 ; i += 4
B fistWhileStart
firstWhileEnd:
ADDI $s5, $s5, 0x4; b_control += 1
B secondWhileStart
secondWhileEnd: SYSCALL 0