forked from M-Elsaeed/MIPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test Cases.txt
80 lines (72 loc) · 1.01 KB
/
Test Cases.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
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
TC 1
addi $sp,$sp,200
j main
sum :
slti $t1,$a0,2
addi $t5,$00,1
beq $t1,$t5,exit
addi $sp,$sp,-4
sw $ra,0($sp)
addi $sp,$sp,-4
sw $a0,0($sp)
addi $a0,$a0 ,-1
jal sum
lw $a0,0($sp)
addi $sp, $sp,4
add $v0,$v0,$a0
lw $ra,0($sp)
addi $sp,$sp,4
jr $ra
exit :
addi $v0,$00,1
jr $ra
main :
addi $a0,$00,5
jal sum
addi $a0,$v0,0
TC 2
addi $s0,$s0,200
addi $t0,$00,0
addi $t1,$00,3
loop1 :
beq $t0,$t1,finish1
sll $t3,$t0,2
add $s1,$s0,$t0
sb $t3,0($s1)
addi $t0,$t0,1
j loop1
finish1 :
add $t0,$00,$00
addi $t4,$00,0
loop2 :
beq $t0,$t1,finish2
add $s1,$s0,$t0
lb $t5,0($s1)
add $t4,$t4,$t5
addi $t0,$t0,1
j loop2
finish2 :
addi $a0,$t4,0
TC 3
addi $s0,$s0,200
addi $t0,$00,0
addi $t1,$00,12
loop1 :
beq $t0,$t1,finish1
sll $t3,$t0,2
add $s1,$s0,$t0
sw $t3,0($s1)
addi $t0,$t0,4
j loop1
finish1 :
add $t0,$00,$00
addi $t4,$00,0
loop2 :
beq $t0,$t1,finish2
add $s1,$s0,$t0
lw $t5,0($s1)
add $t4,$t4,$t5
addi $t0,$t0,4
j loop2
finish2 :
addi $a0,$t4,0