freqdivider.vhd

来自「描述:LED示范、按钮及开关、视频输出、键入、含Xilinx PicoBlaze」· VHDL 代码 · 共 26 行

VHD
26
字号
--Used to divide the input CLK signal by a power of two.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity FreqDivider is
	 -- determines the power of two by which to divide
	 generic ( division_factor: positive := 2);
    Port ( CLK : in std_logic;
           DIVIDED_CLK : out std_logic);
end FreqDivider;

architecture Behavioral of FreqDivider is
	signal counter: std_logic_vector(division_factor-1 downto 0);
begin
	process (CLK)
	begin
		if (CLK = '1' and CLK'event) then
			counter <= counter + '1';
		end if;
	end process;

	DIVIDED_CLK <= counter(division_factor-1);
end Behavioral;

⌨️ 快捷键说明

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