timing-closure-cdclisted
Install: claude install-skill Premchand006/AI-assistant-skills
# Timing and clock-domain crossings
Two failure modes, related by the fact that static timing analysis cannot see
the second one. A timing violation is visible, reproducible and gets fixed. A
missing synchroniser passes RTL simulation, passes STA, and shows up as a
machine that hangs once a week.
## Clock-domain crossings
```bash
python3 scripts/cdc_scan.py rtl/ --fail-on error
```
The scanner infers each signal's domain from the always block that writes it,
propagates through combinational logic, and reports every read in a different
domain along with what synchronisation it found: none, one flop, two flops on a
multi-bit bus, or a correct two-flop synchroniser.
Pick the structure by what the signal is, because a two-flop synchroniser is
the right answer for exactly one of these:
| What crosses | Pattern |
|---|---|
| Single-bit level | two-flop synchroniser |
| Single-bit pulse | toggle synchroniser |
| Multi-bit, one bit changes at a time | gray code, then synchronise |
| Multi-bit data, arbitrary values | handshake with data held stable, or async FIFO |
| Streaming data | async FIFO with gray-coded pointers |
| Reset | async assert, sync de-assert, one per domain |
```systemverilog
logic meta, sync;
always_ff @(posedge clk_dst or negedge rst_n) begin
if (!rst_n) {sync, meta} <= 2'b00;
else {sync, meta} <= {meta, src_level};
end
// use sync; meta feeds nothing else
```
Two flops per bit on a bus is the mistake worth naming. Each bit settles
independe