Documente Academic
Documente Profesional
Documente Cultură
Sequential circuits
Timing methodologies
Basic registers
Asynchronous inputs
shift registers
simple counters
VI - Sequential
Sequential circuits
state is memory
state is an "output" and an "input" to combinational logic
combination storage elements are also memory
new
equal
reset
value
C1
C2
C3
multiplexer
mux
control
comb. logic
state
comparator
equal
VI - Sequential
clock
open/closed
X1
X2
Xn
VI - Sequential
switching
network
Z1
Z2
Zn
VI - Sequential
"load"
"stored value"
Q'
R
S
S'
R'
VI - Sequential
S'
R'
Q'
Timing behavior
Reset
Hold
Q'
Set
Reset
Set
100
Race
R
S
Q
\Q
VI - Sequential
Q'
R
0
1
0
1
Q
hold
0
1
unstable
Q Q'
1 0
Q Q'
0 0
Q Q'
1 1
VI - Sequential
Q'
SR=10
SR=00
SR=01
SR=01
Q Q'
0 1
SR=01
Q Q'
1 0
SR=00
SR=10
SR=10
SR=11
State diagram
SR=11
SR=01
possible oscillation
between states 00 and 11
VI - Sequential
Q Q'
0 0
SR=11
SR=00
SR=11
SR=00
SR=10
Q Q'
1 1
Q'
SR=10
SR=00
SR=01
SR=01
Q Q'
0 1
SR=01
Q Q'
1 0
SR=00
SR=10
SR=10
SR=11
SR=11
SR=00
VI - Sequential
Q Q'
0 0
SR=11
SR=00
Q'
S
S
0
0
0
0
1
1
1
1
R
0
0
1
1
0
0
1
1
Q(t)
Q(t)
0
1
0
1
0
1
0
1
VI - Sequential
Q(t+)
0
hold
1
0
reset
0
1
set
1
X not allowed
X
Q(t+)
S
R
Q(t)
R
characteristic equation
Q(t+) = S + R Q(t)
10
Q'
R
0
0
1
1
0
0
1
1
R
S
S
0
0
0
0
1
1
1
1
Q(t)
S
1
1
1
1
0
0
0
0
R
1
1
0
0
1
1
0
0
VI - Sequential
Q(t)
0
1
0
1
0
1
0
1
Q(t+)
0
1
0
0
1
1
X
X
hold
reset
Q(t)
set
not allowed
R
characteristic equation
Q(t+) = S + R Q(t)
11
otherwise, the
slightest glitch on
R or S while
enable is low could
cause
change in value
stored
R'
enable'
Q'
S'
Set
100
Reset
S'
R'
enable'
Q
Q'
VI - Sequential
12
Clocks
period
VI - Sequential
13
Clocks (contd)
clock
S
Q
S
stablechanging stable changing stable
R and S
clock
VI - Sequential
14
Cascading latches
need to be able to control flow of data from one latch to the next
move one latch per clock period
have to worry about logic between latches (arrows) that is too fast
clock
VI - Sequential
15
Master-slave structure
master-slave flip-flop
twice as much logic
output changes a few gate delays after the falling edge of clock
but does not affect any cascaded flip-flops
slave stage
master stage
CLK
VI - Sequential
16
master stage
Set
S
R
CLK
P
P
Q
Q
1s
Reset catch
VI - Sequential
P
P
CLK
Master
Outputs
Slave
Outputs
17
D flip-flop
Make S and R complements of each other
master stage
CLK
VI - Sequential
10 gates
18
Edge-triggered flip-flops
sensitive to inputs only near edge of clock signal (not while high)
holds D when
clock goes low
0
R
Clk=1
Q
negative edge-triggered D
flip-flop (D-FF)
4-5 gate delays
must respect setup and hold time
constraints to successfully
capture input
0
holds D when
clock goes low
D
VI - Sequential
characteristic equation
Q(t+1) = D
19
Step-by-step analysis
D
Clk=0
Clk=0
S
S
D
new D
new D old D
2004,
20
Positive edge-triggered
D
CLK
Qpos
Qpos
Qneg
Qneg
VI - Sequential
positive edge-triggered FF
negative edge-triggered FF
21
Timing methodologies
(1) correct inputs, with respect to time, are provided to the flipflops
(2) no flip-flop changes state more than once per clocking event
VI - Sequential
22
Definition of terms
clock:
Tsu Th
D Q
D Q
input
clock
clock
VI - Sequential
stable changing
data
clock
23
D Q
CLK
positive
edge-triggered
flip-flop
D
CLK
Qedge
D Q
G
Qlatch
CLK
transparent
(level-sensitive)
latch
VI - Sequential
24
unclocked
latch
always
master-slave
flip-flop
clock high
(Tsu/Th around falling
edge of clock)
negative
clock hi-to-lo transition propagation delay from falling edge
edge-triggered (Tsu/Th around falling of clock
flip-flop
edge of clock)
VI - Sequential
25
Clk
Tsu
Th
1.8
ns
0.5
ns
Tw
3.3
ns
Tpd
3.6 ns
1.1 ns
Tsu
Th
1.8
ns
0.5
ns
Tw
3.3
ns
Tpd
3.6 ns
1.1 ns
all measurements are made from the clocking event (the rising edge of the clock)
VI - Sequential
26
Shift register
IN
Q0
D Q
Q1
OUT
CLK
100
IN
Q0
Q1
CLK
VI - Sequential
27
Tsu
1.8ns
Q0
Tsu
1.8ns
Tp
1.1-3.6ns
Tp
1.1-3.6ns
timing constraints
guarantee proper
operation of
cascaded components
Q1
assumes infinitely fast
distribution of the clock
CLK
Th
0.5ns
VI - Sequential
Th
0.5ns
28
Clock skew
The problem
In
Q0
Q1
CLK0
CLK1
CLK1 is a delayed
version of CLK0
original state: IN = 0, Q0 = 1, Q1 = 1
due to skew, next state becomes: Q0 = 0, Q1 = 0, and not Q0 = 0, Q1 = 1
VI - Sequential
29
Development of D-FF
similar to R-S but with 1-1 being used to toggle output (complement state)
good in days of TTL/SSI (more complex input function: D = J Q + K Q
not a good choice for PALs/PLAs as it requires 2 inputs
can always be implemented using D-FF
VI - Sequential
30
Asynchronous circuits
inputs can change at any time, will not meet setup/hold times
dangerous, synchronous inputs are greatly preferred
cannot be avoided (e.g., reset signal, memory wait, user input)
VI - Sequential
31
Synchronization failure
logic 0
logic 1
logic 0
oscilloscope traces demonstrating
synchronizer failure and eventual
decayB
to steady state
32
2004, Gaetano
asynchronous
input
synchronized
input
Q
Clk
synchronous system
VI - Sequential
33
Clocked
Synchronous
System
Async
Input
D Q
Synchronizer
Q0
Async
Input D Q
D Q
Clock
Clock
D Q
Q1
Clock
VI - Sequential
Q0
D Q
Q1
Clock
34
In
Q0
Q1
In is asynchronous and
fans out to D0 and D1
one FF catches the
signal, one does not
inconsistent state may
be reached!
CLK
VI - Sequential
35
Flip-flop features
(set-dominant)
(reset-dominant)
VI - Sequential
36
Registers
Examples
shift registers
counters
OUT1
OUT2
OUT3
OUT4
"0"
R S
D Q
R S
D Q
R S
D Q
R S
D Q
CLK
IN1
VI - Sequential
IN2
IN3
IN4
37
Shift register
D Q
D Q
OUT2
OUT3
D Q
OUT4
D Q
CLK
VI - Sequential
38
Holds 4 values
left_in
left_out
clear
s0
s1
right_out
right_in
clock
input
VI - Sequential
s1
0
1
0
1
function
hold state
shift right
shift left
load new input
39
clears0
1
0
0
0
0
0
1
0
1
s1
0
1
0
1
new value
0
output
output value of FF to left (shift righ
output value of FF to right (shift le
input
Nth cell
to N-1th
cell
to N+1th
cell
Q
D
CLK
CLEAR
0 1 2 3 s0 and s1
control mux
VI - Sequential
Q[N-1]
(left)
Input[N]
Q[N+1]
(right)
40
parallel inputs
serial transmission
VI - Sequential
41
Pattern recognizer
OUT1
IN
D Q
D Q
OUT2
D Q
OUT3
OUT4
D Q
CLK
VI - Sequential
42
Counters
D Q
D Q
OUT2
OUT3
D Q
OUT4
D Q
CLK
VI - Sequential
43
Activity
D Q
OUT2
D Q
OUT3
D Q
OUT4
D Q
CLK
Counts through the sequence: 1000, 1100, 1110, 1111, 0111, 0011,
0001, 0000
Known as Mobius (or Johnson) counter
VI - Sequential
44
Binary counter
OUT2
D Q
OUT3
D Q
OUT4
D Q
CLK
"1"
VI - Sequential
45
D
C
RCO
B
QD
A
QC
LOAD QB
QA
CLK
CLR
VI - Sequential
46
Offset counters
"1"
"0"
"1"
"1"
"0"
"0"
RCO
QD
D
QC
C
QB
B
QA
A
LOAD
CLK
CLR
"1"
"0"
"0"
"0"
"0"
EN
VI - Sequential
EN
D
C
B
A
LOAD
CLK
CLR
RCO
QD
QC
QB
QA
47
Flip-flops
Shift registers
Simple counters
VI - Sequential
48
Flip-flop in Verilog
VI - Sequential
49
More Flip-flops
Synchronous/asynchronous reset/set
module dff
input
output
reg
(clk, s, r, d, q);
clk, s, r, d;
q;
q;
Asynchronous
module dff
input
output
reg
(clk, s, r, d, q);
clk, s, r, d;
q;
q;
always @(posedge r)
q = 1'b0;
always @(posedge s)
q = 1'b1;
always @(posedge clk)
q = d;
endmodule
VI - Sequential
50
endmodule
VI - Sequential
51
Example: swap
VI - Sequential
52
Register-transfer-level (RTL)
Assignment
VI - Sequential
53
1b0;
1b0;
1b0;
1b0;
VI - Sequential
54
input clk;
output c8, c4, c2, c1, rco;
initial begin
count = 0;
end
assign
assign
assign
assign
assign
assign
assign
assign
assign
c8
c4
c2
c1
=
=
=
=
count[3];
count[2];
count[1];
count[0];
endmodule
endmodule
VI - Sequential
55
Timing methodologies
Basic registers
use of clocks
cascaded FFs work because propagation delays exceed hold times
beware of clock skew
shift registers
counters
VI - Sequential
56