Synchronization
Synchronization
Dr. S. D. Ruikar
Syllabus
Synchronization Fundamentals, Applications of
synchronization (Arbitration of asynchronous signals,
Sampling asynchronous signals, Crossing clock domains),
Synchronization failure and meta-stability, Synchronizer
Design (Mesochronous, Plesiochronous, Periodic
Asynchronous)
Clock domains
Mesochronous
same frequency but different phases
Plesiochronous
slightly different frequencies
Periodic
clearly different frequencies, but the phase difference is periodic
Asynchronous
clearly different frequenciens without a periodic phase difference
Comparison of three Synchronous strategies
D Q
Brute-Force (Waiting) Synchronizer
Synchronizes the asynchronous input A
to the clock Clk
First flip-flop FF1 samples A
– may go into a metastable state,
depending on the timing of A and Clk
Then we await the possible metastable
state to end for a waiting period tw
Usually the waiting time is one clock
cycle, which means that the output of
FF1 is sampled by the second flip-flop
FF2 to generate the final synchronized
signal AS
In general, to implement an N-cycle
waiting period, we need N casca-ded
flip-flops in addition to the sampling
flip-flop FF1
Total synchronization latency is N+1
clock cycles
Brute-Force Synchronization Failure
What if the first flip-flop FF1 is
still in a metastable state after the
one-cycle waiting period ?
– second flip-flop FF2 samples a
metastable state !
ta
PE ta fClk
tcy
Probability of Staying in the Metastable State
Flip-flop is still in the metastable state after the waiting period tw , if the initial voltage
difference V1 was too small to be exponentially amplified to the full value 1 during the
waiting period. Hence, the final value VF is smaller than 1.
Probability of this to happen is defined to be the ratio of such a small initial difference
V1 to the corresponding final value VF
t
VF V1 exp w
s
VF =1
V1 tw
V1 PS exp
V F s
Failure Probability and Frequency
Synchronization failure probability PF is the product of the probabilities of entering and
staying in the metastable state PE and PS
Potentially, every event at the flip-flop data input D can cause a synchronization failure
with the probability PF
Hence, the synchronization failure frequency (synchronization error rate) fF is calculated
by multiplying the failure probability PF by the event frequency fD
t w
PF PE PS t a f Clk exp
s
t w
f F f D PF t a f D f Clk exp
s
VF =1
V1
Two Synchronizer Calculation Examples
Assume that a 1 MHz data signal (fD) is
sampled with a 100 MHz clock signal
(fClk)
Aperture time ta and the regene-ration
time constant s of the sampling flip-flop
are both 200 ps
Waiting period tw is one clock cycle (we
have the second flip-flop):
tw = 1/ fClk = 10 ns
Two Synchronizer Calculation Examples
Assume that a 1 MHz data signal (fD) is
sampled with a 100 MHz clock signal
(fClk)
Aperture time ta and the regene-ration
time constant s of the sampling flip-flop
are both 200 ps
Waiting period tw is one clock cycle (we
have the second flip-flop):
tw = 1/ fClk = 10 ns
We get:
PE = 0.02
PS = 1.94·10 -22
PF = 3.88·10 -24
fF = 3.88·10 -18 Hz
MTBF = 1/ fF = 2.58·10 17 s
= 8.2 ·10 9 years
Mean Time Between Failures
Two Synchronizer Calculation Examples
Assume that a 1 MHz data signal (fD) is Assume that a 10 MHz data signal (fD)
sampled with a 100 MHz clock signal is sampled with a 500 MHz clock signal
(fClk) (fClk)
Aperture time ta and the regene-ration Aperture time ta and the regene-ration
time constant s of the sampling flip-flop time constant s of the sampling flip-flop
are both 200 ps are both 100 ps
Waiting period tw is one clock cycle (we Waiting period tw is one clock cycle (we
have the second flip-flop): have the second flip-flop):
tw = 1/ fClk = 10 ns tw = 1/ fClk = 2 ns
We get:
PE = 0.02
PS = 1.94·10 -22
PF = 3.88·10 -24
fF = 3.88·10 -18 Hz
MTBF = 1/ fF = 2.58·10 17 s
= 8.2 ·10 9 years
Mean Time Between Failures
Two Synchronizer Calculation Examples
Assume that a 1 MHz data signal (fD) is Assume that a 10 MHz data signal (fD)
sampled with a 100 MHz clock signal is sampled with a 500 MHz clock signal
(fClk) (fClk)
Aperture time ta and the regene-ration Aperture time ta and the regene-ration
time constant s of the sampling flip-flop time constant s of the sampling flip-flop
are both 200 ps are both 100 ps
Waiting period tw is one clock cycle (we Waiting period tw is one clock cycle (we
have the second flip-flop): have the second flip-flop):
tw = 1/ fClk = 10 ns tw = 1/ fClk = 2 ns
We get: We get:
PE = 0.02 PE = 0.05
PS = 1.94·10 -22 PS = 2.07·10 -9
PF = 3.88·10 -24 PF = 1.04·10 -10
fF = 3.88·10 -18 Hz fF = 1.04·10 -3 Hz
MTBF = 1/ fF = 2.58·10 17 s MTBF = 1/ fF = 961 s
= 8.2 ·10 9 years = 16 min !!
Mean Time Between Failures
Common Synchronizer Mistakes
Common mistake in synchronizer
design is to make the regeneration time
constant s of the sampling device large
by
– using a dynamic flip-flop
» s is infinitive (no regeneration at
all ! ) D Q
– driving a load with the feedback loop
directly
» load capacitance increases the
effective regeneration time constant
significantly Q
D
load capacitance may be 20 times
the internal capacitance
» for example, if the time constant is Cload
increased from 200 ps to 4 ns, t w
MTBF decreases from 8 billion PF PE PS ta fClk exp
years to 0.6 ms s
t
f F f D PF t a f D f Clk exp w
s
Correct Implementation
Correct way to implement a
synchronizer is to
– use static latches/flip-flops with
feedback loops
– isolate the driven load capacitance from
the feedback loop by appropriate
buffering
Clk’
Q
Clk
Cload
Completion Detection
It is not possible to bound the synchronizer settling time, because in theory a
metastable state may last forever
– so you just have to decide how many clock cycles make a sufficient/safe waiting period
However, it is possible to detect when the synchronizer has been settled !
Consider the below circuit (Vd = decision voltage)
– upper comparator’s output goes high when V < -Vd
– lower comparator’s output goes high when V > Vd
– both outputs are low when -Vd < V < Vd
This can be exploited only in the asynchronous (self-timed) design style
– no use in synchronous (clocked) design !
AFirst
– AFirst
V
+
+Vd -
Done BFirst
–
+ BFirst
+Vd -
Classification of Signal-Clock Synchronization
Synchronous Periodic
– signal has the same frequency and phase – signal and clock have arbitrary
as the clock frequencies but the phase difference is
– it is safe to sample the signal directly periodic
with the clock (synchronizer is not – this information can be used to predict
needed) which signal events occur during the
Mesochronous unsafe portion of the clock, i.e., close to
the sampling edge of the clock
– signal has the same frequency as the
clock but is potentially out of phase, Asynchronous
with an phase difference c – signal is not periodic, which means that
– it is safe to sample the signal if the clock the signal events may occur at arbitrary
or signal is delayed by a constant times
amount – full brute-force synchronizer is needed !
Plesiochronous
– signal and clock have nearly the same
frequency, and hence the phase
difference varies slowly XAsync Sync XSync
– it is safe to sample the signal if the clock
or signal is delayed by a variable
amount Clk
Synchronization Hierarchy
Difficulty of synchronization depends
on the relationship between the clock
and the signal to be sampled
Synchronous
– signal events are always outside the
keep-out region of the clock
Mesochronous
– unknown but constant phase diffe-rence
between the signal and the clock events
Plesiochronous
– phase difference varies slowly
Periodic
– phase difference is periodic
– includes mesochronous and
plesiochronous cases
Asynchronous
– signal events are arbitrary with respect
to clock events
Brute-Force Synchronizer
Synchronizers can be compared in terms
of
– synchronizer delay tz
– failure rate fF
For the brute-force synchronizer:
Inherent
t Amax
t z t w 2t dCQ cy synchronization
delay
2 Aavg
t
f F t a f D f Clk exp w Amin
s
Clk
Can we get rid of the waiting period
min = 0
tw ?
avg = tcy / 2
max = tcy
2
variable delay line
Delay-line synchronizer is not the best
choice for wide data paths, because a
variable delay line is needed for each
data bit separately
Delay-Line Synchronizer
Detection of an Unsafe Signal
Received signal transition is unsafe, if it takes place within the keep-out region of the
receiver clock, i.e., within the aperture of the sampling flip-flop
To detect this, the signal is sampled at the borders of the keep-out region: a flip-flop
setup time ts before and a flip-flop hold time th after the actual sampling edge of the
receiver clock
– if the results are different (XOR gate) the signal is unsafe
– otherwise the signal is safe
Because the involved flip-flops may enter a metastable state, an appropriate time tw has
to be waited before the flag unsafe is updated
– in the mesochronous case we can wait a very long time, as it is done only once !
Flag unsafe is then used to control the delay of the variable delay line
MUX
x
0 xd
1
tko
(= ts + th ) unsafe
x xd
N(txcy – trcy)
Periodic Two-Register Synchronizer
Waiting period must match the clock
MUX
prediction ―degree
rclk
rclk
General Purpose Asynchronous FIFO Synchronizer
Data in inserted into the FIFO buffer with the transmitter clock xclk keeping the control
signal shiftIn high
Data in removed from the FIFO buffer with the receiver clock rclk keeping the control
signal shiftOut high
No actual synchronization delay or failures in the data path
Provides inherent flow control via the full and empty signals
– when the FIFO is about to be overrun, full is asserted, and the transmitter pauses its data
sending process by setting shiftIn low
– when the FIFO is about to be underrun, empty is asserted, and the receiver pauses reading by
setting shiftOut low
shiftOut
Read ptr
Brute-force rclk
full sync
Compare
sx
FIFO
x
Compare
Brute-force empty
sync
xclk
Write ptr
shiftIn
Thank You