集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 8047|回复: 14

三分频、五分频程序

[复制链接]
老怪甲 该用户已被删除
老怪甲 发表于 2010-4-13 11:30:32 | 显示全部楼层 |阅读模式
三分频程序如下:
library IEEE;
use IEEE.STD_LOGIC_116 4.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity division5 is
port (clk: in std_logic;
     out1: out std_logic);
     end division5;
architecture Behavioral of division5 is
      signal division2,division4  :std_logic;
      signal temp1,temp2:integer range 0 to 10;
begin
p1:process(clk)
begin
if rising_edge(clk) then
temp1<=temp1+1;
if temp1=1 then
division2<='1';
elsif temp1=2 then
division2<='0';
temp1<=0;
end if;
end if;
end process p1;

p2:process(clk)
begin
if clk'event and clk='0' then
temp2<=temp2+1;
if temp2=1 then
division4<='1';
elsif temp2=2 then
division4<='0';
temp2<=0;
end if;
end if;
end process p2;
p3:process(division2,division4)
begin
out1<=division2 or division4;
end process p3;
end Behavioral;

五分频程序如下:
library IEEE;
use IEEE.STD_LOGIC_116 4.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity division5 is
port (clk: in std_logic;
     out1: out std_logic);
     end division5;
architecture Behavioral of division5 is
      signal division2,division4  :std_logic;
      signal temp1,temp2:integer range 0 to 10;
begin
p1:process(clk)
begin
if rising_edge(clk) then
temp1<=temp1+1;
if temp1=2 then
division2<='1';
elsif temp1=4 then
division2<='0';
temp1<=0;
end if;
end if;
end process p1;
p2:process(clk)
begin
if clk'event and clk='0' then
temp2<=temp2+1;
if temp2=2 then
division4<='1';
elsif temp2=4 then
division4<='0';
temp2<=0;
end if;
end if;
end process p2;
p3:process(division2,division4)
begin
out1<=division2 or division4;
end process p3;
end Behavioral;

希望对大家有用!
TCL 发表于 2011-7-1 15:01:45 | 显示全部楼层
三分频、五分频程序
蓝余 发表于 2011-7-1 15:46:44 | 显示全部楼层
好贴!
蓝余 发表于 2011-7-4 15:13:50 | 显示全部楼层
三分频的波形图,有疑问的我可以帮忙解释。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?我要注册

x
yych 发表于 2011-7-4 18:01:21 | 显示全部楼层
这是什么代码啊?我怎么看不懂啊?但又有点眼熟。
蓝余 发表于 2011-7-4 18:46:14 | 显示全部楼层
vhdl代码!
TCL 发表于 2011-7-4 23:05:34 | 显示全部楼层
vhdl代码!
蓝余 发表于 2011-7-4 18:46



    xiexie
木头猪 发表于 2011-7-4 23:06:18 | 显示全部楼层
不错,收藏了
ningbeyond 发表于 2011-7-6 23:08:09 | 显示全部楼层
有任意分频的
蓝余 发表于 2011-7-6 23:35:45 | 显示全部楼层
改改参数就能实现其他分频了。
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-8-19 15:40 , Processed in 0.189151 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表