28
Synchronous sequential logic – state changes occur in lock step across all storage elements (using a clock signal – a periodic waveform) Sequential logic Clock Asynchronous sequential logic – state changes may occur whenever inputs change (elements may be simple wires or delay elements)

Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

  • Upload
    dinhdat

  • View
    225

  • Download
    5

Embed Size (px)

Citation preview

Page 1: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Synchronous sequential logic – state changes occur in lock step across all storage elements (using a clock signal – a periodic waveform)

Sequential logic

Clock

Asynchronous sequential logic – state changes may occur whenever inputs change (elements may be simple wires or delay elements)

Page 2: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Basis of sequential circuits: the R-S latch

can force output to 0 (reset) or 1 (set)

R

S

Q

QRS

Q

Cross-coupled NOR gates

0D

D’ 1D

0

fundamental component of ALL latches and flip-flops

Page 3: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

0

0

Q

R

S

Q

Q

R

S

Q

Q

Two stable states when R=S=0

Q

Page 4: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

R

S

Q

Q

R

S

Q

Q

S changes 0⇒1

Page 5: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

R

S

Q

Q

R

S

Q

Q

R changes 0⇒1

Page 6: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

R

S

Q

Q

R

S

Q

Q

S and R =1

Inconsistent

values

Page 7: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

R

S

Q

Q

R

S

Q

Q

S and R change 1⇒0

Page 8: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Summary: the R-S latch

Reset Hold Race

RS

Q

Timing waveform

RSQQ

Set Force

R

S

Q

Q

Page 9: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Gated R-S Latch

Q

Q

CLK

S

R

CLKoperates as R-S latch holds value

R and S better not both be 1 here

Page 10: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Q

\Q

CLK

D

Gated D Latch

0 -- Q(t)

Clk D Q(t+1)

1 0 0

1 1 1

R

S

CLK

D Q

Page 11: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Latches vs Flip-Flops

behavior is the same unless input changeswhile the clock is high

positiveedge-triggered

flip-flop

transparent(level-sensitive)

latch

D

Clk

Q edge

Q latch

D Q

CLK

D Q

Page 12: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Master Slave Flip-Flops

CLK

D QD QM

D

M

Clk

Clk

ClkQ

CLK

D Q

Negative edge-triggered Flip-Flop

D Q

Page 13: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

A Smaller Negative edge-triggered flip-flopSensitive to inputs only near edge of clock signal

Setup and hold times necessary to successfully latch the input

Characteristic equation: Q(t+1) = D(t)

holds D whenclock goes low holds D when

clock goes low

QR

S

Q

Q

S

R

Q

Q

Clk = 1

DD’

0

0

D

0

4-5 gate delays

D Q

Page 14: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Analysis of negative edge-triggered flip-flop

\QR

S

Q

Q

S

R

Q

Q

Clk = 1

DD’

D

Clk = 0Q

D’

D

D

D’

D’

Q

Clk = 1

D

Clk = 0 QD’

newDQ

D

Clk = 1Clk = 0 QD’

newDnewDnewD newDnewDnewDnewD

When Clk=0 two stable states

Page 15: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

S

R

Q

Q

Analysis of negative edge-triggered flip-flop

Q

S

Q

Q

Clk = 1

D

Clk = 0 Q

D

Hold or setup time violation:D changes before the effects of the clock edge have propagated through flip-flop

S

R

Q

Q

Page 16: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Clocking Terminologyclock: periodic event, causes state of memory element to change

can be rising edge or falling edge or high level or low level

setup time: minimum time before the clocking event by which theinput must be stable ( )

hold time: minimum time after the clocking event for which theinput must remain stable ( )

there is a timing "window" around the clocking event during which the input must remain stable and unchanged in order to be recognized

clock

data

clock

datachangingstable

D Q D Q

clock

input suT hT

suT

hT

Page 17: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Typical timing specificationsPositive edge-triggered D flip-flop

setup and hold timesminimum clock widthpropagation delays (low to high, high to low, max and typical)

All measurements are made from the clocking eventIn this case, the rising edge of the clock

