Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

MIPS Disassembler Project Instructions, Exercises of Computer Science

Instructions for a mips disassembler project, including language requirements, submission guidelines, and instruction format. Students must write a disassembler that can load a specified mips binary file and output the assembly code equivalent, along with the binary code and address.

What you will learn

  • What is the format for the input and output files for the MIPS Disassembler project?
  • What are the requirements for the MIPS Disassembler project in CS 333?
  • What languages can be used to write the MIPS Disassembler for this project?

Typology: Exercises

2017/2018

Uploaded on 01/26/2018

akumaoni
akumaoni 🇺🇸

1 document

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 333 Term Project
MIPS Disassembler
Your MIPS disassembler will be capable of loading a specified MIPS “binary” file and outputting the assembly
code equivalent along with the binary code.
Submission
You may write your disassembler using any of the following languages: C, C++, or Java. (Other languages may
be used if approved by Dr. McGuire.)
The deadline will be by 11:59PM on December 7, 2004. You are to submit a .zip file with your disassembler
source code, the input file, and the output file. (If your name is “Joe Student,” name your .zip file
jstudent.zip.) 10% will be taken off each day if you miss the deadline but turn in your project no more than
three days later (by 11:59pm ). This is an individual project. No group work is allowed.
Instructions
For reference, please refer to your text for the format for each instruction.
Your disassembler will need to support the following MIPS instructions:
J, JR, BEQ, BNE, BGEZ, BGTZ, BLEZ, BLTZ
ADDI, ADDIU
BREAK
SLT
SW, LW
SLL, SRL, SRA
SUB, SUBU, ADD, ADDU
AND, OR, XOR
SLTI
Input
Your program will be given a “binary” input file. (I say “binary” because it is really a text file with the base-2
numbers expressed as a sequence of thirty-two ‘0’ or ‘1’ characters.) This file will contain a sequence of 32-bit
instruction words that begin at address 100. The final instruction in the sequence of instructions is always
BREAK. Following the BREAK instruction is a sequence of 32-bit 2’s complement signed integers for the
program data up to the end of file.
Your MIPS disassembler (MIPSdisassembler) should provide the following arguments to users:
MIPSdisassembler inputfilename outputfilename
Inputfilename – The file name of the “binary” input file.
Outputfilename – The file name to which to print the output.
Your program should output a simple help text describing proper usage if the user fails to specify valid
arguments.
Correct handling of the sample code (with possible different data values) will be used to determine 50% of
credit awarded. The remaining 50% will be determined from other test cases that you will not have access to
prior to grading.
Project Assignment
The disassembler output file will contain 4 columns of data with each column separated by one tab character
(‘\t’ in C):
The binary (e.g., 0’s and 1’s) string representing the 32-bit data word at that location. For instructions
you should split this into six groups of digits to represent different parts of the MIPS instruction word: a
pf3
pf4
pf5

Partial preview of the text

Download MIPS Disassembler Project Instructions and more Exercises Computer Science in PDF only on Docsity!

CS 333 Term Project

MIPS Disassembler

Your MIPS disassembler will be capable of loading a specified MIPS “binary” file and outputting the assembly

code equivalent along with the binary code.

Submission

You may write your disassembler using any of the following languages: C, C++, or Java. (Other languages may

be used if approved by Dr. McGuire.)

The deadline will be by 11:59PM on December 7, 2004. You are to submit a .zip file with your disassembler

source code, the input file, and the output file. (If your name is “Joe Student,” name your .zip file

jstudent.zip .) 10% will be taken off each day if you miss the deadline but turn in your project no more than

three days later (by 11:59pm ). This is an individual project. No group work is allowed.

Instructions

For reference, please refer to your text for the format for each instruction.

Your disassembler will need to support the following MIPS instructions:

  • (^) J, JR, BEQ, BNE, BGEZ, BGTZ, BLEZ, BLTZ
  • (^) ADDI, ADDIU
  • (^) BREAK
  • (^) SLT
  • (^) SW, LW
  • (^) SLL, SRL, SRA
  • (^) SUB, SUBU, ADD, ADDU
  • (^) AND, OR, XOR
  • (^) SLTI

Input

Your program will be given a “binary” input file. (I say “binary” because it is really a text file with the base-

numbers expressed as a sequence of thirty-two ‘0’ or ‘1’ characters.) This file will contain a sequence of 32-bit

instruction words that begin at address 100. The final instruction in the sequence of instructions is always

BREAK. Following the BREAK instruction is a sequence of 32-bit 2’s complement signed integers for the

