Due: Wednesday, 27 October 1999
Register names should be the symbolic names and NOT the register number, except register $0. Your program should generate labels for the "jump" and "branch" instructions. Your program should flag illegal or unimplemented instructions (instructions not in the list).
| Instruction | Example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Store Word | sw $fp,0x0008($sp)
| Load word | lw $t5,0x0000($t3)
| Load upper immediate | lui $t0,0x5555
| Add | add $t0,$s0,$a0
| Subtract | sub $t6,$s0,$a0
| Subtract unsigned | subu $sp,$sp,$a0
| Add unsigned | addu $fp,$sp,$a0
| Add immediate | addi $t0,$0,0x0001
| Add immediate unsigned | addiu $t0,$v0,0xfff1
| AND | and $t0,$t3,$t6
| OR | or $t5,$t2,$t5
| NOR (not OR) | nor $t3,$t1,$t4
| XOR | xor $s2,$t6,$t0
| OR immediate | ori $t4,$t0,0x5555
| AND immediate | andi $s6,$s6,0x3333
| XOR immediate | xori $t2,$t2,0x5678
| Branch equal | beq $s5,$0, label
| Branch not equal | bne $s1,$t0, label
| Branch greater-equal 0 | bgez $s3, label
| Branch less than 0 | bltz $s4, label
| Branch GE 0 and link | bgezal $t0, label
| Branch less equal 0 | blez $t1, label
| Branch greater than 0 | bgtz $t1, label
| Jump | j label
| Jump register | jr $ra
| Jump and link | jal label
| Jump and link register | jalr $t1
| Shift left logical | sll $v1,$a0,1
| Shift left logical variable | sllv $t0,$t0,$t4
| Shift right logical | srl $t6,$a2,1
| Shift right logical variable | srlv $s6,$s6,$t1
| Shift right arithmetic | sra $t7,$a1,1
| Shift right arithmetic variable | srav $s6,$s6,$t1
| Set less than | slt $t2,$t0,$t1
| Set less than unsigned | sltu $t3,$t0,$t1
| Set less than immediate | slti $t4,$t0,0xfffb
| Set less than immediate unsigned | sltiu $t5,$t0,0xfffb
| System call | syscall
| |
asmr2000 file.sWhere file.s has a list of assembly instructions you want to convert to "binary". The command will generate a file called hex.out with a sequence of hex values, one value per instruction.