 Chapter 2 Logic Circuits.

Presentation on theme: "Chapter 2 Logic Circuits."— Presentation transcript:

Chapter 2 Logic Circuits

Chapter Objectives In this chapter you will be introduced to:
Logic functions and circuits Boolean algebra for dealing with logic circuits Logic gates and synthesis of simple circuits CAD tools and the VHDL hardware description language

Binary Switch x = x = 1 (a) Two states of a switch S x
x = 1 (a) Two states of a switch S x (b) Symbol for a switch

Light Controlled by a Switch
Battery x Light (a) Simple connection to a battery S Power x Light supply (b) Using a ground connection as the return path

AND and OR Logic Functions
Power x1 x2 Light supply (a) The logical AND function (series connection) S x1 Power Light supply S x2 (b) The logical OR function (parallel connection)

Series-Parallel Connection
Power supply Light X1 X2 X3

Inverting Circuit S Light Power supply R x

Truth Table for Two Input Variables

Truth Table for Three Input Variables

The Basic Gates × x x x x (a) AND gate x x + x x (b) OR gate x x
1 x × x x 1 2 2 (a) AND gate x 1 x + x x 1 2 2 (b) OR gate x x (c) NOT gate

Inverter (NOT Circuit)
Performs a basic logic function called inversion or complementation Changes one logic level (HIGH / LOW) to the opposite logic level In terms of bits, it changes a ‘1’ to a ‘0’ and vice versa INPUT OUTPUT A A’ 1

The AND Gate Composed of two or more inputs and a single output
Performs logical multiplication. The logical operation of the AND gate is such that the output is HIGH (1) when all the inputs are HIGH, otherwise it is LOW (0)

The OR Gate Composed of two or more inputs and a single output
Performs logical addition The logical operation of the OR gate is such that the output is HIGH (1) when any of the inputs are HIGH, otherwise it is LOW (0)

X = AB + A

What is the Truth Table? x 1 x 2 f = ( x + x ) . x x 1 2 3 3

Logic Network Example ® ® 1 ® 1 1 ® 1 ® ® x 1 A 1 ® 1 ® ® 1 f ® ® ® 1
1 1 1 1 x 1 A 1 1 1 f 1 B 1 1 x 2 (a) Network that implements f = x + x × x 1 1 2 x 1 2 f , ( ) (b) Truth table A B 1 x 1 x 1 2 1 A 1 B 1 f Time (c) Timing diagram

Boolean Algebra A mathematical system for formulating logical statements with symbols so that problems can be solved in a manner similar to ordinary algebra. Boolean algebra is the mathematics of digital systems.

Axioms of Boolean Algebra

Commutative Laws of Boolean Algebra
The commutative law of addition for two variables is algebraically expressed as: x + y = y + x The commutative law of multiplication for two variables is expressed as: xy = yx In summary, the order in which the variables are ORed or ANDed make no difference.

Associative Laws of Boolean Algebra
The associative law of addition of three variables is expressed as: x + (y + z) = (x + y) + z The associative law of multiplication of three variables is expressed as: x(yz) = (xy)z In summary, ORing or ANDing a grouping of variables produces the same result regardless of the grouping of the variables.

Distributive Law of Boolean Algebra
The distributive law of three variables is expressed as follows: x (y+z) = xy + xz This law states that ORing several variables and ANDing the result is equivalent of ANDing the single variable with each of the variables in the grouping, then ORing the result.

Single Variable Theorems
Rule Number Boolean Expression 5 a. x * 0 = 0 5 b. x + 1 = 1 6 a. x * 1= x 6 b. x + 0 = x 7 a. x * x = x 7 b. x + x = x 8 a. x * x’ =0 8 b. x + x’ =1 9. (x’)’ = x

Duality To reflect the principle of duality, the axioms and single-variable theorems are listed in pairs. For example, see 5a and 3a. When x =0, by 5a, the result is 0. When x =1, by 5a, the result is 0, which is also proved by 3a.

Two- and Three-Variable Properties
Property Boolean Expression 10 a. Commutative 10 b. Commutative x * y = y *x x + y = y + x 11 a. Associative 11 b. Associative x * (y * z) = (x * y) * z x + (y + z) = (x + y) + z 12 a. Distributive 12 b. Distributive x * (y + z) = x * y + x * z x + (y * z) = (x + y) * (x + z) 13 a. Absorption 13 b. Absorption x + x * y = x x * ( x + y) = x

Two- and Three-Variable Properties
Property Boolean Expression 14 a. Combining 14 b. Combining x * y + x * y’= x (x + y ) * ( x + y’) = x 15 a. DeMorgan’s Theorem 15 b. DeMorgan’s Theorem (x * y)’= (x’+ y’) (x + y)’= x’ * y’ 16 a. 16 b. x + x’ * y = x + y x * (x’ + y) = x * y 17 a. Consensus 17 b. Consensus x * y + x’ * z + y * z = x * y + x’ * z (x + y ) * (x’ + z) * (y + z ) = (x + y) * (x’+ z)

