ECEN 248: INTRODUCTION TO DIGITAL DESIGN Lecture Set A Dr. S.G.Choi Dept. of Electrical and Computer Engineering
Instructor: Office 333G WERC Office Hours MWF 10-11 AM Email: gchoi@ece.tamu.edu Lab Page: http://people.tamu.edu/~rajballavdash/ecen_labpage.html
Required textbook: Required Textbook: "Fundamentals of Digital Logic Design" by Brown and Vranesic. VERILOG VERSION Supplemental texts: "Digital Design: Principles and Practices" by John Wakerly. "Contemporary Logic Design" by Randy Katz.
Course info Mailing list: Course website Emails will be sent periodically to neo accounts Announcements: Lecture cancellations Deadline extension Updates, etc. Course website http://ece.tamu.edu/~gchoi/248.htm All slides, labs, assignments, etc.
Grading Policy: Assignments and Labs 25% 3 Hour Exams No Final Exam 20% for 1st exam 25% for 2nd 30% for 3rd No Final Exam Quizzes: Each quiz 1% of the final Taken into account only if it improves the final grade Can improve the grade, but no extra points Final grading may or may not be curved up
Quizzes: 3-6 quizzes Multiple choice questions 10-15 minutes Each quiz 1% of the final No quiz makeups
Grading scale A standard grading scale will be utilized. The tentative grading scale for the course is: A 90-100% B 80-89% C 70-79% D 60-69% F Below 59%
Course Goals Study methods for Representation, manipulation, and optimization for both combinatorial and sequential logic Solving digital design problems Study HDL description language (verilog)
Topics Number bases Logic gates and Boolean Algebra Gate –label minimization Combinational Logic Sequential logic (Latches, Flip-flops, Registers, and Counters) Memory and Programmable Logic HDL language (Verilog)
Attention over time! t
Attention over time! ~5 min t
Peer Instruction Increase real-time learning in lecture, test understanding of concepts vs. details Complete a “segment” with multiple choice questions 1-2 minutes to decide yourself 3 minutes in pairs/triples to reach consensus. Teach others! 5-7 minute discussion of answers, questions, clarifications
The Evolution of Computer Hardware When was the first transistor invented? Modern-day electronics began with the invention in 1947 of the transfer resistor - the bi-polar transistor - by Bardeen et.al at Bell Laboratories For lecture
The Evolution of Computer Hardware When was the first IC (integrated circuit) invented? In 1958 the IC was born when Jack Kilby at Texas Instruments successfully interconnected, by hand, several transistors, resistors and capacitors on a single substrate For lecture
The Underlying Technologies Year Technology Relative Perf./Unit Cost 1951 Vacuum Tube 1 1965 Transistor 35 1975 Integrated Circuit (IC) 900 1995 Very Large Scale IC (VLSI) 2,400,000 2005 Ultra VLSI 6,200,000,000
The PowerPC 750 Introduced in 1999 3.65M transistors 366 MHz clock rate 40 mm2 die size 250nm technology
Layers of abstraction ECEN 248 Software Hardware Application (ex: browser) Operating Compiler System (Mac OSX) Software Assembler Instruction Set Architecture Hardware Processor Memory I/O system Datapath & Control ECEN 248 Digital Design Circuit Design transistors
Technology Trends: Microprocessor Complexity Itanium 2: 41 Million Athlon (K7): 22 Million Alpha 21264: 15 million Pentium Pro: 5.5 million PowerPC 620: 6.9 million Alpha 21164: 9.3 million Sparc Ultra: 5.2 million Moore’s Law 2X transistors/Chip Every 1.5 years Called “Moore’s Law”
DIGITAL SYSTEMS 19
Overview Logic functions with 1’s and 0’s. Truth tables. Building digital circuitry. Truth tables. Logic symbols and waveforms. Boolean algebra. Properties of Boolean Algebra Reducing functions. Transforming functions. credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·
Digital Systems · Analysis problem: Determine binary outputs for each combination of inputs Design problem: given a task, develop a circuit that accomplishes the task Many possible implementations. Try to develop “best” circuit based on some criterion (size, power, performance, etc.) · Logic Circuit Inputs Outputs
Toll Booth Controller Consider the design of a toll booth controller. Inputs: quarter, car sensor. Outputs: gate lift signal, gate close signal If driver pitches in quarter, raise gate. When car has cleared gate, close gate. Logic Circuit $·25 Car? Raise gate Close gate
Describing Circuit Functionality: Inverter Truth Table A Y 1 A Y Symbol Input Output Basic logic functions have symbols. The same functionality can be represented with truth tables· Truth table completely specifies outputs for all input combinations. The above circuit is an inverter. An input of 0 is inverted to a 1. An input of 1 is inverted to a 0. credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·
The AND Gate A Y B This is an AND gate. So, if the two inputs signals are asserted (high) the output will also be asserted. Otherwise, the output will be deasserted (low). Truth Table A B Y 1
The OR Gate A Y B This is an OR gate. So, if either of the two input signals are asserted, or both of them are, the output will be asserted. A B Y 1
Describing Circuit Functionality: Waveforms AND Gate A B Y 1 credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs· Waveforms provide another approach for representing functionality. Values are either high (logic 1) or low (logic 0). Can you create a truth table from the waveforms?
Consider three-input gates 3 Input OR Gate
Ordering Boolean Functions How to interpret A · B+C? Is it A · B ORed with C ? Is it A ANDed with B+C ? Order of precedence for Boolean algebra: AND before OR. Note that parentheses are needed here :
Boolean Algebra A Boolean algebra is defined as a closed algebraic system containing a set K or two or more elements and the two operators, · and +· Useful for identifying and minimizing circuit functionality Identity elements a + 0 = a a · 1 = a 0 is the identity element for the + operation· 1 is the identity element for the · operation·
Commutativity and Associativity of the Operators The Commutative Property: For every a and b in K, a + b = b + a a · b = b · a The Associative Property: For every a, b, and c in K, a + (b + c) = (a + b) + c a · (b · c) = (a · b) · c
The Distributive Property For every a, b, and c in K, a + ( b · c ) = ( a + b ) · ( a + c ) a · ( b + c ) = ( a · b ) + ( a · c )
Distributivity of the Operators and Complements The Existence of the Complement: For every a in K there exists a unique element called a’ (complement of a) such that, a + a’ = 1 a · a’ = 0 To simplify notation, the · operator is frequently omitted. When two elements are written next to each other, the AND (·) operator is implied… a + b · c = ( a + b ) · ( a + c ) a + bc = ( a + b )( a + c )
Duality The principle of duality is an important concept. This says that if an expression is valid in Boolean algebra, the dual of that expression is also valid. To form the dual of an expression, replace all + operators with · operators, all · operators with + operators, all ones with zeros, and all zeros with ones.
Duality The principle of duality is an important concept· This says that if an expression is valid in Boolean algebra, the dual of that expression is also valid· To form the dual of an expression, replace all + operators with · operators, all · operators with + operators, all ones with zeros, and all zeros with ones· Form the dual of the expression a + (bc) = (a + b)(a + c) Following the replacement rules… a(b + c) = ab + ac Take care not to alter the location of the parentheses if they are present·
Duality The principle of duality is an important concept· This says that if an expression is valid in Boolean algebra, the dual of that expression is also valid· To form the dual of an expression, replace all + operators with · operators, all · operators with + operators, all ones with zeros, and all zeros with ones· Form the dual of the expression a + (bc) = (a + b)(a + c) Following the replacement rules… a(b + c) = ab + ac Take care not to alter the location of the parentheses if they are present·
Involution This theorem states: a’’ = a Remember that aa’ = 0 and a+a’=1. Therefore, a’ is the complement of a and a is also the complement of a’. As the complement of a’ is unique, it follows that a’’=a· Taking the double inverse of a value will give the initial value.
Absorption This theorem states: a + ab = a a(a+b) = a To prove the first half of this theorem: a + ab = a · 1 + ab = a (1 + b) = a (b + 1) = a (1) a + ab = a
DeMorgan’s Theorem A key theorem in simplifying Boolean algebra expression is DeMorgan’s Theorem. It states: (a + b)’ = a’b’ (ab)’ = a’ + b’ Complement the expression a(b + z(x + a’)) and simplify. (a(b+z(x + a’)))’ = a’ + (b + z(x + a’))’ = a’ + b’(z(x + a’))’ = a’ + b’(z’ + (x + a’)’) = a’ + b’(z’ + x’a’’) = a’ + b’(z’ + x’a)
Postulates and Basic Theorems
Summary Basic logic functions can be made from AND, OR, and NOT (invert) functions. The behavior of digital circuits can be represented with waveforms, truth tables, or symbols. Primitive gates can be combined to form larger circuits Boolean algebra defines how binary variables can be combined. Rules for associativity, commutativity, and distribution are similar to algebra. DeMorgan’s rules are important. Will allow us to reduce circuit sizes. credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·
NUMBER SYSTEMS
Overview Understanding decimal numbers Binary and octal numbers The basis of computers! Conversion between different number systems credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Digital Computer Systems Digital systems consider discrete amounts of data. Examples 26 letters in the alphabet 10 decimal digits Larger quantities can be built from discrete values: Words made of letters Numbers made of decimal digits (e.g. 239875.32) Computers operate on binary values (0 and 1) Easy to represent binary values electrically Voltages and currents. Can be implemented using circuits Create the building blocks of modern computers credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Understanding Decimal Numbers Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9) Number representation: 8653 = 8x103 + 6x102 + 5x101 + 3x100 What about fractions? 97654.35 = 9x104 + 7x103 + 6x102 + 5x101 + 4x100 + 3x10-1 + 5x10-2 Informal notation -> (97654.35)10 credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Understanding Octal Numbers Octal numbers are made of octal digits: (0,1,2,3,4,5,6,7) Number representation: (4536)8 = 4x83 + 5x82 + 3x81 + 6x80 = (1362)10 What about fractions? (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2 Octal numbers don’t use digits 8 or 9 credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Understanding Binary Numbers Binary numbers are made of binary digits (bits): 0 and 1 Number representation: (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10 What about fractions? (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2 Groups of eight bits are called a byte (11001001) 2 Groups of four bits are called a nibble. (1101) 2 credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Why Use Binary Numbers? Easy to represent 0 and 1 using electrical values. Possible to tolerate noise. Easy to transmit data Easy to build binary circuits. AND Gate 1
Conversion Between Number Bases Octal(base 8) Decimal(base 10) Binary(base 2) Hexadecimal (base16)
Convert an Integer from Decimal to Another Base For each digit position: Divide decimal number by the base (e.g. 2) The remainder is the lowest-order digit Repeat first two steps until no divisor remains. Example for (13)10: Integer Quotient Remainder Coefficient 13/2 = 6 1 a0 = 1 6/2 = 3 0 a1 = 0 3/2 = 1 1 a2 = 1 1/2 = 0 1 a3 = 1 Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2
Convert an Fraction from Decimal to Another Base For each digit position: Multiply decimal number by the base (e.g. 2) The integer is the highest-order digit Repeat first two steps until fraction becomes zero. Example for (0.625)10: Integer Fraction Coefficient 0.625 x 2 = 1 + 0.25 a-1 = 1 0.250 x 2 = 0 + 0.50 a-2 = 0 0.500 x 2 = 1 + 0 a-3 = 1 Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
The Growth of Binary Numbers 20=1 1 21=2 2 22=4 3 23=8 4 24=16 5 25=32 6 26=64 7 27=128 n 2n 8 28=256 9 29=512 10 210=1024 11 211=2048 12 212=4096 20 220=1M 30 230=1G 40 240=1T Kilo Mega Giga Tera
Binary Addition 1 1 1 1 1 1 carries 1 1 1 1 0 1 + 1 0 1 1 1 Binary addition is very simple. This is best shown in an example of adding two binary numbers… 1 1 1 1 1 1 carries Design state of art organization in 1990 1 1 1 1 0 1 + 1 0 1 1 1 --------------------- 1 1 1
Binary Subtraction 1 10 borrows 0 10 10 0 0 10 1 0 0 1 1 0 1 We can also perform subtraction (with borrows in place of carries). Let’s subtract (10111)2 from (1001101)2… 1 10 0 10 10 0 0 10 1 0 0 1 1 0 1 - 1 0 1 1 1 ------------------------ 1 1 0 1 1 0 borrows Design state of art organization in 1990
Binary Multiplication Binary multiplication is much the same as decimal multiplication, except that the multiplication operations are much simpler… 1 0 1 1 1 X 1 0 1 0 ----------------------- 0 0 0 0 0 1 1 1 0 0 1 1 0 Design state of art organization in 1990
Convert an Integer from Decimal to Octal For each digit position: Divide decimal number by the base (8) The remainder is the lowest-order digit Repeat first two steps until no divisor remains. Example for (175)10: Integer Quotient Remainder Coefficient 175/8 = 21 7 a0 = 7 21/8 = 2 5 a1 = 5 2/8 = 0 2 a2 = 2 Answer (175)10 = (a2 a1 a0)2 = (257)8
Convert an Fraction from Decimal to Octal For each digit position: Multiply decimal number by the base (e.g. 8) The integer is the highest-order digit Repeat first two steps until fraction becomes zero. Example for (0.3125)10: Integer Fraction Coefficient 0.3125 x 8 = 2 + 5 a-1 = 2 0.5000 x 8 = 4 + 0 a-2 = 4 Answer (0.3125)10 = (0.24)8
Summary Binary numbers are made of binary digits (bits) Binary and octal number systems Conversion between number systems Addition, subtraction, and multiplication in binary credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
HEXADECIMAL NUMBERS
Overview Hexadecimal numbers Related to binary and octal numbers Conversion between hexadecimal, octal and binary Value ranges of numbers Representing positive and negative numbers Creating the complement of a number Make a positive number negative (and vice versa) Why binary? credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Understanding Hexadecimal Numbers Hexadecimal numbers are made of 16 digits: (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F) Number representation: (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910 What about fractions? (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510 Note that each hexadecimal digit can be represented with four bits. (1110) 2 = (E)16 Groups of four bits are called a nibble. (1110) 2 credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Putting It All Together Binary, octal, and hexadecimal similar Easy to build circuits to operate on these representations Possible to convert between the three formats
Converting Between Base 16 and Base 2 3A9F16 = 0011 1010 1001 11112 3 A 9 F Conversion is easy! Determine 4-bit value for each hex digit Note that there are 24 = 16 different values of four bits Easier to read and write in hexadecimal. Representations are equivalent!
Converting Between Base 16 and Base 8 3A9F16 = 0011 1010 1001 11112 3 A 9 F 352378 = 011 101 010 011 1112 3 5 2 3 7 Convert from Base 16 to Base 2 Regroup bits into groups of three starting from right Ignore leading zeros Each group of three bits forms an octal digit.
How To Represent Signed Numbers Plus and minus sign used for decimal numbers: 25 (or +25), -16, etc. For computers, desirable to represent everything as bits. Three types of signed binary number representations: signed magnitude, 1’s complement, 2’s complement. In each case: left-most bit indicates sign: positive (0) or negative (1). Consider signed magnitude: 000011002 = 1210 Sign bit Magnitude 100011002 = -1210 Sign bit Magnitude
One’s Complement Representation The one’s complement of a binary number involves inverting all bits. 1’s comp of 00110011 is 11001100 1’s comp of 10101010 is 01010101 For an n bit number N the 1’s complement is (2n-1) – N. Called diminished radix complement by Mano since 1’s complement for base (radix 2). To find negative of 1’s complement number take the 1’s complement. 000011002 = 1210 Sign bit Magnitude 111100112 = -1210 Sign bit Magnitude
Two’s Complement Representation The two’s complement of a binary number involves inverting all bits and adding 1. 2’s comp of 00110011 is 11001101 2’s comp of 10101010 is 01010110 For an n bit number N the 2’s complement is (2n-1) – N + 1. Called radix complement by Mano since 2’s complement for base (radix 2). To find negative of 2’s complement number take the 2’s complement. 000011002 = 1210 Sign bit Magnitude 111101002 = -1210 Sign bit Magnitude
Two’s Complement Shortcuts Algorithm 1 – Simply complement each bit and then add 1 to the result. Finding the 2’s complement of (01100101)2 and of its 2’s complement… N = 01100101 [N] = 10011011 10011010 01100100 + 1 + 1 --------------- --------------- 10011011 01100101 Algorithm 2 – Starting with the least significant bit, copy all of the bits up to and including the first 1 bit and then complementing the remaining bits. N = 0 1 1 0 0 1 0 1 [N] = 1 0 0 1 1 0 1 1
Finite Number Representation Machines that use 2’s complement arithmetic can represent integers in the range -2n-1 <= N <= 2n-1-1 where n is the number of bits available for representing N. Note that 2n-1-1 = (011..11)2 and –2n-1 = (100..00)2 For 2’s complement more negative numbers than positive. For 1’s complement two representations for zero. For an n bit number in base (radix) z there are zn different unsigned values. (0, 1, …zn-1)
1’s Complement Addition Using 1’s complement numbers, adding numbers is easy. For example, suppose we wish to add +(1100)2 and +(0001)2. Let’s compute (12)10 + (1)10. (12)10 = +(1100)2 = 011002 in 1’s comp. (1)10 = +(0001)2 = 000012 in 1’s comp. 0 1 1 0 0 + 0 0 0 0 1 -------------- 0 0 1 1 0 1 0 1 1 0 1 Add carry Final Result Add Step 1: Add binary numbers Step 2: Add carry to low-order bit
1’s Complement Subtraction Using 1’s complement numbers, subtracting numbers is also easy. For example, suppose we wish to subtract +(0001)2 from +(1100)2. Let’s compute (12)10 - (1)10. (12)10 = +(1100)2 = 011002 in 1’s comp. (-1)10 = -(0001)2 = 111102 in 1’s comp.
1’s Complement Subtraction Step 1: Take 1’s complement of 2nd operand Step 2: Add binary numbers Step 3: Add carry to low order bit 0 1 1 0 0 - 0 0 0 0 1 -------------- + 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1’s comp Add Add carry Final Result
2’s Complement Addition Using 2’s complement numbers, adding numbers is easy. For example, suppose we wish to add +(1100)2 and +(0001)2. Let’s compute (12)10 + (1)10. (12)10 = +(1100)2 = 011002 in 2’s comp. (1)10 = +(0001)2 = 000012 in 2’s comp.
2’s Complement Addition Step 1: Add binary numbers Step 2: Ignore carry bit 0 1 1 0 0 + 0 0 0 0 1 -------------- 0 0 1 1 0 1 Add Final Result Ignore
2’s Complement Subtraction Using 2’s complement numbers, follow steps for subtraction For example, suppose we wish to subtract +(0001)2 from +(1100)2. Let’s compute (12)10 - (1)10. (12)10 = +(1100)2 = 011002 in 2’s comp. (-1)10 = -(0001)2 = 111112 in 2’s comp.
2’s Complement Subtraction Step 1: Take 2’s complement of 2nd operand Step 2: Add binary numbers Step 3: Ignore carry bit 0 1 1 0 0 - 0 0 0 0 1 -------------- + 1 1 1 1 1 1 0 1 0 1 1 2’s comp Add Final Result Ignore Carry
2’s Complement Subtraction: Example #2 Let’s compute (13)10 – (5)10. (13)10 = +(1101)2 = (01101)2 (-5)10 = -(0101)2 = (11011)2 Adding these two 5-bit codes… Discarding the carry bit, the sign bit is seen to be zero, indicating a correct result. Indeed, (01000)2 = +(1000)2 = +(8)10. 0 1 1 0 1 + 1 1 0 1 1 -------------- 1 0 1 0 0 0 carry
2’s Complement Subtraction: Example #3 Let’s compute (5)10 – (12)10. (-12)10 = -(1100)2 = (10100)2 (5)10 = +(0101)2 = (00101)2 Adding these two 5-bit codes… Here, there is no carry bit and the sign bit is 1. This indicates a negative result, which is what we expect. (11001)2 = -(7)10. 0 0 1 0 1 + 1 0 1 0 0 -------------- 1 1 0 0 1
Binary numbers Binary numbers can also be represented in octal and hexadecimal Easy to convert between binary, octal, and hexadecimal Signed numbers represented in signed magnitude, 1’s complement, and 2’s complement 2’s complement most important (only 1 representation for zero). Important to understand treatment of sign bit for 1’s and 2’s complement. credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
Binary Coded Decimal Digit BCD Code 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001 Binary coded decimal (BCD) represents each decimal digit with four bits Ex· 0011 0010 1001 = 32910 This is NOT the same as 0011001010012 Why do this? Because people think in decimal. credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs· 3 2 9
Putting It All Together BCD not very efficient. Used in early computers (40s, 50s). Used to encode numbers for seven- segment displays. Easier to read?
Gray Code Gray code is not a number system. Digit Binary Gray Code 0000 1 0001 2 0010 0011 3 4 0100 0110 5 0101 0111 6 7 8 1000 1100 9 1001 1101 10 1010 1111 11 1011 1110 12 13 14 15 Gray code is not a number system. It is an alternate way to represent four bit data Only one bit changes from one decimal digit to the next Useful for reducing errors in communication. Can be scaled to larger numbers. credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·
ASCII Code American Standard Code for Information Interchange ASCII is a 7-bit code, frequently used with an 8th bit for error detection (more about that in a bit). Character ASCII (bin) ASCII (hex) Decimal Octal A 1000001 41 65 101 B 1000010 42 66 102 C 1000011 43 67 103 … Z a 1 ‘ credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·
ASCII Codes and Data Transmission A – Z (26 codes), a – z (26 codes) 0-9 (10 codes), others (@#$%^&*…·) Complete listing in Mano text Transmission susceptible to noise. Typical transmission rates (1500 Kbps, 56.6 Kbps) How to keep data transmission accurate?
Parity Codes Information Bits P Parity codes are formed by concatenating a parity bit, P to each code word of C. In an odd-parity code, the parity bit is specified so that the total number of ones is odd. In an even-parity code, the parity bit is specified so that the total number of ones is even. Information Bits P 1 1 0 0 0 0 1 1 Added even parity bit 0 1 0 0 0 0 1 1 Added odd parity bit
Parity Code Example Concatenate a parity bit to the ASCII code for the characters 0, X, and = to produce both odd-parity and even-parity codes. Character ASCII Odd-Parity ASCII Even-Parity ASCII 0110000 10110000 00110000 X 1011000 01011000 11011000 = 0111100 10111100 00111100
Binary Data Storage Binary cells store individual bits of data Multiple cells form a register. Data in registers can indicate different values Hex (decimal) BCD ASCII 1 1 1 1 Binary Cell
Register Transfer Data can move from register to register. Digital logic used to process data. We will learn to design this logic. Register A Register B Register C Digital Logic Circuits
Transfer of Information Data input at keyboard Shifted into place Stored in memory NOTE: Data input in ASCII
Building a Computer We need processing We need storage We need communication You will learn to use and design these components.
Summary Although 2’s complement most important, other number codes exist. ASCII code used to represent characters (including those on the keyboard). Registers store binary data. Next time: Building logic circuits! credential: bring a computer die photo wafer : This can be an hidden slide· I just want to use this to do my own planning· I have rearranged Culler’s lecture slides slightly and add more slides· This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20· Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs·