42
1 COMP541 COMP541 Combinational Logic Combinational Logic Montek Singh Montek Singh Jan 16, 2007 Jan 16, 2007

1 COMP541 Combinational Logic Montek Singh Jan 16, 2007

  • View
    218

  • Download
    4

Embed Size (px)

Citation preview

1

COMP541COMP541

Combinational LogicCombinational Logic

Montek SinghMontek Singh

Jan 16, 2007Jan 16, 2007

2

TodayToday Basics of digital logic (review)Basics of digital logic (review)

Basic functionsBasic functions Boolean algebraBoolean algebra Gates to implement Boolean functionsGates to implement Boolean functions

Identities and Simplification (review?)Identities and Simplification (review?)

3

Binary LogicBinary Logic Binary variablesBinary variables

Can be 0 or 1 (T or F, low or high)Can be 0 or 1 (T or F, low or high) Variables named with single letters in examplesVariables named with single letters in examples Really use words when designing circuitsReally use words when designing circuits

Basic FunctionsBasic Functions ANDAND OROR NOTNOT

4

ANDAND Symbol is Symbol is dotdot

C = A · BC = A · B

Or no symbolOr no symbol C = ABC = AB

Truth table ->Truth table -> C is 1 only ifC is 1 only if

Both A and B are 1Both A and B are 1

5

OROR Symbol is +Symbol is +

Not additionNot addition C = A + BC = A + B

Truth table ->Truth table -> C is 1 if either 1C is 1 if either 1

Or both!Or both!

6

NOTNOT UnaryUnary Symbol is barSymbol is bar

C = ĀC = Ā

Truth table ->Truth table -> InversionInversion

7

GatesGates Circuit diagrams are traditional to document Circuit diagrams are traditional to document

circuitscircuits Remember that 0 and 1 are represented by Remember that 0 and 1 are represented by

voltages voltages

8

AND GateAND Gate

Timing Diagrams

9

OR GateOR Gate

10

InverterInverter

11

More InputsMore Inputs Work same wayWork same way What’s output?What’s output?

12

Representation: SchematicRepresentation: Schematic Schematic = circuit diagramSchematic = circuit diagram

13

Representation: Boolean AlgebraRepresentation: Boolean Algebra For now equations with operators AND, OR, For now equations with operators AND, OR,

and NOTand NOT Can evaluate terms, then final ORCan evaluate terms, then final OR

Alternate representations nextAlternate representations next

ZY X F

14

Representation: Truth TableRepresentation: Truth Table 22nn rows rows

where n = where n = # of variables# of variables

15

FunctionsFunctions Can get same truth table with different Can get same truth table with different

functionsfunctions

Usually want ‘simplest’Usually want ‘simplest’ Fewest gates, or using only particular types of gatesFewest gates, or using only particular types of gates More on this laterMore on this later

