RTL Studio Open IDE

Edge, Debounce & Pulse

Synchronized Debouncer with Edge Detection

A synchronized debouncer that filters noisy input signals and provides clean edge detection pulses.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Synchronized Debouncer with Edge Detection is a Verilog reference block in the Edge, Debounce & Pulse catalog. Edge detectors, debouncers, pulse stretchers, and one-shot generators. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP provides a robust solution for cleaning noisy digital signals. It synchronizes asynchronous inputs to the local clock domain and filters out glitches shorter than a configurable threshold. Additionally, it provides edge detection logic to identify rising and falling transitions on the clean signal.

This IP effectively mitigates switch bounce and noise in digital systems. The synchronized design ensures safe integration into synchronous logic. Engineers can tune the debounce count to balance latency and noise immunity. Edge detection provides convenient triggers for state machines without additional logic.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Synchronized Debouncer with Edge Detection.
  2. Read the Verilog module in the editor. The catalog line for this block: A synchronized debouncer that filters noisy input signals and provides clean edge detection pulses.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. 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.

Features

  • Metastability Protection: Two-stage synchronizer prevents metastability propagation from asynchronous inputs.
  • Configurable Debounce: Adjustable debounce time via the DEBOUNCE_COUNT parameter.
  • Edge Detection: Dedicated pos_edge and neg_edge pulse outputs for rising and falling transitions.
  • Synchronous Reset: All internal states are reset synchronously.
  • Verified: Tested with Icarus Verilog simulation.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low synchronous reset
raw_inInput1Asynchronous or noisy input signal
deb_outOutput1Cleaned, debounced output signal
pos_edgeOutput1High for one cycle on rising edge
neg_edgeOutput1High for one cycle on falling edge

Architecture

The design follows a three-stage pipeline:

  1. Synchronization: Aligns raw_in with clk using two flip-flops.
  2. Debouncing: Counts consecutive stable cycles of the synchronized signal.
  3. Edge Detection: Identifies transitions on the debounced state.

Parameters

ParameterDefaultDescription
DEBOUNCE_COUNT1000Number of clock cycles required for stability before updating state

Verification

The testbench validates reset behavior, signal stability, edge detection, and glitch rejection.

Test CaseDescriptionResult
TC1Reset forces outputs to zeroPASS
TC2Stable high input results in high outputPASS
TC3Falling edge detection and state changePASS
TC4Rising edge detection and state changePASS
TC5Glitch rejection for short pulsesPASS
TC6Metastability resilience checkPASS

More in Edge, Debounce & Pulse

All Edge, Debounce & Pulse blocks