Digital Logic Circuits Binary Logic and Gates Logic Simulation Boolean Algebra NAND/NOR and XOR gates Decoder fundamentals Half Adder, Full Adder, Ripple Carry Adder
Analog vs Digital Analog Continuous» Time Every time has a value associated with it, not just some times» Magnitude» e.g. A variable can take on any value within a range temperature, voltage, current, weight, length, brightness, color
Digital Systems Digital vs. Analog Waveforms +5 +5 V T ime V T ime 5 5 Digital: only assumes discrete values Analog: values vary over a broad range continuously
Quantization
Analog vs Digital Digital Discontinuous» Time (discretized) The variable is only defined at certain times» Magnitude (quantized)» e.g. The variable can only take on values from a finite set Switch position, digital logic, Dow-Jones Industrial, lottery, batting-average
Analog to Digital A Continuous Signal is Sampled at Some Time and Converted to a Quantized Representation of its Magnitude at that Time Samples are usually taken at regular intervals and controlled by a clock signal The magnitude of the signal is stored as a sequence of binary valued (,) bits according to some encoding scheme
Digital to Analog A Binary Valued, B = {, }, Code Word can be Converted to its Analog Value Output of D/A Usually Passed Through Analog Low Pass Filter to Approximate a Continuous Signal Many Applications Construct a Signal Digitally and then D/A e.g., RF Transmitters, Signal Generators
Digital is Ubiquitous Electronic Circuits based on Digital Principles are Widely Used Automotive Engine/Speed Controllers Microwave Oven Controllers Heating Duct Controls Digital Watches Cellular Phones Video Games
Why Digital? Increased Noise Immunity Reliable Inexpensive Programmable Easy to Compute Nonlinear Functions Reproducible Small
Digital Design Process Computer Aided Design Tools Design entry Synthesis Verification and simulation Physical design Fabrication Testing
Definition
Representations for combinational logic Truth tables Graphical (logic gates) Algebraic equations (Boolean) Exclusive-or (XOR,( EXOR, not-equivalence, ring-or OR) Algebraic symbol: Gate symbol:
Boolean algebra & logic circuits
Representations of a Digital Design Truth Tables tabulate all possible input combinations and their associated output values Example: half adder adds two binary digits to form Sum and Carry Example: full adder adds two binary digits and Carry in to form Sum and Carry Out A B Sum Carry NOTE: plus is with a carry of in binary A B C in S um C out
Representations of Digital Design: Boolean Algebra values:, variables: A, B, C,..., X, Y, Z operations: NOT, AND, OR,... NOT X is written as X X AND Y is written as X & Y, or sometimes X Y X OR Y is written as X + Y Deriving Boolean equations from truth tables: A B Sum Carry Sum = A B + A B OR'd together product terms for each truth table row where the function is if input variable is, it appears in complemented form; if, it appears uncomplemented Carry = A B
Representations of a Digital Representations of a Digital Design: Boolean Algebra Design: Boolean Algebra A B Cin Sum Cout Another example: Sum = A B Cin + A B Cin + A B Cin + A B Cin Cout = A B Cin + A B Cin + A B Cin + A B Cin
Gate Representations of a Digital Design most widely used primitive building block in digital system design Standard Logic Gate Representation Inverter A Half Adder Schematic AND Net SUM OR B Net 2 CARR Y Net: electrically connected collection of wires Netlist: tabulation of gate inputs & outputs and the nets they are connected to
Design methodology
Top-down vs. bottom-up design
Analysis procedures
Schematic for 4 Bit ALU Inverto r AN D Gate EXO R Gate OR Gate
Simulation of 4 Bit ALU A B S 4 4 2 D if S= then D=B A if S= then D=A B if S=2 then D=A+B if S=3 then D= A
Elementary Binary Logic Functions Digital circuits represent information using two voltage levels. binary variables are used to denote these values by convention, the values are called and and we often think of them as meaning True and False Functions of binary variables are called logic functions. AND(A,B) = if A= and B=, else it is zero.» AND is generally written in the shorthand A B (or A&B or A B) OR(A,B) = if A= or B=, else it is zero.» OR is generally written in the shorthand form A+B (or A B or A B) NOT(A) = if A= else it is zero.» NOT is generally written in the shorthand form A (or A or A ) AND, OR and NOT can be used to express all other logic functions.
Two Variable Binary Logic Functions A B ZERO ONE A B A B AND NAND OR NOR EXOR Can make similar truth tables for 3 variable or 4 variable functions, but gets big (256 & 65,536 columns). EQUAL Representing functions in terms of AND, OR, NOT. NAND(A,B) = (A B) EXOR(A,B) = (A B) + (A B ) Α Β Β Α (Α Β) (Β Α)
Basic Logic Gates AND Gate OR Gate Inverter X Y X Y X Y X+Y X X Timing Diagram X Y X Y X+Y X Logic gates compute elementary binary functions. output of an AND gate is when both of its inputs are, otherwise the output is zero similarly for OR gate and inverter Timing diagram shows how output values change over time as input values change
Multivariable Gates 3 input AND Gate A B C A B C 6 input OR Gate A C B D E F A+B+C+D+E+F AND function on n variables is if and only if ALL its arguments are. n input AND gate output is if all inputs are OR function on n variables is if and only if at least one of its arguments is. n input OR gate output is if any inputs are Can construct large gates from 2 input gates. however, large gates can be less expensive than required number of 2 input gates
Elements of Boolean Algebra Boolean algebra defines rules for manipulating symbolic binary logic expressions. a symbolic binary logic expression consists of binary variables and the operators AND, OR and NOT (e.g. A+B C ) The possible values for any Boolean expression can be tabulated in a truth table. Can define circuit for expression by combining gates. A B C A+B C A B C B C A+B C
Schematic Capture & Logic Simulation wires terminals gates advance simulation signal waveforms schematic entry tools signal names
Boolean Functions to Logic Circuits Any Boolean expression can be converted to a logic circuit made up of AND, OR and NOT gates. step : step 2: step 3: add parentheses to expression to fully define order of operations - A+( +(B (C )) create gate for last operation in expression gate s output is value of expression gate s inputs are expressions combined by operation A A+B C (B (C )) repeat for sub-expressions and continue until done Number of simple gates needed to implement expression equals number of operations in expression. so, simpler equivalent expression yields less expensive circuit Boolean algebra provides rules for simplifying expressions
Basic Identities of Boolean Algebra. X + = X 3. X + = 5. X + X = X 7. X + X = 9. (X ) = X. X + Y = Y + X 2. X+( +(Y+Z ) = (X+Y )+Z 4. X(Y+Z ) = X Y + X Z 2. X = X 4. X = 6. X X = X 8. X X =. X Y = Y X 3. X (Y Z ) = (X Y ) Z 5. X+( +(Y Z ) = (X+Y ) (X+Z ) 7. (X Y) = X +Y 6. (X + Y ) = X Y Identities define intrinsic properties of Boolean algebra. Useful in simplifying Boolean expressions Note: 5-77 have no counterpart in ordinary algebra. Parallel columns illustrate duality principle. commutative associative distributive DeMorgan s
Verifying Identities Using Truth Tables XY (X + Y ) = X Y (X + Y ) X Y XYZ Y Z X+( +(Y Z ) = (X+Y ) (X+Z ) X+( +(Y Z ) X+Y X+Z (X+Y ) (X+Z ) Can verify any logical equation with small number of variables using truth tables. Break large expressions into parts, as needed.
DeMorgan s Law
DeMorgan s Laws for n Variables We can extend DeMorgan s laws to 3 variables by applying the laws for two variables. (X + Y + Z ) = (X + (Y + Z )) - by associative law = X (Y + Z ) - by DeMorgan s law = X (Y Z ) - by DeMorgan s law = X Y Z - by associative law (X Y Z) = (X (Y Z )) - by associative law = X + (Y Z ) - by DeMorgan s law = X + (Y + Z ) - by DeMorgan s law = X + Y + Z - by associative law Generalization to n variables. (X + X 2 + + X n ) = X X 2 X n (X X 2 X n ) = X + X 2 + + X n
Simplification of Boolean Expressions X Y Z F=X YZ +X YZ +XZ by identity 4 Y Z X F=X Y(Z +Z )+XZ by identity 7 X Y Z F=X Y +XZ =X Y +XZ by identity 2
The Duality Principle The dual of a Boolean expression is obtained by interchanging all ANDs s and ORs, and all s and s. example: the dual of A+( +(B C )+ is A (B+C ) The duality principle states that if E and E 2 are Boolean expressions then E = E 2 dual (E )=dual (E 2 ) where dual(e) ) is the dual of E.. For example, A+( +(B C )+ = (B C )+D A (B+C ) = (B +C ) D Consequently, the pairs of identities (,2), (3,4), (5,6), (7,8), (,), (2,3), (4,5) and (6,7) all follow from each other through the duality principle.
The Consensus Theorem Theorem. XY + X Z +YZ = XY + X Z Proof. XY + X Z +YZ = XY + X Z + YZ(X + X )) 2,7 = XY + X Z + XYZ + X YZ 4 = XY + XYZ + X Z + X YZ = XY( + Z ) + X Z( + Y ) 2,4 = XY + X Z 3,2 Example. (A + B )(A + C ) = AA + AC + A B + BC = AC + A B + BC = AC + A B Dual. (X + Y )(X + Z )(Y + Z ) = (X + Y )(X + Z )
Taking the Complement of a Function Method.. Apply DeMorgan s Theorem repeatedly. (X(Y Z + YZ )) = X + (Y Z + YZ ) = X + (Y Z ) (YZYZ ) = X + (Y + Z )(Y + Z ) Method 2.. Complement literals and take dual (X (Y Z + YZ )) = dual(x (YZ + Y Z )) = X + (Y + Z )(Y + Z )
Sum of Products Form The sum of products is one of two standard forms for Boolean expressions. sum-of-products-expression Example. X Y Z + X Z + XY + XYZ = term + term... + term term = literal literal literal literal A minterm is a term that contains every variable, in either complemented or uncomplemented form. Example. in expression above, X Y Z is minterm, but X Z is not A sum of minterms expression is a sum of products expression in which every term is a minterm Example. X Y Z + X YZ + XYZ + XYZ is sum of minterms expression that is equivalent to expression above
Product of Sums Form The product of sums is the second standard form for Boolean expressions. product-of-sums-expression = s-term s-term... s-term s-term = literal + literal + + literal Example. (X +Y +Z )(X +Z )(X+Y )(X+Y +Z ) A maxterm is a sum term that contains every variable, in complemented or uncomplemented form. Example. in exp. above, X +Y +Z is a maxterm, but X +Z is not A product of maxterms expression is a product of sums expression in which every term is a maxterm Example. (X +Y +Z )(X +Y+Z)(X+Y+Z )(X+Y+Z ) is product of maxterms expression that is equivalent to expression above
NAND Gate X Y NAND and NOR Gates (X Y) NOR Gate In certain technologies (including CMOS), a NAND (NOR) gate is simpler & faster than an AND (OR) gate. Consequently circuits are often constructed using NANDs and NORs directly, instead of ANDs and ORs. Alternative gate representations makes this easier. X Y (X+Y) = = = =
A B Exclusive Or and Odd Function AB +A B EXOR gate The EXOR function is defined by A B = AB + A B. The odd function on n variables is when an odd number of its variables are. odd(x,y,z ) = XY Z + X Y Z + X Y Z + X Y Z = X Y Z similarly for 4 or more variables Alternative Implementation A Parity checking circuits use the odd function to provide a simple integrity check to verify correctness of data. any erroneous single bit change will alter value of odd function, allowing detection of the change B
Positive and Negative Logic In positive logic systems, a high voltage is associated with a logic, and a low voltage with a logic. positive logic is just one of two conventions that can be used to associate a logic value with a voltage sometimes it is more convenient to use the opposite convention In logic diagrams that use negative logic,, a polarity indicator is used to indicate the correct logical interpretation for a signal. X Y X Y X Y X+Y Circuits commonly use a combination of positive and negative logic.
Analysis example
Truth tables from logic diagram
Logic simulation
Decoder Fundamentals Route data to one specific output line. Selection of devices, resources Code conversions. Arbitrary switching functions implements the AND plane Asserts one-of-many signal; at most one output will be asserted for any input combination
Encoding Binary Decimal Unencoded Encoded 2 3 Note: Finite state machines may be unencoded ("one-hot") or binary encoded. If the all 's state is used, then one less bit is needed and it is called modified one-hot coding.
Why Encode? A Logarithmic Relationship 8 7 6 5 Log 2 (N) 4 3 2 25 5 75 25 5 N
2:4 Decoder A B AND 2 Y E Q 3 A B AND 2 A Y E Q 2 A B AND 2 A Y E Q D D A B AND 2 B Y E Q What happens when the inputs goes from to?
2:4 Decoder with Enable A B C AND 3 Y E Q 3 A B C AND 3 A Y E Q 2 A B C AND 3 A Y E Q D D ENABLE A B C AND 3 B Y E Q
2: Multiplexer A A B Y X A B Y Y S B A B Y X2
Design synthesis procedure
Half Adder
Full Adder with EXOR, AND and OR
Full Adder with EXOR and NAND One-bit Full Adder (FA) 3 inputs: A, B, C 2 outputs: S, Co Truth table: Schematic View: cell-based approach C S A, B, C S, Co,,,,,,,,,,,,,,,,,,,,,,,, A B Co
Ripple Carry Adder