Upload
aldous-bailey
View
218
Download
1
Embed Size (px)
Citation preview
EE365Adv. Digital Circuit Design
Clarkson University
Lecture #13
Clock Skew & Synchronization
Topics
Rissacher EE365Lect #13
• More Serial
• Clock Skew
• Synchronization
Serial data systems (e.g., TPC)
Rissacher EE365Lect #13
Serial data in the phone system (E-1) • 2.048 Mb/s links between phone switches and
subscribers– partitioned into 32 64 Kb/s channels
• Each channel gets a timeslot in a “frame” where it can send 8 bits every 125 sec.– 8000 frames/sec
Rissacher EE365Lect #13
Timeslot details
count = 255
Rissacher EE365Lect #13
Parallel-to-serial conversion
256
LSBs are bit number
Assert shift-registerLOAD input during bit 7
Timeslot number canbe decoded and usedto select source ofparallel data
Serial data todestination
count = 255
Rissacher EE365Lect #13
Serial-to-parallel
conversion
Synchronize destination’s counter to source’s
Shift in serial data
Detect that acomplete bytehas beenreceived
Holding registerfor completebyte
Note:loads0…0
Rissacher EE365Lect #13
Destination timing
Serial-in, parallel-outshift register outputs
Holding-register outputsGrab complete byte when available
Rissacher EE365Lect #13
Serial communication on ONE wire• Serial communication requires three signals:
CLOCK, SYNC, and DATA. Yet only one “wire” is used. How?
• One solution: Manchester code.
• Or use a phase-locked loop (analog circuit)to extract clock from the data:
Rissacher EE365Lect #13
Still a couple of problems• Framing -- SYNC signal
– Solution: Use a unique data pattern for SYNC
• PLL clock recovery -- what if too many zeroes are transmitted? PLL can’t stay in sync.– Solution: Use a code that guarantees a minimum
number of ones– Phone system: Map 00000000 --> 00000010
(creating slight voice distortion)
• Gigabit Ethernet: Uses 8B10B code, solving both problems– Map each byte into 8 bits– Use only a “good” subset of 210 code words– Use another code word for synchronization
Rissacher EE365Lect #13
Synchronous System Structure
Everything is clocked by the same, common clock
Rissacher EE365Lect #13
Typical synchronous-system timing
• Outputs have one complete clock period to propagate to inputs.
• Must take into account flip-flop setup times at next clock period.
Rissacher EE365Lect #13
Clock Skew– Clock signal may not reach all flip-flops simultaneously.– Output changes of flip-flops receiving “early” clock may
reach D inputs of flip-flops with “late” clock too soon.
Reasons for slowness:(a) wiring delays(b) capacitance(c) incorrect design
Rissacher EE365Lect #13
Clock-skew calculation
• tffpd(min) + tcomb(min) thold tskew(max) > 0
• First two terms are minimum time after clock edge that a D input changes
• Hold time is earliest time that the input may change
• Clock skew subtracts from the available hold-time margin
• Compensating for clock skew:– Longer flip-flop propagation delay– Explicit combinational delays– Shorter (even negative) flip-flop hold times
Rissacher EE365Lect #13
In-Class Practice Problem
Rissacher EE365Lect #13
tffpd(min) = 5 ns
tcomb(min) = 20 ns
thold = 20 ns
tskew(max) = 10 ns
Comb Logic(Excitation Eqns)
CLKDelay
Calculate whether clock-skew is an issue for the indicated Flip-Flop
In-Class Practice Problem
Rissacher EE365Lect #13
tffpd(min) = 5 ns
tcomb(min) = 20 ns
thold = 20 ns
tskew(max) = 10 ns
tffpd(min) + tcomb(min) thold tskew(max) = -5 ns
Calculate whether clock-skew is an issue for the indicated Flip-Flop
In-Class Practice Problem
Rissacher EE365Lect #13
tffpd(min) = 5 ns
tcomb(min) = 20 ns
thold = 20 ns
tskew(max) = 10 ns
Comb Logic(Excitation Eqns)
CLKDelay
Now add a delay to the circuit to fix the issue.
In-Class Practice Problem
Rissacher EE365Lect #13
tffpd(min) = 5 ns
tcomb(min) = 20 ns
thold = 20 ns
tskew(max) = 10 ns
Comb Logic(Excitation Eqns)
CLKDelay
> 5 ns
Example of bad clock distribution
Rissacher EE365Lect #13
Clock distribution in ASICs
• This is what a typical ASIC router will do if you don’t lay out the clock by hand.
Rissacher EE365Lect #13
“Clock-tree” solution
• Often laid out by hand• Wide,fast metal (low R ==> fast RC time constant)
Rissacher EE365Lect #13
Gating the
clock
• Definitely a no-no– Glitches possible if control signal (CLKEN) is
generated by the same clock– Excessive clock skew in any case.
Rissacher EE365Lect #13
If you really must gate the
clock...
Rissacher EE365Lect #13
Asynchronous inputs
• Not all inputs are synchronized with the clock• Examples:
– Keystrokes– Sensor inputs– Data received from a network (transmitter has its
own clock)
• Inputs must be synchronized with the system clock before being applied to a synchronous system.
Rissacher EE365Lect #13
A simple synchronizer
Rissacher EE365Lect #13
Only one synchronizer per input
Rissacher EE365Lect #13
Even worse
• Combinational delays to the two synchronizers are likely to be different.
Rissacher EE365Lect #13
The way to do it
• One synchronizer per input• Carefully locate the synchronization points in
a system.• But still a problem -- the synchronizer output
may become metastable when setup and hold time are not met.
Rissacher EE365Lect #13
Recommended synchronizer design
• Hope that FF1 settles down before “META” is sampled.– In this case, “SYNCIN” is valid for almost a full
clock period.– Can calculate the probability of “synchronizer failure”
(FF1 still metastable when META sampled)
Rissacher EE365Lect #13
Metastability decision window
Rissacher EE365Lect #13
Metastability resolution time
Rissacher EE365Lect #13
Flip-flop metastable behavior• Probability of flip-flop output being in the
metastable state is an exponentially decreasing function of tr (time since clock edge, a.k.a.
“resolution time”).
• Stated another way,
MTBF(tr) = exp(tr /) / [T0 f a] , where
and T0 are parameters for a particular flip-flop,
f is the clock frequency, anda is the number of asynchronous transitions / sec
Rissacher EE365Lect #13
Typical flip-flop metastability parameters
exp(tr /)________ [T0 f a]
MTBF =
MTBF = 1000 yrs.F = 25 MHza = 100 KHz
tr = ?
Rissacher EE365Lect #13
Is 1000 years enough?
• If MTBF = 1000 years and you ship 52,000 copies of the product, then some system experiences a mysterious failure every week.
• Real-world MTBFs must be much higher.• How to get better MTBFs?
– Use faster flip-flops• But clock speeds keep getting faster, thwarting this approach.
– Wait for multiple clock ticks to get a longer metastabilty resolution time
• Waiting longer usually doesn’t hurt performance• …unless there is a critical “round-trip” handshake.
Rissacher EE365Lect #13
Multiple-cycle synchronizer
• Clock-skew problem
Rissacher EE365Lect #13
De-skewed multiple-cycle synchronizer
• Necessary in really high-speed systems• DSYNCIN is valid for almost an entire clock
period.
Rissacher EE365Lect #13
Next time
• CPLDs
• FPGAs
Rissacher EE365Lect #13