Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#1: Write a MIPSzy assembly program to determine the range between pairs of numbers. Keep things very basic with instructions such as load (lw), store

#1: Write a MIPSzy assembly program to determine the range between pairs of numbers. Keep things very basic with instructions such as load (lw), store (sw), add (addi and add), subtract (sub), multiplication (mul), branch (beq and bne), jump (j), and set on less than (slt) instructions. Your program should meet the following functional requirements:

  • Input: an arbitrary number of integer pairs (in all pairs, the first number will be the max value)
  • Output: for each pair, output the range
  • You may assume an even number on input values

Below is a converter that will be used to run the assembly code in which you can base your code on:

image text in transcribed

Here is an example of MIPSzy code:

image text in transcribed

PARTICIPATION ACTIVITY 3.10.2: MIPSzy simulator with input and output. Assembly Input Registers $zero 0 Line 1 # Type your program here Data memory 5000 5004 0 0 0 0 0 InputReady Output 0 0 InputValue 0 OutputValue 0 0 ENTER SIMULATION STEP RUN More options Feedback? Assembly Input 3 25 4444 Registers Szero Line 1 addi $t1, Szero, 8192 Line 2 GetIn: lw $t3, ($ti) # kb ready? Line 3 beq $zero, $ts, Done Line 4 Line 5 addi $t2, Szero, 8196 Line 6 lw $t4, ($t2) # Get kb input Line 7 Line 8 add $t4, St4, $t4 # Double Line 9 Line 10 addi $ts, $zero, 8200 Line 11 sw $t4, ($t5) # Output double to sc Line 12 j Getin Line 13 Done: 0 8192 8196 0 8888 8200 Data memory 5000 0 5004 0 5008 8192 0 8196 4444 8200 8888 Output $13 InputReady InputValue OutputValue $t5 EXIT SIMULATION START AGAIN PARTICIPATION ACTIVITY 3.10.2: MIPSzy simulator with input and output. Assembly Input Registers $zero 0 Line 1 # Type your program here Data memory 5000 5004 0 0 0 0 0 InputReady Output 0 0 InputValue 0 OutputValue 0 0 ENTER SIMULATION STEP RUN More options Feedback? Assembly Input 3 25 4444 Registers Szero Line 1 addi $t1, Szero, 8192 Line 2 GetIn: lw $t3, ($ti) # kb ready? Line 3 beq $zero, $ts, Done Line 4 Line 5 addi $t2, Szero, 8196 Line 6 lw $t4, ($t2) # Get kb input Line 7 Line 8 add $t4, St4, $t4 # Double Line 9 Line 10 addi $ts, $zero, 8200 Line 11 sw $t4, ($t5) # Output double to sc Line 12 j Getin Line 13 Done: 0 8192 8196 0 8888 8200 Data memory 5000 0 5004 0 5008 8192 0 8196 4444 8200 8888 Output $13 InputReady InputValue OutputValue $t5 EXIT SIMULATION START AGAIN

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions

Question

What are the advantages of microservices over monoliths?

Answered: 1 week ago