Boolean Simplification
Example 1: F = AB’ + C’D + AB’ + C’D = AB’ + C’D (by identity 5) Example 2: F = ABC + ABC’ + A’C = AB(C + C’) + A’C (by identity 13) = AB(1) + A’C (by identity 7) = AB +A’C (by identity 4)

Logic Circuit Implementation

DeMorgan’s Theorem (A B)’ = A’ + B’ (1) (A + B)’ = A’ B’ (2)
That is, the complement of the product is equivalent to the sum of the complements. This is true for any number of variables. (A B C … Z)’ = A’ + B’ + C’ + … + Z’ (A + B)’ = A’ B’ (2) Similarly, the complement of the sum is equivalent to the product of the complements. Similarly, (A + B + C + …+ Z)’ = A’ * B’ * C’ * … * Z’

Proof of DeMorgan’s Theorem

Methods to Complement a Function
Interchange 1’s and 0’s for the values of F in the truth table. Use DeMorgan’s theorem on algebraic function Change F to F’, and F’ to F Change OR to AND Change AND to OR Complement each individual variable Example 1: F = AB+ C’D + B’D Applying DeMorgan’s theorem, F’ = (A’ + B’)(C + D’)(B + D’)

Methods to Complement a Function
Example 2: Simplify F = (x1 + x3) . (x1’+ x3’) F = x1 x1’+ x1 x3’ + x3 x1’+ x3 x3’ (Distributive Property) x1 x1’ and x3 x3’ = 0 ( Identity 8) F = x1 x3’ + x1’ x3 Example 3: F = x’yz + x’yz’ +xz = x’y(z + z’ ) + xz (Factoring out) = x’y .1 + xz ( By Identity 6) = x’y + xz ( By Identity 4)

Practice Problems Find the complement: (xyz)’ Expand: x + yz Simplify:
x’y’ +x’y + xy x’y’ + xz + xy + yz’ wy + w’yz’ + wxy + w’xy’

Venn Diagram Representation
(a) Constant 1 (b) Constant 0 x x x x (c) Variable x (d) x

Venn Diagram Representation
x y x y (e) x * y (f) x + y x y x y z (g) x * y (h) x * y + z

Verification of the Distributive Property
x y x y z z (a) x (d) x * y x y x y z z (b) y + z (e) x * z x y x y z z (c) x * ( y + z ) (f) x * y + x * z

Verify xy + x’z + yz = xy + x’z
* y x * y x y z * x y x y z z x * z y * z y z x y z x x y * + z x y * + z

Boolean Functions Example 1: Example 2:
Prove: (A + B) (A’ + B’) = AB’ + A’B LHS = AA’ + AB’ + BA’ + BB’ (by distributive property) = O + AB’ + BA’ + O = AB’ + A’B = RHS Example 2: Prove: AC’ + B’ C’ + AC + B’C = A’B’ + AB + AB’ LHS = A(C+C’) + B’(C+C’) = A*1 + B’*1 = A + B’ RHS = A’B’ + AB + AB’ = A’B’ + A(B + B’) = A’ B’ + A = A + B’ (by identity 11) LHS = RHS

Precedence of Operations
NOT, AND, and then OR Example: A*B + A’*B’ 1. Complements 2. AND operations 3. OR operation

Synthesis Using Gates f = m0 * 1 + m1 * 1 + m2 * 0 + m3 *1

Two Implementations x x f (a) Canonical sum-of-products x f x
1 x 2 f (a) Canonical sum-of-products x 1 f x 2 (b) Minimal-cost realization

Terms and Definitions Synthesis Analysis
The designing of a new system that implements a desired functional behavior. Analysis The task of determining the function performed by a system.

Terms and Definitions Sum-of-Products (SOP) Product-of-Sums (POS)
Canonical SOP Canonical POS Minterm A product term with all ‘n’ variables in asserted or negated form. Maxterm The complement of a minterm

Three-Variable Minterms and Maxterms

A Three-Variable Function

A Three-Variable Function
Canonical Sum-of-Products f(x1, x2, x3) = x1’x2’x3 + x1x2’x3’ + x1x2’x3 + x1x2x3’ = Σ (m1, m4, m5, m6) = Σ m(1, 4, 5, 6) Canonical Product-of-Sums f’(x1, x2, x3) = x1’x2’x3’ + x1’x2x3’ + x1’x2x3 + x1x2x3 f(x1, x2, x3) = (x1+x2+x3)(x1+x2’+x3)(x1+x2’+x3’)(x1’+x2’+x3’) = Π (M0, M2, M3, M7) = Π M(0, 2, 3, 7)

Practice Problems Show that the minimal Sum-of-Products is:
f(x1, x2, x3) = x2’x3 + x1x3’ Show that the minimal Product of Sums is: f(x1, x2, x3) = (x1 + x3)(x2’ + x3’)

Minimal Realizations f x (a) A minimal sum-of-products realization f x
1 2 3 f x 2 1 3 (b) A minimal product-of-sums realization

