Question: This Task needs an Expert Computer Science Teacher, please solve it properly otherwise I will report the Answer. In this task we will write an
This Task needs an Expert Computer Science Teacher, please solve it properly otherwise I will report the Answer.
In this task we will write an assembler. Your program should accept a text file from command line. The file should carry a valid and correct MIPS assembly program
. For this assignment we assume that we have a limited number of MIPS assembly instructions.
These instructions are:
add
and
or
andi
ori
addi
sw
lw
slt
Your task is to write a program in C that accepts a text file containing few lines (minimum three) of MIPS assembly program using the above instruction set. (It does not matter whether or not the program makes some useful output).
Your program should then read the file line by line and decode the instruction into its equivalent machine code.
Note that you are not supposed to generate the output of the program. Your only intention is to generate the equivalent machine program.
Introduction about the problem in hand especially well written information about the preprocessor and its functions.
Your code followed by a detailed description explaining how you built up the logic of the program. Additional functionalities and / or exclusions (if any) should be stated with separate heading in bold face font.
The output of the program should be as shown:
Sample Run 1
$ gcc assgn2.c -o assgn
$./assgn inputFile
Assembly language program:
add $9,$10,$11
add $12,$9,$10
and $13,$10,$12
It should then display the machine code of each instruction individually in binary format.
(Tentative) Machine Code:
00000001010010110100100000100000
00000001001010100110000000100000
00000001001011000110100000100100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
