MIPS Disassembler Project 1 – CS 3339


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (3 votes)

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 of all 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.
I have provided two MIPS references as well. Note that the textbook says the sll instruction means ‘rd = rt
<< shamt’ whereas the provided documentation (MIPSinstructions.pdf) says it means ‘rd = rs << shamt’. We will follow the provided MIPS documentation for all shift instructions. However, be aware that this document uses RD to refer to the target register of all instructions, regardless of whether the rd or the rt field specifies the destination register number. For all instructions that use the I format, RD therefore refers to the rt field in the instruction (since these instructions do not have an rd field). 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 under Resources  Project Files  cs3339_project1.tgz. After moving the compressed tar file to your home space on zeus, the following command will extract the files: $ tar xzvf cs3339_proj1.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, and two MIPS references (*.pdf) that are more accurate than those in the textbook. 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
• 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.
At the top of the file, include a block of comments including your name, the course and section number, and
the project number.
All project files are to be submitted using TRACS. Please follow the submission instructions here:
Note that files are only submitted if TRACS indicates a successful submission.
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. 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. Late assignments will incur a 10 point penalty
and after the late deadline passes no assignments will be accepted.