Computer Science 324 |
Your program should read in MIPS instructions as hexadecimal numbers from standard input. Each instruction (which you should read into an unsigned int) is then to be passed to a function that will parse the instruction bit fields and return a structure that contains these values in a more convenient format. It should then call another function that prints out the values of the fields.
A starter framework for this lab assignment can be found on the CS Lab Linux systems (or remotely on babyred.cs.mtholyoke.edu) in
/home/jteresco/shared/cs324/labs/mipsdecode/mipsdecode.tar.gz
Copy that file to your account, extract it to an appropriate work area, and change to that directory. To extract it, you should be able to issue the command
tar xvfz mipsdecode.tar.gz
This will create a new directory mipsdecode in your current directory. When you change to that directory, you should find five files:
Your task is to fill in the missing implementations of the functions parseMipsInstruction and dumpMipsInstruction in mipsInstruction.c, and main in driver.c.
I have provided .o files that you can link with to try out my implementations of driver.c and/or mipsInstruction.c. See the Makefile for details. Your program's behavior should be identical to that of mine when you have completed the assignment.
Your main tasks to complete this lab:
Your code should compile with no warnings when using the -Wall flag to gcc (as is used by the provided Makefile). You should be careful to free any allocated memory at an appropriate time.
I will test your program on a larger input set than that provided in the instructions file. It is up to you to make sure you test all cases that may not be covered in that file.
The lab will be graded out of 30 points. 20 points will be awarded for correctness, 4 for efficiency, and 6 for style and documentation. The efficiency portion of the grade may be impacted, for example, if you use unnecessarily complex functions or operations to break down the input number into fields. Good style requires appropriate code formatting and meaningfule variable and function naming. A well-documented submission will include a comment in each file describing the contents of the file, a comment with each function describing what it does, what parameters it expects, and any restrictions on its usage, and comments clarifying any potentially confusing code segments.
Submit a single tar file called mipsdecode.tar that will extract its contents into a directory mipsdecode. The tar file should include four files: Makefile, driver.c, mipsInstruction.h, and mipsInstruction.c. Make sure your name is in the C files that you modified. Please do not include any additional files, such as emacs backup files, object files, or your executable.