Review Of: Chapters 1 - 2.
You may work individually or in groups of 2 people to finish this project. I expect that the programming will be your group's effort and not the effort of other persons.
Write a program that will read in machine language and write out the corresponding assembly language commands.
Your program should handle all of the instructions and registers in the
MIPS Instructions Table
MIPS Registers Table
I have provided online.
You should be able to handle all 32 registers and all three instruction
formats (R, I, and J), including all forms of addressing (for example,
beq addresses, and
You may find Figures 2.1 (p. 78), 2.6 (p. 100), and 2.14 (p. 121)
helpful in addition to the table I have provided.
Design and Coding Tips:
You may find this structure chart useful, although you should not feel constrained by it. For example, you may want to create functions similar to getRegName for getting operation or function codes, which would be fine even though there are no such functions on the current structure chart.
You should be able to use the
binToDecfunctions you wrote for the Disassembler Utilities Project, as well as the
Makefile, header files, and print functions you downloaded for that program. You may also want to use your modified
disUtilDriver.cfile as a template for the
disassembler.c. Finally, you may wish to complete and use getRegName, a function that translates register numbers to their corresponding register names. (To use the
Makefilefor the disassembler, edit it and switch to the commented-out version of the "all" target or, alternatively, type
make disassemblerat the command line.)
The input file should contain one MIPS instruction (32 bits) in machine language format per line. Your program should:
For example, consider the following machine code. (The columns and spaces are just for readability; the actual file would just have 32 "bit" characters per line, without spaces.)
|100011||01001||01000||0000 0100 1011 0000|
|101011||01001||01000||0000 0100 1011 0000|
\tto represent a tab in a printf statement.)
lw $t0, 1200($t1) add $t0, $s2, $t0 sw $t0, 1200($t1)
As specified in the syllabus, your program should adhere to the Kalamazoo College CS Program Style Guide and Documentation Standards, including use of the Braces Line Up style pattern. You may also use the associated template files: the function template file and the header template file.
To ensure that all function calls are syntactically correct (match the function definitions), you should include function declarations for all of your functions in one or more header files, and include the header file(s) in all appropriate C source files (*.c files).
Makefile I have provided specifies a set of compiler options
that will help you catch many errors at compile time.
These options generate warnings about questionable constructions
that often indicate programmer confusion or actual logic errors.
You may have to make adjustments to the
if the specific options or
option names for your compiler are somewhat different.
Your submission should contain;
manpage or help file) that a new user could use to know how (and why) to use your program. It should include a description of your program, along with some sample input and sample output (which need not be the same as your test file(s), since the point of the sample input/output is to help with your description), and instructions on how to run the program. The Program Style Guide has a little more information on what should be included in external documentation.
make cleanin the directory before submitting; this will remove the machine-specific executable and intermediate "object code" files, since your code will have to be re-compiled on my machine anyway.)
The rubric for grading the Disassembler Programming Project will be based roughly on the following.Compiles and runs 10 pts Correctness (satisfies requirements) 68 pts Internal documentation and coding style 10 pts External Documentation 8 pts Test Cases 9 pts Total: 105 pts