

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The sparc assembly instructions for defining global variables, calculating values, allocating local variables, and optimizing unoptimized sparc assembly instructions for cs30x quiz 2.
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char MarsVolta[] = "The Widow"; double mirror = 420.024;
#2. What is the value ( in hex ) of %o1 after each set of instructions:
a) set 0xFACEBABE, %o sll %o1, 20, %o
Value in %o1 at this point is 0x ______________________________________________
b) set 0xFACEBABE, %o sra %o1, 8, %o
Value in %o1 at this point is 0x ______________________________________________
c) set 0xFACEBABE, %o set 0xDCDCDCDC, %o and %o1, %o2, %o
Value in %o1 at this point is 0x ______________________________________________
#3. Write the save SPARC instruction to allocate 3 shorts as local variables on the stack.
save %sp, ______________________________________ , %sp
(over)
#4. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment. Use the loop construct specified in class/Notes.
C SPARC assembly x = 6789; /* x is mapped to %l2 / / a is mapped to %l6 */ while ( x >= 195 ) { a = x - 127; --x; }
#5. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment.
C SPARC assembly x = x / 4420; /* x is mapped to %l2 */
Now optimize your answer to eliminate any delay slots: Optimized version of above SPARC assembly