Final.sp06

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

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

View Full Document Right Arrow Icon
1 cs30x_______ Name _________________________ Student ID ____________________ Signature_______________________ CSE 30 Spring 2006 Final Exam 1. Number Systems ___________________ (15 points) 2. Binary Addition/Condition Code Bits/Overflow Detection ___________________ (12 points) 3. Branching ___________________ (18 points) 4. Bit Operations ___________________ (13 points) 5. Recursion/SPARC Assembly ___________________ (10 points) 6. Local Variables, The Stack and Return Values ___________________ (27 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 ___________________ (33 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 0xFA5A (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 377 10 to the following (assume 16-bit word). Express answers in hexadecimal. (3 points) sign-magnitude __________________________________ 1’s complement __________________________________ 2’s complement __________________________________ Convert -652 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) 01010101 10110110 00011011 +01101011 +01001010 +01011001 --------- --------- --------- N Z V C N Z V C N Z V C ----------------- ----------------- ----------------- | | | | | | | | | | | | | | | ----------------- ----------------- -----------------
Background image of page 2
3 3. Branching Write the SPARC assembly statements to perform the following C statements. Do not optimize. (18 points) C _SPARC assembly_ int x; ! map x to %l1 int y; ! map y to %l5 if ( x < 15 && y >= 35 ) { x = x + y; } else { x = fubar( y / 7 ); }
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 4. Bit Operations What is the value of %l0 after each statement is executed? Express your answers in hexadecimal. set 0x2006ACED, %l0 set 0x98675309, %l1 or %l0, %l1, %l0 Value in %l0 is _______________________________________ (2 points) set 0x2006ACED, %l0 sll %l0, 13, %l0 Value in %l0 is _______________________________________ (2 points) set 0x2006ACED, %l0 srl %l0, 5, %l0 Value in %l0 is _______________________________________ (2 points) set 0x2006ACED, %l0 set 0x????????, %l1 xor %l0, %l1, %l0 ! Value in %l0 is now OxDEADBEEF
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Final.sp06 - cs30x_ Student ID _ Name _ Signature_ CSE 30...

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

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