Chapter 2

42
Chapter 2 Introduction to Logic Circuits

description

Chapter 2. Introduction to Logic Circuits. Objectives. Know what Truth Tables are Know the Truth Tables for the Basic Gates AND, OR, NOT, NAND, NOR Know how to Analyze Simple Logic Circuits Via Timing Diagrams and Truth Tables - PowerPoint PPT Presentation

Transcript of Chapter 2

Page 1: Chapter 2

Chapter 2

Introduction

to

Logic Circuits

Page 2: Chapter 2

Objectives• Know what Truth Tables are

• Know the Truth Tables for the Basic Gates – AND, OR, NOT, NAND, NOR

• Know how to Analyze Simple Logic Circuits– Via Timing Diagrams and Truth Tables

• Be able to use Boolean Algebra to manipulate simple digital logic equations

• Know what a Venn diagram is and how they apply to digital logic

• Know how to implement a function in both Sum of Products and Product of Sums form

• Know how to use Quartus II’s schematic entry tool to describe simple logic circuits

• Know how to use Quartus II to simulate a logic circuit

Page 3: Chapter 2

Variables and Functions

• Consider a Flashlight– L is the Function that represents the Flashlight

• L = 0 when light is off, L = 1 when light is on

– x is the Variable that represents the switch• Switch open x = 0, switch closed x = 1

• x is an input Variable– When x = 0 L = 0– When x = 1 L = 1

• L(x) = x

Page 4: Chapter 2

AND & OR

• Flashlight controlled by two switches in series = AND– L(x1,x2) = x1

.x2

• Flashlight controlled by two switches in parallel = OR– L(x1,x2) = x1+x2

• AND and OR two very important building blocks

Page 5: Chapter 2

Inversion (NOT)

• Light on if switch open– L = 1 if x = 0

• Light off if switch closed– L = 0 if x = 1

• L(x) = x

• x = x’ = !x = ~x = NOTx

Page 6: Chapter 2

Truth Tables

x1 x2 x1.x2 x1+x2 !x1

0 0 0 0 1

0 1 0 1 1

1 0 0 1 0

1 1 1 1 0

AND OR NOT

Page 7: Chapter 2

Logic Gates

AND

OR

NOT (Inverter)

Page 8: Chapter 2

Logic Networks or Logic Circuits

• Using AND, OR, and NOT logic functions of any complexity can be implemented

• Number of gates/complexity of logic network is directly related to its cost

• Reducing cost is always desirable

• Reducing complexity is always desirable

Page 9: Chapter 2

Analysis of Logic Circuit

• Analysis– Determine how an existing Logic Circuit

functions

• Synthesis– Design a new network that implements a

desired Logic Function

Page 10: Chapter 2

Logic Analysis

• Truth Table

• Timing Diagram

Page 11: Chapter 2

Truth Table

X1 X2 A B C D E f(X1,X2)

0 0 1 1 1 0 0 1

0 1 1 0 0 0 0 0

1 0 0 1 0 0 1 1

1 1 0 0 0 1 0 1

f(X1,X2) = !X1.!X2 + X1.X2 + X1.!X2

Page 12: Chapter 2

Timing Diagram

X1

X2

A

B

C = A.B

D = X1.X2

E = X1.B

f(X1,X2)

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

Page 13: Chapter 2
Page 14: Chapter 2

Truth Table

f(X1,X2) = !X1.!X2 + X1

X1 X2 A B C D f(X1,X2)

0 0 1 1 1 0 1

0 1 1 0 0 0 0

1 0 0 1 0 1 1

1 1 0 0 0 1 1

Page 15: Chapter 2

Timing Diagram

X1

X2

A

B

C = A.B

f(X1,X2)

1

0

1

0

1

0

1

0

1

0

1

0

Page 16: Chapter 2

Functionally Equivalent Circuits

= !X1.!X2 + X1.X2 + X1.!X2

= !X1.!X2 + X1

!X1.!X2 + X1.X2 + X1.!X2 = !X1.!X2 + X1

Two equations result in same output – Which is better?

Page 17: Chapter 2

Boolean Algebra

• In Boolean Algebra elements can take on one of two values, 0 and 1

