principles of digital circuits jehan-françois pâris [email protected]

133
PRINCIPLES OF DIGITAL CIRCUITS Jehan- François Pâris [email protected]

Upload: octavia-webster

Post on 29-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

PRINCIPLES OF DIGITAL CIRCUITS

Jehan-François Pâ[email protected]

Page 2: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Chapter Organization

• Combinatorial circuits– Boolean algebra– Logical gates used to implement them

• Sequential circuits– Finite-state machines– Flip-flops and other memory technologies– Implementation

Page 3: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Importance

• Up to the 80’s, computers were built of discrete components– Computer architects were building their

computers using gates, flip-flops, …• Logical circuitry is now hidden inside

increasingly complex chips– Principles remain the same

Page 4: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

COMBINATORIAL CIRCUITS

Page 5: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Outline

• Boolean Operators:– AND, OR, NOT, XOR, NAND, NOR

• Boolean Expressions– Identities– Simplification

• Algebraic methods• Karnaugh maps

Page 6: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean quantities

• Can only have two values– TRUE or FALSE (logical expressions)– 0 or 1 (digital circuit design)

Page 7: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (I)• AND:

– True if both operands are true– Represented by a . sign (often omitted)

A B AB

0 0 0

0 1 0

1 0 0

1 1 1

This is called a truth table

Page 8: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (II)• OR:

– True unless both operands are false– Represented by a + sign

A B A+B

0 0 0

0 1 1

1 0 1

1 1 1

Page 9: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (III)• NOT:

– True if operand is false– Represented by a macron as in Ā or a prime

A A’

0 1

1 0

Page 10: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (IV)• Equality/Mutual Implication:

– True when both operands are equal– Represented by a sign

A B AB

0 0 1

0 1 0

1 0 0

1 1 1

Page 11: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (V)• Exclusive OR (XOR):

– True when operands are not equal– Represented by a sign

A B AB

0 0 0

0 1 1

1 0 1

1 1 0

Page 12: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (VI)• Not AND (NAND):

– True unless both operands are true

A B A NAND B0 0 1

0 1 1

1 0 1

1 1 0

Page 13: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Boolean operations (VII)• Not OR (NOR):

– True if both operands are false

A B A NOR B0 0 1

0 1 0

1 0 0

1 1 0

Page 14: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Notes

• XOR is used for – Generating parity bits– Hardware hashing

• NOR and NAND are used because they have very efficient hardware implementation

Page 15: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Useful identities (I)

• 1 + A = 1• 0 . A = 0• A + A’ = 1• A.A’ = 0• A(B + C) =AB + AC• (AB)’ = A’ + B’• (A+B)’ = (A’)(B’)

Page 16: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Useful identities (II)

– Let us show that (A+B)’ = A’B’

A B A’ B’ A’B’ A+B (A+B)’

0 0 1 1 1

0 1 1 0 0

1 0 0 1 0

1 1 0 0 0

Page 17: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Useful identities (II)

– Let us show that (A+B)’ = A’B’

A B A’ B’ A’B’ A+B (A+B)’

0 0 1 1 1 0 1

0 1 1 0 0 1 0

1 0 0 1 0 1 0

1 1 0 0 0 1 0

Page 18: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (I)

• A set of operations is said to be universal iff any function can be described by using that set of operations alone

• Claim:AND, OR and NOT constitute a universal set

Page 19: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (II)

• Proof:We will show that– A B = AB + A’B’– A B = A’B + AB’– A NAND B = (AB)’– A NOR B= (A + B)’– …

Page 20: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0

0 1

1 0

1 1

Page 21: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0 0

0 1 1

1 0 0

1 1 0

Page 22: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0 0 0

0 1 1 0

1 0 0 1

1 1 0 0

Page 23: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0 0 0

0 1 1 0

1 0 0 1

1 1 0 0

Page 24: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0 0 0 0

0 1 1 0 1

1 0 0 1 1

1 1 0 0 0

Page 25: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (III)

– Let us show that A B = A’B + AB’

A B A’B AB’ A’B + AB’ AB

0 0 0 0 0 0

0 1 1 0 1 1

1 0 0 1 1 1

1 1 0 0 0 0

Page 26: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (IV)

• Can simulate NOT with either NAND or NOR: • A NAND A = A NOR A = A’

Page 27: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (V)

• Can simulate AND with either NAND or NOR:

• (A NAND B) NAND (A NAND B) =

((AB)’)’ = AB

