Docsity

Computer Organization and Systems Programming - Quiz #2 | CSE 30, Quizzes of Computer Science

Toggle sidebar
bg1
Name:
cs30x____
Score:
Quiz 2
CSE 30
Fall 2002
#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment:
char *s = "Big One";
long l = 420;
double d = 7.891;
#2. What is the value (in hex) of %o1 after each set of instructions:
a) set 0xC99CD7D3, %o1
sll %o1, 16, %o1
Value in %o1 at this point is 0x______________________________________________
b) set 0xC99CD7D3, %o1
sra %o1, 8, %o1
Value in %o1 at this point is 0x______________________________________________
c) set 0xC99CD7D3, %o1
set 0x96329632, %o2
or %o1, %o2, %o1
Value in %o1 at this point is 0x______________________________________________
d) set 0xC99CD7D3, %o1
set 0x96329632, %o2
btog %o2, %o1
Value in %o1 at this point is 0x______________________________________________
(over)
pf2

Partial preview of the text

Download Computer Organization and Systems Programming - Quiz #2 | CSE 30 and more Quizzes Computer Science in PDF only on Docsity!

Name:

cs30x____

Score:

Quiz 2

CSE 30

Fall 2002

#1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char *s = "Big One"; long l = 420; double d = 7.891;

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

a) set 0xC99CD7D3, %o sll %o1, 16, %o

Value in %o1 at this point is 0x ______________________________________________

b) set 0xC99CD7D3, %o sra %o1, 8, %o

Value in %o1 at this point is 0x ______________________________________________

c) set 0xC99CD7D3, %o set 0x96329632, %o or %o1, %o2, %o

Value in %o1 at this point is 0x ______________________________________________

d) set 0xC99CD7D3, %o set 0x96329632, %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 = 5882; /* x is mapped to %l3 / do { --x; a = x % 55; / a is mapped to %l5 */ } while ( a >= 42 );

Now optimize your answer to eliminate any delay slots:

Optimized version of above SPARC assembly