Question

Write a sequence of MIPS instructions to find the absolute value of the value in register...

Write a sequence of MIPS instructions to find the absolute value of the value in register $s0 and store it into register $t0. Assume you do not have access to multiplication instructions. Use as few instructions as possible. You do not have to assemble your code for this question, but you may do so to validate that it works.

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

screenshot:

Add a comment
Know the answer?
Add Answer to:
Write a sequence of MIPS instructions to find the absolute value of the value in register...
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
  • 1. (i) [8] Suppose $s2 contains the value 6. What’s the value of $s1 after the...

    1. (i) [8] Suppose $s2 contains the value 6. What’s the value of $s1 after the instruction sll $s1, $s2, 5? (ii) [6] Convert jalr $s2, $t7 to machine code (binary). (iii) [6] Find the corresponding MIPS instruction to the following machine code. You are given that any immediate value is represented using 2’s complement. 0011010101010111 1111111111111111 2. [20] There is a value stored in $s0. Write a sequence of MIPS instructions that will place the absolute value of $s0...

  • Translate each of the following pseudo-instructions into MIPS instructions. You should Produce a minimal sequence of...

    Translate each of the following pseudo-instructions into MIPS instructions. You should Produce a minimal sequence of MIPS instructions to accomplish the required computation. (8 Points) 1) bgt $t1, 100, Label # bgt means branch if greater than 2) ble $s2, 10, Next # ble means branch if less than or equal 3) ror $s0, $s4, 7 # ror means rotate right $s4 by 7 bits and store the result in $s0 4) neg $s5, $s4 # $s5 will have the...

  • 5. Write the MIPS minimal sequence of instructions for the following C procedure code: int array_sum...

    5. Write the MIPS minimal sequence of instructions for the following C procedure code: int array_sum (a[], b[])                                  { int i;                                       i =1; for (i=1; i<100; i=i+1) { b[i] = D + a[i-1] + a[i] + a[i+1] ;}                                                             } Assume that: a and b are arrays of words and the base address of “a” is in $a0 and the base address of “b” is in $a1, Register $S1 is associated with...

  • Write a sequence of MIPS instructions to do the following: set $t1 to 1 if the...

    Write a sequence of MIPS instructions to do the following: set $t1 to 1 if the contents of $s0 is an even number and set $t1 to 0 otherwise. Please do not use the division instruction in you code. Instead, you could use some logical instruction to test if a number is even or odd.       

  • B2. Convert the C code to MIPS assembly with only 2 efficient instructions: Register assignment: ...

    B2. Convert the C code to MIPS assembly with only 2 efficient instructions: Register assignment: timer-v0 int timer = 0x0AC8 0001; B3. Write MIPS assembly code segment for the following C code snippet for (i - 0, i < 100; i++) -array Register assignment: i-) $ao Base of array -> $s0 array [ i+1] [i] / 2; B2. Convert the C code to MIPS assembly with only 2 efficient instructions: Register assignment: timer-v0 int timer = 0x0AC8 0001; B3. Write...

  • (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final...

    (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final value of the $t0 register. Set register $t1 = 4 Set register $t2 = 16 Put the result of the following arithmetic sequence into register $t0 $t1 + $t2 + 5 = $t0

  • (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final...

    (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final value of the $t0 register. Set register $t1 = - 8 (negative 8) Set register $t2 = 0x30 Put the result of the following arithmetic sequence into register $t0 $t2 - $t1 - 4 = $t0

  • Write the program in MIPS Initialize register $t0 (will hold the sum) to zero. Then add...

    Write the program in MIPS Initialize register $t0 (will hold the sum) to zero. Then add 409610 to $t0 sixteen times. You don't know how to loop yet, so do this by making 16 copies of the same instruction. The hexadecimal value of 409610 is 0x1000 Next, initialize register Stl to 409610. Shift St1 left by the correct number of positions so that registers $t0 and $tl contain the same bit pattern. Finally, initialize register $t2 to 409610. Add $t2...

  • Using MIPS: Consider the following fragment of C code: for i=0: i < = 100: i...

    Using MIPS: Consider the following fragment of C code: for i=0: i < = 100: i = i + 1) {a[i] = b[i] + c;} Assume that a and bare arrays of words and the base address of a is in $a0 and the base address of b is in $a1. Register $t0 is associated with variable i and register $s0 with c. Write the code for MIPS. How many instructions are executed during the running of this code? How...

  • Could someone explain the shortest sequence of MIPS instructions that extracts four bits, bits 18-15, from...

    Could someone explain the shortest sequence of MIPS instructions that extracts four bits, bits 18-15, from register $s0 and uses the value of this field to replace bits 12-9 in register $s1 without changing other bits of register $s1?

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