Control & Timers
Missing Pulse Detector — L2 Upgrade
Detects absence of pulses within a defined window and latches a sticky IRQ flag.
About this block
Simulate it in the Verilog IDE
Missing Pulse Detector — L2 Upgrade is a Verilog reference block in the Control & Timers catalog. FSMs, timers, watchdogs, and control/state sequencing blocks. Marked Medium: more state or a wider datapath, still one workspace in the IDE.
This IP implements a Missing Pulse Detector with Sticky IRQ Capture. It monitors an input pulse stream and detects the absence of pulses within a defined time window. When a gap between pulses exceeds a configurable threshold, the module asserts a sticky interrupt request (irq_sticky). This flag remains set until explicitly cleared via the irq_clear signal, ensuring that missing pulse events are not lost even if the host processor is busy.
The design is fully synchronous, uses an active-low asynchronous reset, and provides a direct pulse_detected output for real-time monitoring.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Missing Pulse Detector — L2 Upgrade.
- Read the Verilog module in the editor. The catalog line for this block: Detects absence of pulses within a defined window and latches a sticky IRQ flag.
- 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.
Features
- Configurable Detection Window: Set the gap threshold via the
GAP_THRESHparameter. - Sticky Interrupt: The
irq_stickyflag latches the missing pulse event and persists until cleared. - Explicit Clear: The sticky IRQ can only be cleared via the
irq_clearinput signal. - Real-time Monitoring: Direct
pulse_detectedoutput reflects the current state ofpulse_in. - Synchronous Design: Fully synchronous logic with active-low asynchronous reset for robust integration.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low asynchronous reset |
pulse_in | Input | 1 | Input pulse stream |
irq_clear | Input | 1 | Active-high clear for sticky IRQ |
pulse_detected | Output | 1 | High when pulse_in is high |
irq_sticky | Output | 1 | Sticky interrupt flag |
Architecture
The module consists of two main logic blocks:
- Gap Counter: An 8-bit counter increments on every clock cycle when
pulse_inis low. Ifpulse_ingoes high, the counter resets to zero. If the counter exceeds theGAP_THRESHparameter, amissing_pulse_flagis asserted. - Sticky IRQ Latch: This block latches the
missing_pulse_flaginto theirq_stickyoutput. The latch is only cleared whenirq_clearis asserted or whenrst_nis de-asserted.
Verification
The provided testbench (tb_missing_pulse_detector_sticky_irq_capture.v) validates the following scenarios:
| Test Case | Description | Result |
|---|---|---|
| TC1 | Reset behavior check | PASS |
| TC2 | Normal pulse stream (no missing pulse) | PASS |
| TC3 | Missing pulse detection and sticky IRQ | PASS |
| TC4 | IRQ clear functionality | PASS |
| TC5 | Pulse detection output high/low | PASS |
### Running Simulation
To verify the design, run the simulation using your preferred Verilog simulator. For example, using Icarus Verilog and GTKWave:
Upon successful completion, the log should display:
More in Control & Timers
- 1 MHz Tick Generator — L1 Upgrade — L2 Upgrade
- 16-Bit Down Timer (Match on Load-Zero Too) — L2 Upgrade
- 16-Bit Programmable Prescaler — L1 Upgrade — L2 Upgrade
- 16-bit Programmable Timer with Interrupt — L2 Upgrade
- 16-Bit Pulse Width Modulator (PWM) Controller
- 32-Bit Interval Timer with IRQ
- 32-Bit Kick Watchdog with Configurable Timeout and Reset Pulse
- 8-Bit Down Timer (Pulse Match on Zero) — L2 Upgrade
- 8-Bit Programmable Digital Deglitch Filter — L1 Upgrade — L2 Upgrade
- 8-Bit Window Comparator — L1 Upgrade — L2 Upgrade
- 8-Channel 16-Bit PWM Controller
- Activity Timeout Flag 8-bit — L2 Upgrade
- Bang-Bang Thermostat 8-bit
- Complementary PWM Dead-Time Inserter — L2 Upgrade
- Duty-Cycle Measurement 8-Bit — L2 Upgrade
- Edge Rate Limiter 8-bit — L2 Upgrade