Final.sp09

# Final.sp09 - Login: cs30x_ Name _ Student ID _ Signature_...

This preview shows pages 1–5. Sign up to view the full content.

1 Login: cs30x_______ Name _________________________ Student ID ____________________ Signature_______________________ CSE 30 Spring 2009 Final Exam 1. Number Systems / C Compiling Sequence ___________________ (15 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (12 points) 3. Branching ___________________ (21 points) 4. Bit Operations ___________________ (13 points) 5. Recursion/SPARC Assembly ___________________ (10 points) 6. Local Variables, The Stack, Return Values ___________________ (20 points) 7. More Recursive Subroutines ___________________ (9 points) 8. Floating Point ___________________ (12 points) 9. Machine Instructions ___________________ (20 points) 10. Linkage, Scope, Lifetime, Data ___________________ (32 points) 11. Load/Store/Memory ___________________ (11 points) 12. Miscellaneous ___________________ (25 points) SubTotal ___________________ (200 points) Extra Credit ___________________ (13 points) Total ___________________

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

View Full Document
2 1. Number Systems Convert 0xFC67 (2’s complement, 16-bit word) to the following. (6 points) binary _____________________________________ (straight base conversion) octal _______________________________________ (straight base conversion) decimal ____________________________________ (convert to signed decimal) Convert 372 10 to the following (assume 16-bit word). Express answers in hexadecimal. (3 points) sign-magnitude _______________________________________________ 1’s complement _______________________________________________ 2’s complement _______________________________________________ Convert -423 10 to the following (assume 16-bit word). Express answers in hexadecimal. (6 points) sign-magnitude _______________________________________________ 1’s complement _______________________________________________ 2’s complement _______________________________________________ 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. (12 points) 01010110 10110100 10011101 +00111011 +01001100 +10101001 --------- --------- --------- N Z V C N Z V C N Z V C ----------------- ----------------- ----------------- | | | | | | | | | | | | | | | ----------------- ----------------- -----------------
3 3. Branching (21 points) Translate the C code below into the equivalent unoptimized SPARC Assembly code. Just perform a direct translation – no optimizations. Use the local register mappings for the variables in assembly as specified. Remember to implement short-circuiting logic for the logical OR. _ C_ _SPARC ASSEMBLY_ /* Assume variables a and b have been ! a is mapped to %l3 properly declared as ints. */ ! b is mapped to %l6 if ( (a <= b) || (b > 99) ) { do { a = a * b; } while ( a < 55 ); ++b; } else { b = b - 22; }

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

View Full Document
4 4. Bit Operations What is the value of %l0 after each statement is executed? Express your answers in hexadecimal. set
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/31/2011 for the course CSE 30 taught by Professor Ord during the Fall '08 term at UCSD.

### Page1 / 15

Final.sp09 - Login: cs30x_ Name _ Student ID _ Signature_...

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

View Full Document
Ask a homework question - tutors are online