

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 ch = ’a’; int i = 405; char *fmt = “Hello World\n”;
#2. What is the value ( in hex ) of %o1 after each set of instructions:
a) set 0xDEADF00D, %o sll %o1, 12, %o
Value in %o1 at this point is 0x ______________________________________________
b) set 0xDEADF00D, %o sra %o1, 20, %o
Value in %o1 at this point is 0x ______________________________________________
c) set 0xDEADF00D, %o set 0x9C9C9C9C, %o and %o1, %o2, %o
Value in %o1 at this point is 0x ______________________________________________
d) set 0xDEADF00D, %o set 0x9C9C9C9C, %o btog %o2, %o
Value in %o1 at this point is 0x ______________________________________________ (over)
#3. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment.
C SPARC assembly
x = -8118; /* x is mapped to %l4 */
do { x = x + 15; --x; } while( x <= 420 );
Now optimize your answer to eliminate any delay slots:
Optimized version of above SPARC assembly