Reference no: EM132224081
Project - MIPS Disassembler
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_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.
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
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 and $ 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.
Attachment:- Assignment Files.rar