ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 3 Dr. Shi Dept. of Electrical and Computer Engineering
Understanding Decimal Numbers Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9) Number representation: 8653 = 8x x x x10 0 What about fractions? = 9x x x x x x x10 -2 Informal notation ( ) 10
Understanding Binary Numbers Binary numbers are made of binary digits (bits): 0 and 1 Number representation: (1011) 2 = 1x x x x2 0 = (11) 10 What about fractions? (110.10) 2 = 1x x x x x2 -2 Groups of eight bits are called a byte (B) ( ) 2
Convert an Integer from Decimal to Another Base 1.Divide decimal number by the base (e.g. 2) 2.The remainder is the lowest-order digit 3.Repeat first two steps until no divisor remains. For each digit position: Example for (13) 10: Integer Quotient 13/2 = 6 1 a 0 = 1 6/2 = 3 0 a 1 = 0 3/2 = 1 1 a 2 = 1 1/2 = 0 1 a 3 = 1 RemainderCoefficient Answer (13) 10 = (a 3 a 2 a 1 a 0 ) 2 = (1101) 2
Convert a Fraction from Decimal to Another Base 1.Multiply decimal number by the base (e.g. 2) 2.The integer is the highest-order digit 3.Repeat first two steps until fraction becomes zero. For each digit position: Example for (0.625) 10: Integer x 2 = a -1 = x 2 = a -2 = x 2 = a -3 = 1 FractionCoefficient Answer (0.625) 10 = (0.a -1 a -2 a -3 ) 2 = (0.101) 2
The Growth of Binary Numbers n2n2n 02 0 = = = = = = = =128 n2n2n 82 8 = = = = = =1M =1G =1T Mega Giga Tera Kilo 2 50 =Peta
Binary Addition Binary addition is very simple. This is best shown in an example of adding two binary numbers… Procedure easy to implement by circuits carries
Binary Subtraction °We can also perform subtraction (with borrows in place of carries). °Let’s subtract (10111) 2 from ( ) 2 … °Procedure hard to implement by circuit borrows
Binary Multiplication Binary multiplication is much the same as decimal multiplication, except that the multiplication operations are much simpler… X
Binary Data Storage & Representation Binary cells store individual bits of data Multiple cells form a register. Data in registers can indicate different values Hexadecimal: (41) 16 =(65) 10 BCD (Binary Coded Decimal): (41) 10 ASCII (American Standard Code for Information Interchange): letter “A” 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 ARegister B Register C Digital Logic Circuits
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 InputsOutputs
Boolean Algebra George Boole English mathematician Boolean algebra or Boolean logic Sound and complete system Everything is either true or false, and can proven Nothing is unknown Case closed In contrast, mathematics about integers are incomplete Many things can NOT be proven true nor false Godel’s incomplete theorem Endless effort …
Boolean Algebra A Boolean algebra is defined as a closed algebraic system containing a set of elements Every variable can take only two values 0 or 1 Only two operators, * and + 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 a + b = b + a a * b = b * a The Associative Property: For every a, b, and c a + (b + c) = (a + b) + c a * (b * c) = (a * b) * c
The Distributive Property The Distributive Property: For every a, b, and c, 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 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 )
Claude Shannon American mathematician Father of information theory and cryptography In 1937, at age 21, he was a master student at MIT Noticed engineers were messing around with logic circuits without a sound foundation Wrote the “most important master’s thesis of all time” to demonstrate Boolean algebra could be used to resolve any logical relationship Since then, Boolean algebra becomes widely used
Describing Circuit Functionality: Inverter 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. AY InputOutput A Y Symbol Truth Table
The AND Gate This is an AND gate Logic operation Y= A* B So, if the two inputs signals are asserted (high) the output will also be asserted. Otherwise, the output will be deasserted (low). ABY A B Y Truth Table
The OR Gate This is an OR gate. Logic operation Y = A+B So, if either of the two input signals are asserted, or both of them are, the output will be asserted. Note: If there are n inputs, then the truth table will have 2 n rows. Since we can fill any of the entries on output with 0 or 1, there are 2^2^n ways to fill a truth table of n input. Therefore, there are 2^2^n gates of n input ABY A B Y
The NAND Gate This is a NAND gate. It is a combination of an AND gate followed by an inverter. Its truth table shows this. ABY A B Y
The NOR Gate This is a NOR gate. It is a combination of an OR gate followed by an inverter. It’s truth table shows this ABY A B Y
The XOR Gate (Exclusive-OR) This is a XOR gate. XOR gates assert their output when exactly one of the inputs is asserted, hence the name. The switching algebra symbol for this operation is , i.e. 1 1 = 0 and 1 0 = 1. ABY A B Y
Describing Circuit Functionality: Waveforms 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? ABY AND Gate
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 :
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. Call quarter detector signal Q, car detector C Call raise gate signal R=Q*C, and lower gate signal L=C’ Logic Circuit $0.25? Car? Raise gate Close gate
Boolean Algebra
A Boolean algebra is defined with: A set of elements S={0,1} A set of operators A number of unproved axioms or postulates
Boolean Algebra (cont.) A binary operator: Defined on a set S of elements A rule that assigns to each pair of elements from S a unique element from S Example a*b=c a S and b S it must hold that a*b S A set S is closed with respect to a binary operator if for every two elements of S, the binary operator specifies a unique element of S
Definition of Boolean Algebra Boolean algebra is an algebraic structure, defined by a set of elements S and two binary operators, +, and ·, with the following postulates: 1. The structure is closed with respect to + and * 2. Element 0 is an identity element for + Element 1 is an identify element for * x+0=0+x=x x · 1=1 · x=x
Definition of Boolean Algebra (cont.) 3. The structure is commutative with respect to + and · : a + b = b + a a · b = b · a 4. The operator · is distributive over + The operation + is distributive over · a · ( b + c ) = ( a · b ) + ( a · c ) a + ( b · c ) = ( a + b ) · ( a + c )