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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity ConditionalIncrement is
Port (
clk : in STD_LOGIC;
reset : in STD_LOGIC;
count_out : out INTEGER
);
end ConditionalIncrement;
architecture Behavioral of ConditionalIncrement is
signal count : INTEGER := 3;
begin
process(clk, reset)
begin
if reset = '1' then
count <= 3;
elsif rising_edge(clk) then
if count < 5 then
count <= count + 1;
end if;
end if;
end process;
count_out <= count;
end Behavioral;Coding works best on desktop or with an external keyboard.