Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with MIPS Assembly Language and the MARS program development environ

ID: 3785243 • Letter: I

Question

I need help with MIPS Assembly Language and the MARS program development environment.

The program should begin by loading the contents of four signed integer operands (A, B, C, and D) from memory into registers. Next, your program should use the shift and rotate instructions to multiply the value of A by 5, divide the value of B by 4 (truncating the result), shift the value of C to the right 3 bit places (writing 0s into the most significant bits of the register), and rotate the value of D 2 bit places to the left. Finally, the program should write the new values of A, B, C, and D back to memory. Be sure to test the program carefully, using both positive and negative integers for inputs. Validate correct program operation by examining the updated contents of the memory operands. Do NOT use multiply or divide instructions! (HINT: 5A = 4A + A.) Be careful to select the best shift instruction for each task.

Explanation / Answer

addi $s0, $s0, 5 # A=(5*4)+5=25     #add one more 5 to $s0

sra $s1, $t1, 2 # B= -44/4=-11      #Shift the value right of $t1 by given amount and place it to $s1

sra $s2, $t2, 3 # C= -128/8=-16    #shift the vaule of $t2 by right 3 rd place

rol $s3, $t3, 2 # D= -8 becomes -29 #rotate the value left by 2bit place.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote