====================================== Assignment #02 - Logic and Binary Math ====================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: 4pm Wednesday September 23, 2009 Due date in the Blackboard Digital Dropbox: due at start of Wednesday lecture - 4pm Wednesday September 30, 2009 Upload drop box file name template: abcd0001_02_binary.txt Use your own userid, not abcd0001. The rest of the name must be exactly as given. Typing mistakes in the name mean no credit. Be precise. Upload only plain text, not HTML, not MSWord. No fonts. Plain text only. Plain text only. Did I mention that the format is plain text? ------------------ 1. Develop a binary encoding scheme which could be used to encode a field to represent one of the months of the year. Use the minimum number of bits. ANSWER: 2. What is the minimum number of binary bits needed to represent 51,629 items? ANSWER: In a 10-bit storage cell: 3. What is the bit number of the highest (most significant) bit? ANSWER: 4. If you write down the 10 bits on paper, is the highest bit written on the left or the right of the 10 bits? ANSWER: 5. In unsigned binary encoding, what is the weight of this high bit, expressed both as a power of two and in decimal? ANSWERS: 6. Assuming an 8-bit word, show, in binary, how such a word would be encoded to represent the decimal number 96 using unsigned binary encoding. ANSWER: 7. What is the minimum number of binary bits needed to represent 96 items? ANSWER: 8. Assuming unsigned binary encoding, what decimal value is represented by the binary pattern: 1 0 1 0 0 0 1 1 ? ANSWER: 9. Define the term "word" as it is used in computer architecture. ANSWER: 10. For each of the following circuit descriptions, draw the circuit (or use ASCII art - see the Appendix Example below) and then create the complete truth table showing input and output values for all possible input combinations. You don't have to hand in your circuit drawing, unless you want to use ASCII art to create it: Circuit 1 A. Input B. Input C. NOT from B D. AND from A and C E. OUTPUT from D ANSWER: Circuit 2 A. Input B. Input C. Input D. OR from A and B E. NOT from B F. XOR from C and E G. Output from D H. Output from F ANSWER: 11. Perform the following additions and subtractions in binary, assuming a 6 bit word. Show the result value plus the values of the Zero, Sign, Carry, and Overflow flag values for each (five answers for each). 011010 011010 + 001111 - 001111 ANSWERS: 010111 010110 + 101001 - 010110 ANSWERS: 12. Convert the following decimal values into 2's complement form, assuming a 12-bit word. Show your results in both binary and hexadecimal. a. -1 ANSWERS: b. +693 ANSWERS: c. -693 ANSWERS: d. 2048 ANSWERS: e. -2048 ANSWERS: f. 4097 ANSWERS: 13. Perform the indicated arithmetic in hexadecimal, assuming a 12-bit word; show the hexadecimal result plus the states of the Zero, Sign, Carry and Overflow flags (five answers for each). D8A 948 C8B ACE +276 -35A +839 -BDF ANSWERS: =============================================================================== --------------------------------- Appendix Example for Question 10: --------------------------------- You can optionally use ASCII art to show your gate diagrams. Here is a sample: View with a monospace (fixed-width) font, e.g. "Courier": X. Input Y. Input A. NOT from Y B. XOR from X and A C. NOT from B D. NOT from Y O1. Output from C O2. Output from D +---+ X -----------------|> | +---+ | X | b | N | c +---+ | O |>--|>O |>---- O1 | N | a | R | | T | Y ---+----|>O |>---|> | +---+ | | T | +---+ | +---+ +---+ | | N | d +---------------------|>O |>---- O2 | T | +---+ See the great collections of ASCII art on the Internet (Google search) and watch the Star Wars Episode IV movie delivered in pure ASCII art here: http://www.asciimation.co.nz/ or you can see it directly via "telnet towel.blinkenlights.nl" http://www.youtube.com/watch?v=fl473xQdRks