RTL Studio Open IDE

Counters

Loadable Down Counter 8-Bit — L1 Upgrade — L2 Upgrade

Fully synthesizable 8-bit loadable down counter with match and zero interrupt requests.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Loadable Down Counter 8-Bit — L1 Upgrade — L2 Upgrade is a Verilog reference block in the Counters catalog. Up/down, modulo, and loadable binary counters with enable logic. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP core implements a fully synthesizable, latch-free 8-bit loadable down counter. It supports asynchronous active-low reset, independent load and count enable controls, and generates interrupt requests (irq_match and irq_zero) based on counter state. The design is compliant with Verilog-2001 standards and includes a comprehensive testbench for verification.

Key Features:

  • 8-bit Counting: Counts down from a loaded value to zero.
  • Control Signals: Independent load_en and count_en inputs.
  • Interrupts: Asserts irq_match when counter equals match_value; asserts irq_zero when counter reaches zero.
  • Reset: Asynchronous active-low reset (rst_n).
  • Verification: Includes a testbench with 7 test cases covering reset, load, count, match, and zero behaviors.
  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Loadable Down Counter 8-Bit — L1 Upgrade — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Fully synthesizable 8-bit loadable down counter with match and zero interrupt requests.
  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.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low asynchronous reset input
load_enInput1Load enable input (Priority over count_en)
count_enInput1Count enable input
load_valueInput8Data value to load into counter
match_valueInput8Value to match against for irq_match
irq_matchOutput1Match interrupt output (Combinational)
irq_zeroOutput1Zero interrupt output (Combinational)
counter_outOutput8Current counter value

Architecture

The internal signal flow is illustrated below:

Verification

The provided testbench (tb/tb_loadable_down_irq_8_match_irq_load.v) verifies the following behaviors:

Test CaseDescriptionResult
TC1Reset behaviorPASS
TC2Load valuePASS
TC3Count down and match IRQPASS
TC4Count to zero and zero IRQPASS
TC5Reload and verify match IRQPASS
TC6IRQ match deassertionPASS
TC7IRQ zero deassertionPASS

Running Simulation: After running the simulation, the Log panel should display:

  • TC1 PASS reset
  • TC2 PASS load
  • TC3 PASS count down and match
  • TC4 PASS count to zero
  • TC5 PASS reload
  • TC5 PASS reload and match
  • TC6 PASS IRQ deassert
  • TC7 PASS IRQ zero deassert

Use the RtlStudio Waveform tab with sim/dump.vcd for visual inspection of signals.

More in Counters

All Counters blocks