------------------------------------------------------------------------------- -- The Count4USL module from 'counter1.vhd', but with an error. The counter -- rolls over at count 14, rather than count 15. -- -- C Clock -- SLOAD Synchronous Load (active High) -- D[3:0] Data Input -- Q[3:0] Data Output ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity Count4USL is port( C : in std_logic; SLOAD : in std_logic; D : in std_logic_vector(3 downto 0); Q : out std_logic_vector(3 downto 0)); end entity Count4USL; architecture A of Count4USL is signal COUNT : unsigned(3 downto 0); begin Q <= std_logic_vector(COUNT); process(C) is begin if rising_edge(C) then if SLOAD = '1' then COUNT <= unsigned(D); elsif COUNT = 14 then COUNT <= (others => '0'); else COUNT <= COUNT + 1; end if; end if; end process; end architecture A;