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

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Name _________________________ Student ID __________________ Signature_______________________ cs30x_______ CSE 30 Spring 2007 Midterm Exam 1. Number Systems ___________________ (12 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (8 points) 3. Branching ___________________ (10 points) 4. Bit Operations / C Runtime Environment ___________________ (7 points) 5. Parameter Passing and Return Values (Structures) ___________________ (12 points) 6. Local Variables, The Stack and Return Values ___________________ (12 points) 7. Load/Store/Memory ___________________ (3 points) SubTotal ___________________ (64 points) Extra Credit ___________________ (3 points) Total ___________________
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
2 1. Number Systems Convert 0xFB1D (2’s complement, 16-bit word) to the following. (6 points) binary ____________________________________ (just a direct base translation) octal 0 ___________________________________ (just a direct base translation) decimal ____________________________________ (convert to signed decimal value) Convert -428 to the following (assume 16-bit word). Express answers in hexadecimal. (6 points) sign-magnitude 0x _______________________________________________ 1’s complement 0x _______________________________________________ 2’s complement 0x _______________________________________________ 2. Binary Addition/Condition Code Bits/Overflow Detection Indicate what the condition code bits are when adding the following 8-bit 2’s complement numbers. (8 points) 01111111 01001101 +10000001 +00111010 --------- --------- N Z V C N Z V C ----------------- ----------------- | | | | | | | | | | ----------------- -----------------
Image of page 2
3 3. Branching (10 points) Translate the SPARC Assembly function below into the equivalent C code. Just perform a direct translation.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the 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