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

📄 frequency_division.txt

📁 任意奇数分频
💻 TXT
字号:
 我做了一个任意基数分频,请大家看看?给点意见。
package temp is--ding yi han shu bao
subtype bcd is integer range 0 to 3; --控制分频数。分频数=2*(bcd + 1) -1;
end package;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use work.temp.all;--diao yong han shu bao
entity fenpin4 is
port(clk : in std_logic;--被分频的时钟
en : in std_logic;--输入使能
dclk : out std_logic);--分频后输出
end;
architecture bhv of fenpin4 is

signal data : bcd;--设置任意整数分频
signal clkk,temp,co : std_logic;
begin
clkk <= clk xor temp;--扣除一个时钟脉冲
process(clkk)--任意整数分频 
begin
if clkk'event and clkk = '1' then
if en = '1' then 
if data = 3 then co <= '1';data <= 0;
else data <= data + 1;co <= '0';
end if;
end if;
end if;
end process;

process(co)--实现二分频和占空比为50%
begin
if co'event and co = '1' then
temp <= not temp;
end if;
end process;
dclk <= temp; 
end;

⌨️ 快捷键说明

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