In this part of the project we will be writing an assembler


In this part of the project, we will be writing an assembler that translates a subset of the MIPS instruction set to machine code. Our assembler is a two-pass assembler similar to the one described in lecture. However, we will only assemble the .text segment. At a high level, the functionality of our assembler can be divided as follows:

Pass 1: Reads the input (.s) file. Comments are stripped, pseudoinstructions are expanded, and the address of each label is recorded into the symbol table. Input validation of the labels and pseudoinstructions is performed here. The output is written to an intermediate (.int) file .

Pass 2: Reads the intermediate file and translates each instruction to machine code. Instruction syntax and arguments are validated at this step. The relocation table is generated, and the instructions, symbol table, and relocation table are written to an object (.out) file.

The Instruction Set

Please consult the MIPS Green Sheet for register numbers, instruction opcodes, and bitwise formats. Our asembler will support the following registers: $zero, $at, $v0, $a0 - $a3, $t0 - $t3, $s0 - $s3, $sp, and $ra. The name $0 can be used in lieu of $zero. Other register numbers (eg. $1, $2, etc.) are not supported.

Implementation Steps

Step 0: Obtaining the Files

Step 1: Building Blocks

Step 2: SymbolTable

Step 3: Pseudoinstruction expansion

Step 4: Instruction Translation

Step 5: Putting It All Together

Step 6: Testing (NO, DO NOT JUST SKIP THIS SECTION.)

How Tests Are Run

CUnit performs the following actions when running a test suite:

1. Runs the suite initialization function. In the above code, this function is called init_suite.

2. Runs all of the tests you added to the suite. In the above example, this runs only the function named simple_sample_test.

3. Runs the suite cleanup function. In the above code, this function is called clean_suite.

Attachment:- Assignment File.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: In this part of the project we will be writing an assembler
Reference No:- TGS02197723

Expected delivery within 24 Hours