Академический Документы
Профессиональный Документы
Культура Документы
KAIST
maeng@kaist.ac.kr
Sequential Circuits
Combinational Circuits
circuits without feedback output = f (current inputs)
Sequential Circuits
circuits with feedback output = f (current inputs, past inputs, past outputs) how can we feed the past inputs and outputs into the circuits? basis for building memory into logic circuits
x1 x2 x3 . . . Sequential Circuit . . .
y1 y2 y3
xn
ym
Memory is needed to remember that the alarm has to be active until the reset signal arrives
Data TG1
Output
TG2
Two inputs
Set Reset
Reset Set Q
S (a) Circuit t1 1 R 0 1 S 0 1 t2 t3
Qb
Qa
Qb
Timing Waveform
R S R Q
Timing Waveform
Reset Hold Set Reset
\Q
Set
100
Race
R S Q \ Q
Forbidden State
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
Forbidden State
10
QQ 00
QQ 11
11
12
Very difficult to observe R-S Latch in the 1-1 state Ambiguously returns to state 0-1 or 1-0 A so-called "race condition"
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 13
Derived K-Map:
SR Q( t ) 0 00 0 1 01 0 0 R 11 X X S 10 1 1
Characteristic Equation: Q+ = S + R Q t
S R Q
R-S Latch
Q+
14
15
Gated SR latch
Control when R and S inputs matters
the latch can be modified to respond to the input signal S and R only when Enable =1
output is stable output is changing
\S \Q
\R Q \enb
Set
Reset
16
Gated SR Latch
17
S Q Clk Q R
18
19
Cascading Latches
R
R S
Q Q
R S
Q Q
S clock
20
S=R=1
21
Q+
0 1 0 0 1 1 1 0
Characteristic Equation: Q+ = Q K + Q J
22
Reset
100
Toggle
Race Condition Toggle Correctness: Single State change per clocking event Solution: Master/Slave Flipflop
23
Slave Stage
R R-S Latch Q Q \Q \Q
Clk
Uses time to break feedback path from outputs to inputs! Uses time to break feedback path from outputs to inputs!
24
Master/Slave D Flip-Flop
Master D Clock D Q Qm Slave D Q Qs Q Q
Clk Q
Clk Q
(a) Circuit
Clock D Qm Q = Qs
Q Q
25
positive-edge-triggered D flip-flop
1 P3
P1 5
Clock P2 6
Clock = 0 Output of gate 2 and 3 are high -> P1,P2 high Output is maintained Clock = 1 P3 and P4 are transmitted through gate 2 and 3 to cause P1 = D and P2 = D. Q This sets Q = D and Q = D P3 and P4 must be stable when the clock goes from 0 to 1. After that, the changes in D have no effect.
Q
P4
Clock
(a) Circuit
26
(a) Circuit
Clock D Q a Q b Q c 2004Spring CS211 Digital Systems & Lab (b) Timing diagram 2007 (jinsoo@cs.kaist.ac.kr) 27
Clear (a) Circuit Preset D Q Q Clear (b) Graphical symbol 2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
28
(a) Circuit
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 29
Clear D Clock
Q Q
Q Q
30
T Flip-Flop
T D T Q Q Q Q 0 1 Q(t + 1) Q(t ) Q(t ) Q
(a) Circuit
Clock T Q
(d) Timing diagram 2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 31
(a) Circuit
J K Q ( t + 1) 0 0 1 1 0 1 0 1 Q (t) 0 1 Q (t ) J K Q Q
Timing Methodologies
Set of rules for interconnecting components and clocks
When followed, guarantee proper operation of system
Correct Timing:
(1) correct inputs, with respect to time, are provided to the FFs (2) no FF changes more than once per clocking event
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 33
Definition of Terms
Clock: Periodic Event, causes state of memory element to change rising edge, falling edge, high level, low level Setup Time (Tsu) Minimum time before the clocking event by which the input must be stable Hold Time (Th) Minimum time after the clocking event during which the input must remain stable
Tsu Input
Th
Clock
There is a timing There is a timing "window" around the "window" around the clocking event clocking event during which the input during which the input must remain stable must remain stable and unchanged and unchanged in order in order to be recognized to be recognized
34
tplh
tphl
35
Edge triggered device sample inputs on the event edge Transparent latches sample inputs as long as the clock is asserted Timing Diagram:
D
7476
D C Clk Level-sensitive latch Q
Behavior the same unless input changes while the clock is high
36
37
Setup time Hold time Clk Minimum clock width Propagation delays (low to high, high to low, max and typical) Q
T phl 40 ns 25 ns
All measurements are made from the clocking event that is, the rising edge of the clock
38
Setup time Hold time Minimum Clock Width Propagation Delays: high to low, low to high, maximum, typical data to output clock to output
Clk
T phl C Q 25 ns 14 ns T phl D Q 16 ns 7 ns
Timing Methodologies
Shift Register S,R are preset, preclear New value to first stage while second stage obtains current value of first stage
IN D Q Q0 D Q Q1
C Q CLK
C Q
Q0 Q1 Clk
40
Timing constraints Timing constraints guarantee proper guarantee proper operation of operation of cascaded components cascaded components
Q1 Clk
Th 5 ns
Th 5 ns
41
In Q0 Q1 Clk1 Clk2
43
Choosing a Flipflop
R-S Clocked Latch:
used as storage element in narrow width clocked systems its use is not recommended! however, fundamental building block of other flipflop types
D Flipflop:
minimizes wires, much preferred in VLSI technologies simplest design technique best choice for storage registers
T Flipflops:
don't really exist, constructed from J-K FFs usually best choice for implementing counters
Registers
Collection of Flip-Flops with similar controls and logic
stored values somehow related share clocks, reset, and set lines similar logic at each stage
Examples
storage registers shift registers counters
45
Storage Register
+ \clr
Q3
DS
Group of storage elements read/written as a unit 4-bit register constructed from 4 D FFs Shared clock and clear lines Schematic Shape
D3
Q2
DS
171
12 CLK 13 CLR Q3 Q3 Q2 Q2 Q1 Q1 Q0 Q0 9 10 7 6 2 3 1 15
D2
S R
Q1
D1 D0
D
11 5 4 14
D3 D2 D1 D0
S R
Q0
TTL 74171 Quad D-type FF with Clear (Small numbers represent pin #s on package)
clk
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 46
Kinds of Registers
Input/Output Variations Selective Load Capability Tri-state or Open Collector Outputs True and Complementary Outputs
377
11 1 18 17 14 13 8 7 4 3 CLK EN D7 D6 D5 D4 D3 D2 D1 D0 Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 19 16 15 12 9 6 5 2
374
11 18 17 14 13 8 7 4 3 CLK H QH G QG F QF E QE D QD C QC B QB A QA OE 1 19 16 15 12 9 6 5 2
EN enabled low and lo-to-hi clock transition to load new data into register
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
In In Clock D Q Q Q1 D Q Q Q2 D Q Q Q3 D Q Q Q4 t0 Out t1 t2 t3 t4 1 0 1 1 1 0 0 0
Q1 0 1 0 1 1 1 0 0
Q2 0 0 1 0 1 1 1 0
Q3 0 0 0 1 0 1 1 1
Q4 = Out 0 0 0 0 1 0 1 1
(a) Circuit
t5 t6 t7
48
Q Q
Q Q
Q Q
Q Q
Serial input Shift/Load 2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
Parallel input
Clock 49
S1,S0 determine the shift function S1 = 1, S0 = 1: Load on rising clk edge synchronous load S1 = 1, S0 = 0: shift left on rising clk edge LSI replaces element D S1 = 0, S0 = 1: shift right on rising clk edge RSI replaces element A S1 = 0, S0 = 0: hold state Multiplexing logic on input to each FF!
Shifters well suited for serial-to-parallel conversions, such as terminal to computer communications
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 50
Parallel Inputs
10 S1 9 S0 7 LSI 6 D D7 5 C 194 D6 4 D5 D4 3B A 2 RSI Clock 11 CLK 1 CLR 10 S1 9 S0 7 LSI 6 D 5 C 194 4 3B A 2 RSI 11 CLK 1 CLR
12 13 14 15
10 S1 9 S0 7 LSI 6 D 5 C 194 4 3B A 2 RSI 11 CLK 1 CLR 10 S1 9 S0 7 LSI 6 D 5 C 194 4 3B A 2 RSI 11 CLK 1 CLR
12 D7 13 D6 14 D5 15 D4
Parallel Outputs
12D3 13D2 14D1 15D0
D3 D2 D1 D0
12 13 14 15
Serial transmission
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr) 51
Counters
Counters
Proceed through a well-defined sequence of states in response to count signal 3 Bit Up-counter: 000, 001, 010, 011, 100, 101, 110, 111, 000, ... 3 Bit Down-counter: 111, 110, 101, 100, 011, 010, 001, 000, 111, ... Binary vs. BCD vs. Gray Code Counters A counter is a "degenerate" finite state machine/sequential circuit A counter is a "degenerate" finite state machine/sequential circuit where the state is the only output where the state is the only output
52
Asynchronous counters
Ripple counter
1 Clock
State transitions are not sharp! Can lead to "spiked outputs" from combinational logic decoding the counter's state
Q Q
Q Q
Q Q
Q0
Q1
Q2
(a) Circuit
Clock Q0 Q1 Q2 Count 0 1 2 3 4 5 6 7 0
A three-bit up-counter
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
Q0
Q1
Q2
(a) Circuit
Clock Q0 Q1 Q2 Count 0 7 6 5 4 3 2 1 0
Synchronous counter
Asynchronous counters
simple, but not very fast can build faster counters by clocking all FFs at the same time synchronous counter
Clock cycle Synchronous counters with T F/F 0 1 2 3 4 5 6 7 8 Q2 Q1 Q0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Q1 changes Q2 changes
55
(a) Circuit
Clock Q0 Q1 Q2 Q3 Count 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1
Enable Clock
Q Q
Q Q
Q Q
Q Q
Clear
57
D Q Q
Q1
D Q Q
Q2
D Q Q Clock
2004Spring CS211 Digital Systems & Lab 2007 (jinsoo@cs.kaist.ac.kr)
Q3
Output carry
58
D1
0 1
Q Q
Q1
D2
0 1
Q Q
Q2
D3
0 1
Q Q
Q3
Load Clock
Output carry
59
Catalog Counter
7 P 10 T 163 15 2 CLK RCO 6 5 4 3 9 1 D C B A LOAD CLR QD QC QB QA 11 12 13 14
Synchronous Load and Clear Inputs Positive Edge Triggered FFs Parallel Load Data from D, C, B, A P, T Enable Inputs: both must be asserted to enable counting RCO: asserted when counter enters its highest state 1111, used for cascading counters "Ripple Carry Output"
74163 Synchronous 4-Bit Upcounter 74161: similar in function, asynchronous load and reset
60
61
(a) Circuit
Clock Q0 Q1 Q2 Count 0 1 2 3 4 5 0 1
62
(a) Circuit
Clock Q0 Q1 Q2 Count 0 1 2 3 4 5 0 1 2
Ring counters
One bit is one while other bits are 0 one hot encoding
Johnson counter
1000, 1100, 1110, 1111, 0111, 0011, 0001, 0000,
64
BCD 0
Q0 Q1 Q2 Q3
BCD 1
65
Ring Counter
Q0 Start Q1 Qn ? 1
Q Q
Q Q
Q Q
Clock
Q0 Q1 Q2 Q3 y0 w1 y1 y2 y3 w0
2-to-4 decoder En
1 Q1 Q0
Clock
Clock
66
Johnson counter
Q0 Q1 Qn 1
Q Q
Q Q
Q Q
Reset Clock
67