⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fenpinqi89.vhd

📁 非整数分频器 分频系数为无限不循环小数 vhdl
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity fenpinqi89 is
 port(clk :in std_logic;
      control:in std_logic;
      output:out std_logic;
      count_ctrl:out std_logic);
end fenpinqi89;

architecture main of fenpinqi89 is
signal counter00,counter01:std_logic;
signal counter1:integer range 0 to 7;
signal counter2:integer range 0 to 8;
signal cp1,cp2,p,q:std_logic;
begin

process(clk,control)
begin
if falling_edge(clk) then
   if control='0' then 
        if counter1=7 then counter1<=0; counter00<='1';
             else counter1<=counter1+1;counter00<='0';
        end if;
        if(counter1<=3) then cp1<='0';
             else cp1<='1';
        end if;
    end if;
 end if;
p<=counter00;
end process;

process(clk,control)
begin
   if falling_edge(clk) then
     if control='1' then 
        if counter2=8 then counter2<=0; counter01<='1';
             else counter2<=counter2+1;counter01<='0';
        end if;
        if(counter2<=3) then cp2<='0';
             else cp2<='1';
        end if;
     end if;
 end if;
q<=counter01;
end process;
count_ctrl<=p or q;

process(clk,control)
begin
if falling_edge(clk) then
   if control='0' then output<=cp1;
      else output<=cp2;
   end if;
end if;
end process;

end main;

⌨️ 快捷键说明

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