----------------------- -- 6-bit counter ----------------------- -- COURSE: EE 552 -- FILE: MUXcounter.vhd -- DESCRIPTION: counts to 5 -- This block counts to 5 to select each 5 inputs to MUX -- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; ------------------------------------------------------------------------------- entity MUXcounter is generic(datawidth: positive := 3); port (clock: in std_logic; thecount: out std_logic_vector(datawidth-1 downto 0) ); end entity MUXcounter; ------------------------------------------------------------------------------- architecture behaviour of MUXcounter is signal sec_count : std_logic_vector(datawidth-1 downto 0):=(others =>'0'); begin count : process (clock) is begin if rising_edge(clock) then -- count to indicate 1 sec if (sec_count< "100")then sec_count <= sec_count + '1'; thecount<=sec_count; -- then increment the sec counter till 4 elsif (sec_count = "100") then -- if count at 4 then thecount<=sec_count; sec_count <= "000"; end if; end if; end process count; end architecture behaviour;