DICD-Fall-2024-Lecture-08-Sequential-Logic
DICD-Fall-2024-Lecture-08-Sequential-Logic
Lecture # 08
Design of Sequential Logic Circuits
Muhammad Imran
[email protected]
Acknowledgement
2
Introduction
What is Sequential Logic?
Why Sequential Logic?
Basics of Sequential Logic
Timing Parameters in Sequential Circuits
Other Latch and Flip-Flop Implementations
Basic Timing Constraints
Static Timing Analysis
What is Sequential Logic and why we need it?
Sequential Logic
5
Output is a function of both the current state and the previous state
Circuit has memory!
Sequential circuits are generally Synchronous
Use a clock to synchronize the logic paths
www.tutorialspoint.com
Why use Sequential Logic?
6
Accumulator Example
An accumulator is a register that sums a list of numbers
Therefore, it feeds back the output back to the input
Without a register, there would be the possibility that races would
occur, causing erroneous outputs
We need to delay the output until the original calculation is finished
IN 0 1 0 IN
OUT
OUT 0 1 2
FB
+
FB 0 1 2
Why use Sequential Logic?
7
Accumulator Example
Essential to use sequential logic when
Paths have different delays but need to converge together
We always have to slow our fast paths down so they arrive along with
our slowest path
If we could make all paths have equal delays, we wouldn’t need
sequential logic, but this is really hard (almost impossible) to do
Why use Sequential Logic?
8
Pipelining Example
Small laundry has one washer, one dryer and
one operator, it takes 90 minutes to finish one
load:
Pipelining Example
Doing laundry sequentially
Pipelining Example
Doing laundry in a pipelined manner
Pipelining Data
If it takes 10 time units to process an instruction, we could perform one
instruction every 10 time units:
Instruction Output
Delay
But if we divide the process into 5 tasks that take 2 time units each:
Instruction
Output
Delay
Pipelining Data
But some stages may be faster than others
So we need to hold the input to each stage constant until the previous
stage is done
We achieve this by adding a register in between the stages
When the gain of the inverter in the transient region is larger than 1,
A and B are the only two stable operation points
C is a metastable operation point V Vi2
o1
Vi1 Vo2
Vo1
A
Vi2 = Vo1
Vo2 C
CLK
CLK
Latch vs Flip Flop
16
opaque opaque
Flip Flop
Edge-triggered
locked locked
sample
sample
Latch vs Flip Flop
17
Clock
Input (D)
Latch D
D Q
Flip Flop
Latch Based Design vs Flip Flop Based Design
18
Latch-based
Flip-Flop-based
Static vs Dynamic Latch
19
CLK
S0
D Q
MUX
Q
2:1
D S1
CLK
Static Dynamic
CLK
CLK
Q
CLK D Q
D
CLK
CLK
Multiplexer Based NMOS Latches
21
mid
Input D Q D Q out
Making a Flip Flop
clk clk
22
Input
D Q
mid
D Q
out
Master-Slave (Edge-Triggered) Register
23
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
Asynchronous Set /
Reset Flip Flop
CLK Register
t D Q
tsetup thold
D DATA
CLK
STABLE t
tcq
Q DATA
STABLE t
– propagation delay
tcq
– setup time
tcq is the time from the clock edge until the data appears at the
output
The tcq for rising and falling outputs is different
clk
Q
tcqLH tcqHL tcqLH
Mux Based Flip Flop – tcq Calculation
30
During low clock edge, data traverses slave and “waits” for the clock
at pass gate input
When clock rises, data has to go through pass gate and inverter
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
tcq =T3 I 6
Setup Time – tsetup
31
Setup time is the time the data has to arrive before the clock to
ensure correct sampling
Before clock edge, data should have propagated to the latching pass
gate
Else data will be restored to the previous state
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
tsetup I1 T1 I 3 I 2 T 3I
Timing Analysis – Setup Time
33
Hold time is the time the data has to be stable after the clock to
ensure correct sampling
clk
When the clock rises, T1 closes, latching the data at the output of I1
Therefore, any changes made after the clock will take tpd(I1) to
traverse
The hold time is 0 or – tpd(I1)
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
thold 0
Characterizing Timing
36
tD -
Q
D Q D Q
Clk Clk
tC - Q tC -
Q
Registe Latch
r
Setup Time Violation
37
Set up time
Required time for input to be stable BEFORE clock edge
Hold time
Required time for input to be stable AFTER clock edge
Td_buf = 2ns
Other Latch and Flip Flop Implementations
SR Latch Circuit
40
Dynamic Latch
Static Latch
(Charge-
based)
CLK
CLKb
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
C2MOS – Clocked CMOS
47
CLK = 0
Master stage = evaluation mode,
Slave stage = hold mode (high impedance)
CLK = 1
Master stage = hold mode
Slave stage = evaluation mode
C2MOS – Clocked CMOS
48
CLK
CLKb
April
T
27,
C2MOS – Clocked CMOS
49
CLK
CLKb
April
T
27,
C2MOS – Clocked CMOS
50
April
27,
TSPC – True Single-Phase Clocked Register
51
Example
: AND
latch
TSPC Flip Flop
53
CLK Q
M3 M6 M9
Y
Q
D X CLK
CLK M2 M5 M8
CLK
M1 M4 M7
TSPC latch malfunctions when the slope of the clock is not sufficiently steep
Pulse-Triggered Latches
54
Master-Slave Latches
Instead of a full set of master-slave latches
We can emulate an edge with a short clock pulse L1 L2
Data
D Q D Q
Clk Clk
Clk
Pulse-Triggered Latch
L
Data
D Q Design a clock pulse with a “clock
chopper”
Clk
Clk
Schmitt Trigger Circuits
55
In Out
<Schematic symbol>
There are two main problems that can arise in synchronous logic:
Max Delay: The data doesn’t have enough time to pass from one
register to the next before the next clock edge.
Min Delay: The data path is so short that it passes through several
registers during the same clock cycle.
Max delay violations are a result of a slow data path, including the
registers’ tsetup, therefore it is often called the “Setup” path
Min delay violations are a result of a short data path, causing the
data to change before the thold has passed, therefore it is often
called the “Hold” path
Setup (Max) Constraint
60
clk D Q Logic D Q
A B
D tcq
A clk
B tsetup
Setup (Max) Constraint
61
T tcq t
logic
Hold (Min) Constraint
62
Hold problems occur due to the logic changing before thold has
passed
This is not a function of cycle time – it is relative to a single clock edge!
Let’s see how this can happen:
The clock rises and the data at A changes after tcq
The data at B changes tpd (logic) later
Since the data at B had to stay stable for thold after the clock (for the
second register), the change at B has to be at least thold after the clock
edge
cl
k D Q Logic D Q
tcq
A B
D
clk
Hold (Min) Constraint
63
tcq t hold
Timing Constraints – Summary
64
For Setup constraints, the clock period has to be longer than the
data path delay:
T t t
This sets our maximumcq frequency
logic t setup
If we have setup failures, we can always just slow down the clock
For Hold constrains, the data path delay has to be longer than the
hold time:
t
This is independent
t
cq of clock t
logic hold
period.
If there is a hold failure, you can throw your chip away!
Pipelining – Optimizing Sequential Circuits
65
67
tskew tskew
t jit t jit
Clock jitter
Temporal variations in
consecutive edges of the clock
signal; modulation + random Ref_Clock
noise
Cycle-to-cycle (short-term) tJit,S
Long term tJit,L
tskew tskew
Variation of the pulse width t jit
Important for level sensitive t jit
clocking
Received
Clock
t
Positive and Negative Skew
68
R1 R2 R3
In D Q
Combinational Combinational
D Q
Logic D •••
Logic
Q
CLK
tCLK1 tCLK2 tCLK3
delay delay
Positive
skew
R1 R2 R3
In D Q
Combinational Combinational
D Q
Logic D •••
Logic
Q
tCLK1 tCLK2 tCLK3
delay delay CLK
Negative skew
Setup (Max) Constraint
69
t t t tsetup t jitter
The Capture pathlaunch cq
consists of:
logic
T t t t 2t
Setup (Max) Constraint
70
tcq
T skew t logic tsetup 2t jitter
Hold (Min) Constraint
71
Data has to arrive after the same clock edge has arrived at capture
reg
In addition:
Static Timing Analysis – Example
76
Path 1:
Static Timing Analysis – Example
77
Path 2:
Static Timing Analysis – Example
78
Path 3:
Static Timing Analysis – Example
79
Path 1:
Static Timing Analysis – Example
81
Path 2:
Static Timing Analysis – Example
82
Path 3:
Static Timing Analysis – Example
83
Asynchronous Design
Completion is ensured by careful timing analysis
Ordering of events is implicit in logic
No global clock = no skew = Potentially high speed and low power
High design complexity due to careful timing requirement
Self-Timed Design
Completion ensured by completion signal
Ordering imposed by handshaking protocol
Synchronous vs Self-Timed Pipelined Datapath
87
Relevant Reading
88