Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assemblers are programs to translate an assembly file into a specific machine language. Most of the compilers and assemblers are written in C language.

image

Assemblers are programs to translate an assembly file into a specific machine language. Most of the compilers and assemblers are written in C language. Since you are familiar with MIPS encoding syntaxes, I designed the following C project: In this project, you will create a simple assembler program for the MIPS assembly language by using C programming language. Your program receives the source code filename (for example mycode.asm), translates each instruction into the machine code(HEX or Binary), and stores them with their associated address in an output file with the same name as the input file but with .obj extension. For Simplicity, only consider the following MIPS instructions: ADD, SUB, AND, OR (R-type) ADDI, ANDI, SLL (I-Type) BEQ, BNE (1-type) J (J-type) The source code in the input file can contain several instructions with different types, The target address of BEG, BNE, and J instructions are determined by labels in the source code. The start Address of the program is 0x00400000 For example consider the following source code .text again: add show: addi andi x1: beq bne sll j $11, $12, $23 $8,$7,-1234 $3,$7,127 $8,$10, show $4,$6,x1 $17,$18,4 again the corresponding output file should contain the following Address and Code columns (only) Codc Basic Address 0x00400000 0x01975030 Add $11,$13,531 0x00400004 0x20e8fb2e addi $8,$7,-1234 0x00400008 0x30e3007fandi $3,$7,127 0x0040000c 0x110afffdbeq $8,$10,-3 0x00400010 0x14860000 bne $4, $6,0 0x00100011 0x00130900 811 $17,410,4 0x00400018 0x08100000j 0x00400000 3: Again: Add 3: show: addi 4: andi 5: beg 6: bne 7: x1: 811 8: j $11,$12,931 $8,$7,-1234 $3,$7,127 $8, $10, show $4,$6,x1 $17,410,4 again

Step by Step Solution

3.32 Rating (140 Votes )

There are 3 Steps involved in it

Step: 1

To create a simple assembler program for the MIPS assembly language using C you can follow the steps below 1 Read the input MIPS assembly code from th... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions

Question

What challenges does QVC face? How has it confronted them so far?

Answered: 1 week ago

Question

State the six transaction-related audit objectives.

Answered: 1 week ago