More Practice Problems
Determine the canonical Sum-of-Products expressions for the following functions: f(x1, x2, x3) = Σ m(2, 3, 4, 6, 7) f(x1, x2, x3, x4) = Σ m(3, 7, 9, 12, 13, 14, 15) Now determine the minimized SOPs for these two functions. Find the canonical Product of Sums expression for: f(x1, x2, x) = Π M(0, 1, 5)

Four More Logic Gates NAND NOR Exclusive OR (XOR) Exclusive NOR (XNOR)

The NAND Gate The NAND, which is composed of two or more inputs and a single output, is a very popular logic element because it may be used as a universal function. It may be employed to construct an inverter, an AND gate, an OR gate, or any combination of these functions. The term NAND is formed by the concatenation NOT-AND and implies an AND function with an inverted output. The logical operation of the NAND gate is such that the output is LOW (0) only when all the inputs are HIGH (1).

The NOR gate The NOR gate, which is composed of two or more inputs and a single output, also has a universal property. The term NOR is formed by the concatenation NOT-OR and implies an OR function with an inverted output. The logical operation of the NOR gate is such that the output is HIGH (1) only when all the inputs are LOW.

The Exclusive-OR (XOR) and Exclusive NOR (XNOR) Gates
These gates are usually formed from the combination of the other logic gates already discussed. Because of their functional importance, these gates are treated as basic gates with their own unique symbols. The Exclusive-OR is an "inequality" function and the output is HIGH (1) when the inputs are not equal to each other. The Exclusive-NOR is an "equality" function and the output is HIGH (0) when the inputs are equal to each other.

NAND and NOR Gates

DeMorgan’s Theorem in Terms of Logic Gates
x 1 2 + = (a) (b)

Using NAND Gates to Implement a Sum-of-Products
x 1 2 3 4 5

Using NOR Gates to Implement a Product-of-Sums
x 1 2 3 4 5

NOR Gate Realization of an Example Function
(a) POS implementation x1 x2 f x3 (b) NOR implementation

NAND Gate Realization of an Example Function
(a) SOP implementation x1 f x2 x3 (b) NAND implementation

Truth Table for a Three-Way Light Control

SOP and POS Realizations
f (a) Sum-of-products realization (b) Product-of-sums realization x1 x3 x2

Implementation of a Multiplexer
1 s x1 x2 f (s, x1, x2) f s 1 x 2 1 1 (b) Circuit 1 1 1 1 s 1 1 1 s f (s, x1, x2) x 1 1 1 x1 f 1 1 1 1 x 2 1 1 x2 (a) Truth table (c) Graphical symbol (d) More compact truth-table representation

A Typical CAD System See Figure 2.29, page 61, in your textbook.

A Simple Logic Function
x 1 x 2 f x 3

VHDL VHSIC Hardware Description Language Entity Declaration
Very High Speed Integrated Circuit Entity Declaration Describes Ports Input Output Architecture Declaration Describes Functions

VHDL Entity Declaration
ENTITY example1 IS PORT ( x1, x2, x3 : IN BIT ; f : OUT BIT ) ; END example1 ;

VHDL Architecture for the Entity
ARCHITECTURE LogicFunc OF example1 IS BEGIN f <= (x1 AND x2) OR (NOT x2 AND x3) ; END LogicFunc ;

Complete VHDL Code for the Circuit

VHDL Code for a Four-Input Function

Logic Circuit for the VHDL Code

Example 2.10 A circuit that controls a given digital system has three inputs: x1, x2, and x3. It has to recognize three different conditions: Condition A is true if x3 is true and either x1 is true or x2 is false. Condition B is true if x1 is true and either x2 or x3 is false. Condition C is true if x2 is true and either x1 is true or x3 is false. The control circuit must produce an output of 1 if at least two of the conditions A, B, and C are true. Design the simplest circuit that can be used for this purpose.

Solution to Example 2.10 Using 1 for true and 0 for false, express the three conditions A, B, and C as: A = x3(x1 + x2’) = x3x1 + x3x2’ B = x1(x2’ + x3’) = x1x2’ + x1x3’ C = x2(x1 + x3’) = x2x1 + x2x3‘ The desired output can be expressed as: f(x1, x2, x3) = AB + AC + BC

Solution to Example 2.10 Determine the product term AB:
= (x3x1 + x3x2’)(x1x2’ + x1x3’) = x3x1x1x2’ + x3x1x1x3’ + x3x2’x1x2’ + x3x2’x1x3’ = x3x1x2’ + O + x3x2’x1 + O = x1x2’x3 Determine the product term AC = x1x2x3 Determine the product term BC = x1x2x3’

Solution to Example 2.10 f(x1, x2, x3 ) = AB + AC + BC
= x1x2’x3 + x1x2x3 + x1x2x3’ = x1(x2’ + x2)x3 + x1x2(x3 + x3’) = x1x3 + x1x2 =x1(x3 + x2)

Example 2.11 Solve Example 2.10 using Venn Diagrams

Solution to Example 2.11 (a) Function A (b) Function B (c) Function C
(d) Function f