【发布时间】:2016-02-02 22:14:40
【问题描述】:
我正在学习如何使用 VHDL 对 FPGA 进行编程,并且想知道如何确定时钟输入的正确频率。
我使用了Sp605 Hardware User Guide,引脚 K21,在时钟源连接表(如果您有兴趣,请参见第 27 页!)中描述为“200 MHz OSC SYSCLK_P”。
然后我使用以下过程来尝试从 200 MHz 时钟创建一个 1 Hz 时钟
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;
但是,如果我将计数器上限设置为 100,000,000 - 它应该是,时钟远慢于 1 Hz - 实际上使用 1,000,000 计数的当前值可以接近 1 Hz 脉冲 -但这是为什么呢?
【问题讨论】:
-
您的代码计数为 100 Hz:计数器 -> 除以 1,000,000,嵌入式 T 触发器 -> 除以 2。