

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Score: ____________ Date:___________ Name:__________________________________
TA Signoff : ________________________________________________________________
In this programming assignment, you will implement a simple disassembler program using MIPS assembly language for the Mini-MIPS ISA defined below. You will use the MIPS functional simulator “SPIM” (http://www.ece.gatech.edu/~leehs/ECE3055 Click on Assignments -> My SPIM page) for validating the functionality of your MIPS disassembler program. Your program should disassemble and only disassemble the 6 instructions defined in our mini-MIPS ISA from the binary words provided. All other binaries not belonging to any of the 6 instructions should print out “unsupported opcode !!” First of all, you have to download the ece3055p1.s skeleton file from our course website (http://www.ece.gatech.edu/~leehs/ECE3055 click on Assignments-
Skeleton Program). This skeleton file contains 14 instructions defined after the label “binary_code” in hexadecimal format. Each instruction is encoded by each .word using Little Endian byte-order. Your MIPS program should read one .word at a time, decode the .word binary to determine the instruction, and then print out each instruction on the Console window. Note that some instructions in the skeleton program are not defined by the Mini-MIPS ISA. During disassembling, your program should print out “Unsupported opcode !!“ on the console window when encountering such instructions. Another caveat is that the Offset field encodes a signed number, be cautious when you print them out. For jump target, simply print out the 26-bit number.
0x23 rs rt offset 0x2b rs rt offset
8 rs rt imm 3 target
0 rs rt rd 0 0x
6 5 5 16 6 5 5 16
(^6 5 5 16 6 5 5 5 5 )
(^6 5 5 166 5 5 5 5 )
Load word : lw rt, offset(rs) Store word : sw rt, offset(rs)
Add immediate addi rt, rs, imm
Jump and link jal target
Branch on less than zero bltz rs, offset
And and rd, rs, rt 1 rs 0 offset
Printout example on the SPIM console window:
lw $4 24($10) addi $5 $6 - unsupported opcode! and $2 $3 $ unsupported opcode! jal 120000 ...
Hint. In the skeleton file, a few ASCII (.asciiz) symbols and instruction mnemonics (e.g. bne) were defined. You can use them to print out some of the needed instruction symbols on Console window. There are many repetitive operations to carry out in your program (e.g. print dollar sign ($) before print the register number). In order to reduce the code size, you are encouraged to use procedure call, e.g. jal instruction for call and its corresponding jr $31 for return in MIPS, to handle these repetitive operations.
Tool. SPIM simulator will be used for executing your MIPS program. Visit our course website for complete information on SPIM and MIPS assembly language. For those who use PCSpim on Windows, uncheck the “load trap file” under Simulator→Settings since our skeleton file already contains _start initialization code. If you’ve never used any editor such as vi, emacs, MS visual IDE to write programs before, a free syntax-coloring editor with MIPS syntax coloring files is available at www.crimsoneditor.com.
How to receive your credit? You must go to the lab hours held by TAs for having your assignment checked off before the due time. You need to go to the right TA based on the Section you registered for. There is no need to turn in any separate document. The TA will announce sign-off sheet later for you to make an appointment for check-off. Also note that, the TA might use a different input set to perform further tests.
TA1 : Justin Fiore (justin.fiore AT gatech edu) TA2 : Nathan Parrish (nvparrish AT gatech edu)
Honor Code. This assignment must be done individually. You can discuss questions using the webct discussion board but you are not allowed to copy others’ codes. For those who violate the rule, both the originator and the copier will receive zero credit and will be immediately reported to the Dean of Students’ Affair for further action.