1 ------------------------------------------------------------------------------- 2 -- File : ClockDivider.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2016-06-01 5 -- Last update: 2016-09-22 6 ------------------------------------------------------------------------------- 7 -- Description: A clock divider with programmable duty cycle and phase delay. 8 ------------------------------------------------------------------------------- 9 -- This file is part of StdLib. It is subject to 10 -- the license terms in the LICENSE.txt file found in the top-level directory 11 -- of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of StdLib, including this file, may be 14 -- copied, modified, propagated, or distributed except according to the terms 15 -- contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 20 use ieee.std_logic_1164.
all;
21 use ieee.std_logic_arith.
all;
22 use ieee.std_logic_unsigned.
all;
26 --! @ingroup base_general 43 end entity ClockDivider;
47 type StateType is (DELAY_S, CLOCK_S);
49 type RegType is record 57 constant REG_INIT_C : RegType := ( 62 counter => (others => '0'));
64 signal r : RegType := REG_INIT_C;
74 v.counter := r.counter + 1;
90 v.counter := (others => '0');
104 v.counter := (others => '0');
119 seq :
process (
clk)
is 121 if (rising_edge(clk)) then 122 r <= rin after TPD_G;
127 end architecture rtl;
in highCountslv( COUNT_WIDTH_G- 1 downto 0)
in delayCountslv( COUNT_WIDTH_G- 1 downto 0)
COUNT_WIDTH_Ginteger range 1 to 32:= 16
in lowCountslv( COUNT_WIDTH_G- 1 downto 0)