Question
Using MIPS Assembly Language, implement the following: Shift Left Circular (SLC): Implement a method (subprogram) called shiftLeftCircular that shifts the contents of a register and
Using MIPS Assembly Language, implement the following:
Shift Left Circular (SLC): Implement a method (subprogram) called shiftLeftCircular that shifts the contents of a register and works as demonstrated below:
# input 8 hex digits (shift left amount) ==> output 8 hex digits
0XAA 00 00 BB (SLC 4) ==> 0XA0 00 0B BA
0XAA 00 00 BB (SLC 8) ==> 0X00 00 BB AA
As shown above the bits falling down from left comes to right in the order they drop.
Shift Right Circular (SRC): Implement a method (subprogram) called shiftRightCircular. It works like SLC but this time the bits falling down from right comes to left in the order they drop.
Write two separate subprograms for these circular shift operations. Provide the necessary interface for testing your code in the main (top level) program. Ask the user to enter the decimal integer number to be shifted and a number that indicates the amount of shift. Display the number to be shifted, the shift amount and direction, and the shifted number in hexadecimal on the console.
You must pass the number to be shifted and the shift amount in $a0, and $a1 respectively and return the result in $v0 (as required by the rules of MIPS software development).
How to display an integer in hexadecimal: See Mars help menu on syscalls.
Make sure that you have an efficient implementation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started