signal wait_for_lock : std_logic := '1';
signal clock_select : std_logic := '0';
-signal timer : unsigned(26 downto 0) := (others => '0');
+signal timer : unsigned(27 downto 0) := (others => '0');
signal clear_n_i : std_logic := '0';
signal reset_i : std_logic;
process begin
wait until rising_edge(INT_CLK_IN);
- if timer(26-CLOCK_FAST_SELECT*11) = '1' and timer(0) = '0' then --after 135us or 8.8ms
- timer <= timer + 1;
+ if timer(26-CLOCK_FAST_SELECT*11) = '0' and timer(27-CLOCK_FAST_SELECT*11) = '0' then
+ clock_select <= '0';
+ end if;
+ if timer(26-CLOCK_FAST_SELECT*11) = '1' and timer(25-CLOCK_FAST_SELECT*11 downto 0) = 0 then --after 135us or 8.8ms
clock_select <= pll_ext_lock;
- elsif timer(26-CLOCK_FAST_SELECT*11) = '1' and timer(0) = '1' then --after 135us or 8.8ms plus 1
+ end if;
+
+ if timer(27-CLOCK_FAST_SELECT*11) = '1' then --after 135us or 8.8ms plus 1
timer <= timer;
else
timer <= timer + 1;
- clock_select <= '0';
end if;
end process;
end generate;
-clear_n_i <= timer(26-CLOCK_FAST_SELECT*11) when rising_edge(INT_CLK_IN);
+clear_n_i <= timer(27-CLOCK_FAST_SELECT*11) when rising_edge(INT_CLK_IN);
---------------------------------------------------------------------------
-- Reset generation