Question

Assume that $s1 = 0x87654321. Determine the content of registers $s2 to $s4 after executing the...

Assume that $s1 = 0x87654321. Determine the content of registers $s2 to $s4 after executing

the following instructions:


sll $s2,$s1, 16 # $s2 =


srl $s3,$s1, 8 # $s3 =


sra $s4,$s1, 12 # $s4 =


Write a mips assembly language program to execute these instructions and verify the content of registers $s2 to $s4.

Homework Answers

Answer #1

1)

sll $s2, $s1, 16 => $s2 = $s1 << 16 => $s2 = 0x87654321 << 16 => $s2 = 0x4321

srl $s3, $s1, 8 => $s2 = $s1 >> 8 => $s2 = 0x87654321 >> 8 => $s2 = 0x00876543

sra $s4, $s1, 12 => $s2 = $s1 >> 12 => $s2 = 0x87654321 >> 12 => $s2 = 0xFFF87654

2)

MIPS PROGRAM :-

.data

.text

.globl main

main:

sll $s2, $s1, 16

addi $v0, $0, 1

add $a0, $0, $s2 #printing $s2

syscall

srl $s3, $s1, 8

addi $v0, $0, 1

add $a0, $0, $s3 #printing $s3

syscall

sra $s4, $s1, 12

addi $v0, $0, 1

add $a0, $0, $s4 #printing $s4

syscall

#system exit

addi $v0, $0, 10

syscall

Know the answer?
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
Similar Questions
Assume that $s1 = 0x87654321. Determine the content of registers $s2 to $s4 after executing the...
Assume that $s1 = 0x87654321. Determine the content of registers $s2 to $s4 after executing the following instructions: sll $s2,$s1, 16 # $s2 = srl $s3,$s1, 8 # $s3 = sra $s4,$s1, 12 # $s4 = Write mips assembly language program to execute these instructions and verify the content of registers $s2 to $s4. COMMENT COMPLETE CODE PLEASE
We assume the following $s0 = a $s1 = b $s2 = c $s3 = i...
We assume the following $s0 = a $s1 = b $s2 = c $s3 = i $s4 = address of ar[0] Write MIPS assembly code for the following C code. for (i = 10; i < 30; i ++) { if ((ar[i] > b) || (ar[i] <= c)) ar[i] = 0; else ar[i] = a; }
Let S = {s1, s2, s3, s4, s5, s6} be the sample space associated with the...
Let S = {s1, s2, s3, s4, s5, s6} be the sample space associated with the experiment having the following probability distribution. (Enter your answers as fractions.) Outcome s1 s2 s3 s4 s5 s6 Probability 3 12 1 12 4 12 1 12 2 12 1 12 (a) Find the probability of A = {s1, s3}. (b) Find the probability of B = {s2, s4, s5, s6}. (c) Find the probability of C = S.
After each step, give the value of the updated semaphore and the content of the updated...
After each step, give the value of the updated semaphore and the content of the updated semaphore queue. Counting Semaphores: S1, S2, S3 Binary Semaphores: S4, S5, S6 Semaphores initial values: S1 = 1,   S2 = 0,   S3 = 2,   S4 = 0,   S5 = 1,   S6 = 1 1) P1: P(S3) 2) P2: P(S5) 3) P3: P(S5) 4) P5: P(S2) 5) P2: V(S2) 6) P10: V(S6) 7) P2: P(S4) 8) P6: P(S5) 9) P4: V(S4) 10)P4: P(S2)
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1]; In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x,  and $s2 for the base address of y. Make sure your code includes all necessary declarations such that it could run in SPIM.
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022...
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022 ori $t0, $t0, 2048 srl $t1, $t0, 18 sw $t0, 101($t1) slti $t2, $t1, 5 beq $t2, $0, label3 label2:... ... label3:... a) The code modifies a word in memory at the following address (circle one): (i) 1022 (ii) 101 (iii) 5 (iv) 10220000 (v) Other (provide your own answer): _________________ b) The following value is stored in memory (circle one): (i) 0x17 (ii)...
Q1. A UL student wants to invest $100,000 for 1 year. After analyzing and eliminating numerous...
Q1. A UL student wants to invest $100,000 for 1 year. After analyzing and eliminating numerous possibilities, she has narrowed her choice to one of three alternatives: D1: Invest in a well-diversified portfolio of bonds; D2: Invest in a well-diversified portfolio of bonds and stocks; D3: Invest in a well-diversified portfolio of stocks. She believes that the payoffs associated with the alternatives depend on a number of factors, foremost among which are the new global trade frameworks. She concludes that...
Implement the following expression in assembly language:                                  &nb
Implement the following expression in assembly language:                                                 BX = –val2 + 7 - (- val3 + val1) * 2 Assume that val1, val2, and val3 are 8-bit integer variables Initialize val1 with 12, val2 with 9, and val3 with 2 You are only allowed to use 16-bit registers to hold intermediate results, whenever needed. Use ONLY mov, add, sub, movzx, movzx, or neg instructions whenever needed. Use the debugger to verify your answer. Please answer using this format for...
ONE WAY ANOVA Assume that you are a nutritionist who has been asked to determine whether...
ONE WAY ANOVA Assume that you are a nutritionist who has been asked to determine whether there is a difference in sugar content among the three leading brands of breakfast cereal – Kelloggs, Post, and General Mills. To assess the amount of sugar in the cereals, you randomly sample six types of cereal for each brand and chemically determine the sugar content. The following grams of sugar were found: Group 1           Group 2           Group 3 Kellogg’s  ...
Q1: A random sample of 390 married couples found that 290 had two or more personality...
Q1: A random sample of 390 married couples found that 290 had two or more personality preferences in common. In another random sample of 570 married couples, it was found that only 36 had no preferences in common. Let p1 be the population proportion of all married couples who have two or more personality preferences in common. Let p2 be the population proportion of all married couples who have no personality preferences in common. (a) Find a 95% confidence interval...