Quiz2.fa06

SPARC Architecture, Assembly Language Programming, and C (2nd Edition)

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Signature _______________________ Name_________________ cs30x____ Student ID ______________________ Score: Quiz 2 CSE 30 Fall 2006 #1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char Wolfmother[] = "Mind's Eye"; float root_beer = 8.05; #2. What is the value ( in hex ) of %o1 after each set of instructions: a) set 0xCAFEBABE, %o1 sra %o1, 12, %o1 Value in %o1 at this point is 0x ______________________________________________ b) set 0xCAFEBABE, %o1 set 0x5A5A5A5A, %o2 xor %o1, %o2, %o1 Value in %o1 at this point is 0x ______________________________________________ c) set 0xCAFEBABE, %o1 set 0x5A5A5A5A, %o2 and %o1, %o2, %o1 Value in %o1 at this point is 0x ______________________________________________
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #3. Write the save SPARC instruction to allocate 4 doubles as local variables on the stack. save %sp, ______________________________________ , %sp (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 a = -9129; /* x is mapped to %l0 */ /* a is mapped to %l1 */ while ( a < 129 ) { x = 391 + a; a++; } #5. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment. C SPARC assembly x = x / 9876; /* x is mapped to %l2 */ Now optimize your answer to eliminate any delay slots : Optimized version of above SPARC assembly...
View Full Document

Page1 / 2

Quiz2.fa06 - #3. Write the save SPARC instruction to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online