For the following MIPS instructions, (1) show its format or type (I-format, R- format, or J-...
Free
90.2K
Verified Solution
Question
Programming
For the following MIPS instructions, (1) show its format or type(I-format, R- format, or J- format); (2) translate them into binaryusing the follow procedure (Note: $s0-$s7 are the 16-23thregisters, $t0-$t7 are the 8-15th registers). Forexample,
addi   $s0, $s1, 2             # theop code of addi is 0010002
Format (?):
lw      $s1, 4($s1)             # theop code of lw is 1000112
Format (?):
bne    $s1, $t1,loop          #the value of loop here is 00102 and
# the op code of bne is0001012
Format (?):
jal      leaf                          # the value of leaf here is 0x2000016
                                # the op code of jal is 0000112
Format (?):
sub    $t1, $s6,$0  # the op code of add is 0 and the funct code is1000102     Â
Format (?):
For the following MIPS instructions, (1) show its format or type(I-format, R- format, or J- format); (2) translate them into binaryusing the follow procedure (Note: $s0-$s7 are the 16-23thregisters, $t0-$t7 are the 8-15th registers). Forexample,
addi   $s0, $s1, 2             # theop code of addi is 0010002
Format (?):
lw      $s1, 4($s1)             # theop code of lw is 1000112
Format (?):
bne    $s1, $t1,loop          #the value of loop here is 00102 and
# the op code of bne is0001012
Format (?):
jal      leaf                          # the value of leaf here is 0x2000016
                                # the op code of jal is 0000112
Format (?):
sub    $t1, $s6,$0  # the op code of add is 0 and the funct code is1000102     Â
Format (?):
Answer & Explanation Solved by verified expert
addi   $s0, $s1,
2Â Â Â Â Â Â Â Â Â Â Â Â Â
I-format
ADDIÂ Â Â Â Â Â Â $s1Â Â
     $s0 Â
         Â
immediate
001000Â Â 10001Â Â 10000Â Â
0000000000000010
Binary = 00100010001100000000000000000010
---------------------------------------------------------------------------------
lw      $s1,
4($s1)Â Â Â Â
I-Format
LWÂ Â Â Â Â Â Â Â Â
$s1Â Â Â Â Â Â Â Â
$s1Â Â
           Â
offset
100011Â Â 10001Â Â 10001Â Â
0000000000000100
Binary = 10001110001100010000000000000100
---------------------------------------------------------------------------------
bne    $s1, $t1, loop
I-Format:
BNEÂ Â Â Â Â Â Â Â Â
$s1Â Â Â Â Â Â Â $t1Â Â
  offset
000101Â Â 10001Â Â 01001Â Â
0000000000000010
Binary = 00010110001010010000000000000010
---------------------------------------------------------------------------------
jal
leaf                    Â
0x20000 >> 2 =
0x01000Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
J-Format
JALÂ Â
                    Â
target
000011Â Â 00000000000001000000000000
Binary : 00001100000000000001000000000000
---------------------------------------------------------------------------------
sub    $t1, $s6, $0
R-type
opcode  $s6   Â
$zero  $t1     Â
shamt  SUB
000000Â Â 10110Â Â 00000Â Â
01001Â Â 00000Â Â 100010
Binary: 00000010110000000100100000100010
Get Answers to Unlimited Questions
Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!
Membership Benefits:
- Unlimited Question Access with detailed Answers
- Zin AI - 3 Million Words
- 10 Dall-E 3 Images
- 20 Plot Generations
- Conversation with Dialogue Memory
- No Ads, Ever!
- Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Other questions asked by students
StudyZin's Question Purchase
1 Answer
$0.99
(Save $1 )
One time Pay
- No Ads
- Answer to 1 Question
- Get free Zin AI - 50 Thousand Words per Month
Unlimited
$4.99*
(Save $5 )
Billed Monthly
- No Ads
- Answers to Unlimited Questions
- Get free Zin AI - 3 Million Words per Month
*First month only
Free
$0
- Get this answer for free!
- Sign up now to unlock the answer instantly
You can see the logs in the Dashboard.