Final.sp07

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

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

View Full Document Right Arrow Icon
1 Login: cs30x_______ Name _________________________ Student ID ____________________ Signature_______________________ CSE 30 Spring 2007 Final Exam 1. Number Systems ___________________ (25 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (12 points) 3. Branching ___________________ (19 points) 4. Bit Operations ___________________ (13 points) 5. Recursion/SPARC Assembly ___________________ (10 points) 6. Local Variables, The Stack, Return Values ___________________ (22 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 ___________________ (9 points) 12. Miscellaneous ___________________ (29 points) SubTotal ___________________ (215 points) Extra Credit ___________________ (10 points) Total ___________________
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 1. Number Systems Convert FB3C 16 (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 415 10 to the following (assume 16-bit word). Express answers in hexadecimal. (3 points) sign-magnitude _______________________________________________ 1’s complement _______________________________________________ 2’s complement _______________________________________________ Convert -396 10 to the following (assume 16-bit word). Express answers in hexadecimal. (6 points) sign-magnitude _______________________________________________ 1’s complement _______________________________________________ 2’s complement _______________________________________________ C Compiling Sequence Put the following in the correct order/sequence using the numbers to the left of each word: (10 points) 1. loader 5. program execution 9. resulting .s file 2. executable (.exe/a.out) 6. assembler 10. resulting .o file 3. compiler 7. preprocessor 4. source code (.c file) 8. linkage editor _____ —> _____ —> _____ —> _____ —> _____ —> _____ —> _____ —> _____ —> _____ —> _____
Background image of page 2
3 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) 00101100 01110110 10101010 +11010100 +01001101 +11010110 --------- --------- --------- N Z V C N Z V C N Z V C ----------------- ----------------- ----------------- | | | | | | | | | | | | | | | ----------------- ----------------- ----------------- 3. Branching Given the following SPARC assembly code write the equivalent function in C. Use only standard loops and if/else statements; no gotos ! (19 points) SPARC ASSEMBLY C .global subtract .section ".text" subtract: save %sp, -96, %sp mov %g0, %l0 ! local var count ! mapped to %l0 cmp %i0, %i1
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 02/11/2008 for the course CSE 30 taught by Professor Ord during the Winter '08 term at UCSD.

Page1 / 15

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

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

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