Clock-Domain Crossing
Slow-Enable Fast Sample-Hold
Samples data on a rising edge of a synchronized slow enable signal in a fast clock domain.
About this block
Simulate it in the Verilog IDE
Slow-Enable Fast Sample-Hold is a Verilog reference block in the Clock-Domain Crossing catalog. Clock-domain crossing FIFOs, synchronizers, and handshake bridges. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.
This IP implements a cross-clock-domain sample-and-hold circuit. It operates in the clk_fast domain, capturing data from data_in based on a synchronized, slow enable signal (en_slow_raw).
The design ensures metastability safety using a two-stage synchronizer chain. The sampled data is held in data_out until the next enable edge. This module is suitable for interfacing low-frequency control signals with high-speed data paths.
This IP provides a robust method for sampling high-speed data using a low-frequency enable signal. By synchronizing the enable signal across clock domains, it prevents metastability issues while maintaining data integrity. The design is simple, using a two-stage synchronizer and a standard sample-and-hold logic, making it easy to integrate into larger systems requiring cross-clock-domain control.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Slow-Enable Fast Sample-Hold.
- Read the Verilog module in the editor. The catalog line for this block: Samples data on a rising edge of a synchronized slow enable signal in a fast clock domain.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.
RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
| clk_fast | input | 1 | Fast clock domain |
| rst_n | input | 1 | Active-low asynchronous reset |
| clk_slow | input | 1 | Slow clock domain (reference only, not used internally) |
| en_slow_raw | input | 1 | Raw slow enable signal from slow domain |
| data_in | input | [7:0] | Data to be sampled |
| data_out | output | [7:0] | Sampled and held data |
Verification
The provided testbench (tb/tb_slow_enable_fast_sample_hold.v) validates the following behaviors:
- Reset Behavior: Ensures
data_outinitializes to zero. - Hold State: Verifies output remains constant when
en_slow_rawis inactive. - Sampling: Confirms
data_outupdates todata_inon the rising edge of the synchronized enable. - Multiple Samples: Checks correct operation across multiple enable cycles.
### Expected Simulation Results
Upon running the simulation, the log should display:
TC1 PASS - Reset state correctTC2 PASS - Hold state correctTC3 PASS - Sample correctTC4 PASS - Hold correctTC5 PASS - Second sample correctTC6 PASS - Reset correctINFO: PASS
More in Clock-Domain Crossing
- 1-Bit Handshake CDC Bridge
- 3-Stage Asynchronous Reset Synchronizer
- 4-Bit Bus Synchronizer (2-FF per bit)
- 4-Bit Gray Bus Synchronizer — L2 Upgrade
- Async Handshake Pulse Bridge
- Async Set Sync-Clear Flag — L2 Upgrade
- Asynchronous Reset Synchronizer for FIFO Gray Pointer Crossings
- Dual-Clock Pulse with Credit Return
- Enable Level Synchronizer — L1 Upgrade
- Four-Phase Req/Ack CDC Payload 16-bit
- Handshake CDC with 8-Bit Payload
- Multi-Bit Bus Synchronizer (2-FF)
- Multi-Bit Mux-Select Synchronizer — L2 Upgrade
- Pulse-Ack Round-Trip Across 2 Clocks
- Req/Ack Payload Hold 8-bit
- Single-Cycle Pulse Synchronizer (2-FF + Edge Detector)