CSE140: Lab/HW #2 Machine Language…continued

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Overview
This assignment is divided into 2 parts: a programming exercise and a written
assignment. You will spend the lab hours to work on the programming exercise,
while finish the written assignment in your own free time.
(Programming exercise) Create MachineCode.c
Paired with the classmate sitting next to you and do the following tasks (you can
have groups of 3 students):
Write a C program (MachineCode.c) to convert any R-format MIPS instructions
into machine codes. Refer to the MIPS reference sheet to find out all the possible
operators your program will need to implement.
You program must produce the following sample results in the exact same format:
Sample results (input is in italic and bold):
Enter an R-format instruction:
add s1, t0, t1
Operation: add
Rs: t0 (R8)
Rt: t1 (R9)
Rd: s1 (R17)
Shamt: 0
Funct: 32
Machine code: 00000001000010011000100000100000
Enter an R-format instruction:
jr ra
Operation: jr
Rs: ra (R31)
Rt: 0 (R0)
Rd: 0 (R0)
Shamt: 0
Funct: 8
Machine code: 00000011111000000000000000001000
As a group, discuss about how to read and interpret the instructions from user. Once
this step is done, split the task among your group so that each member will
implement different category of the operators (arithmetic, shift, or jump)
individually. In an upper division course, you are expected to complete your own
portion of a group work.
Do not worry about invalid inputs. Assume all test cases will follow the correct
instruction format.
Demo to your TA your working program before the end of your
next lab (Lab #3). Indicate which portion of the code was your
implementation. “Working on the code together” means
someone did not implement individually.
(Written assignment)
Solve the problems (in CSE140_HW2_written.pdf) and place your answers in
a text document for submission.
What to submit
When you are done with this lab assignments, you are ready to submit your work.
Make sure you have included the following before you press Submit:
 Your MachineCode.c, answers to written assignment, and a list of
Collaborators.
 Your assignment is closed 7 days after this lab is posted (at 11:59pm).