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

Info icon This 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 Spring 2007 #1. a) Write the SPARC assembly instructions to define the following global variables in the data segment: char CSI[] = "Miami"; short hair = 911; #2. What is the value ( in hex ) of %o1 after each set of instructions: a) set 0x8630131B, %o1 sra %o1, 24, %o1 Value in %o1 at this point is 0x ______________________________________________ b) set 0x8630131B, %o1 set 0x5A5A5A5A, %o2 xor %o1, %o2, %o1 Value in %o1 at this point is 0x ______________________________________________ c) set 0x8630131B, %o1 set 0x5A5A5A5A, %o2 and %o1, %o2, %o1 Value in %o1 at this point is 0x ______________________________________________ #3. Assume you run gdb on pa1. State how to set a breakpoint at the entry point in displayX():
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Assume you correctly set this breakpoint and performed a run with correct command line arguments. State how to print the value of the 1 st argument passed to displayX(): (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 /* x is mapped to %l2 */ /* a is mapped to %l4 */ for ( x = 14; x >= 129; ++x ) { a = x - 8008; } #5. Write the equivalent unoptimized SPARC assembly language instructions to perform the following C code fragment. C SPARC assembly x = x / 9009; /* x is mapped to %l0 */ Now optimize your answer to eliminate any delay slots : Optimized version of above SPARC assembly...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern