Question

Consider the following MIPS machine code.          bne $0, $0, 2          addi $t0, $0, 5          addi $t1,...

Consider the following MIPS machine code.

         bne $0, $0, 2

         addi $t0, $0, 5

         addi $t1, $0, 10

What will be in $t0 and $t1 after the above program is executed?

a.       $t0 = 5, $t1 is unknown because 3rd statement will not be executed

b.      $t1 = 10, $t0 is unknown because 2nd statement will not be executed

c.       $t0 = 5, $t1 = 10

d.      $t0 = 0, $t1 = 0

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Option c: $t0 = 5, $t1 = 10
Explanation:
since $0 =$0; the branch will not take place
in the 2nd statement t0 will get 5 and in the 3rd statement t1 will become 10.

Add a comment
Know the answer?
Add Answer to:
Consider the following MIPS machine code.          bne $0, $0, 2          addi $t0, $0, 5          addi $t1,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Compiling C Programs into MIPS Assembly and Machine Code sll $t1, $a1, 2 add $t1, $a0....

    Compiling C Programs into MIPS Assembly and Machine Code sll $t1, $a1, 2 add $t1, $a0. $t1 lw $t0, 0($t1) lw $t2, 4($t1) sw $t2, 0($t1) sw $t0, 4($t1) 1. From the assembly code, what machine code might a MIPS assembler produce? 2. What does this program do? Write the C code for this assembly program.

  • A) The following code fragment takes as input a number in t1 and produces a value...

    A) The following code fragment takes as input a number in t1 and produces a value in register $s2. Assume that initially $s2 equals zero. Line Loop: addi $t2, $zero, 10 2 Loop2: addi$s2, $s2, 2 3 subi $t2, $t2, 1 4 bne $t2, $zero, Loop2 5 subi $t1,$t1, 1 6 bne $t1, $zero, Loop For each of the following problems, justify your answers and show your calculations clearly. Final answers without justifications are not accepted. What is the final...

  • 2. The table below holds MIPS assembly code fragments with different branch instructions LOOP addi $s2....

    2. The table below holds MIPS assembly code fragments with different branch instructions LOOP addi $s2. $s2. 2 subi $t1. st1. 1 bne t1. 0. LOOP DONE: LOOP: it st2. $0. stl beq t2. 0. DONE addi $s2. Ss2. 2 LOOP DONE: For the loops written in MIPS assembly in the above table, assume that the register Şt1 is initialized to the value of 10. What is the value in register $s2 assuming that $s2 initially has a value of...

  • Please solve the following 5. Given the following MIPS instructions with their corresponding addresses answer the...

    Please solve the following 5. Given the following MIPS instructions with their corresponding addresses answer the following questions. a. Instruction Start: Address 1000 s1l St1, Ss2, 4 1w $t0, 128(St) bne St0, S t1. Exit Here 004 Here 1008 012 .. Exit: 1096 Write the machine code for cnch of the above MIPS instructions (5 pts) i. i. Find the total number of bits required to store the instructions (3 pts) Scanned by CamScanner 5. Given the following MIPS instructions...

  • Question 3 (10 points) Convert the following MIPS assembly code into machine language. Write the instruction...

    Question 3 (10 points) Convert the following MIPS assembly code into machine language. Write the instruction in hexadecimal. The opcode for sw 43 (101011). sw St1, -4(St3) Question 4 (10 points) Consider the following MIPS assembly code: addi $s3, $0, 5 addi $s1, S0, 3 addi Ss1, $s1, 2 beq Ss3, Ssl, target addi Ss1, Ss1, 1 target: add Ss3, Ss1, Ssl a. After running the code, what is the value of Ss3? b. If the memory address of the...

  • please explain fully 3. Consider the following MIPS loop: LOOP: Comment slt $t2, 0, Sti beg...

    please explain fully 3. Consider the following MIPS loop: LOOP: Comment slt $t2, 0, Sti beg $t2, 0, exit addi $t1, $t1,-1 addi Sal, $31, 2 TOOP exit: a. (5 pts) Write comments for each line, at the right side of above table. b. (12 pts) Write the equivalent C code. Assume that the registers $sland $t1 is associated with integers "a" and "I", respectively. c. (3pts) Assume that the register $t1 is initialized to the value 2. What is...

  • Convert the following instructions from MIPS assembly language to machine language add $50, $t0, $s3 (op...

    Convert the following instructions from MIPS assembly language to machine language add $50, $t0, $s3 (op code: 0, function code: 32) sub $t9, $50, $zero (op code: 0, function code: 34) addi $s2, $t0, 16 (op code: 8, function code: Does not exist for I-type instructions)

  • add SW addi bne The classic five-stage pipeline MIPS architecture is used to execute the code...

    add SW addi bne The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 100....

  • MIPS Insertion program.........I could really use some help ASAP

    I have this MIPS program and I'm having trouble with it. This program is user inputs numbers until zero and sorts and print the numbers in order. Please soove this issue. You can use any sorting algorithm except bubble sort.  Need it as soon as possible. Here is the code:.datanum: .word 0space: .byte ' ' .text main:  # la $t0, val # loads val into a register  # li $t1, 0      #keeps track of how many numbers entered  la $a0,...

  • Consider the following MIPS code (don't worry about what it does): loop: beq $s0, $s1, done...

    Consider the following MIPS code (don't worry about what it does): loop: beq $s0, $s1, done addi $t0, $t0, 7 addi St1, St2, 4 addi $s0, $s0, 1 j loop done: beq St1, $15, skip addi St0, Sto, 1 addi St1, St2, St0 skip addi $t5, $0, 10 beq St1, St5, done j end Compute the branch offset for each beq in number of words away from the branch (e.g., "branch offset is 2") Assume label loop is at location...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT