目录
整体项目资源在:VHDL分频器-占空比50%-将FPGA板上的50Mhz的信号分频为1hz时钟信号-嵌入式文档类资源-CSDN文库
设计要求:
将系统时钟50MHz 分频为1Hz 的时钟信号
占空比为50%
实现代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity div_vhdl is
port(
clk : in std_logic;
div_out : out std_logic
);
end div_vhdl;
architecture behavior of div_vhdl is
signal time : integer range 0 to 4;
signal q : std_logic := '0';
begin
process(clk)
begin
if rising_edge(clk) then
time <= time+1;
if time = 25000000 then
q<='1';
elsif time = 50000000 then
q<='0';
time <= 0;
else null;
end if;
end if;
end process;
div_out<=q;
end behavior;