D

Clock

Q

suT hT20ns 5ns

suT20ns 5ns

hT

wT25nswT

25ns

plhT30ns

phlT20ns

Page 18: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Cascaded Flip-Flops

shift register:new value to first stage while second stage

obtains current value of first stage

IN

Q0

Clk

Q1

D1IN

CLK

Q0 Q1D

C

Q

Q

D

C

Q

Q

Page 19: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Cascaded Flip-Flops (continued)Setup/hold/propagation delays must be balancedWorks when: propagation delays far exceed hold times

clock period exceeds setup time(guarantees following stage will latch current valuebefore it is replaced by new value)

assuming perfect clock distribution !!!

IN

D1

Clk

Q0suT

plhT

Q1

hT

phlT

suT

hT

plhT

Page 20: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Cascaded Flip-Flops (continued)

A setup time violation can occur if the propagation delay plus logic/wire delay plus the setup time is more than the clock period.

assuming perfect clock distribution !!!

IN

D1

Clk

Q0suT

plhT

Q1

hTsuT

phlT

A hold time violation can occur if the propagation delay plus logic/wire delay is less than the hold time.

Page 21: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Timing problems

Setup time violationsmust lengthen clock period or speedup signal, get faster logic

Hold time violationsslow down signal, slower logic

Clock skewshifts relative time clock edge arrives at FFs

may lengthen setup and hold time requirements

Asynchronous signalsreal world interfaces - real world isn't controlled by the same clock

interfaces to other systems with different clocks

Page 22: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Clock skewIdeally – all storage elements clocked at the same time

Reality -- different wire delay to different points in the circuit causes skew between clock inputs

Effect of skew on cascaded flip-flops:

IN

D1

Clk

Q0

Q1

Clk2

Page 23: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Clock skewCan shorten time available for logic propagation

Clk

Clk2

suT

pTsuT

pT

suT

Time for logic to propagate

Page 24: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Strategies for minimizing clock skew

Distribute clock signals in general direction of data flow

Wires carrying clock between communicating componentsshould be as short as possible

Make all wires from the clock source the same length

When skew is of same order as FF propagation delays, problems arise.

Worsens as systems get faster (wire delays don't improve as fast as circuit delays).

Page 25: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Metastability and asynchronous inputs

Clocked synchronous circuitsInputs, state, and outputs sampled or changed in relation to acommon reference signal (called the clock)

Asynchronous circuitsInputs, state, and outputs sampled or changed independently of acommon reference signal (glitches/hazards a major concern)(e.g., R-S latch)

Asynchronous inputs to synchronous circuitsInputs can change at any time, will not meet setup/hold timesDangerous, synchronous inputs are greatly preferredUnavoidable (e.g., reset signal, memory wait, user input)

Page 26: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Handling asynchronous inputsNever allow asynchronous inputs to be fanned out to more than one FF Different FFs could decide differently and the result could be an incorrect or illegal state

adds delay to input into system

Q1Q0InClk

D QQ0

Clock

Clock

Q1

AsyncInput

Clocked Synchronous

System

D Q

AsyncInput

Synchronizer

D QQ0

Clock

Clock

Q1D Q

D Q

Page 27: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Synchronizer failureWhen FF input changes near clock edge, the FF may enter a metastablestate – neither a logic 0 nor 1 – it may stay in this state an indefinite amount of time, although this is not likely in real circuits.

small, but non-zero probability that FF output will get stuck in an in-between state

oscilloscope traces demonstratingsynchronizer failure and eventualdecay to steady state

Page 28: Sequential logic - Course Web Pages logic Clock ... Clocking Terminology ... Strategies for minimizing clock skew Distribute clock signals in general direction of data flow

Solutions to synchronizer failureSlow down the system clock

to give synchronizer more time to decay into steady state

Use fastest possible logic in the synchronizerthis makes for a very sharp "peak" upon which to balance

Cascade two synchronizers

Probability of failure can never be made 0, but it can be substantially reduced

Qasynchronousinput

synchronizedinput

Clk

D Q D Q