ZY X F ))(( ZXY X F

16

IdentitiesIdentities Use identities to manipulate functionsUse identities to manipulate functions I used distributive law … I used distributive law …

… … to transform fromto transform from

ZY X F

))(( ZXY X F

))(( ZX YX YZ X

toto

17

Table of IdentitiesTable of Identities

18

DualsDuals Left and right columns are Left and right columns are dualsduals Replace AND and OR, 0s and 1sReplace AND and OR, 0s and 1s

19

Single Variable IdentitiesSingle Variable Identities

20

CommutativityCommutativity Operation is independent of order of variablesOperation is independent of order of variables

21

AssociativityAssociativity Independent of order in which we groupIndependent of order in which we group

So can also be written asSo can also be written as

andandZYX

XYZ

22

DistributivityDistributivity

Can substitute arbitrarily large algebraic Can substitute arbitrarily large algebraic expressions for the variablesexpressions for the variables Distribute an operation over the entire expressionDistribute an operation over the entire expression

23

DeMorgan’s TheoremDeMorgan’s Theorem Used a lotUsed a lot NOR NOR invert, then AND invert, then AND

NAND NAND invert, then OR invert, then OR

24

Truth Tables for DeMorgan’sTruth Tables for DeMorgan’s

25

Algebraic ManipulationAlgebraic Manipulation Consider functionConsider function

XZZYX YZ X F

26

Simplify FunctionSimplify Function

XZZYX YZ X F

XZZ Z YX F )(

XZYX F 1

XZYX F

Apply

Apply

Apply

27

Fewer GatesFewer Gates

XZYX F

28

Consensus TheoremConsensus Theorem

The third term is redundantThe third term is redundant Can just dropCan just drop

Proof in book, but in summary:Proof in book, but in summary: For third term to be true, Y & Z both must be 1For third term to be true, Y & Z both must be 1 Then one of the first two terms must be 1!Then one of the first two terms must be 1!

ZXXYYZZXXY

29

Complement of a FunctionComplement of a Function Definition: 1s & 0s swapped in truth tableDefinition: 1s & 0s swapped in truth table Mechanical way to derive algebraic formMechanical way to derive algebraic form

Take the dualTake the dualRecall: Interchange AND and OR, and 1s & 0sRecall: Interchange AND and OR, and 1s & 0s

Complement each literalComplement each literal

30

Mechanically Go From Truth Table Mechanically Go From Truth Table to Functionto Function

31

From Truth Table to FuncFrom Truth Table to Func Consider a truth tableConsider a truth table Can implement F by taking OR of all terms that Can implement F by taking OR of all terms that

are 1are 1

XYZZXYZYXZY XZ YX F

32

Standard FormsStandard Forms Not necessarily simplest FNot necessarily simplest F But it’s a mechanical way to go from truth But it’s a mechanical way to go from truth

table to functiontable to function

Definitions:Definitions: Product terms – AND Product terms – AND ĀBZ ĀBZ Sum terms – OR Sum terms – OR X + Ā X + Ā This is logical product and sum, not arithmeticThis is logical product and sum, not arithmetic

33

Definition: MintermDefinition: Minterm Product term in which all variables appear Product term in which all variables appear

once (complemented or not)once (complemented or not)

34

Number of MintermsNumber of Minterms For For nn variables, there will be variables, there will be 22nn minterms minterms Like binary numbers from 0 to 2Like binary numbers from 0 to 2nn-1-1 In book, numbered same way (with decimal In book, numbered same way (with decimal

conversion)conversion)

35

MaxtermsMaxterms Sum term in which all variables appear once Sum term in which all variables appear once

(complemented or not)(complemented or not)

36

Minterm related to MaxtermMinterm related to Maxterm Minterm and maxterm with same subscripts Minterm and maxterm with same subscripts

are complementsare complements

ExampleExample

33 MZYXYZXm

Mjm j

37

Sum of MintermsSum of Minterms Like the introductory slideLike the introductory slide OR all of the minterms of truth table row with OR all of the minterms of truth table row with

a 1a 1

38

Complement of FComplement of F Not surprisingly, just sum of the other Not surprisingly, just sum of the other

mintermsminterms In this caseIn this case

mm11 + m + m33 + m + m44 + m + m66

39

Product of MaxtermsProduct of Maxterms Recall that maxterm is true except for its own Recall that maxterm is true except for its own

casecase So M1 is only false for 001So M1 is only false for 001

40

Product of MaxtermsProduct of Maxterms Can express F as AND of all rows that should Can express F as AND of all rows that should

evaluate to 0evaluate to 0

6431 MMMMF

))(( ZYXZYXF ))(( ZYXZYX

oror

41

RecapRecap Working (so far) with AND, OR, and NOTWorking (so far) with AND, OR, and NOT Algebraic identitiesAlgebraic identities Algebraic simplificationAlgebraic simplification Minterms and maxtermsMinterms and maxterms Can now synthesize function (and gates) from Can now synthesize function (and gates) from

truth tabletruth table

42

Next TimeNext Time Lab PrepLab Prep

Demo lab softwareDemo lab software Talk about FPGA internalsTalk about FPGA internals Overview of components on boardOverview of components on board Downloading and testingDownloading and testing

Karnaugh maps: mechanical synthesis Karnaugh maps: mechanical synthesis approach (quick)approach (quick)