# NOTE - THIS IS NOT A THOROUGH TEST. YOURS SHOULD BE MORE THOROUGH THAN THIS. # THE FACT THAT WE WERE ABLE TO CATCH ERRORS WITH THIS PROGRAM IMPLIES THAT # MANY OF YOU DIDN'T TEST ENOUGH. # It would be wise to have one partner think of crazy test cases if s/he # is ever sitting idly while the other partner works. #addu, addiu, subu #sltiu, sltu #ori, or #lw, sw #load some constants first main: addiu $0, $1, 1 # Either nothing should be written to 0 or addiu $0, $0, -1 # it should go from 0x00000001 to 0xffffffff. # If it changes to 0x00000001 and then back # to 0, then you didn't hard code your 0 # register. addiu $20, $0, 1 # Load some constants addiu $30, $0, -1 addiu $29, $0, 2 addiu $28, $0, -2 addiu $27, $0, 0xFF00 addiu $26, $0, 0x00FF #add,sub addu $1, $20, $29 #should get $1 = 3 (0x00000001 + 0x00000002) addiu $2, $27, 0xF0 #should get $2 = 0xFFFFFFF0 #(0xffffff00 + 0x000000f0) subu $3, $29, $20 #should get $3 = 1 (0x00000002 - 0x00000001) #slt sltu $4, $0, $20 #should get $4 = 1 (0x00000000 < 0x00000001) sltiu $5, $26, 0xFFFF #should get $5 = 1 (0x000000ff < 0xffffffff) #(unsigned) #or or $6, $26, $27 #should get $6 = 0xFFFFFFFF #(0x000000ff | 0xffffff00) ori $7, $26, 0xFF00 #$7 = 0x0000FFFF (no sign-extend) #(0x000000ff | 0x0000ff00) #sw, lw, offsets addiu $25, $0, 520 addiu $24, $0, 524 addiu $23, $0, 528 sw $26, 0($24) #store 0xff lw $8, 0($24) #three loads, should all load 0xff lw $9, 4($25) #into $8, $9, $10 lw $10, -4($23)