• Axioms of Boolean Algebra

1a. 0 . 0 = 0

1b. 1 + 1 = 1

2a. 1 . 1 = 1

2b. 0 + 0 = 0

3a. 0 . 1 = 1 . 0 = 0

3b. 1 + 0 = 0 + 1 = 1

4a. If x = 0 then !x = 1

4b. If x = 1 then !x = 0

Page 18: Chapter 2

Single-Variable Theorems

5a. x . 0 = 0

5b. x + 1 = 1

6a. x . 1 = x

6b. x + 0 = 0

7a. x . x = x

7b. x + x = x

8a. x . !x = 0

8b. x + !x = 1

9 !!x = x

Validity easy to prove by substituting x = 0 and x = 1 and using the Axioms

Page 19: Chapter 2

Duality

• Dual of an expression is achieved by– Replacing all ANDs with ORs and all ORs with

ANDs– Replacing all 1s with 0s and all 0s with 1s

Page 20: Chapter 2

Two and Three Variable PropertiesCommutative

10a. X . Y = Y . X

10b. X + Y = Y + X

Associative

11a. X . (Y . Z) = (X . Y) . Z

11b. X + (Y + Z) = (X + Y) + Z

Distributive

12a. X . (Y + Z) = X . Y + X . Z

12b. X + Y . Z = (X + Y) . (X + Z)

Absorption

13a. X + X . Y = X

13b. X . (X + Y) = X

Combining

14a. X . Y + X . !Y = X

14b. (X + Y) . (X + !Y) = X

DeMorgan’s Theorem

15a. !(X . Y) = !X + !Y

15b. !(X + Y) = !X . !Y

16a. X + !X . Y = X + Y

16b. X . (!X + Y) = X . Y

Consensus

17a. X . Y + Y . Z + !X . Z = X . Y + !X . Z

17b. (X + Y) . (Y + Z) . (!X + Z) = (X + Y) . (!X + Z)

Page 21: Chapter 2

Algebraic Manipulation

• !X1 . !X2 + X1 . X2 + X1 . !X2 =? !X2 + X1

• !X1 . !X2 + X1 . (X2 + !X2)– Via 12a. Distributive (X . Y) + (X . Z) = X . (Y + Z)

• !X1 . !X2 + X1 . (1) – Via 8b. X + !X = 1

• !X1 . !X2 + X1 = !X1 . !X2 + X1 – Via 6a. X . 1 = X

• !X2 + X1– Via 16a. X + !X . Y = X + Y

Page 22: Chapter 2

Venn Diagram

Page 23: Chapter 2

!X1 . !X2 + X1 . X2 + X1 . !X2 !X2 + X1

Page 24: Chapter 2

Notation, Terminology, & Precedence

• + versus + called sum

• . versus . called product

• = AND

• = OR

• NOT, AND, OR Order of Precedence

Page 25: Chapter 2

Synthesis or Design

• If the alarm is enabled and the window is open the alarm should sound

• Assign variable names and functions

• Create truth table

• Write Sum of Products or Product of Sums

• Create Schematic or HDL

Page 26: Chapter 2

Assign Variable Names and Functions

• Alarm Enabled = En

• Window Open = Wo

• Alarm Sound = Al

Page 27: Chapter 2

Create Truth Table

En Wo AlEn Wo Al0 00 11 01 1

En Wo Al0 0 00 1 01 0 01 1 1

Page 28: Chapter 2

Write Sum of Products or Product of Sums

f = En . Wo = Al

En Wo Al0 0 00 1 01 0 01 1 1

EnWo Al

Page 29: Chapter 2

Cost

• Total number of gates

• Plus

• Total number of inputs to all gates

Page 30: Chapter 2

Sum of Products• Uses minterms to express the function

• f(X1,X2) = Σ(m0,m2,m3) = !X1 . !X2 + X1 . !X2 + X1 . X2– Canonical Sum of Products

• Note: Brown uses Σm(0,2,3) as a simple form

• Using Boolean logic theorems and properties the Canonical Sum of Products expression can be manipulated to produce– f(X1,X2) = !X2 + X1

– Which is a Minimum Cost Sum of Products expression of f

Row # X1 X2 f(X1,X2)

