]> rtime.felk.cvut.cz Git - fpga/spartan2/qcounter.git/blob - div_20.vhd
Component instances replaced by entity instances.
[fpga/spartan2/qcounter.git] / div_20.vhd
1 library IEEE;
2 use IEEE.STD_LOGIC_1164.all;
3 use IEEE.STD_LOGIC_ARITH.all;
4 use IEEE.STD_LOGIC_UNSIGNED.all;
5
6 --------------------------------------------------------------------------------
7 -- This module divides the incoming clock by 2^20 and outputs the 20th bit of
8 -- the counter as clk_2k.
9 --------------------------------------------------------------------------------
10
11 entity div_20 is
12   port (
13     clk    : in  std_logic;
14     clk_2k : out std_logic);
15 end div_20;
16
17 --------------------------------------------------------------------------------
18
19 architecture Behavioral of div_20 is
20   
21   signal count : std_logic_vector (19 downto 0);
22   
23 begin
24   
25   process(clk)
26   begin
27     if(clk'event and clk = '1') then
28       count <= count + "00000000000000000001";
29     end if;
30   end process;
31
32   clk_2k <= count(19);
33   
34 end Behavioral;
35