Changeset 10037 for firmware/FTU/clock
- Timestamp:
- 10/25/10 15:29:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FTU/clock/FTU_clk_gen.vhd
r9880 r10037 34 34 rst : IN STD_LOGIC; 35 35 clk_50 : OUT STD_LOGIC; 36 clk_1 : OUT STD_LOGIC; 36 37 ready : OUT STD_LOGIC 37 38 ); … … 48 49 LOCKED_OUT : out std_logic); 49 50 end component; 51 52 component Clock_Divider 53 port( 54 clock_in : IN STD_LOGIC; 55 clock_out : OUT STD_LOGIC 56 ); 57 end component; 58 59 signal clk_1M_sig : std_logic; 60 signal clk_50M_sig : std_logic; 50 61 51 62 begin … … 55 66 CLKIN_IN => clk, 56 67 RST_IN => rst, 57 CLKFX_OUT => clk_50 ,68 CLKFX_OUT => clk_50M_sig, 58 69 CLKIN_IBUFG_OUT => open, 59 70 LOCKED_OUT => ready 60 71 ); 72 73 Inst_Clock_Divider : Clock_Divider 74 port map ( 75 clock_in => clk_50M_sig, 76 clock_out => clk_1M_sig 77 ); 78 79 clk_50 <= clk_50M_sig; 80 clk_1 <= clk_1M_sig; 61 81 62 82 end Behavioral; 83 84 ---------------------------------------------------------------------------------- 85 86 library IEEE; 87 use IEEE.STD_LOGIC_1164.ALL; 88 use IEEE.STD_LOGIC_ARITH.ALL; 89 use IEEE.STD_LOGIC_UNSIGNED.ALL; 90 91 library ftu_definitions; 92 USE ftu_definitions.ftu_array_types.all; 93 USE ftu_definitions.ftu_constants.all; 94 95 entity Clock_Divider is 96 generic( 97 divider : integer := INT_CLK_FREQUENCY / COUNTER_FREQUENCY 98 ); 99 port( 100 clock_in : in std_logic; 101 clock_out : out std_logic := '0' 102 ); 103 end entity Clock_Divider; 104 105 architecture RTL of Clock_Divider is 106 107 begin 108 109 process (clock_in) 110 variable Z: integer range 0 to divider - 1; 111 begin 112 if rising_edge(clock_in) then 113 if (Z < divider - 1) then 114 Z := Z + 1; 115 else 116 Z := 0; 117 end if; 118 if (Z = 0) then 119 clock_out <= '1'; 120 end if; 121 if (Z = divider / 2) then 122 clock_out <= '0'; 123 end if; 124 end if; 125 end process; 126 127 end architecture RTL;
Note:
See TracChangeset
for help on using the changeset viewer.