I'm working to learn how to program an FPGA in VHDL and want to know how I can determine the correct frequency of my clock input.
I have used the Sp605 Hardware User Guide, pin K21 which in the Clock Source Connections table (pg 27 if you're interested!) is described as being "200 MHz OSC SYSCLK_P".
I then used the following process in order to try and create a 1 Hz clock from the 200 MHz clock
prescaler : process(CLK)
begin
if rising_edge(CLK) then
if (counter < 1000000) then --possibly change to number in binary
counter <= counter + 1;
else
CLK_1Hz <= not CLK_1Hz;
counter <= (others => '0');
end if;
end if;
end process;
However, if I set the counter upper limit to be 100,000,000 - which it should be, the clock is far far slower than 1 Hz - in fact using the current value of 1,000,000 counts gives a close approximation of a 1 Hz pulse - but why is this?