在数字逻辑电路设计中,分频器是一种基本电路。通常用来对某个给定频率进行分频,以得到所需的频率。
VHDL代码如下:
port(clk : in std_logic;
cl1k: out std_logic);
end prescaler_50;
architecture rtl of prescaler_50 is
signal count50:std_logic_vector(5 downto 0);
begin
process(clk)
begin
if(clk'event and clk='1')thenif(count50="110001")then
count50<="000000";else
count50<=count50+1
end if;
clk1<=count50(5);end if;
end process;
end rtl;