Docsity

Practice Quiz 2 on Computer Organization Systems Program | CSE 30, Quizzes of Computer Science

Toggle sidebar
bg1
Signature __________________ Name_________________
cs30x____
Student ID _________________ Score:
Quiz 2
CSE 30
Fall 2004
#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, %o1
set 0x D4A9D4A9, %o2
btog %o2, %o1
Value in %o1 at this point is 0x______________________________________________
b) set 0x CA2475FE, %o1
sra %o1, 8, %o1
Value in %o1 at this point is 0x______________________________________________
c) set 0x CA2475FE, %o1
set 0x D4A9D4A9, %o2
or %o1, %o2, %o1
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)
pf2

Partial preview of the text

Download Practice Quiz 2 on Computer Organization Systems Program | CSE 30 and more Quizzes Computer Science in PDF only on Docsity!

Signature __________________ Name_________________

cs30x____

Student ID _________________ Score:

Quiz 2

CSE 30

Fall 2004

#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