blob: 1836c758778685cc4ebbd2f999f543798836ebef (
plain)
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 cnt04 is
port (
clk : in std_logic;
rst : in std_logic;
counter : out std_logic_vector (7 downto 0)
);
end cnt04;
architecture behav of cnt04 is
signal s_count : unsigned(7 downto 0); -- := (others => '0');
begin
process(clk, rst)
begin
if rst = '1' then
s_count <= (others => '0');
elsif rising_edge(clk) then
s_count <= s_count + 1;
end if;
end process;
-- connect internal signal to output
counter <= std_logic_vector(s_count + 1);
end behav;
|