Debian Codegraph @

demo/kitchen-sink/docs/vhdl.vhd

raw
1 library IEEE;
2 use IEEE.std_logic_1164.all;
3 use IEEE.numeric_std.all;
4
5 entity COUNT16 is
6
7 port (
8 cOut :out std_logic_vector(15 downto 0); -- counter output
9 clkEn :in std_logic; -- count enable
10 clk :in std_logic; -- clock input
11 rst :in std_logic -- reset input
12 );
13
14 end entity;
15
16 architecture count_rtl of COUNT16 is
17 signal count : unsigned (15 downto 0);
18
19 begin
20 process (clk, rst) begin
21
22 if(rst = '1') then
23 count <= (others=>'0');
24 elsif(rising_edge(clk)) then
25 if(clkEn = '1') then
26 count <= count + 1;
27 end if;
28 end if;
29
30 end process;
31 cOut <= std_logic_vector(count);
32
33 end architecture;
34