Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical...

16
Full Flow Clock Domain Crossing - From Source To Sí Mark Litterick, Verilab, Germany Copyright © Verilab 2016

Transcript of Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical...

Page 1: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Full Flow Clock Domain Crossing - From Source To Sí

Mark Litterick, Verilab, Germany

Copyright © Verilab 2016

Page 2: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Introduction

•  Overview –  pre-silicon flow, metastability & MTBF,

timing analysis for CDC & synchronizers •  Physical Requirements

–  2FF, parallel, handshake & phase-detect synchronizers –  timing requirements & failure modes

•  Continuity & Closure –  pragmatic solutions for encapsulation –  SVA timing checks for continuity –  closure using gate-level CDC analysis,

constraints management & CDC review 13/03/16 Mark Litterick, Verilab 2

Page 3: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Pre-Silicon Flow

13/03/16 Mark Litterick, Verilab 3

front-end

CE concept

V verification D design

PV physical verification

LS logic synthesis

DFT design-for-test LP low-power clk-gates

FP floor planning P&R place & route CTS clock-tree synthesis PS physical synthesis

STA

static timing analysis

SPECIFICATION

RTL

GATE

GDSII back-end

CONSTRAINTS

Physical implementation goals •  transform RTL to GL & GDS • optimize area, power & speed •  timing & routing closure • enable manufacture & test

RTL CDC Verification •  structural analysis •  synchronizer protocol •  operation of rest of DUT in presence of synchronizers

•  relatively early in flow •  less complex than netlist • most defects observable

back-end processes can compromise CDC

effectiveness and break synchronizers

Even with clean RTL CDC signoff

Page 4: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Metastability & MTBF

•  Violation of setup or hold times causes metastability –  unstable state eventually decays to 0 or 1, but unpredictable! –  real-life transistor effect, not observable in simulations or formal –  cannot be avoided, must be designed around & managed

•  Mean Time Between Failures (MTBF) –  probability of metastability not decaying to stable legal value

in time for the next sampling event => catastrophic failure 13/03/16 Mark Litterick, Verilab 4

clk d q

Tsetup

metastable

Thold

eTs/Tc TwFcFd MTBF =

Ts = settling window Tc = settling time constant Tw = window of susceptibility Fc = clock frequency Fd = data update rate

Technology & Implementation

Concept & Application

Page 5: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

out

clk2

in

clk1 Tck_skew Tck_q

Tpath

Timing Arcs & CDC Paths

13/03/16 Mark Litterick, Verilab 5

eTs/Tc TwFcFd MTBF =

Tw = Tsetup + Thold Tc

Ts = Tperiod –Tck_skew – Tsetup –Tck_q - Tpath

Tck_skew Tck_q

Tpath

don’t care CDC path

relative timing CDC data paths

transition time

metastability characteristics

sub-cycle timing metastable net

clock skew

Page 6: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

clk

sim: m d_in

2FF Synchronizer

13/03/16 Mark Litterick, Verilab 6

d_in d_out

clk

m

sim: d_out

h su h su h

real: m real: d_out

Uncertainty & Jitter Generation Filtering

glitch = unsampled

narrow pulse (≈ many src clks)

PHY CDC Requirements • sub-cycle timing on m •  fast transition time at d_in •  fast metastability damping • no scan insertion 2nd FF •  tight clock-skew tolerance

RTL CDC Requirements • no logic on CDC path • no glitches on D input • D stability > 2 clock

narrow pulse filtered out

(2 clk edges!) RTL or GL sim

Page 7: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

d

m1’

clk

T1 Ts1

Failure: Sub-Cycle Timing

13/03/16 Mark Litterick, Verilab 7

Max delay for metastable net must be much less than the clock period

(even though both FFs in same domain)

! CDC PASS m2’

normal synchronous

constraint

actual signal timing

Ts2

T2 m2’

normal operation (no su/h violation)

" CDC FAIL

d

m1’

metastable (su/h violation)

Ts = Tperiod –Tck_skew – Tsetup –Tck_q - Tpath eTs/Tc TwFcFd MTBF =

Exponential effect on MTBF

additional sub-cycle constraint

Page 8: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Parallel Synchronizer

13/03/16 Mark Litterick, Verilab 8

bus_in bus_out clk

clk

sim bus_out

bus_in

real bus_out 0011 0110 0111

0110 0111 0011

0110 0111 0011

h su

slow-to-fast (all codes transported)

0001 0011 0010 0110 1110

0001

0001

0010 0110

0011 1110

su h

fast-to-slow (some codes dropped)

RAM

WR CTRL

RD CTRL wa

wdata

ra

rdata

Asynchronous FIFO Synchronizer

only 1 bit can go metastable per clk

RTL CDC Requirements •  bus is gray-coded at source (only one bit change per clock)

•  no stability check in each 2FF •  no gray-code check @ dest clk

PHY CDC Requirements •  relative timing for all bits must ensure bus is gray-coded on arrival at 1st FFs

Page 9: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

src_clk

bus_in[0]

bus_in[1] T1

00 01 11

T0

SENT#

dest_clk

bus_out[0]

bus_out[1] 00 10 11 RECEIVED#

" CDC FAIL

