VHDL 分频器

VHDL设计一个一个分频器,要求把50Mhz分频成1Khz,占空比为50%

仿真的图形给出了,因为本题数字太大,我改小后仿真的

library IEEE;

use IEEE.std_logic_1164.all;

use IEEE.std_logic_unsigned.all;

entity fp is

    port (

        clk: in STD_LOGIC;

        q: out STD_LOGIC

    );

end fp;

architecture fp_arch of fp is

begin

 process(clk)

 variable n:integer range 0 to 49999; 

 begin

  if clk'event and clk='1' then

   if n<=24999 then  

   n:=n+1;

   q<='0';

   elsif n=49999 then 

   n:=0;

   q<='1';

   else

   n:=n+1;

   q<='1';

   end if;

  end if;

  end process;

   

end fp_arch;

温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-10-14
做一个50000分频器,对输入时钟进行计数,来一个上升沿加1,累加到25000时,对输出取反一下,清0计数器。
相似回答