6-bit Johnson Ring Counter using Schematic + Verilog
Note: This chapter assume you done the 5Hz clock with LED blink project
A ring counter is a type of counter composed of a type of circular shift register. The output of the last shift register is fed to the input of the first register.
The Johnson counter is a variant that holds 2N of states, generates a Gray code, a code in which adjacent states differ by only one bit.
References:
Create New Project,
Project settings:
Page 1 of 5:
Name of directory, project, top design entity: ring_counter
Page 3 of 5:
Device: MAX II EPM240T100C5
Add slower_clock.v Verilog File
Under Project Navigator, open Files Tab,
Right click Files
Click Add/Remove Files
Find slower_clock.v Verilog file from previous project, then add.
Create Schematic Diagram,
From menu bar, Click File->New,
Then Select Block Diagram/Schematic File.
You will see empty schematic window
Save the schematic as ring_counter.bdf
Use slower_clock.v as a symbol
Click anywhere on the schematic window to show the symbol pop-up
In the Symbol pop-up window, Click the [...] button, then add slower_clock.bdf file
You will get this symbol. clk will be connected to input pin 64, while clkOutput is connected to clock pins of flip-flops.
6-bit Ring counter
Please create a schematic as shown.
In this counter, Q0 is LSB, Q5 is MSB
We use slower_clock as clock source for D flip-flops
Tips:
Ctrl-Drag to duplicate
Shift-Click to multi select.
In Symbol pop-up, the symbols locations:
- Logic gates: primitives/gate
- D Flip Flop: primitives/storage
- I/O pins: primitives/pins
- Altera Out Buffer: primitives/buffer
Save the file, click Start Synthesis and Analysis
Set I/O Pins
After Start Synthesis and Analysis is completed, we need to set the pins
Open Pin Planner, set as follows
Compile and Program
Open programmer, set the USB-Blaster as Hardware, check the program file, click Start.
Results
The LED array should start blinking and scrolling from LSB to MSB, with pattern
e.g.
000000
000001
000011
...
111111
111110
111100
..
110000
100000
000000