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 mips assembly language program to execute these instructions and verify the content of registers $s2 to $s4.

COMMENT COMPLETE CODE PLEASE

Homework Answers

Answer #1

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.

li $s1,0x87654321
sll $s2,$s1, 16 # $s2 = it will be left shift of s1, Hence it will be 0x43210000
srl $s3,$s1, 8 # $s3 = it will be right shift of s1, Hence it will be 0x00876543
sra $s4,$s1, 12 # $s4 = it will be arthmatic right shift of s1, Hence it will be 0xfff87654

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 a mips assembly language program to execute these instructions and verify the content of registers $s2 to $s4.
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; }
Suppose a MIPS processor uses the simple 5-stage pipeline described in the text, where the stages...
Suppose a MIPS processor uses the simple 5-stage pipeline described in the text, where the stages are instruction fetch, instruction decode and operand fetch, execute and calculate address, memory access, and register write. Suppose further that • There is a single memory for both instruction and data, which can only support one read or write each cycle. • There is no “forwarding” in the pipeline. Thus, if an instruction B relies on a value written into a register by an...
(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)...
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...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged             Mov al, bl       And 00111111, bl       Write a sequence of two instructions that copies the integer in bits 4-7 from AL register into bits 0-3 of the BL register. Upper 4 bits of AL and BL will be cleared             Shr al, 4       Mov bl,...
Clinical Scenario: You are admitting this patient from the ED and have completed the following H&P....
Clinical Scenario: You are admitting this patient from the ED and have completed the following H&P. CC: Abdominal Pain HPI: Ms. ABC is a 40-year-old Caucasian female who presented to the ED with a complaint of abdominal pain x 1week. She reports LUQ and epigastric abdominal pain, which radiates to the back, is constant, and gets better with sitting up or leaning forward. She has had some associated nausea, vomiting, fever, constipation, and fatigue. She has had multiple admissions for...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT