Final.sp10

Final.sp10 - Login cs30x Name Student ID Signature CSE 30...

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

1 Login: cs30x_______ Name _________________________ Student ID ____________________ Signature_______________________ CSE 30 Spring 2010 Final Exam 1. Number Systems / C Compiling Sequence ___________________ (15 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (12 points) 3. Branching ___________________ (24 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 ___________________ (12 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 ___________________ (21 points) SubTotal (100%) ___________________ (202 points) Extra Credit ___________________ (18 points) Total ___________________

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

View Full Document
2 1. Number Systems Convert 0xFB07 (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 299 10 to the following (assume 16-bit word). Express answers in hexadecimal. (3 points) sign-magnitude _______________________________________________ 1’s complement _______________________________________________ 2’s complement _______________________________________________ Convert -398 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) 11010110 10110100 01011101 +00111011 +11001100 +00101001 --------- --------- --------- N Z V C N Z V C N Z V C ----------------- ----------------- ----------------- | | | | | | | | | | | | | | | ----------------- ----------------- -----------------
3 3. Branching (24 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 for ( a = 0; a < b; ++a ) { if ( b < 9000 ) { b = b * a; } else { a = a + b; } }

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.

{[ snackBarMessage ]}

Page1 / 15

Final.sp10 - Login cs30x Name Student ID Signature CSE 30...

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

View Full Document
Ask a homework question - tutors are online