

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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 ModestMouse[] = "Ocean Breathes Salty"; float boat = -4.20;
#2. What is the value ( in hex ) of %o1 after each set of instructions:
a) set 0x CA2475FE, %o set 0x D4A9D4A9, %o btog %o2, %o
Value in %o1 at this point is 0x ______________________________________________
b) set 0x CA2475FE, %o sra %o1, 8, %o
Value in %o1 at this point is 0x ______________________________________________
c) set 0x CA2475FE, %o set 0x D4A9D4A9, %o or %o1, %o2, %o
Value in %o1 at this point is 0x ______________________________________________
#3. List two reasons why you would need to allocate local variable space on the stack as opposed to mapping a local variable to local registers in the SPARC architecture.
(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 for ( i = 4920; i > 420; --i ) { /* i is mapped to %l1 / x = i - x; / x is mapped to %l3 */ }
#5. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment.
C SPARC assembly x = x % 5555; /* x is mapped to %l3 */
Now optimize your answer to eliminate any delay slots: Optimized version of above SPARC assembly