【发布时间】:2020-09-04 18:07:36
【问题描述】:
我编写了这个代码来划分时钟一个nexys4 fpga,默认情况下它的集成时钟频率为100Mhz,我需要将它划分为1hz。有人可以告诉我它是否正确或者是否需要更改?
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity digi_clk is
port (clk1 : in std_logic;
clk : out std_logic
);
end digi_clk;
architecture Behavioral of digi_clk is
signal count : integer :=0;
signal b : std_logic :='0';
begin
--clk generation.For 100 MHz clock this generates 1 Hz clock.
process(clk1)
begin
if(rising_edge(clk1)) then
count <=count+1;
if(count = 50000000) then
b <= not b;
count <=0;
end if;
end if;
clk<=b;
end process;
end;
【问题讨论】:
-
一般情况下,FPGA 不推荐使用逻辑来创建分频时钟。它应该生成时钟使能。