Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 MIPS: Translate MIPS program into C program [ 1 2 pts ] Read the following MIPS code segment and comments. Translate it into C

3 MIPS: Translate MIPS program into C program [12pts]
Read the following MIPS code segment and comments. Translate it into C code. Specifically,
the registers $s0,$s1,$s2,$s3 store signed integers x,y,z,w, respectively. Complete the C
code using expressions of x,y,z,w. Do not care too much about the grammars of C. You will
get full marks as long as the meanings are correct.
MIPS code segment:
bge $s0,$s1,L1,# go to L1 if $s0$s1
bgt $s2, $s3, skip # go to skip if $s2>$s3
L1:
bne $s0,$s2, skip # go to skip if $s0$s2
L2: , # inner if statement
bne $s2, $s3, L3 # go to L3 if $s2!= $s3
addu $s0,$s1,$s2
j skip
L3:
addiu $s2,$s1,-2
skip:
C code you need to complete:
if (some condition 1[5pts]){
if (some condition 2[3pts])
{
some code 1[1pt]
}else{
some code 2[1pt]
}
}
image text in transcribed

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

Students also viewed these Databases questions

Question

What is phishing? How do people get phished?

Answered: 1 week ago