clk.vhd

来自「USB与FPGA接口的程序设计。里面是所有的源文件都经本人测试可以用」· VHDL 代码 · 共 30 行

VHD
30
字号
library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity CLK is
	port(
		clk:  in  STD_LOGIC; -- 48MHz输入时钟
		rst:  in  STD_LOGIC; -- 异步复位
		clko: out STD_LOGIC; -- 24MHz输出时钟
		rsto: out STD_LOGIC  -- 复位
		);
end CLK;

--------------------------------------------------------------------------------
architecture BHV of CLK is
	signal div: STD_LOGIC;
begin
	clko<= div;
	rsto<= rst;
	
	process(clk, rst)              --2分频
	begin
		if rst= '1' then
			div<= '0';
		elsif rising_edge(clk) then
			div<= not(div);
		end if;
	end process;
	
end BHV;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?