00 0 0 1

01 0 1 0

10 1 0 1

11 1 1 1

!X1 . !X2 - minterm

X1 . !X2 - minterm

X1 . X2 - minterm

Page 31: Chapter 2

Product of Sums• Uses Maxterms to express function• f(X1,X2) = П(M1) = (X1 + !X2) . (!X1 + X2)

– Canonical Product of Sums• Note: Brown uses П M(1) as a simple form

– Also Minimum Cost Product of Sums in this case

Row # X1 X2 f(X1,X2)

00 0 0 1

01 0 1 0

10 1 0 0

11 1 1 1

X1 + !X2 – maxterm

!X1 + X2 – maxterm

Page 32: Chapter 2

Using De Morgan’s Theoremto generate Product of Sums

• !f(X1,X2) = (!X1 . X2) + (X1 . !X2)

• !(!f(X1,X2)) = !((!X1 . X2) + (X1 . !X2))

• f(X1,X2) = !(!X1 . X2) . !(X1 . !X2)

• f(X1,X2) = (X1 + !X2) . (!X1 + X2)

Row # X1 X2 f(X1,X2)

00 0 0 1

01 0 1 0

10 1 0 0

11 1 1 1

Page 33: Chapter 2

Minterm vs Maxterm• Σ = Minterm – rows where f(x) = 1

• П = Maxterm – rows where f(x) = 0

Row # X1 X2 f(X1,X2)

00 0 0 1

01 0 1 0

10 1 0 1

11 1 1 1

!X1 . !X2 - minterm

X1 + !X2 - maxterm

X1 . !X2 - minterm

X1 . X2 - minterm

f(X1,X2) = Σ(m0,m2,m3) = !X1 . !X2 + X1 . !X2 + X1 . X2

f(X1,X2) = П(M1) = X1 + !X2

Page 34: Chapter 2

Further Examples

• f(m0,m2,m3,m7)– Truth table– Sum of Products– Product of Sums– Minimization– Schematic– Timing Diagram

Page 35: Chapter 2

Sum of Products

!X1!X2!X3 + !X1X2!X3 + !X1X2X3 + X1X2X3

!X1!X3(!X2 + X2) + X2X3(!X1 + X1)

!X1!X3 + X2X3

Page 36: Chapter 2

Product of Sums

(X1+X2+!X3)(!X1+X2+X3)(!X1+X2+!X3)(!X1+!X2+X3)((X1 +!X3)+X2)((!X1+X3)+X2)((!X1+X3)+X2)((!X1+!X3)+X2)((!X1+!X3)+X2)((!X1+X3)+!X2)

A B B C C D

A B C D

A C B D

((X1 +!X3)+X2)((!X1+!X3)+X2)((!X1+X3)+X2)((!X1+X3)+!X2)

((X1 +!X3)+X2)((!X1+!X3)+X2)((!X1+X3)+X2!X2)

Page 37: Chapter 2

NAND and NOR Gatesvia DeMorgan’s Theorem

!(X1 . X2) = !X1 + !X2 = !X1 + !X2

!(X1 + X2) = !X1 . !X2 = !X1 . !X2

Page 38: Chapter 2

NAND gates in Sum of ProductsNOR gate in Product of Sums

Sum of Products

Product of Sums

Page 39: Chapter 2

Design Example

• Three-Way Light Control– Did you understand the book’s example?

• Multiplexer Circuit

Page 40: Chapter 2

Reading• Chapter 2 – Omit section 2.10

Laboratory Preparation• Quartus II Introduction Using Schematic Design

• ftp://ftp.altera.com/up/pub/Altera_Material/QII_9.0/Digital_Logic/DE2/Tutorials/tut_quartus_intro_schem.pdf

Page 41: Chapter 2

Homework Problems• 2.1-2.4, 2.6, 2.8, 2.9, 2.10

• 2.28-2.30 Create Truth Table, attempt to minimize, and write SOP & POS

• 2.31-2.34 Create Truth Table, attempt to minimize, and write required form

• 2.35 Create Truth Table

• 2.44, 2.45 Print or save as jpg and email Schematic and Simulator Waveform

Page 42: Chapter 2

Schematic Design

Poor

Good