
A signal that comes from outside the chip (a switch, a button, or logic running on a different clock) can change at any moment, including right at a clock edge. A flip-flop that samples it can become metastable. The classic fix is the two flip-flop (2-FF) synchronizer: the first flip-flop may go metastable, but it gets one full clock period to settle before the second flip-flop samples it, so the rest of the design only sees a clean, synchronized signal.
This project demonstrates the common clock-domain-crossing (CDC) building blocks:
ui[3:0] are four independent asynchronous inputs. Each passes through two
flip-flops and appears on uo[3:0] two clock cycles later.ui[0]. Comparing the two gives a
one-clock pulse on uo[4] for a rising edge and on uo[5] for a falling edge.uo[6] changes state on every synchronized rising edge of ui[0].ui[4] once per event. After synchronization, an XOR
of the current and previous values gives exactly one clock pulse on uo[7] per event. This is how single-cycle
events are passed safely between clock domains.ui[0] and the pulses from ui[4]. ui[5]
selects which counter drives uio[7:0] (0 = rising-edge count, 1 = pulse count).All flip-flops reset synchronously when rst_n is low.
ui[0]..ui[3]. The same values appear on uo[0]..uo[3] two clock cycles later.ui[0] from 0 to 1. uo[4] pulses high for one clock, uo[6] toggles, and the counter on uio[7:0]
(with ui[5] = 0) increases by one. Switching ui[0] back to 0 gives a one-clock pulse on uo[5].ui[5] = 1 and flip ui[4] several times. Each change gives one pulse on uo[7] and the counter on
uio[7:0] counts the changes.With a slow clock, the pulses can be seen on LEDs. With a fast clock, use a logic analyzer or watch the counters.
None required. Switches or buttons on the inputs and LEDs on the outputs (for example on the Tiny Tapeout demo board) are enough. A logic analyzer is useful to see the one-clock pulses.
We gratefully acknowledge the Center of Excellence (CoE) in Integrated Circuits and Systems (ICAS) and the Department of Electronics and Communication Engineering (ECE) for providing the necessary resources and guidance.
Special thanks to Dr. H V Ravish Aradhya (HoD - ECE), Dr. K R Usha Rani (Associate Dean - PG), Dr. K. S. Geetha (Vice Principal) and Dr. K. N. Subramanya (Principal) for their constant encouragement and support in facilitating this Tiny Tapeout SKY26E submission.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | ASYNC_IN0 | SYNC_OUT0 | COUNT[0] |
| 1 | ASYNC_IN1 | SYNC_OUT1 | COUNT[1] |
| 2 | ASYNC_IN2 | SYNC_OUT2 | COUNT[2] |
| 3 | ASYNC_IN3 | SYNC_OUT3 | COUNT[3] |
| 4 | ASYNC_TOGGLE | RISE_PULSE | COUNT[4] |
| 5 | COUNT_SEL | FALL_PULSE | COUNT[5] |
| 6 | TOGGLE_OUT | COUNT[6] | |
| 7 | SYNC_PULSE | COUNT[7] |