Question: Assignment2 Bit Reversal using Shift and Bitwise Logical Operations Create an ARMv8 assembly language program that implements the following program: #include int main() register unsigned

 Assignment2 Bit Reversal using Shift and Bitwise Logical Operations Create an

Assignment2 Bit Reversal using Shift and Bitwise Logical Operations Create an ARMv8 assembly language program that implements the following program: #include int main() register unsigned int x, y, ti, t2, t3, t4; // Initialize variable x = 0x07FC07FC; // Reverse bits in the variable // Step i tl = (x & 0x55555555) > 1) & Ox55555555; y = ti | t2; // Step 2 tl = (y & 0x33333333) > 2) & 0x33333333; y = ti | t2; // Step 3 t1 = (y & Ox0FOFOFOF) > 4) & Ox0F0F0F0F; y = ti | t2; // Step 4 tl = y > 8) & OxFF00; t4 = y >> 24; y = tl | t2 | t3 t4; // Print out the original and reversed variables printf("original: Ox $08X reversed: Ox08X ", x, y); // Return o back to os return 0; Be sure to use 32-bit registers for variables declared using int. Use m4 macros to name the registers to make your code more readable. Name the program assign2a.asm. Optimize your code so that it uses as few instructions as possible. Also run the program in gdb, displaying the contents of key registers as the program executes; you should show that the algorithm is working as expected. Also print out the original and reversed values both in hexadecimal and in binary, just before the program exits. Capture the gdb Assignment2 Bit Reversal using Shift and Bitwise Logical Operations Create an ARMv8 assembly language program that implements the following program: #include int main() register unsigned int x, y, ti, t2, t3, t4; // Initialize variable x = 0x07FC07FC; // Reverse bits in the variable // Step i tl = (x & 0x55555555) > 1) & Ox55555555; y = ti | t2; // Step 2 tl = (y & 0x33333333) > 2) & 0x33333333; y = ti | t2; // Step 3 t1 = (y & Ox0FOFOFOF) > 4) & Ox0F0F0F0F; y = ti | t2; // Step 4 tl = y > 8) & OxFF00; t4 = y >> 24; y = tl | t2 | t3 t4; // Print out the original and reversed variables printf("original: Ox $08X reversed: Ox08X ", x, y); // Return o back to os return 0; Be sure to use 32-bit registers for variables declared using int. Use m4 macros to name the registers to make your code more readable. Name the program assign2a.asm. Optimize your code so that it uses as few instructions as possible. Also run the program in gdb, displaying the contents of key registers as the program executes; you should show that the algorithm is working as expected. Also print out the original and reversed values both in hexadecimal and in binary, just before the program exits. Capture the gdb

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!