X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/spartan2/qcounter.git/blobdiff_plain/872ec78db667afc871fa7b3bc48486cc3a91ef46..9fa62b2515657dd614104a621d244b63642a6585:/div_20.vhd diff --git a/div_20.vhd b/div_20.vhd new file mode 100644 index 0000000..a5af207 --- /dev/null +++ b/div_20.vhd @@ -0,0 +1,35 @@ +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use IEEE.STD_LOGIC_ARITH.all; +use IEEE.STD_LOGIC_UNSIGNED.all; + +-------------------------------------------------------------------------------- +-- This module divides the incoming clock by 2^20 and outputs the 20th bit of +-- the counter as clk_2k. +-------------------------------------------------------------------------------- + +entity div_20 is + port ( + clk : in std_logic; + clk_2k : out std_logic); +end div_20; + +-------------------------------------------------------------------------------- + +architecture Behavioral of div_20 is + + signal count : std_logic_vector (19 downto 0); + +begin + + process(clk) + begin + if(clk'event and clk = '1') then + count <= count + "00000000000000000001"; + end if; + end process; + + clk_2k <= count(19); + +end Behavioral; +