Question: Part 1 Write MIPSzy assembly code to accomplish the tasks specified by the following high - level language ( Java or C + + )
Part
Write MIPSzy assembly code to accomplish the tasks specified by the following highlevel language Java or C statement.
System.out.print; Java
cout ; C
both do the same thing
Essentially, your program needs to do three things:
Compute
Multiply the result of step by
Display the result of step by storing this result to memory address
Write code that does all of these steps, in order.
Test your code in the "MIPSzy simulator with input and output". Once you're convinced that it works correctly, copy it out of the simulator and paste it into a text editor eg Notepad TextPad, Atom, or mousepad Save it as a file named partasm. You will submit this file as part of your project.
Part
Write MIPSzy assembly code to accomplish the tasks specified by the following code in a highlevel language Java or C
int w; use a register for this variable
int w; use a register for this variable
int total; use a register for this variable
int result; note: int word bytes on this machine
total w;
for int i ; i ; i
total total w;
resulti total;
System.out.printlntotal; C: cout total
;
Hints
Begin by deciding which registers you will use for the variables w w and total. You may want to write comments which begin with # in MIPSzy assembly or make a separate file or note sheet to keep track of the register you are using for each variable.
Then decide which registers you will use or reuse? to store other values used in the program:
the loop counter variable
the memory address of the current element in the result array starts at in base
the memory address that you use to display output in base
Now move into writing the code. The following zyBook sections might be especially helpful for you.
Section : tips for writing assembly programs, plus examples
Sections and : conditional branch instructions; the MIPSzy simulator does accept the branch pseudoinstructions in section
Section : construct a for loop using conditional branch instructions
Section : access different elements of an array as your code moves through a loop but there is a simpler way than what they show you...
The newline will be automatically added by the MIPSzy simulator. You do not need to print the newline character.
Test your code in the "MIPSzy simulator with input and output". Once you're convinced that it works correctly, copy it out of the simulator and paste it into a text editor eg Notepad TextPad, Atom, or mousepad Save it as a file named partasm. You will submit this file as part of your project.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