Failure: Path Variance

13/03/16 Mark Litterick, Verilab 9

Pragmatic: delay for all paths must be less than one source clock period

Normal failure: signal reorder (visible in GLS) fast path

slow path

[(Tperiod1 + T1) – (Tck_skew1 + T0)] > (Tsetup2 + Thold2)

No absolute path delay requirement, but relative timing for all parallel paths

must ensure in-order and variance >Tw

Corner case: close together

but in-order

CDC bus under-constrained, e.g. • marked as false-path (unconstrained) • marked as multi-cycle path (either clk) •  using slow destination clock period •  default constraints (slow-speed scan)

Received value was not sent

Page 10: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Handshake Synchronizer

13/03/16 Mark Litterick, Verilab 10

SOURCE DESTINATION

req_i req_o

ack_i

src_clk data_o

dest_clk ack_o

data_i

data

src_clk

req_o

dest_clk

req_i

ack_o

ack_i

d1 d2 !ACK !REQ ACK REQ

sample data

PHY CDC Requirements • max delay on data relative to req and dest_clk

RTL CDC Requirements •  full handshake protocol • D stable until ack in src

Page 11: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

src_clk

req’

data’s

Treq

Tdata

dest_clk

m

req_i

Tmcp data’f ! CDC PASS

" CDC FAIL

sample data (earliest)

Failure: Slow Path

13/03/16 Mark Litterick, Verilab 11

(Tdata + Tck_skew1) < [Treq + (2 x Tperiod2) – Thold2)]

Data has path delay requirement, relative to req and destination clock

CDC data under-constrained, e.g. • marked as false-path (unconstrained) • marked as multi-cycle path (src_clk) •  using slow source clock period •  default constraints (slow-speed scan)

CDC control no path delay requirement

multi-cycle path relative to dest_clk

Pragmatic: MCP of 2 x dest_clk periods (slight over-constrained if Treq > Thold2)

Page 12: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

c2 d2

Mesochronous (phase offset)

c2 d2

Phase-Detect Synchronizers

13/03/16 Mark Litterick, Verilab 12

c1 d1

c2 d2

Plesiochronous (phase changes)

c2 c1 d2 d1

digital delay line

conflict detect ctrl

c2 d2

d1

conflict detect

delay c2

delay

d2 d1

conflict detect

PHY CDC Requirements • sub-cycle timing on CDC data

Page 13: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

monolithic hard 2FF macro-cell

Pragmatic Solutions

•  Synthesize to meta-hard FF or (better) 2FF macro-cell –  hard to map all RTL to desired circuits (e.g. no reset, no scan) –  manageable with internal blocks, difficult with third-party IP

•  Instantiate meta-hard FF or 2FF macro-cell into RTL –  compromises portability and flexibility of the RTL

(RTL becomes technology and frequency dependent) –  manageable for internal designs and technology derivatives –  inappropriate or impossible if using or supplying third-party IP

13/03/16 Mark Litterick, Verilab 13

d_in d_out

clk

m If available in target technology!

Encapsulates & protects many of the physical concerns (not eradicated!)

metastability-hardened flip-flop

fast settling time (Tc) narrow susceptibility (Tw)

Page 14: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

SVA Timing Checks

•  SVA allows time and EventExpression formal arguments

•  Actual arguments are supplied by assert property statement

•  Use assertions for both RTL and gate-level

13/03/16 Mark Litterick, Verilab 14

property p_max_time(start, stop, duration); time start_time; @(start) (1,start_time = $time) |=> @(stop) (($time - start_time) <= duration); endproperty

a_meta_sub_cycle: assert property (p_max_time(posedge clk, m, 300ps));

argument used as time variable

argument used as event expression

maximum delay from posedge clk to any change on m must be less than 300ps

... but be aware that assertion binding to optimized netlist can be non-trivial!

Provides good safety net for validating closure on some timing-based intent ...

Page 15: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Tools & Methodology

•  Gate-level CDC analysis –  some formal CDC analysis tools can handle GL complexity –  add structural checks, clock-tree aware, reuse RTL intent –  complement, but do not eradicate CDC-aware STA

•  Constraints management –  evolution and refinement of constraints is major issue –  especially with multiple tool vendors in the flow –  tools emerging to manage & validate equivalence of constraints

•  Multi-discipline CDC reviews –  recognize that CDC is not just an RTL problem... –  review CDC functional operation and synchronizer physical

implementation with a multi-discipline multi-talented team! 13/03/16 Mark Litterick, Verilab 15

Page 16: Full Flow Clock Domain Crossing - Verification · PDF fileCTS clock-tree synthesis PS physical synthesis S T static timing analysis SPECIFICATION RTL GATE GDSII back-end CONSTRAINTS

Conclusion

•  Presented an overview of the problem –  RTL verification of CDC is necessary but not sufficient –  additional requirements need to be understood front & back-end

•  Illustrated detailed hazards for some common synchronizers –  intra-domain operation within synchronizers –  inter-domain CDC requirements and relationships

•  Discussed some pragmatic solutions & tool advances –  anything which closes the gap is good!

13/03/16 Mark Litterick, Verilab 16

[email protected]

Primary goal: raise multi-discipline CDC awareness