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
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.
- Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit Johnson Counter (Twisted Ring) — L1 Upgrade — L2 Upgrade.
- 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.
- 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
- 8-bit Johnson Counter Sequence: Generates a 16-state twisted ring pattern.
- Synchronous Load: Parallel data input via
load_valuewhenload_enis asserted. - Synchronous Count Enable: State progression controlled by
count_en. - Match Comparator: Compares current state
qwithmatch_value. - Registered Interrupt:
match_irqis registered to ensure glitch-free output. - Asynchronous Reset: Active-low reset via
rst_n. - Verified: Fully verified with Icarus Verilog simulation.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low asynchronous reset |
load_en | Input | 1 | Synchronous load enable |
count_en | Input | 1 | Synchronous count enable |
load_value | Input | 8 | Parallel load data |
match_value | Input | 8 | Comparator match value |
match_irq | Output | 1 | Match interrupt flag (registered) |
q | Output | 8 | Counter output |
Verification
The testbench verifies the following functionalities:
- Reset: Ensures
qandmatch_irqare zero after reset. - Load: Verifies parallel loading of
load_value. - Counting: Checks the full 16-state Johnson sequence.
- Match IRQ: Verifies assertion and de-assertion of
match_irqwhenq == match_value.
| Test Case | Description | Result |
|---|---|---|
| TC1 | Reset state and IRQ check | PASS |
| TC2 | Parallel load check | PASS |
| TC3 | Johnson sequence check (16 steps) | PASS |
| TC4 | Match IRQ check | PASS |
More in Counters
- 16-Bit Cycle Counter with Prescaler — L1 Upgrade — L2 Upgrade
- 4-Bit Counter Match Pulse
- 4-Bit Counter with Wrap Strobe
- 4-Bit Down Counter
- 4-Digit BCD Up/Down Counter with Carry/Borrow
- 8-Bit Binary Up Counter — L1 Upgrade — L2 Upgrade
- 8-Bit Leading Zero Counter — L1 Upgrade — L2 Upgrade
- 8-Bit Ring Counter
- 8-Bit Up/Down Counter
- Bidirectional Counter 4-Bit — L1 Upgrade — L2 Upgrade
- Decade BCD Counter 1-Digit — L1 Upgrade
- Dual Compare-Match Counter 8 — L1 Upgrade — L2 Upgrade
- Event Counter with Capture
- Gray-Code Counter 8-Bit — L2 Upgrade
- Loadable 4-Bit Up Counter
- Loadable Down Counter 8-Bit — L1 Upgrade — L2 Upgrade