Docsity

SPARC Assembly Instructions for CS30x Winter 2005 Quiz 2 - Prof. Richard Ord, Quizzes of Computer Science

Toggle sidebar
bg1
Signature __________________ Name_________________
cs30x____
Student ID _________________ Score:
Quiz 2
CSE 30
Winter 2005
#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment:
char BadReligion[] = "LA Is Burning";
double radio = 94.9;
#2. What is the value (in hex) of %o1 after each set of instructions:
a) set 0xFEEDBABE, %o1
sra %o1, 8, %o1
Value in %o1 at this point is 0x______________________________________________
c) set 0xFEEDBABE, %o1
set 0xC3C3C3C3, %o2
and %o1, %o2, %o1
Value in %o1 at this point is 0x______________________________________________
c) set 0xFEEDBABE, %o1
set 0xC3C3C3C3, %o2
xor %o1, %o2, %o1
Value in %o1 at this point is 0x______________________________________________
#3. List two instructions that are not eligible to be used to fill a delay slot in the SPARC architecture.
__________________ __________________
(over)
pf2

Partial preview of the text

Download SPARC Assembly Instructions for CS30x Winter 2005 Quiz 2 - Prof. Richard Ord and more Quizzes Computer Science in PDF only on Docsity!

Signature __________________ Name_________________

cs30x____

Student ID _________________ Score:

Quiz 2

CSE 30

Winter 2005

#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char BadReligion[] = "LA Is Burning"; double radio = 94.9;

#2. What is the value ( in hex ) of %o1 after each set of instructions:

a) set 0xFEEDBABE, %o sra %o1, 8, %o

Value in %o1 at this point is 0x ______________________________________________

c) set 0xFEEDBABE, %o set 0xC3C3C3C3, %o and %o1, %o2, %o

Value in %o1 at this point is 0x ______________________________________________

c) set 0xFEEDBABE, %o set 0xC3C3C3C3, %o xor %o1, %o2, %o

Value in %o1 at this point is 0x ______________________________________________

#3. List two instructions that are not eligible to be used to fill a delay slot 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 = 9021; i >= 17; --i ) { /* i is mapped to %l2 / x = i + 420; / x is mapped to %l4 */ }

#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 %l4 */

Now optimize your answer to eliminate any delay slots: Optimized version of above SPARC assembly