偶数分频

 ibrary IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith;
use ieee.std_logic_unsigned; entity test_1 is
generic (n: integer:=);
port(
clkin: in std_logic;-----rate=n,n is odd;
clkout: out std_logic ---relative FPGA,clkout is out signal;
);
end test_1; architecture Behavioral of test_1 is
signal cnt:integer range to n-;
begin
process (clkin)------count
begin
if (clkin'event and clkin='') then
if(cnt<n-) then
cnt<=cnt+;
else
cnt<=;
end if;
end if;
end process; process(cnt) -----根据计数值,控制输出始终脉冲的高低电平
begin
if(cnt<n/) then
clkout<='';
else
clkout<='';
end if;
end process; end Behavioral;
 library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith;
use ieee.std_logic_unsigned; -- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all; entity test_1 is
generic (n: integer:=);
port(
clkin: in std_logic;-----rate=n,n is odd;
clkout: out std_logic ---relative FPGA,clkout is out signal;
);
end test_1; architecture Behavioral of test_1 is
signal cnt:integer range to n/-;
signal temp :std_logic;
begin
process (clkin)------count
begin
if (clkin'event and clkin='') then
if(cnt=n/-) then
cnt<=;
temp<=not temp;
else
cnt<=cnt+;
end if;
end if;
end process; clkout<=temp;---clkout和temp都是信号,均可传出来 end Behavioral;

奇偶分频

 entity test_1 is
generic (n: integer:=);
port(
clkin: in std_logic;-----rate=n,n is 偶数;
clkout: out std_logic ---relative FPGA,clkout is out signal;
);
end test_1; architecture Behavioral of test_1 is
signal cnt1,cnt2:integer range to n/-; begin
process (clkin)------count
begin
if (clkin'event and clkin='') then ------上升沿计数
if(cnt1<n-) then
cnt1<=cnt1+; else
cnt1<=;
end if;
end if;
end process; process (clkin)------count
begin
if (clkin'event and clkin='') then ------下升沿计数
if(cnt2<n-) then
cnt2<=cnt2+; else
cnt2<=;
end if;
end if;
end process; clkout<='' when cnt1<(n-)/ else
'' when cnt2<(n-)/; end Behavioral;

占空标准

 entity test_1 is----占空比3:: 的偶数分频器
-----当计数值为0-2时,输出高电平,到计数值为
----9时,输出低电平
generic (
n: integer:=;
m: integer:= ----占空比为m:n,rate=n;
);
port(
clkin: in std_logic;-----rate=n,n is 偶数;
clkout: out std_logic ---relative FPGA,clkout is out signal;
);
end test_1; architecture Behavioral of test_1 is
signal cnt1:integer range to n-; begin
process (clkin)------count
begin
if (clkin'event and clkin='') then ------上升沿计数
if(cnt1<n-) then
cnt1<=cnt1+; else
cnt1<=;
end if;
end if;
end process; clkout<='' when cnt1<m else
'' ; end Behavioral;

vhdl基础---分频的更多相关文章

  1. VHDL基础2

    Signals & Variables VHDL 提供了 signal 和 variable 两种对象来处理非静态数据:提供了 constant 和 generic 来处理静态数据. cons ...

  2. VHDL基础1

    Description Structure 一个可综合的VHDL描述中一般由3部分组成:LIBRARY declarations.ENTITY.ARCHITECTURE Library(库)用来设计重 ...

  3. VHDL基础 学习笔记

    最近一直忙着学校里的活动,所以没怎么更新,上周活动忙完了,正好也借着数电实验的机会,重新学习一下VHDL的编程.以下是转自360doc的教程: ———————————————————————————— ...

  4. 基于BASYS2的VHDL程序——分频和数码管静态显示程序

    转载请注明出处:http://www.cnblogs.com/connorzx/p/3633860.html 分频是基于计数器程序.由于FPGA的并行处理能力,根本不需要单片机式的中断指令,用起来很方 ...

  5. VHDL TestBench基础(转)

    TestBench的主要目标是: 实例化DUT-Design Under Test 为DUT产生激励波形 产生参考输出,并将DUT的输出与参考输出进行比较 提供测试通过或失败的指示 TestBench ...

  6. 1.ARM的基础知识

    ARM简述 ARM公司既不生产芯片也不销售芯片,它只出售芯片技术授权.ARM技术具有很高的性能和功效,因而容易被厂商接受.同时,合作伙伴的增多,可获得更多的第三方工具.制造和软件支持,这又会使整个系统 ...

  7. [ZigBee] 13、ZigBee基础阶段性回顾与加深理解——用定时器1产生PWM来控制LED亮度(七色灯)

    引言:PWM对于很多软件工程师可能又熟悉又陌生,以PWM调节LED亮度为例,其本质是在每个周期都偷工减料一些,整体表现出LED欠压亮度不同的效果.像大家看到的七色彩灯其原理也类似,只是用3路PWM分别 ...

  8. 如何学习FPGA?FPGA学习必备的基础知识

    如何学习FPGA?FPGA学习必备的基础知识 时间:2013-08-12 来源:eepw 作者: 关键字:FPGA   基础知识       FPGA已成为现今的技术热点之一,无论学生还是工程师都希望 ...

  9. 3. 戏说VHDL之入门游戏一:流水灯

    一.   流水灯 1.1流水灯原理 流水灯是每个学电子的入门“游戏” ,示意图如图1,其原理极其简单,但是可玩性却极强,可以就8个LED写出不同花样的程序.在1.2中我们列出两个不同思路的代码作为VH ...

随机推荐

  1. SSH环境搭建步骤解析

    一.建立Java web project:AngelSSH 二.引入jar包,必要清单如下 2.1,Struts2 commons-fileupload  文件上传组件 commons-io   io ...

  2. jqmobi 的一些設置

    jqmobi version=2.1; 不是 version =3.0: 好吧,我用了jqmobi 差不多半年了,我竟然連 官方的文檔都沒有看完,怪不得我走了多少的彎路.....哎!!!! 1.隱藏 ...

  3. 监控系统 - check_mk_agent

    系统级监控 cpu (system, user) memory (cache, buffer, use)(MB) load (cpu core) diskspace (used, inode)(GB) ...

  4. 织梦dedecms中html和xml格式的网站地图sitemap制作方法

    sitemap是网站上各网页的列表.创建并提交sitemap有助于百度(Google)发现并了解您网站上的所有网页,包括百度通过传统抓取方式可能找不到的网页.还可以使用sitemap提供有关你网站的其 ...

  5. hdu2571

    if(x==1) f(x,y)=max{f(x,y-1),f(x,z)}  {y%z==0&&1<y/z<=y&&1<=z<<y} els ...

  6. 2.2安装JDK

    在Ubuntu下安装JDK的步骤: (1)首先需要自己安装的Ubuntu系统是多少位的,可以使用命令[getconf LONG_BIT]获取这个信息: (2)在JDK官网下载相应(选取和Linux系统 ...

  7. iOS 支付宝支付集成获取私钥

    http://doc.open.alipay.com/doc2/apiList?docType=4 登录到支付宝开放平台,下载相关支付宝支付的demo.解压出来有3个文件夹.(服务端demo,客户端 ...

  8. 一款安卓ShowcaseView视图源码效果

    该源码是从源码天堂那边转载过来的,大家可以看看一下吧啊,一款安卓ShowcaseView视图源码效果,非常不错的,特别是在做引导时使用. 源码下载地址:http://code.662p.com/vie ...

  9. jquery 分页控件功能

      <script>        //分页         function getPageNum(num) {             $("#PageNum ul" ...

  10. 在SQL中取出字符串中数字部分或在SQL中取出字符部分

    在SQL中取出字符串中数字部分或在SQL中取出字符部分 编写人:CC阿爸 2013-10-18 近来在开发一个项目时,一包含数字的字符串,需要取出中间的数字部分进行排序.经过baidu搜索.并结合自己 ...