Final.winter07

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

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

1 cs30x_______ Name _________________________ Student ID ____________________ Signature_______________________ CSE 30 Winter 2007 Final Exam 1. Number Systems ___________________ (15 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (12 points) 3. Branching ___________________ (17 points) 4. Bit Operations ___________________ (13 points) 5. Recursion/SPARC Assembly ___________________ (10 points) 6. Local Variables, The Stack, ld/st, and Return Values ___________________ (28 points) 7. Bit Slinging ___________________ (12 points) 8. Floating Point ___________________ (12 points) 9. Machine Instructions ___________________ (20 points) 10. Linkage, Scope, Lifetime, Data ___________________ (34 points) 11. Load/Store/Memory ___________________ (9 points) 12. Miscellaneous ___________________ (35 points) SubTotal ___________________ (217 points) Extra Credit ___________________ (10 points) Total ___________________

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

View Full Document
2 1. Number Systems Convert 0xFBA9 (2’s complement, 16-bit word) to the following. (6 points) binary ______________________________________ (straight bit pattern translation) octal ________________________________________(straight bit pattern translation) decimal ____________________________________ (pos/neg decimal value from 2's complement encoding) Convert 309 10 to the following (assume 16-bit word). Express answers in hexadecimal. (3 points) sign-magnitude __________________________________ 1’s complement __________________________________ 2’s complement __________________________________ Convert -428 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) 00011011 01010101 10110110 +01101011 +11011001 +01001010 --------- --------- --------- N Z V C N Z V C N Z V C ----------------- ----------------- ----------------- | | | | | | | | | | | | | | | ----------------- ----------------- -----------------
3 3. Branching Write the SPARC assembly statements to perform the following C statements. Do not optimize nops. Be sure to properly ld/st local vars. Remember logical OR short circuiting. (17 points) C _SPARC assembly_ int a; ! local var a mapped to %fp - 4 int b; ! local var b mapped to %fp - 8 /* other stmts here giving a and b values */ save %sp, -(92 + 8) & -8, %sp if ( a != 15 || b < 35 ) { a = foo( b % 17 ); } else { b = a - b; } /* other stmts here */

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 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.winter07 - cs30x_ Student ID _ Name _ Signature_ CSE...

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

View Full Document
Ask a homework question - tutors are online