Lecture 7 Sequential Logic 2020
Lecture 7 Sequential Logic 2020
(83-313)
Lecture 7:
Designing Sequential
Logic Circuits
Prof. Adam Teman
27 April 2021
Disclaimer: This course was prepared, in its entirety, by Adam Teman. Many materials were copied from sources freely available on the internet. When possible, these sources have been cited;
however, some references may have been cited incorrectly or overlooked. If you feel that a picture, graph, or code example has been copied from you and either needs to be cited or removed,
please feel free to email [email protected] and I will address this as soon as possible.
Sequential Logic
• Sequential circuits are a function of both the
current state and the previous state.
• In other words,
they have memory.
• The majority of sequential
circuits are Synchronous,
using a clock to synchronize
the logic paths.
www.tutorialspoint.com
2
© Adam April
Teman,27, 2021
Lecture Content
3
© Adam April
Teman,27, 2021
Why use Sequential Logic?
4
Explanation through example
• We will look at two examples:
• An accumulator circuit, where sequential
methods are essential to eliminate races.
• A pipelined system, where sequential
methods improve throughput.
5
© Adam April
Teman,27, 2021
What would happen if there were no traffic lights?
6
© Adam April
Teman,27, 2021
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
IN 0 1 0 FB + OUT
OUT 0 1 2
FB 0 1 2
7
© Adam April
Teman,27, 2021
Accumulator Example
• It is 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.
8
© Adam April
Teman,27, 2021
Laundry Example
• Small laundry has one washer, one dryer and one operator,
it takes 90 minutes to finish one load:
9
© Adam April
Teman,27, 2021
Sequential Laundry
• It takes 90 minutes to finish one load.
• The process is sequential.
• Sequential laundry
takes 6 hours
for 4 loads.
10
© Adam April
Teman,27, 2021
Pipelined Laundry
• Every 40 minutes a new load starts and a new load ends.
• Pipelined laundry
takes 3.5 hours
for 4 loads
11
© Adam April
Teman,27, 2021
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
15
Naming Conventions
• In our course we relate to registers as follows:
• a latch is level sensitive
transparent transparent
opaque opaque
• a flip-flop is edge-triggered
locked locked
sample
sample
• There are many different naming conventions
• For instance, many books call
any bi-stable element a flip-flop (such as an SR Latch)
• However, this leads to confusion,
so we will use the convention above (as used in industry).
16
© Adam April
Teman,27, 2021
Latch Vs. Register
• During high clock phases, a latch is transparent,
latching the input on the falling edge.
• However, a Flip Flop only samples the input on the rising edge.
Clock
Input (D)
Latch D Q
D Q
Flip
Flop
17
© Adam April
Teman,27, 2021
Latch Vs. Register
• 3 main options for sequential timing:
• Using Flip-Flops
18
© Adam April
Teman,27, 2021
Static Vs. Dynamic Latch
• A static latch stores its output in a static state
• A dynamic latch uses temporary capacitance to store its state.
• As with logic, this provides a trade-off between area, speed and reliability.
CLK
D Q
S0
MUX
Q
2:1
D S1
CLK
Dynamic Latch
Static Latch
19
© Adam April
Teman,27, 2021
Static Vs. Dynamic Latch
• Some basic implementations of static and dynamic latches.
Static Dynamic
CLK
CLK
Q
CLK D Q
D
CLK
CLK
20
© Adam April
Teman,27, 2021
Ratioed vs. Non-Ratioed Latch
• A static latch can be made by using a feedback inverter.
• The TG (with the driver before it) CLK
must overcome the feedback
D D
inverter to write into the latch.
CLK
CLK
CLK
21
© Adam April
Teman,27, 2021
mid
clk clk
• Conceptually, we can create an edge triggered flip-flop
by combining two opposite polarity latches:
Input
D Q
mid
D Q
out
22
© Adam April
Teman,27, 2021
Master-Slave (Edge-Triggered) Register
• Two opposite latches trigger on edge
• Also called master-slave latch pair
23
© Adam April
Teman,27, 2021
Master-Slave Register
• Multiplexer-based latch pair
I2 T2 I3 I5 T4 I6 Q
QM
D
I1 T1 I4 T3
CLK
25
© Adam April
Teman,27, 2021
Timing Parameters of
Sequential Elements
26
Timing Definitions Register
D Q
CLK
CLK
t
tsetup thold
D DATA
tcq – propagation delay
STABLE t
tcq
tsetup – setup time
Q DATA thold – hold time
STABLE t
27
© Adam April
Teman,27, 2021
Clk-Q Delay - tcq
• 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
28
© Adam April
Teman,27, 2021
Mux based FF – tcq Calculation
• 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
D Q
CLK
CLK
t
tsetup thold
D DATA
tcq – propagation delay
STABLE t
tcq
tsetup – setup time
Q DATA thold – hold time
STABLE t
30
© Adam April
Teman,27, 2021
Setup Time - tsetup
• Setup time is the time the data has to arrive before the clock to ensure correct
sampling.
clk
31
© Adam April
Teman,27, 2021
Mux based FF – tsetup Calculation
• Before clock edge, data should have propagated to the latching pass gate,
or 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
32
© Adam April
Teman,27, 2021
Timing Analysis - Setup Time
• To obtain the setup time of the register while using SPICE, we progressively
skew the input with respect to the clock edge until the circuit fails.
33
© Adam April
Teman,27, 2021
Timing Definitions Register
D Q
CLK
CLK
t
tsetup thold
D DATA
tcq – propagation delay
STABLE t
tcq
tsetup – setup time
Q DATA thold – hold time
STABLE t
34
© Adam April
Teman,27, 2021
Hold Time - thold
• Hold time is the time the data has to be stable after the clock to ensure correct
sampling.
clk
I2 T2 I3 I5 T4 I6 Q
QM
D I1 T1 I4 T3
CLK thold = − I1
36
© Adam April
Teman,27, 2021
Characterizing Timing
tD - Q
D Q D Q
Clk Clk
tC - Q tC - Q
Register Latch
37
© Adam April
Teman,27, 2021
Other Flip Flop
Implementations
39
Problem – Clock Overlap
CLK
CLKb
I2 T2 I3 I5 T4 I6 Q
QM
D I1 T1 I4 T3
CLK
40
© Adam April
Teman,27, 2021
C2MOS – clocked CMOS
• Insensitive to clock overlap.
Low Phase Overlap High Phase Overlap
CLK
41
CLKb
© Adam April
Teman,27, 2021
TSPC – True Single-Phase Clocked Register
TSPC enables including
logic inside the latch!
Example:
Positive latch AND latch
(transparent when CLK= 1)
Negative latch
(transparent when CLK= 0)
42
© Adam April
Teman,27, 2021
TSPC Flip Flop
VDD VDD VDD
CLK Q
M3 M6 M9
Y
Q
D CLK X CLK
M2 M5 M8
CLK
M1 M4 M7
43
© Adam April
Teman,27, 2021
Pulse-Triggered Latches Master-Slave Latches
L1 L2
Data
• Instead of a full set of master-slave latches D Q D Q
Clk
Clk
Clk
44
© Adam April
Teman,27, 2021
Basic Timing Constraints
45
Synchronous Timing
46
© Adam April
Teman,27, 2021
Timing Constraints
• 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.
• 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.
47
© Adam April
Teman,27, 2021
Setup (Max) Constraint
• Let’s see what makes up our clock cycle:
• After the clock rises, it takes tcq for the data to propagate to point A.
• Then the data goes through the delay of the logic to get to point B.
• The data has to arrive at point B, tsetup before the next clock.
• In general, our timing path is a race:
• Between the Data Arrival, starting with the launching clock edge.
• And the Data Capture, one clock period later.
clk D Q Logic D Q
A B
D tcq
A clk
B tsetup
48
© Adam April
Teman,27, 2021
Setup (Max) Constraint
clk D Q Logic D Q
A B
D tcq
A clk
B
thold
50
© Adam April
Teman,27, 2021
Hold (Min) Constraint
51
© Adam April
Teman,27, 2021
Summary
• For Setup constraints, the clock period has to be
longer than the data path delay:
• This sets our maximum frequency. T tcq + tlogic + tsetup
• If we have setup failures, we can always just
slow down the clock.
52
© Adam April
Teman,27, 2021
t DRV_CLK
• Clock jitter
• Temporal variations in consecutive Ref_Clock
delay delay
Positive skew
R1 R2 R3
In Combinational Combinational
D Q D Q D Q •••
Logic Logic
54
© Adam April
Teman,27, 2021
Setup (Max) Constraint
• The Launch path (still) consists of:
• tcq+tlogic+tsetup
tlaunch = tcq + tlogic + tsetup + t jitter
• But if jitter makes the launch clock later,
we need to add it to the data path delay.
• The Capture path consists of:
• The clock period (T) tcapture = T + skew − t jitter
• Positive skew means the capture clock path is longer.
• If jitter makes the capture clock earlier, we need to subtract it.
• Our max constraint is:
• So we get: tcapture tlaunch
T tcq + tlogic + tsetup + 2t jitter − skew
55
© Adam April
Teman,27, 2021
Setup (Max) Constraint
• Data has to arrive before next clock edge.
59
© Adam April
Teman,27, 2021
The Computer Hall of Fame
• The machine that made IBM dominate the computer
industry for 20 years
Source: techradar.com
• Announced April 7th, 1964, the first “upgradable”
and fully “compatible” computer.
• Thomas Watson “bet the business” on this machine
with a $5B investment that was to cannibalize all of
IBM’s existing computers.
• Ranked as one of the all-time top 3 business accomplishments
alongside Ford’s Model T and the Boeing 707.
• The machine that pioneered the 8-bit byte and the peripheral
components made by third parties.
Source:computerhistory.org
Static Timing Analysis
Example
61
STA Example
• We are given a synchronous network with:
tCQ = 150ps, tsetup = 50ps, thold = 100ps, t jitter = 0
• In addition: t = −100ps, t = 50ps
skew1 skew2
62
© Adam April
Teman,27, 2021
STA Example
• We’ll find the setup
constraints for each path:
Path 1: T1 + tskew1 tcq1 + tp,max ( CL1 ) + tsetup2
T1 150p + 1.2n + 50p + 100p = 1500p = 1.5ns → 666MHz
64
© Adam April
Teman,27, 2021
STA Example
• If we could set tskew1 and tskew2,
could we use them to maximize
our frequency?
• If we could equally divide the delay of each path:
ttotal = 3 tcq + tp,max (CL1 + CL2 + CL3 ) + 3 tsetup =
= 450p + 2.7n + 150p = 3.3ns
• So to get the max frequency, set all delays to 1.1ns:
67
© Adam April
Teman,27, 2021