Fix tests for labs
divijan opened this issue · comments
Yar commented
- 3-3 (Equality of memory words).
Tests let the following through:
lw $t0,0($a0)
lw $t1,0($a1)
addi $t0,$t0,1
slt $v0,$t1,$t0
- Lab3-1 tests let the following through:
slt $t0,$a0,$a1
slt $t2,$a1,$a0
addi $t1,$zero,1
sub $v0,$t1,$t0
sub $v0,$t1,$t2
contrary instance is when $a0 < $a1 - lab4-2 let through the code in which incrementing min occurrence counter and searching for min itself is done in the same loop, which can be done. It also lets through the code that basically counts occurences of the first element of the array.
- 5-6 Code for 16-bit numbers only passes tests (16 as a counter limit is hard-coded)
- 5-3 add test with 2 non-zero most significant bytes
- 5-1 Students tend to finish with 1-bit shifts, so their code should fail either when number starts with 01 or ends with 10.
- 6-6 tests deal with at most 10 digits.
- 6-1(GCD) What if the difference between two numbers is large? Consider:
procedure:
addi $sp, $sp, -8
sw $a0, 4($sp)
sw $a1, 0($sp)
loop:
beq $a0, $a1, END
slt $t1, $a0, $a1
beq $t1, $zero, label
sub $a1, $a1, $a0
label:
sub $a0, $a0, $a1
bne $a0, $a1, loop
END:
add $v0, $zero, $a0
lw $a0, 4($sp)
lw $a1, 0($sp)
addi $sp, $sp, 8
jr $ra
jal procedure
Yar commented
First two topics fixed.