-
Notifications
You must be signed in to change notification settings - Fork 0
/
vectorial_2_mp_test1.txt
40 lines (31 loc) · 1.36 KB
/
vectorial_2_mp_test1.txt
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
# -----------------------------------------------------------------------------
# vectorial_2_mp_test1.txt
#
# Lab assignment 2: Microprogramming Lab
# Implementation of the subroutine 'addv_2_test1' in order to test addv_2
# subroutine.
#
# @author Guillermo Escobero & Raul Olmedo
# @date November 2016
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Invokes 100 times the addv_2 subroutine for testing purposes.
# -----------------------------------------------------------------------------
addv_2_test1: li $s0 100 # Loop limit
li $s1 0 # Counter for loop (i)
li $s2 1 # Step for the counter
li $s3 4 # Offset to iterate through the array
la $s4 R0
la $s5 V0
la $s6 V1
li $s7 10
# Use of stack needed to keep the value of $ra.
sub $sp $sp $s3 # Stack PUSH
sw $ra ($sp)
for: bge $s1 $s0 end # Loop condition (i<100)
addv_2 $s4 $s5 $s6 $s7
add $s1 $s1 $s2 # i++
b for # Go to check condition of the loop again
end: lw $ra ($sp) # Stack POP
add $sp $sp $s3
jr $ra # return