Add activities for FH.

This commit is contained in:
Nicolás A. Ortega Froysa 2021-11-10 18:59:57 +01:00
parent c4a2c3f45d
commit e5b70ac305
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,21 @@
.data
theArray:
.space 160
.text
main:
li $t6, 1 # Sets t6 to 1
li $t7, 4 # Sets t7 to 4
sw $t6, theArray($0) # Sets the first term to 1
sw $t6, theArray($t7) # Sets the second term to 1
li $t0, 8 # Sets t0 to 8
loop:
addi $t3, $t0, -8
addi $t4, $t0, -4
lw $t1, theArray($t3) # Gets the last
lw $t2, theArray($t4) # two elements
mul $t5, $t1, $t2 # Adds them together...
sw $t5, theArray($t0) # ...and stores the result
addi $t0, $t0, 4 # Moves to next "element" of theArray
blt $t0, 160, loop # If not past the end of theArray, repeat
jr $ra

View File

@ -0,0 +1,51 @@
1)
Operaciones:
c = a{9} + b{2} = 11
d = c{11} - a{9} = 2
a = a{9} / 3 = 3
b = b{2} * b{2} = 4
Resultados:
a = 3
b = 4
c = 11
d = 2
2)
Operaciones:
d = 0
b = b{45} * d{0} = 0
a = a{16} / 4 = 4
d = c{24} / a{15} = 2
Resultados:
a = 4
b = 0
c = 24
d = 2
3)
d = c{0} * a{26} = 0
si d{0} = 0
goto ins4
d = b{45} * a{26} # saltada
ins4: d = c{0} * b{45} = 0
a = 26
b = 45
c = 0
d = 0
4)
si a > 4
goto ins5
a = a + 1
b = b + a
goto ins1
ins5: b = b * b
a = 5
b = 256
c = 9546351681
d = 123487890