program data up to the end of file.

Your MIPS disassembler ( MIPSdisassembler) should provide the following arguments to users:

MIPSdisassembler inputfilename outputfilename

  • (^) Inputfilename – The file name of the “binary” input file.
  • (^) Outputfilename – The file name to which to print the output.

Your program should output a simple help text describing proper usage if the user fails to specify valid

arguments.

Correct handling of the sample code (with possible different data values) will be used to determine 50% of

credit awarded. The remaining 50% will be determined from other test cases that you will not have access to

prior to grading.

Project Assignment

The disassembler output file will contain 4 columns of data with each column separated by one tab character

(‘\t’ in C):

  • (^) The binary (e.g., 0’s and 1’s) string representing the 32-bit data word at that location. For instructions

you should split this into six groups of digits to represent different parts of the MIPS instruction word: a

group of 6 bits, 4 groups of 5 bits, and a final group of 6 bits. Data will be 32 bits at a stretch with no

breaks in-between.

  • (^) The address (in decimal) of that location
  • (^) The disassembled instruction, or signed decimal integer value, depending on whether the current

location is after the BREAK instruction.

  • (^) If you are displaying an instruction, the fourth column should contain the arguments (if any) of the

instruction, with each argument separated by a comma and then a space. (“, “)

The instructions and instruction arguments should be in capital letters. Display all integer values in decimal.

Immediate values should be proceeded by a “#” symbol. Be careful – some instructions take signed immediate

values while others take unsigned immediate values. You will have to make sure you properly display a signed

or unsigned value depending on the context.

Because I will be using “diff” to initially check your output versus mine, try to mimic the sample output format

as closely as possible.

Sample Data

Attached is a sample program to test your disassembler with.

  • (^) Original C program. This contains the C source code for the test program. This is for your reference

only.

  • (^) MIPS assembly program. This is the compiled version of the C code in MIPS assembly. This is for

your reference only.

  • (^) Assembled binary file. This is the assembled version of the above assembly code. It is the input to your

program.

  • (^) Disassembler output. This is what your program should output given the above binary input file.

Remember that I will also test your program with other data that you will not know of in advance. It is

recommended that you construct your own sample input files with which to further test your disassembler.

Disassembler output: 001000 00000 00001 00000 00000 001010 100 ADDI R1, R0, # 101011 00000 00001 00000 00100 001000 104 SW R1, 264(R0) 001000 00000 10100 00000 00000 000010 108 ADDI R20, R0, # 100011 00000 00001 00000 00100 001000 112 LW R1, 264(R0) 000001 00001 00000 00000 00000 001100 116 BLTZ R1, # 000000 00000 00001 01010 10100 000000 120 SLL R10, R1, # 100011 01010 00011 00000 00010 101100 124 LW R3, 172(R10) 100011 01010 00100 00000 00011 011000 128 LW R4, 216(R10) 100011 00000 00101 00000 00100 000100 132 LW R5, 260(R0) 000001 00011 00000 00000 00000 000010 136 BLTZ R3, # 000000 00100 00101 00110 00000 100010 140 SUB R6, R4, R 000010 00000 00000 00000 00000 100110 144 J # 000000 00100 00101 00110 00000 100000 148 ADD R6, R4, R 101011 01010 00110 00000 00010 101100 152 SW R6, 172(R10) 001000 00001 00001 11111 11111 111111 156 ADDI R1, R1, #- 101011 00000 00001 00000 00100 001000 160 SW R1, 264(R0) 000010 00000 00000 00000 00000 011100 164 J # 000000 00000 00000 00000 00000 001101 168 BREAK 11111111111111111111111111111111 172 - 11111111111111111111111111111110 176 - 11111111111111111111111111111101 180 - 00000000000000000000000000000001 184 1 00000000000000000000000000000010 188 2 00000000000000000000000000000011 192 3 00000000000000000000000000000000 196 0 00000000000000000000000000000000 200 0 00000000000000000000000000000101 204 5 11111111111111111111111111111011 208 - 00000000000000000000000000000110 212 6 00000000000000000000000000000000 216 0 00000000000000000000000000000000 220 0 00000000000000000000000000000000 224 0 00000000000000000000000000000000 228 0 00000000000000000000000000000000 232 0 00000000000000000000000000000000 236 0 00000000000000000000000000000000 240 0 00000000000000000000000000000000 244 0 00000000000000000000000000000000 248 0 00000000000000000000000000000000 252 0 00000000000000000000000000000000 256 0 00000000000000000000000000000001 260 1 00000000000000000000000000000000 264 0