Starting from:

$30

MIPS Disassembler Project 1

1
MIPS Disassembler
Project 1 – CS 3339

PROBLEM STATEMENT
In this project, you will write a disassembler that reads MIPS machine instructions from a (simplified)
binary executable file and prints each assembly language instruction to the screen.
Write your disassembler code in the provided C++ code skeleton, disassembler.cpp. All of your code will
go in the disassembleInstr function. You should read and understand the rest of the code, as it will form
the basis for the remaining projects. Your disassembler only needs to support the MIPS instructions listed
in comments in the code skeleton.
Your disassembler must precisely match the output in the sample output files, including all whitespace and
formatting. Note that all constants are in decimal representation except PC values and jump and branch
targets, which are in hexadecimal.
Please use the updated “green card” provided in class and posted on TRACS. Note that the green card says
the sll instruction means ‘rd = rt << shamt’ whereas the official MIPS standard says it means ‘rd = rs <<
shamt’. We will follow the provided MIPS standard for all shift instructions. Make your code match the
comments and output files.
ASSIGNMENT SPECIFICS
This project is to be submitted individually, and you should be able to explain all code that you submit. You
are encouraged to discuss, plan, design, and debug with fellow students.
All provided files are on TRACS. After moving the compressed tar file to your home space on zeus, the
following command will extract the files:
$ tar xzvf cs3339_project1.tgz
This will create a directory called project1 that contains several sample executables (*.mips) for testing
your disassembler, the corresponding expected output files (*.dis), the disassembler code skeleton
(disassembler.cpp) to which all your code must be added.
Once you have added the missing code to the .cpp file, compile the file with this command:
$ g++ -O3 disassembler.cpp -o disassembler -std=c++11
2
Assuming the compilation succeeded, you can run your disassembler on the provided *.mips files. For
example, to disassemble test1.mips, run this command:
$ ./disassembler test1.mips
To output the disassembly to a file instead of to the screen and then compare the output to the provided
expected output, run these 2 commands:
$ ./disassembler test1.mips test1.out
$ diff –w test1.out test1.dis
If the diff command produces any output to the screen, then the two files are not identical and you need to
change your disassembler code so that the outputs match.
Additional Requirements:
• Your code must compile with g++ and run on zeus.cs.txstate.edu
• Do not change any code outside of the disassembleInstr function and name block
• Your code must be well-commented, sufficiently to prove you understand its operation
• Make sure your code doesn’t produce unwanted output such as debugging messages
• Make sure your code is correctly indented and uses a consistent coding style
• Do not use TAB characters for indentation! (Use a consistent # of spaces per indent level)
• Clean up your code before submitting: i.e., make sure there are no unused variables, unreachable
code, etc.
SUBMISSION INSTRUCTIONS
At the top of the file in the name block type in your first name last name and netID.
All project files are to be submitted using TRACS. Please follow the submission instructions here:
https://tracsfacts.its.txstate.edu/user-guides/tutorials-students/coretools/assignments.html
Note that files are only submitted if TRACS indicates a successful submission and you should receive an
email confirmation.
Any special instructions or comments to the grader, including notes about features you know do not work,
should be submitted in a separate text file named README.txt.
Submit only your final disassembler.cpp file and the optional README.txt file to TRACS. Upload each
file separately and do not compress them. Do not submit any additional files (i.e., no provided files or
generated disassembly output). Please put your netID at the front of the filenames e.g.
lbh31_dissassembler.cpp and lbh31_README.txt.
You may submit your file(s) as many times as you’d like before the deadline. Only the last submission will
be graded. Late assignments will incur a 10-point penalty and after the late deadline passes no
assignments will be accepted. TRACS will not allow submission after the deadline, so I strongly
recommend that you don’t come down to the final seconds of the assignment window. 

More products