-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab02
23 lines (23 loc) · 773 Bytes
/
Lab02
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Laboratory Exercise 2, Assignment 3
#.text
#li $s0,0x2110003d #pseudo instruction=2 basic instructions
#li $s1,0x2
#but if the immediate value is small, one ins
#Laboratory Exercise 2, Assignment 4
#.text
# Assign X, Y
#addi $t1, $zero, 5 # X = $t1 = ?
#addi $t2, $zero, -1 # Y = $t2 = ?
# Expression Z = 2X + Y
#add $s0, $t1, $t1 # $s0 = $t1 + $t1 = X + X = 2X
#add $s0, $s0, $t2 # $s0 = $s0 + $t2 = 2X + Y
#Laboratory Exercise 2, Assignment 5
.text
# Assign X, Y
addi $t1, $zero, 4 # X = $t1 = ?
addi $t2, $zero, 5 # Y = $t2 = ?
# Expression Z = 3*XY
mul $s0, $t1, $t2 # HI-LO = $t1 * $t2 = X * Y ; $s0 = LO
mul $s0, $s0, 3 # $s0 = $s0 * 3 = 3 * X * Y
# Z' = Z
mflo $s1