• (A NOR A) NOR (B NOR B) =

( A’ + B’)’ = ((AB)’)’ = AB

Page 28: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Universal set of operations (VI)

• Can simulate OR with either NAND or NOR

• (A NAND A) NAND (B NAND B) =(A’B’)’ = ((A +B)’)’ = A + B

• (A NOR B) NOR (A NOR B) =((A +B)’)’ = A + B

• Both NOR alone and NAND alone form universal sets of operations

Page 29: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Exercise

• Construct an exclusive or usinga) only NAND operationsb) only NOR operations

Page 30: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution using NANDs

• Will start top down– AB = AB' + A'B

= (AB' NAND AB') NAND (AB' NAND AB')

where • AB' = (A NAND A) NAND B • A'B = A NAND (B NAND B)

Page 31: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Easier to draw it

and or not

nand nor xor

Page 32: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Easier to draw it (II)

(F NAND F) NAND (G NAND G) =F' NAND G' = F + G

GG'

F'(FG')' =F + GF

Page 33: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Easier to draw it (III)

(A NAND B) NAND (A NAND B) =(AB)' NAND (AB)' = AB

A

B

(AB)' (AB)'' = AB

Page 34: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Easier to draw it (IV)

(A NAND (BNAND B) NAND ( same) =(AB)' NAND (AB)' = AB

(AB')' = A'+B (A'+B)' = AB'A

BB'

(A'+B)' = AB'A

B

Page 35: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Easier to draw it (V)

(A NAND (BNAND B) NAND ( same) =(AB)' NAND (AB)' = AB

(A'B)' = A+B' (A+B')' = A'BA

B

A'

Page 36: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Putting it together

AB'

A

B A'+B

A

B

A+B' A'B AB'

A'B

Output is ((A'B) (B'A))' = AB'+A'B

Page 37: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Simplifying (I)

A

B A'+B

A

B

A+B'

Output is ((A'B) (B'A))' = AB'+A'B

X XX X

Page 38: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Simplifying (II)

A

B

A

B

(AB')'

(A'B)'

Output is ((A'B)' (B'A)')' = (AB')''+(A'B)'' = AB'+A'B

A'

B'

AB'+A'B

Page 39: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Expression simplification (I)

• My other class is full• I could make exceptions for

– All PhD students because the course is one of their core courses

– All MS students who graduate this semester because they might need the course

Page 40: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Expression simplification (II)

• I have two Boolean variables– D true if the student is a PhD student and

false otherwise– T if student completes his/her last semester

• We can assume that all non-PhD students are MS students– Course restricted to graduate students

Page 41: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Expression simplification (III)

• Rules can be expressed by Boolean expressionD +D’T

• Can I simplify this expression?– D + D’T = D (1 + T) + D’T

= D + DT + D’T = D + (D + D’)T = D + T

– One operation instead of three

Page 42: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (I)

• Graphical method to represent truth tables of Boolean expressions with up to four variables

• Our example becomes

T ' T

D’ 1

D 1 1

Page 43: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (II)

• Can identify rectangles corresponding to variables or AND “products”

• Form OR “sum” of these products

T ‘ T

D’ 1

D 1 1

Page 44: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (III)

• Want to simplify AB’C + ABC’ + A(BC)’= AB’C + ABC’ +A(B’ + C’)

B’C’ B’C BC BC’

A’ 0 0 0 0

A 1 1 0 1

Must use the sequence B’C’, B’C, BC, BC’

Page 45: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (III)

• Solution is AB’ + AC’ = A(B’ + C’)– Observe wrap-around for product AC’

B’C’ B’C BC BC’

A’ 0 0 0 0

A 1 1 0 1

Page 46: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (IV)

• Can have Karnaugh maps with four variables

C'D' C'D CD CD'

A’B’ 0 0 1 1

A’B 0 0 0 0

AB 0 0 0 0

AB’ 1 1 1 1

Page 47: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (V)

C’D’ C’D CD CD’

A’B’ 0 0 1 1

A’B 0 0 0 0

AB 0 0 0 0

AB’ 1 1 1 1

Page 48: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Karnaugh maps (VI)

• Solution is AB’ + B’C = B’(A +C)

C’D’ C’D CD CD’

A’B’ 0 0 1 1

A’B 0 0 0 0

AB 0 0 0 0

AB’ 1 1 1 1

Page 49: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Exercise (I)

• Simplify the expressionAC + (A’ + B) (C + D) + BD

Page 50: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Exercise (II)

Algebraic Solution:AC + (A’ + B) (C + D) + BD’ =AC + A’C + A’D + BC + BD + BD’ =C +A'D + BC + B =C + A’D + B

Page 51: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Exercise (III)

• Karnaugh Map:AC + (A’ + B) (C + D) + BD’ =C + A’D + B

C’D’ C’D CD CD’

A’B’ 0 1 1 1

A’B 1 1 1 1

AB 1 1 1 1

AB’ 0 0 1 1

Page 52: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Half adder (I)

• Implements Boolean addition without a carry from a lesser significant bit

• Binary addition table is very simple

+ 0 1

0 0 1

1 1 10

Page 53: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Half adder (II)

• Karnaugh map for sum bit

• Karnaugh map for carry bit

+ 0 1

0 0 1

1 1 0

+ 0 1

0 0 0

1 0 1

Page 54: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Half adder (IIII)

• Two outputs:– The sum S = x y– The carry C = xy

Page 55: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Half adder (IV)

• An implementation only using AND, OR and NOT gates– C = xy– S = x y

= x’y + xy’ + x’x + y’y = x’(x + y) + y’(x + y) = (x’ + y’)(x + y) = (xy)’(x + y)

Page 56: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Half adder

Carry =XY

Sum

X

XY

Y

XY

X'+Y'

Sum = (X'+Y')(X+ Y) = X'X + X'Y + Y'X + Y'Y

Page 57: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (I)

• We add the carry z from a less significant bit position

C'S' C'S CS'

+ 00 01 10 -

0 00 01 10 -

1 01 10 11 -

Outputs from half adder

Carry z

Page 58: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (II)• New sum:

C'S' C'S CS'

00 01 10 -

0 0 1 0 -

1 1 0 1 -

Outputs from half adder

Carry z

Page 59: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (II)• Checkerboard pattern indicates an XOR

C'S' C'S CS'

00 01 10 -

0 00 1 00 -

1 1 00 1 -

Outputs from half adder

Carry z

Page 60: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (III)• New carry:

C'S' C'S CS'

00 01 10 -

0 0 0 1 -

1 0 1 1 -

Outputs from half adder

Carry z

Page 61: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (IV)

• Define– SH = x y

– CH = xy

• With the carry z– New sum S = SH z

– New carry C = CH + SH z

for the half adder

Page 62: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (V)

• We can build a full adder using two half adders and an OR gate

Page 63: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Full adder (VI)

• A simpler diagram

Half adder Half adderxy

z

S

C

We treat the half adder as a black box.

Page 64: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Multiplexers (I)

• A multiplexer has– 2n input lines numbered 0 to 2n - 1– n select lines– one output

• Values of n select lines specify which input line is rolled to output

Page 65: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Four-input multiplexer (I)

Page 66: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Four-input multiplexer (II)

Page 67: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Decoders

• A decoder has– n input lines– 2n output lines numbered 0 to 2n – 1

• Values of n input line specify which output line is on

Page 68: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Two-input decoder

Page 69: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

A generic decoder

Page 70: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Programmable Logic Arrays

• A PLA has– one selectable NOT gate for each input line– a set of programmable AND gate planes– a set of programmable OR gate planes

• Can represent any Boolean expression insum of product form:

ABC’ + AD + A’ED

Page 71: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Programmable Logic ArraysThe squiggly connectionscan be turnedon or off when the array isprogrammed

Page 72: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

X states (I)• Sometimes we know that some input

combinations will never happen– Represented on a Karnaugh map by a X state

B’C’ B’C BC BC’

A’ X X 0 0

A 1 1 0 1

Page 73: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

X states (II)• Can be assigned either 0 or 1• Expression simplifies in

B’+ AC’

B’C’ B’C BC BC’

A’ X=1 X=1 X=0 0

A 1 1 0 1

Page 74: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

SEQUENTIAL CIRCUITS

Page 75: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Definition

• A sequential circuit is a circuit whose response depends on its past inputs– After n attempts to enter a password, the

systems stops asking the user for the correct password

– “Three strikes and you are out” laws• A sequential circuit has a state and requires

some memory capability to store that state

Page 76: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Overall organization

Input OutputSequential

Circuit

Feedback

Memory

Page 77: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Classes of sequential circuits

• Synchronous sequential circuits:– Can only modify their state when a clock pulse

is applied• Asynchronous sequential circuits:

– Can modify their state at any time– Feedback from memory can cause instabilities– Much less used

Page 78: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

S-R Latch

• Two inputs– S for set (to one)– R for reset (to zero)

• Two complementary outputs Q and Q’.– Input S sets Q and resets Q’– Input R resets Q and sets Q’

Page 79: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

S-R latch using NOR gates

Q’

QR

S

The lines that cross in the middle do not touch each other

Page 80: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (I)

• When S = R = 0– If Q =1

• Q’ remains reset• Q remains set

– If Q =0• Q’ remains set• Q remains reset

Page 81: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (II)

• When S = 1 and R = 0– If Q =1

• Q’ remains reset• Q remains set

– If Q =0• S=1 resets Q’• Q’ sets Q

Page 82: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (III)

• When S = 0 and R = 1– If Q =1

• R = 1 resets Q• Q = 0 sets Q’

– If Q =0• Q remains reset• Q’ remains set

Page 83: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (IV)

• When S = R = 1– Nothing works!– Cannot allow it to happen

Page 84: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

S-R latch using NAND gates

Q

Q’R’

S’

Nothing happens as long as R = S = 1

Q and Q’have beenswitched

Page 85: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works

• When S’ = 0– Q NAND gate outputs 1– Both inputs of Q’ NAND gates are 1– Q’ NAND gate outputs 0

• When R’ = 0– Q’ NAND gate outputs 1– Both inputs of Q NAND gates are 1– Q NAND gate outputs 0

Page 86: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock controlled S-R latch (I)

• Will add additional clock input– Nothing can happen without a clock pulse

Page 87: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled S-R latch (II)

Q’

QR

S

Clock

Page 88: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled S-R latch (III)

Q

Q’R

S

Clock Q and Q’ have been switched

Page 89: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works• When S = 1 and Clock = 1

– S input NAND gate outputs 0– Q NAND gate outputs 1– Both inputs of Q’ NAND gates are 1– Q’ NAND gate outputs 0

• When R = 1 and Clock = 1– R input NAND gate outputs 0– Q’ NAND gate outputs 1– Both inputs of Q NAND gates are 1– Q NAND gate outputs 0

Page 90: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled D latch (I)

• Has one single input– S-R latch such that S = R’

• When clock pulse is on– D = 0 resets Q and sets Q’– D = 1 sets Q and resets Q’

• D stands for Delay

Page 91: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled D latch (II)

Q

Q’

D

Clock

Page 92: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

D latch (III)

D

Clock

Q

Q’

Page 93: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled J-K latch (I)

• Avoid the problems of S-R latches• When clock pulse is on

– J = K = 0 does nothing– J = 1 and K = 0 sets Q and resets Q’– J = 0 and K = 1 resets Q and sets Q’– J = K = 1 toggles the latch

• Values of Q and Q’ change from 0 to 1 and from 1 to 0

Page 94: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled J-K latch (II)

Q’

QK

J

Clock

Page 95: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled J-K latch (III)

Q

Q’K

J

Clock

Page 96: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (I)

• When J = 1, Q’ = 1 and Clock = 1– J NAND gate outputs 0– Q NAND gate outputs 1– Q’ NAND gate outputs 0

• When J = 1, Q’ = 0 and Clock = 1– J input has no effect

Page 97: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

How it works (II)

• When K = 1, Q = 1 and Clock = 1– K NAND gate outputs 0– Q’ NAND gate outputs 1– Q NAND gate outputs 0

• When K = 1, Q = 0 and Clock = 1– J input has no effect

• When J = K = 1 and Clock = 1– Either Q = 0 disables the effect of having K = 1 or

Q’ = 0 disables the effect of having J = 1

Page 98: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled J-K latch (IV)

J

K

Clock

Q

Q’

Page 99: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled T latch (I)

• Has a single input– J-K latch such that J=K

• When clock pulse is on– T = 0 keeps current values of Q and Q’

unchanged– T = 1 toggles the latch

• Values of Q and Q’ change from 0 to 1 and from 1 to 0

Page 100: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Clock-controlled T latch (II)

T

Clock

Q

Q’

J-Klatch

Requires very short clock pulses!

Page 101: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Edge-triggered flipflops (I)

• If the clock pulse is not very short,J-K and T flipflops may change state twice during a clock pulse

Page 102: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Edge-triggered flipflops (II)

• Solution is to restrict change to either raising edge (a) or failing edge (b) of clock pulse– Use a short pulse generator

(a) (b)

Page 103: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Short-pulse generator (I)

• Generator takes advantage of switching delay of NOT gate– When input goes from 0 to 1,

output of NOT gate remains at 1 for a short while

Page 104: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Short-pulse generator (II)

Input

Output

Page 105: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

J-K flip flop

J

K

Clock Q

Q’

Page 106: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Conventional representation

J

K

Q

Q’

Clock

Page 107: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Failing edge-triggered JK flipflop

J

K

Q

Q’

Clock

Page 108: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Notes

• There are many many different flipflops and latches

• Not all authors agree that – Latches are always level-triggered– Flipflops are always edge-triggered

Page 109: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Sequential circuit synthesis

• Multistep process:– Construct a conceptual representation of

circuit• Finite-state machine

– Assign flipflop values to states– Build Karnaugh maps– Select flipflop types

Page 110: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Example

• A very simple binary counter– Counts input pulses– Goes through cycle

• 00 01 10 11 00 …• Memory has four states

• Good prototype of bigger counters

Page 111: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 1: The finite-state machine

00

10

01

111/110/11

1/01

1/101/11

0/10

0/010/00

Page 112: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Note

• Each transition is labeled with a pair i/o where– i are the input value(s) triggering the transition– o are the output value(s) associated with the

transition• Our counter has no outputs other than the

values of its flipflops

Page 113: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (I)

• Truth table for least significant bit Y

• Flips when A = 1

X’Y’ X’Y XY XY’

A’ 0 1 1 0

A 1 0 0 1

Page 114: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (I)

• Truth table for least significant bit Y

• Flips when A = 1

X’Y’ X’Y XY XY’

A’ 0 1 1 0

A 1 0 0 1

Page 115: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (II)

• Solution is

Y = A’Y + AY’

• Could use a D flipflop and an XOR• Better to use a T flipflop alone

Page 116: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (III)

• Truth table for most significant bit X

• Flips when A = Y = 1

X’Y’ X’Y XY XY’

A’ 0 0 1 1

A 0 1 0 1

Page 117: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (III)

• Truth table for most significant bit X

• Flips when A = Y = 1

X’Y’ X’Y XY XY’

A’ 0 0 1 1

A 0 1 0 1

Page 118: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 2: Karnaugh maps (IV)

• Solution is

X = A’Y + AX’Y + XY’

• Will use a T flipflop and an AND

Page 119: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Step 3: The circuit

T Q’

QX

Clock

TQ’

QY

Clock

Page 120: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Notes

• In general, the assignment of states to flipflops is not as trivial– Start the state-transition diagram of the finite

state machine with symbolic names for the states

– Can often reduce the number of states by merging equivalent states

Page 121: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Debouncing switches

• Opening or closing an electrical connection cause transient signals– Interpreted by gates as multiple pulses

• Must debounce each switch

Page 122: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

REVIEW PROBLEMS

Page 123: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Combinatorial circuits

• Simplify the following expression

AB + BC + CA + A’C’

Page 124: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution

• AB + BC + CA + A’C’ =AC +B +A’C’

B’C’ B’C BC BC’

A’ 1 0 1 1

A 0 1 1 1

Page 125: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Combinatorial circuits

• Represent the expression

AB + AC’

only using NAND gates

Page 126: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution

• AB + AC’= ((AB)’ (AC’)’)’

• First NAND computes X = (AB)’• Second NAND computes Y = C’• Third NAND computes Z = (AY)’• Fourth NAND computes (XZ)’ = X’ + Z’

Page 127: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Combinatorial circuits

• Represent the expression

(A + B’)(A’ + C)

using a PLA

Page 128: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution

• Must convert (A + B’)(A’ + C)into a sum of products

(A + B’)(A’ + C) = AA’ + AC + B’A’ + B’C = AC + B’A’ + B’C

Page 129: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Sequential circuits

• Draw the state transition diagram for a sequential circuit outputting 1 if it has received an odd number of 1 inputs and 0 otherwise

Page 130: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution (I)

1/1

0 1

0/0 0/1

1/0

Page 131: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution (II)

• Implementing the circuit will only requirea T flipflop

Page 132: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Sequential circuits

• Build a T flipflop using – A D flipflops– Some gates

Page 133: PRINCIPLES OF DIGITAL CIRCUITS Jehan-François Pâris jparis@uh.edu

Solution

• P is previous state of flipflopA is current input

• Solution is A’P+ AP’ (one XOR)

P’ P

A’ 0 1

A 1 0