RTL Studio Open IDE

Control & Timers

Hysteresis Schmitt 8-bit — L1 Upgrade — L2 Upgrade

8-bit Schmitt trigger with sticky interrupt capture and configurable hysteresis thresholds.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Hysteresis Schmitt 8-bit — L1 Upgrade — 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 an 8-bit Schmitt trigger with a sticky interrupt capture mechanism. It detects transitions across defined hysteresis thresholds, captures the input data value at the exact moment of transition, and asserts a sticky interrupt flag (irq_o) on any valid transition. The module supports both asynchronous reset and synchronous clear operations.

This IP provides robust edge detection with noise immunity via hysteresis. It is suitable for sensor interface and signal conditioning applications. The sticky IRQ ensures no transition events are missed, and the captured data allows for precise event logging.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Hysteresis Schmitt 8-bit — L1 Upgrade — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 8-bit Schmitt trigger with sticky interrupt capture and configurable hysteresis thresholds.
  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

  • 8-bit Parallel Data Input: Processes an 8-bit wide data stream.
  • Configurable Hysteresis: Upper (THRESH_HIGH) and lower (THRESH_LOW) thresholds are configurable via parameters.
  • Sticky IRQ Assertion: Asserts an interrupt on both rising and falling edge transitions. The flag remains asserted until explicitly cleared.
  • Data Capture: Captures the input data value (capture_data) at the exact moment of transition.
  • Synchronous Clear: Allows explicit clearing of the IRQ flag via clear_n.
  • Asynchronous Reset: Active-low rst_n resets all internal state.
  • Verilog-2001 Compatible: Source code is compatible with standard Verilog-2001 simulators.
  • Simulation Support: Verified with Icarus Verilog.

Architecture

The module uses a single-bit state register to track the current logic level:

  • High (1): When the input exceeds the upper threshold (THRESH_HIGH).
  • Low (0): When the input falls below the lower threshold (THRESH_LOW).

Transitions between states trigger the interrupt (irq_o) and data capture (capture_data). The capture register holds the last transition value until reset. The IRQ flag remains asserted until explicitly cleared by clear_n or reset by rst_n.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Asynchronous active-low reset
data_inInput88-bit input data stream
clear_nInput1Synchronous active-low IRQ clear
irq_oOutput1Sticky interrupt output
capture_dataOutput8Captured data at transition

Parameters

ParameterDefaultDescription
THRESH_HIGH180Upper threshold for Low-to-High transition
THRESH_LOW80Lower threshold for High-to-Low transition

Verification

The testbench (tb_hysteresis_schmitt.v) verifies reset behavior, transition detection, and clear functionality. It checks IRQ assertion and data capture accuracy for both rising and falling edges. It confirms that the IRQ remains sticky until cleared and validates state retention when inputs stay within the hysteresis band.

### Running Simulation

To run the simulation using Icarus Verilog:

### Expected Results

  • TC1 PASS irq_o is 0 after reset
  • TC1 PASS capture_data is 0 after reset
  • TC2 PASS irq_o is 1 after rising edge
  • TC2 PASS capture_data is 200 after rising edge
  • TC3 PASS irq_o is 1 after falling edge
  • TC3 PASS capture_data is 50 after falling edge
  • TC4 PASS irq_o is 0 after clear
  • TC5 PASS irq_o is 1 after second rising edge
Test CaseDescriptionResult
TC1Reset checkPASS
TC2Rising Edge CapturePASS
TC3Falling Edge CapturePASS
TC4Clear IRQPASS
TC5Second Rising EdgePASS
TC6Second Falling EdgePASS
TC7Second ClearPASS
TC8Stay in Low StatePASS
TC9Transition to High StatePASS
TC10Transition to Low StatePASS

More in Control & Timers

All Control & Timers blocks