-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_all_instructions.a
84 lines (84 loc) · 2.21 KB
/
test_all_instructions.a
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.data
val1: 456
val2: 7658
val3: 4574584
val4: 5
#-------------------------------------------
addi $16, $16, 3 # $16 = 3
addi $17, $16, 5 # $17 = 8
addu $18, $16, $17 # $18 = 16
#-------------------------------------------
addi $16, $16, -5 # $16 = -3
addi $17, $17, -8 # $17 = 0
addiu $20, $17, -1 # $20 = (unsigned -1)
#-------------------------------------------
addi $16, $zero, 5 # $16 = 5
addi $17, $zero, 3 # $17 = 3
and $18, $16, $17 # $18 = 1
andi $19, $16, 7 # $19 = 5
#-------------------------------------------
nor $16, $16, $17 # $16 = 4
or $16, $16, $17 # $16 = 5
ori $16, $16, 9 # $16 = 13
#-------------------------------------------
sub $16, $16, $17 # $16 = 10
addi $17, $17, -4 # $17 = -1
sub $16, $16, $16 # $16 = 0
subu $20, $16, $17 # $16 = (0 - (unsigned -1))
#-------------------------------------------
addi $16, $16, 5 # $16 = 5
addi $17, $17, 3 # $17 = 2
xor $16, $16, $17 # $16 = 7
xor $16, $16, $16 # $16 = 0
xori $16, $16, 7 # $16 = 7
xori $16, $16, 9 # $16 = 14
lui $9, $16, 78433
slt $10, $9, $16
addi $8, $zero, -4 # put -4 into $8
sltu $11, $8, $16
slti $12, $8,-7848
sltiu $13, $8, 238973
#------------------------------------------
addi $5, $zero, 5 # put5 into $5
addi $6, $zero, 29874 # put 298743 into $6
beq $6, $6, uno
j END # should be skipped
uno:
beq $5, $5, dos
j END # should be skipped
dos:
bne $5, $6, tres
j END # should be skipped
tres:
bne $6, $5, quatro
j END # should be skipped
quatro:
j cinco # skip over loop1
loop1:
addi $5, $5, 10
jr $ra
j END # should be skipped
cinco:
jal loop1 # go back to loop1
#-------------------------------------------
jal skip1
addi $16, $16, 1 # $16 = 8
j skip2
skip1:
addi $16, $16, 2 # $16 = 7
jr $ra
skip2:
#-------------------------------------------
la $4, val1
lw $5, 0($4) # load val1
lw $6, 4($4) # load val2
lw $7, 8($4) # load val3
lw $8, val4 # load val4
#-------------------------------------------
sw $5, 0($4) # store at val1
sw $6, 4($4) # store at val2
sw $7, 8($4) # store at val3
sw $8, val4 # store at val4
sw $8, -4($4) # store one slot before val1
#-------------------------------------------
END: