Sequential Circuit Design

59
Dec 2012 1 Sequential Circuit Design Shmuel Wimer Bar Ilan University, Engineering Faculty Technion, EE Faculty

description

Sequential Circuit Design. Shmuel Wimer Bar Ilan University, Engineering Faculty Technion, EE Faculty. clock. clock. clock. data. Q. data. Q. Latch. Flop. Q-latch. Q-flop. Latch is transparent on high clock and opaque on low clock. - PowerPoint PPT Presentation

Transcript of Sequential Circuit Design

Page 1: Sequential Circuit Design

Dec 2012 1

Sequential Circuit Design

Shmuel WimerBar Ilan University, Engineering Faculty

Technion, EE Faculty

Page 2: Sequential Circuit Design

Dec 2012 2

clock

data

Latc

hdata Q

clock

Q-latch

Latch is transparent on high clock and opaque on low clock.

Q-flop

Flo

p

data Q

clock

Flip-flop is edge triggered. It transfers input data to Q on clock rising edge.

Memory Elements

Page 3: Sequential Circuit Design

Dec 2012 3

Flo

p

clk

Flo

p

clk

Combinational Logic

TC

Static Sequencing by Flip-Flops

One flip-flop is used on each cycle boundary. Tokens advance from one

cycle to the next on rising edge.

Page 4: Sequential Circuit Design

Dec 2012 4

Static Sequencing by Latches

2-phase system. Phases may be separated by some non overlapping time.

TC

TC/2

tnon-overlap

tnon-overlap

Φ1

Latc

h

Combinational Logic

Combinational Logic

Half-Cycle 1 Half-Cycle 2

Latc

h

Φ1

Latc

h

Φ2

Φ1

Φ2

Page 5: Sequential Circuit Design

Dec 2012 5

Latc

h

Φp

Combinational Logic

TC

tpw

Latc

h

Φp

Static Sequencing by Pulsed Latches

Page 6: Sequential Circuit Design

Dec 2012 6

Combinational Logic

Latc

h

Latc

h

CLK CLK

Flip-Flop

Latc

h

Latc

h

CLK CLK

Flip-Flop

CLK

CLK

Flip-flop sequencing can be viewed as a back-to-back latch pair

Page 7: Sequential Circuit Design

Dec 2012 7

Sequencing Elements Timing Notations

Logic Propagation Delay

pdt

Latch / Flop Clock-to- Propagation Delay

pcqt

Q

Latch / Flop Clock-to- Contamination Delay

ccqt

Q

Logic Contamination Delaycdt

Page 8: Sequential Circuit Design

Dec 2012 8

hold

Latch / Flop Hold Time

t

setup

Latch / Flop Setup Time

t

Latch / Flop -to- Contamination Delay

cdqt

D Q

Latch / Flop -to- Propagation Delay

pdqt

D Q

Page 9: Sequential Circuit Design

Dec 2012 9

Combinational Logic

A Y

Flo

p

clk

D Q

A

Y

clk

D

Q

cdt

pdt

setupt

holdt

ccqt pcqt

Page 10: Sequential Circuit Design

Dec 2012 10

Latc

h

clk

D Q

clk

setupt holdt

D

Latch is transparent when clock is high. In order for a

data change to transfer to output, the latest change

must occur at tsetup before latch turns to opaque. It must

sustain thold after latch turns opaque.

Page 11: Sequential Circuit Design

Dec 2012 11

Latc

h

clk

D Q

clk

setupt holdt

ccqt pcqt

D

Q

cdqt pdqt

When a latch turns transparent the data is transferred

to output at min delay of tccq and max delay of tpcq.

Data change at transparency is transferred to output at

min delay of tcdq and max delay of tpdq .

Page 12: Sequential Circuit Design

Dec 2012 12

Max-Delay Constraints

Q1

D2

TC

clk setuptpcqt

pdt

FF

1

clk

FF

2

clk

Combinational LogicQ1 D2

setup setup

sequencing overhead

c pcq pd pd c pcqT t t t t T t t

Page 13: Sequential Circuit Design

Dec 2012 13

TC

Φ1

Combinational Logic

Combinational LogicL1

D1 Q1

L2

Φ2

D2 Q2

L3

Φ1

D3 Q3

Φ1

Φ2

D1

Q1

D2

Q2

D3

1pdqt

1pdt

2pdqt

2pdt

Page 14: Sequential Circuit Design

Dec 2012 14

1 1 2 2

1 2 1 2

sequencing overhead

c pdq pd pdq pd

pd pd c pdq pdq

T t t t t

t t T t t

Notice that the non overlap between clocks doesn’t

degrade performance.

Flip-Flop can be realized by two latches connected

back to back, yielding expression similar to Flip-Flop

sequencing. 1 2

sequencingoverhead

2pd pd pd c pdqt t t T t

Page 15: Sequential Circuit Design

Dec 2012 15

Combinational LogicL1

Φp

D1 Q1

L2

Φp

D2 Q2

D1

Q1

D2

TCpdqt

pdt

tpw

Page 16: Sequential Circuit Design

Dec 2012 16

If the pulse width is wide enough the max delay is

similar to two-phase latches, except that only one

latch is in the critical path.

setup: pw c pdq pdt t T t t

If the pulse width is narrower than the setup time,

the data must be set up before the pulse falls.

Page 17: Sequential Circuit Design

Dec 2012 17

Combinational LogicL1

Φp

D1 Q1

L2

Φp

D2 Q2

TC tpw

D2

Q1

pcqt

pdtsetupt

setup setup: pw c pcq pd pwt t T t t t t

setup

sequencing overhead

max ,pd c pdq pcq pwt T t t t t Consequently:

Page 18: Sequential Circuit Design

Min-Delay Constraints

Logic circuits cannot be too fast.

Such malfunction is called race condition, hold time

failure or min-delay failure.

Otherwise the input data to next sequential circuit will

change while it is still holding its current data.

Dec 2012 18

Page 19: Sequential Circuit Design

Dec 2012 19

Combinational LogicF

F1

clk

Q1F

F2

clk

D2

Q1

D2

clk

ccqt

holdt cdt

hold hold ccq cd cd ccqt t t t t t

Page 20: Sequential Circuit Design

Dec 2012 20

Φ1

Φ2

Q1

D2

Φ1

Combinational LogicL1

D1 Q1L2

Φ2

D2 Q2

ccqt

cdt

tnon-overlap

holdt

non-overlap hold

1 2 hold non-overlap ,

ccq cd

cd cd ccq

t t t t

t t t t t

Page 21: Sequential Circuit Design

Dec 2012 21

Taking large enough non overlapping time will avoid

min delay problems, but distributing two clocks and

controlling non overlapping time is difficult and

expensive.

Latch-based systems are usually using single clock

and its complement, making non overlapping time be

zero. In that case min delay constraint for flip-flop and

latches is the same.

Page 22: Sequential Circuit Design

Dec 2012 22

Here is a paradox: The logic in latch-based system

requires twice min-delay as in flip-flop. On the other

hand flip-flop can be built by a pair of latches!

The resolution follows from the fact that a flip-flop

has an internal race condition, making its hold time

longer than in latch.

Page 23: Sequential Circuit Design

Dec 2012 23

Φp

Combinational LogicL1

D1 Q1L2

Φp

D2 Q2

tpw

D2

Q1

holdtccqt

cdt

hold hold ccq cd pw cd ccq pwt t t t t t t t

Φp

Page 24: Sequential Circuit Design

Dec 2012 24

Time Borrowing

In flip-flop systems clock sharply delineates the cycles.

Hence clock imposes hard edge.

Latch systems are more flexible due to latch transparency.

Data input of a latch must set up before falling edge.

Page 25: Sequential Circuit Design

Dec 2012 25

Φ1

Latc

h

Combinational Logic

Combinational Logic La

tch

Φ1

Latc

h

Φ2

Φ1

Φ2

Borrowing time across half-cycle

boundary

Borrowing time across pipeline stage boundary

Page 26: Sequential Circuit Design

Dec 2012 26

Φ1

Φ2

Φ1

Latc

h

CL CL

Latc

h

Φ2

Loops may borrow time internally but must complete

within the cycle.

Page 27: Sequential Circuit Design

Dec 2012 27

TC

Φ1

Combinational LogicL1D1 Q1

L2

Φ2

D2 Q2

Φ1

Φ2

setupt

D2

non-overlapt

TC/2 borrowt

borrow setup non-overlap

borrow setup non-overlap

2

2

c c

c

T T t t t

t T t t

Page 28: Sequential Circuit Design

Dec 2012 28

Clock Skew

• Clock should theoretically arrive simultaneously to all

sequential circuits.

• Practically it arrives in different times. The differences

are called clock skews.

• Clock skew consists of the following components:– Systematic is the portion existing under nominal conditions. It

can be minimized by appropriate design.– Random is caused by process variations like devices’ channel

length, oxide thickness, threshold voltage, wire thickness, width and space. It can be measured on silicon and adjusted by delay components.

Page 29: Sequential Circuit Design

Dec 2012 29

FF

1

clk

FF

2

clk

Combinational LogicQ1 D2

setup skew

sequencing overhead

pd c pcqt T t t t

Q1

D2

setuptpcqt

pdt

clk

TC

skewt

Page 30: Sequential Circuit Design

Dec 2012 30

Combinational LogicF

F1

clk

Q1

FF

2

clk

D2

hold skewcd ccqt t t t

ccqt

holdt

cdt

Q1

D2

clk

skewt

Clock skew worsen max and min delay constraints. Max

delay constraint becomes shorter. Min delay constraint

becomes longer.

Page 31: Sequential Circuit Design

Dec 2012 31

In transparent latch system max delay constraints are

not hooked to clock edge since it is assumed that

transparency period is long enough. Hence clock skew

doesn’t affect max delay constrained.

1 2 hold non-overlap skew,cd cd ccqt t t t t t

Min delay constraints are worsen however since they

depend on the non overlap time, which may effectively

be shortened by skew.

Page 32: Sequential Circuit Design

Dec 2012 32

hold skewcd pw ccqt t t t t

Min delay constrained in pulsed latch is increased since

skew effectively increases hold time.

It is also reducing time borrowing.

borrow setup skewpwt t t t

Max delay constraint in pulsed latch is not affected if

pulse is wide enough.

setup skew

sequencing overhead

max ,pd c pdq pcq pwt T t t t t t

Page 33: Sequential Circuit Design

Dec 2012 33

Latches and Flip-flops

D Q

Buffered output inverting latch

D Q

Buffered input inverting latch. It is a tristate inverter.

Both are fast dynamic latches.

Page 34: Sequential Circuit Design

Dec 2012 34

In high leakage, the dynamic latches retain their output

value only for a short period and in order to sustain it,

latches must be static to avoid floating output.

D Q

Tristate feedback inverter

sustains output voltage when

clock is low (latch is opaque).

Input was also be isolated.

A noise spike at output may invert the latch output.

Page 35: Sequential Circuit Design

Dec 2012 35

This is a robust non

inverting latch addressing

all deficiencies

To reduced clock load and save two transistors, the

tristate can be replaced by a weak inverter, called

jamb latch.

D

Q

Page 36: Sequential Circuit Design

Dec 2012 36

D

Q

Dynamic inverting flip-flop can be constructed by a pair

of back-to-back dynamic latches.

To reduce delay at the expense of noise sensitivity,

either first or last inverters can be removed.

Page 37: Sequential Circuit Design

Dec 2012 37

Static non inverting flip-flop is constructed from two

static latches.

Q

D Q

1

2

2 2

2

1

1

1

Page 38: Sequential Circuit Design

Dec 2012 38

For very slow rise / fall time both latches will be

simultaneously transparent, which will require to increase

FF’s hold time.

To sharpen clock edges local clock buffers can be used.

The expense is more area and clock load (power).

Non-overlapping clocks avoid simultaneous transparency.

Making it large enough, large skew can also be tolerated.

Large non-overlapping causes however large setup time

(sequencing overhead).

Page 39: Sequential Circuit Design

Dec 2012 39

Pulsed latch is built from conventional latch driven by

a brief clock pulse, generated by a clock chopper.

tpwtpw

p

p

ptpw

Page 40: Sequential Circuit Design

Dec 2012 40

Sequencing elements require a reset signal to enter a

known initial state or startup. Asynchronous reset forces Q

immediately, while synchronous reset waits for clock edge.

Q

D

RESET

RESET

Asynchronous resettable latch

Page 41: Sequential Circuit Design

Dec 2012 41

DQ

RESET

SET

RESET SET

Asynchronous settable and resettable flip-flop

Set and reset must enter in both master and slave stages

Page 42: Sequential Circuit Design

Dec 2012 42

Q

QD

RESET

Synchronous resettable flip-flop

Reset affects Q only at clock rising

Reset must be stable for setup and hold time

around clock edge.

Page 43: Sequential Circuit Design

Dec 2012

Enabling latches and flip-flops

FF

DQ

1

0

en

Enabling is done on data change. The savings is mostly in suppressing the D generation, known to be unchanged.

It doesn’t affect clock, but affects delay, adds area and power.

43

Page 44: Sequential Circuit Design

Dec 2012 44

Clock gating doesn’t affect delay but may add clock skew. The savings is on the CLK network and FFs.

It significantly reduces power consumption since clock is not toggling on disabled element. AND gate is added to clock driver.

FF

D Q

en

Page 45: Sequential Circuit Design

Dec 2012 45

Static Sequencing Methodology

• Flip-flops: Most popular in non aggressive deigns.

– Simple and robust.

– Setup and hold times are penalties.

– No time borrowing across clock cycle (unless clock is shifted).

• Pulsed Latches: Similar behavior to flip-flops.

– Simpler than FF or transparent latches, less area and power.

– Faster than FF.

– Higher effective hold time, min-delay constraints more difficult.

Page 46: Sequential Circuit Design

Dec 2012 46

• Transparent Latches: Use in high-end designs

– Lower sequencing overhead, faster than FF.

– Allows nearly half cycle time borrowing.

– Complex clock design, sensitive to clock slew rate

Page 47: Sequential Circuit Design

Dec 2012 47

Metastability in a latch

D QA

B

D QA

B

At transparency sample

switch is closed and hold

switch is open.

When latch is opaque sample

switch is open and hold switch is

closed, and the two inverters are

connected in a feedback loop.

Page 48: Sequential Circuit Design

Dec 2012 48

metastable mA B V

stable DDA B V

stable 0A B

A Q

Q B

Latch can enter into

metastable state where

voltages are consistent.

It can remain so

unbounded time!

Page 49: Sequential Circuit Design

Dec 2012 49

Page 50: Sequential Circuit Design

Dec 2012 50

Page 51: Sequential Circuit Design

Dec 2012 51

Though the latch can stay metastable infinite time, the

probability of remaining metastable drops off exponentially

with time.

Stable Stable

Metastable

Any noise or other disturbance will cause A and B node

to switch into one of the stable states.

Page 52: Sequential Circuit Design

Dec 2012 52

When A is near the metastable voltage Vm the cross-

coupled inverters behave like a linear amplifier with gain

G.

Inverter delay can be modeled by output resistance R

and load capacitance C.

G a t R

C

Small signal model

of bistable element

in metastability

Page 53: Sequential Circuit Design

Dec 2012 53

To predict metastability behavior, let latch turn opaque

at 0. The voltage 0 at point is 0 0 ,

where 0 is a small signal offset.

mt A A A V a

a

The current throug is charging ,

,

which solves to 0 exp 1 .

R C

Ga t a t da tC

R dt

a t a t G RC

Page 54: Sequential Circuit Design

Dec 2012 54

If the node is defined to reach legal logic level

when , the time to reach this level is

1 ln ln 0 .DQ

a t V

t RC G V a

Latch propagation delay may reach infinity

if 0 0, which cannot happen in reality

because of noise. There's however no upper

bound for the time until output becomes valid.

a

Page 55: Sequential Circuit Design

Dec 2012 55

To quickly recover from

metastability the term

1 should be

sufficiently large.

G RC

0

0

Latch propagation delay is the time until its

output becomes valid. The probability it will be

1longer than is exp .

and 1 are obtained by measurements

or simulations.

DQ

DQC

t

t GTt P t t

T RC

T G RC

Page 56: Sequential Circuit Design

Dec 2012 56

stable data

unstable data

Page 57: Sequential Circuit Design

Dec 2012 57

Synchronizers and Metastability

• Proper operation of synchronous circuits requires that data

is stable around the clock rising edge.

• Connection to an external input may not satisfy it.

– Input devices like keyboard or mouse are blind to internal system.

– Two systems of different clocks may feed each other.

• What happens when data is changed in the aperture

between setup and hold times?

– Output may be unpredictable and the time for settling to a good

logic level may be unbounded. This is called metastability.

Page 58: Sequential Circuit Design

Dec 2012 58

• A synchronizer is a circuit that accept an input that can

change arbitrarily and produce an output aligned to the

synchronizer’s clock.

• Because the input can change arbitrarily in the

synchronizer’s aperture, there is non zero probability that

synchronizer’s output is still metastable.

• Synchronizers are built to make this probability

sufficiently small.

– It is measured by mean time between failures (MTBF), which

can be set arbitrarily long.

Page 59: Sequential Circuit Design

Dec 2012 59

And one here will almost certainly get resolved.

A metastable state here will probably resolve itself to a valid level before it gets into my circuit.