here is a sync reset version of the code (just cause i prefer sync reset rather than async, no other reason), same reason goes for my use of unsigned rather than std_logic_vector and signals rather than variables.
-- signal declarations
signal count : unsigned(2 downto 0);
signal hi8low8 : std_logic;
[... snip ...]
process
begin
wait until clock'event and clock= '1';
if reset = '1' then
count <= "000";
hi8low8 <= '0';
else
-- unsigned signal will roll over when it gets to
-- "111"
count <= count + 1;
if count = unsigned'("111" then
hi8low8 <= not hi8low8;
end if;
end if;
end process;
this of course assumes that clock and reset are also declared (in this case in a port declaration to this entity). I didn't include any of the entity/architecture declarations etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.