Block Diagram:
The circuit diagram for a 3 bit Johnson counter is shown below:
The counter goes through the following states over and over when the reset is not applied: 001 - 011 - 111 - 110 - 100 - 000 ...
Lets take a look at the simulation waveform from modelsim.
Johnson Counter:
library ieee; use ieee.std_logic_1164.all; entity johnson_counter is port(clk : in std_logic; reset : in std_logic; count : out std_logic_vector(3 downto 0) ); end johnson_counter; architecture Behavioral of johnson_counter is signal temp : std_logic_vector(3 downto 0) := (others => '0'); begin --assign the temparary signal to output port. --In VHDL-1997, output ports cannot be read. Thats why we use temp here. count <= temp; process(clk) begin if(rising_edge(clk)) then if (reset = '1') then ---synchronous reset temp <= (others => '0'); else --these are concurrent statements. --which means they all execute at the same time. temp(1) <= temp(0); temp(2) <= temp(1); temp(3) <= temp(2); temp(0) <= not temp(3); end if; end if; end process; end Behavioral;
Testbench for the Johnson Counter:
library ieee; use ieee.std_logic_1164.all; --testbench has empty entity entity tb_johnson_counter is end entity tb_johnson_counter; architecture behavioral of tb_johnson_counter is signal clk,reset : std_logic := '0'; signal count :std_logic_vector(3 downto 0) := "0000"; constant clk_period : time := 10 ns; begin --entity instantiation with named association port mapping counter_uut: entity work.johnson_counter port map(clk => clk, reset => reset, count => count); --generate clock Clk_generation: process begin wait for clk_period/2; clk <= not clk; --toggle clock when half of clk_period is over end process; stimulus: process begin reset <= '1'; wait for clk_period; reset <= '0'; wait for Clk_period*10; reset <= '1'; wait for Clk_period; reset <= '0'; wait; --testing done. wait endlessly end process; end behavioral;
Lets take a look at the simulation waveform from modelsim.
Simulation Waveform from Modelsim:
Post Synthesis Schematic from Xilinx Vivado:
The schematic looks quite simple, few flipflops connected in a sequence, along with some input and output buffers.
cud ny1 guide plz y here the word other being used,is it a keyword??
ReplyDeleteCheck in this link:
ReplyDeletehttp://vhdlguru.blogspot.com/2010/02/arrays-and-records-in-vhdl.html
how to convert ring counter circuit to johnson counter circuit?can you show are circuit?step by step??
ReplyDeletesignal temp : unsigned(3 downto 0):=(others => '0');
ReplyDeletewhy other =>'0' is used in this signal statement
can anyone explain the each line meaning for understanding?
ReplyDelete