Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- entity JohnsonCounter is
- generic ( n : integer := 4);
- port (
- clock : in std_logic;
- reset : in std_logic;
- output : out std_logic_vector(n-1 to 0) := (others => '0')
- );
- end entity;
- architecture Behaviour of JohnsonCounter is
- begin
- counter : process(clock, reset) is
- variable i : integer := 0;
- begin
- if reset = '1' then
- output <= (others => '0');
- elsif rising_edge(clock) then
- output(0) <= not output(n-1);
- looper : for i in (n-1) downto 1 loop
- output(i) <= output(i-1);
- end loop looper;
- end if;
- end process counter;
- end architecture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement