Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Counter is
Port (
clk : in STD_LOGIC;
reset : in STD_LOGIC;
count_out : out INTEGER;
isDark_out : out STD_LOGIC
);
end Counter;
architecture Behavioral of Counter is
signal count : INTEGER := 0;
signal isDark : STD_LOGIC := '0';
begin
process(clk, reset)
begin
if reset = '1' then
count <= 0;
isDark <= '0';
elsif rising_edge(clk) then
count <= count + 1;
isDark <= not isDark;
end if;
end process;
count_out <= count;
isDark_out <= isDark;
end Behavioral;Coding works best on desktop or with an external keyboard.