





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Digital Design Copyright © 2006 Frank Vahid
Slides to accompany the textbook Digital Design , First Edition, by Frank Vahid, John Wiley and Sons Publishers, 2007. http://www.ddvahid.com
Copyright © 2007 Frank Vahid
Instructors of courses requiring Vahid's Digital Design textbook (published by John Wiley and Sons) have permission to modify and use these slides for customary course-related activities, subject to keeping this copyright notice in place and unmodified. These slides may be posted as unanimated pdf versions on publicly-accessible course websites.. PowerPoint source (or pdf with animations) may not be posted to publicly-accessible websites, but may be posted for students on internal protected sites or distributed directly to students by other electronic means. Instructors may make printouts of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. Instructors may obtain PowerPoint source or obtain special use permissions from Wiley – see http://www.ddvahid.com for information.
Digital Design Copyright © 2006 Frank Vahid
combinational circuit), but on past sequence of inputs
one bit
register
sequential circuit having a register and combinational
logic
si
ze
ansis
Combinational digital circuit
a
b
a
b
Must know sequence of past inputs to know output
Sequential digital circuit
Note: Slides with animation are denoted with a small red "a" near the animated items
Digital Design Copyright © 2006 Frank Vahid
Example Needing Bit Storage
Call Q
Cancel
Doesn’t work. Q=1 when Call=1, but
doesn’t stay 1 when Call returns to 0
Need some form of “feedback” in the circuit
a
a
Bit Storage
Call Blue light button
Cancel button
Bit Storage
Call Blue light button Cancel button
Bit Storage
Call Blue light button
Cancel button
Digital Design Copyright © 2006 Frank Vahid
First attempt at Bit Storage
S Q
t
0 1 0 1 0 1 0
Q
t
S
t
1 t
0 Q
S (^1) a
Digital Design Copyright © 2006 Frank Vahid
Problem with SR Latch
t 0 1 Q 0
Q may oscillate. Then, because one path will be
slightly longer than the other, Q will eventually
settle to 1 or 0 – but we don’t know which.
Digital Design Copyright © 2006 Frank Vahid
Problem with SR Latch
same time
supposedly never sets S=1 and R=1 at same time
The longer path from X to R than to S causes SR=11 for short time – could be long enough to cause oscillation
Y^ R
X S^
SR latch
Q
Arbitrary circuit
Digital Design Copyright © 2006 Frank Vahid
Solution: Level-Sensitive SR Latch
Though SR=11 briefly...
...S1R1 never = 11
S C
Q’ Q R
Clk
Level-sensitive SR latch
0
1
0
1
1
a
Digital Design Copyright © 2006 Frank Vahid
Clock Signals for a Latch
Clk
Level-sensitive SR latch
Digital Design Copyright © 2006 Frank Vahid
Problem with Level-Sensitive D Latch
D1 Q1 D2 Q2 D3 Q3 D
C1 C2 C3 C
Y Q
Clk
Clk_A Clk_B
Clk
rising edges
Digital Design Copyright © 2006 Frank Vahid
D Flip-Flop
Clk
rising edges
Note: Hundreds of different flip- flop designs exist
D latch
master
D latch
servant
D Dm Ds
Cs
Qm Qs’
Qs
Q
Q’
Cm
Clk
D flip-flop
Digital Design Copyright © 2006 Frank Vahid
D Flip-Flop
D Q’
Q
D Q’
Q
Symbol for rising-edge
triggered D flip-flop
Symbol for falling-edge
triggered D flip-flop
Clk
rising edges
Clk
falling edges
Internal design: Just invert servant clock rather than master
The triangle
means clock
input, edge
triggered
Digital Design Copyright © 2006 Frank Vahid
D Flip-Flop
travels when C=
Y D1 Q1 D2 Q2 D3 Q3 D4 Q
Clk
Clk_A Clk_B
T w ol a tches
insideeach fli p
Digital Design Copyright © 2006 Frank Vahid
Bit Storage Summary
arrived at the robust D flip-flop bit storage
D flip-flop D latch
master
D latch
servant
DmQm Cm
D Ds
Clk
Qs’ Cs Qs
D latch
Feature: Only loads D value present at rising clock edge, so values can’t propagate to other flip-flops during same clock cycle. Tradeoff: uses more gates internally than D latch, and requires more external gates than SR – but gate count is less of an issue today.
Feature: SR can’t be 11 if D is stable before and while C=1, and will be 11 for only a brief glitch even if D changes while C=1. Problem: C=1 too long propagates new values through too many latches: too short may not enable a store.
Level-sensitive SR latch
Feature: S and R only have effect when C=1. We can design outside circuit so SR=11 never happens when C=1. Problem: avoiding SR= can be a burden.
R (reset)
S (set)
SR latch
Feature: S=1 sets Q to 1, R=1 resets Q to 0. Problem: SR=11 yield undefined Q.
Digital Design Copyright © 2006 Frank Vahid
Basic Register
I3 I2 I1 I
Q3 Q2 Q1 Q
reg(4)
Digital Design Copyright © 2006 Frank Vahid
Example Using Registers: Temperature Display
x4 a x x x
x
C
a3 a2 a1 a
tempe
ra
tu
re
sensor
timer
Display
Present
b4 b3 b2 b1 b
Display
TemperatureHistoryStorage
1 hour ago
c4 c3 c2 c1 c
Display
2 hours ago
(In practice, we would actually avoid connecting the timer output C to a clock input, instead only connecting an oscillator output to a clock input.)
Digital Design Copyright © 2006 Frank Vahid
Example Using Registers: Temperature Display
x4...x0 21 21 22 24 24 24 25 25 26 26 26 27 27 27 27
Ra
Rb
Rc
x x x x x
Ra Rb
a4 a3 a2 a1 a
Rc
b4 b3 b2 b1 b
c4 c3 c2 c1 c
TemperatureHistoryStorage
Digital Design Copyright © 2006 Frank Vahid
Describing Behavior of Sequential Circuit: FSM
behavior of sequential circuit
among states
Outputs: x
Off On
x=0 x=
clk^
clk^
Digital Design Copyright © 2006 Frank Vahid
FSM Example: 0,1,1,1,repeat
edge to next state
Off On1On2 On3 OffOn1On2On3Off
clk
x
State
Outputs:
Outputs: x
Off On1 On2 On
clk^
clk^
x=0 clk^ x=1 x=1 clk^ x=
Digital Design Copyright © 2006 Frank Vahid
Extend FSM to Three-Cycles High Laser Timer
0 (b’)
clock edge), transition to
On
transition to On2, then On3,
which also set x=
button pressed
Digital Design Copyright © 2006 Frank Vahid
FSM Simplification: Rising Clock Edges Implicit
transition: cluttered
edge has rising clock, even if not
shown
without a rising edge
common, and advanced topic
FSMs -- rising edge on every
transition
Note: Transition with no associated condition thus transistions to next state on next clock cycle
On1 On2 On
Off
x=1 x=1 x=
x=
b’
b
Inputs: b; Outputs: x
Inputs: b; Outputs: x
a
Digital Design Copyright © 2006 Frank Vahid
FSM Example: Secure Car Key (cont.)
for different input sequence
and output values for different
input waveforms
r=1 r=1 r=0 r=
Wait r=
Inputs: a; Outputs: r
a a’
Wait Wait K1 K2 K3 K4 Wait Wait
clk
Inputs
Outputs
State
a
r
clk Inputs a
Wait Wait K1 K2 K3 K4 WaitK
Output
State
r
Q: Determine states and r value for
given input waveform:
a
Digital Design Copyright © 2006 Frank Vahid
FSM Example: Code Detector
buttons pressed in sequence:
Q: Can you trick this FSM to open the door, without knowing the code?
A: Yes, hold all buttons simultaneously
a
a
a
Digital Design Copyright © 2006 Frank Vahid
Improve FSM for Code Detector
Note: small problem still remains; we’ll discuss later
Wait
Start
Red1 Blue Green Red
s’
a’
a’
ab ag^ ar
a’ a’ u=
u= ar
u= s
u=0 u=0 u=
ar’ ab’ ag’ ar’ (^) a
Inputs: s,r,g,b,a;
Outputs: u
Digital Design Copyright © 2006 Frank Vahid
Standard Controller Architecture
circuit?
a
On1 On2 On
Off
x=1 x=1 x=
x=
b’
b
Inputs: b; Outputs: x
Combinational logic
State register
s1 s
n
n
b x
clk
FSM
outputs
FSMinputs FSM outputs
General version
m
m-bit state register
outputs
FSMinputs
Digital Design Copyright © 2006 Frank Vahid
Controller Design: Laser Timer Example (cont)
Combinational logic
State register
s1 s
n
n
b x
clk
FSMinputs
outputs
a
Digital Design Copyright © 2006 Frank Vahid
Controller Design: Laser Timer Example (cont)
combinational logic
Combinational logic
State register
s1 s
n
n
b x
clk
FSMinputs
outputs
a
x = s1 + s0 (note from the table that x=1 if s1 = 1 or s
n1 = s1’s0b’ + s1’s0b + s1s0’b’ + s1s0’b
n1 = s1’s0 + s1s0’
n0 = s1’s0’b + s1s0’b’ + s1s0’b
n0 = s1’s0’b + s1s0’
Digital Design Copyright © 2006 Frank Vahid
Controller Design: Laser Timer Example (cont)
combinational logic (cont)
a
x = s1 + s
n1 = s1’s0 + s1s0’
n0 = s1’s0’b + s1s0’
Combinational logic
State register
s1 s
n
n
b x
clk
FSMinputs
outputs
n
n
s1 s
clk
Combinational Logic
State register
b
FSMoutputs
FSMinputs
x
Digital Design Copyright © 2006 Frank Vahid
Understanding the Controller’s Behavior
s1 s
b (^) x
n
n
x=1 x=1 x=
b
(^01) On1 (^10) On2 11
Off
On
00
b’
x=
clk
clk
Inputs:
Outputs:
b
s1 s
b (^) x
n
n
x=1 x=1 x=
b’
(^01) On1 (^10) On2 11
Off
On
clk
b
x
00
x=
state=00 state=
s1 s
b (^) x
n
n
x=1 x=1 x=
x=
b
b’
01
00
On1^10 On2^11
Off
On
clk 0 1 1 0
state=
a