Question: MIPS A) Consider The C Statement: A (B + D) + (B - C) + (C + D)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

10/22/21, 3:17 PM MIPS A) Consider The C Statement: A = (b + D) + (b... | Chegg.

com

  Home Study tools


 My courses
 My books Career Life 

Find solutions for your homework Search

home / study / engineering / computer science / computer science questions and answers / mips a) consider the c statement: a = (b + d) + (b - c) +…

Question: MIPS
a) Consider the C statement: a = (b + d) + (b - c) + (c
+ d)
… Post a question
Answers from our experts for your tough
homework questions

MIPS Enter question


a) Consider the C statement: a = (b + d) + (b - c) + (c
+ d)
Which of the following assembly instructions can be used
to replicate all or part of this statement in
MIPS, without
changing or reducing the equation. Assume variables a, b, c, and d
are assigned to
registers $s0, $s1, $s2 and $s3
respectively. Continue to post
1. sub $t0, $s2, $s3 20 questions remaining
2. sub $t0, $s0, $s3
3. sub $t1, $s1, $s2
4. sub $t2, $s1, $s3
Snap a photo from your
5. add $t2, $s0, $s3 phone to post a question
6. add $t0, $s2, $s3 We'll send you a one-time download
link
b) Consider the MIPS instruction: add $t0, $s0, $s1.
What would the corresponding machine code be?
Write your answer in
binary, or in hexadecimal with no spaces.
c) Consider the machine code: 1000 1110 0000 1000 0000
0000 0000 0100. What MIPS instruction does 888-888-8888 Text me
this
represent?
    1. lw $t0, 4($s0) By providing your phone number, you agree to receive a one-time
automated text message with a link to get the app. Standard
    2. sw $t6, 100($s3) messaging rates may apply.

    3. add $t0, $t1, $t2


    4. beq $t7, $t8, 68

My Textbook Solutions
Expert Answer

Anonymous answered this


Was this answer helpful? 4 0 Add a Add a
228 answers
textbook textbook
a) a b c d are assigned to register $s0 $1 $2
$3 respectively Physics for
Scientists...
Given a = (b+d) + (b-c) +(c+d) 2nd Edition

As in the question it is mentioned that we are not allowed to


change or reduce the equation (statement) View all solutions

1.(c+d) can be calculated using 6. add $t0,


$s2, $s3

2.(b-c) can be calculated using 3. sub $t1,


$s1, $s2

3.(b+d) can be calculated using add $t2, $s1, $s3 (not present
in given 6 statements)

adding and storing content of $t0 $t1 $t2 we can get desired
equation

b) add $t0, $s0, $s1  

given instruction is register instruction

Register Instruction Format

Opcode Source 1 Source 2 Destination Shift Amount Function

000000 5 bits 5 bits 5 bits 5 bits 6 bits

000000 10000 10001 01000 00000 100000 (answer)

RI $s0 $s1 $t0 unused add

RI = register instruction

c) as all the option are having different


instruction so just by looking opcode ie we can decide

100011 is opcode (first 6 bit ) which is opcode for load


instruction.

so answer is option1  lw $t0, 4($s0)




Comment

https://www.chegg.com/homework-help/questions-and-answers/mips-consider-c-statement-b-d-b-c-c-d-following-assembly-instructions-used-replicate-part--q58546034 1/2
10/22/21, 3:17 PM MIPS A) Consider The C Statement: A = (b + D) + (b... | Chegg.com

  Home Study tools


 My courses
 My books Career Life 

Up next for you in Computer Science

Consider the following C


Use the FPGA illustrated

statement: a = (b + d) + (b below to implement a full


adder. Label the outputs

c) + (c + d) Which of the
clearly. Draw lines
following assembly
between See more questions
instructions can be used for subjects you study
to

replicate all or part of this

See answer See answer

Questions viewed by other students

Q: Consider the following C statement:


         a = (b + d) + (b –
c) + (c + d)
Which of the following assembly instructions
can be used to
replicate all or part of this statement in MIPS, without changing
or reducing the equation. Assume
variables a, b, c, and d are
assigned to registers $s0, $s1, $s2 and $s3 respectively.
sub $t0, $s2, $s3
sub...

A: See answer

Q: Complete the corresponding assembly language fragments by


selecting the correct instruction, register, or value:
(Choices in bold)
a) Consider the following fragment of C code:
if(a == b) {
      x += 10;
      A[50] = A[50] +x;
}
else {
      
y += 10;
       A[50] = A[5...

A: See answer 100% (5 ratings)

Show more 

COMPANY

LEGAL & POLICIES

CHEGG PRODUCTS AND SERVICES

CHEGG NETWORK

CUSTOMER SERVICE

© 2003-2021 Chegg Inc. All rights reserved.

https://www.chegg.com/homework-help/questions-and-answers/mips-consider-c-statement-b-d-b-c-c-d-following-assembly-instructions-used-replicate-part--q58546034 2/2

You might also like