RTL Studio Open IDE

Counters

8-Bit Johnson Counter (Twisted Ring) — L1 Upgrade — L2 Upgrade

8-Bit Johnson Counter with parallel load, count enable, and match-based interrupt generation.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

8-Bit Johnson Counter (Twisted Ring) — L1 Upgrade — L2 Upgrade is a Verilog reference block in the Counters catalog. Up/down, modulo, and loadable binary counters with enable logic. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

This IP implements an 8-bit Johnson Counter (also known as a Twisted Ring Counter). It supports parallel loading, synchronous counting, and a match-based interrupt generation mechanism. The feedback path inverts the least significant bit (LSB) and feeds it back to the most significant bit (MSB), creating a sequence of 16 unique states.

The match interrupt is registered to prevent combinational glitches, ensuring stable output in synchronous systems.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Johnson Counter (Twisted Ring) — L1 Upgrade — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 8-Bit Johnson Counter with parallel load, count enable, and match-based interrupt generation.
  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 Johnson Counter Sequence: Generates a 16-state twisted ring pattern.
  • Synchronous Load: Parallel data input via load_value when load_en is asserted.
  • Synchronous Count Enable: State progression controlled by count_en.
  • Match Comparator: Compares current state q with match_value.
  • Registered Interrupt: match_irq is registered to ensure glitch-free output.
  • Asynchronous Reset: Active-low reset via rst_n.
  • Verified: Fully verified with Icarus Verilog simulation.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low asynchronous reset
load_enInput1Synchronous load enable
count_enInput1Synchronous count enable
load_valueInput8Parallel load data
match_valueInput8Comparator match value
match_irqOutput1Match interrupt flag (registered)
qOutput8Counter output

Verification

The testbench verifies the following functionalities:

  1. Reset: Ensures q and match_irq are zero after reset.
  2. Load: Verifies parallel loading of load_value.
  3. Counting: Checks the full 16-state Johnson sequence.
  4. Match IRQ: Verifies assertion and de-assertion of match_irq when q == match_value.
Test CaseDescriptionResult
TC1Reset state and IRQ checkPASS
TC2Parallel load checkPASS
TC3Johnson sequence check (16 steps)PASS
TC4Match IRQ checkPASS

More in Counters

All Counters blocks