vhdl基础---分频
偶数分频
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基础---分频的更多相关文章
- VHDL基础2
Signals & Variables VHDL 提供了 signal 和 variable 两种对象来处理非静态数据:提供了 constant 和 generic 来处理静态数据. cons ...
- VHDL基础1
Description Structure 一个可综合的VHDL描述中一般由3部分组成:LIBRARY declarations.ENTITY.ARCHITECTURE Library(库)用来设计重 ...
- VHDL基础 学习笔记
最近一直忙着学校里的活动,所以没怎么更新,上周活动忙完了,正好也借着数电实验的机会,重新学习一下VHDL的编程.以下是转自360doc的教程: ———————————————————————————— ...
- 基于BASYS2的VHDL程序——分频和数码管静态显示程序
转载请注明出处:http://www.cnblogs.com/connorzx/p/3633860.html 分频是基于计数器程序.由于FPGA的并行处理能力,根本不需要单片机式的中断指令,用起来很方 ...
- VHDL TestBench基础(转)
TestBench的主要目标是: 实例化DUT-Design Under Test 为DUT产生激励波形 产生参考输出,并将DUT的输出与参考输出进行比较 提供测试通过或失败的指示 TestBench ...
- 1.ARM的基础知识
ARM简述 ARM公司既不生产芯片也不销售芯片,它只出售芯片技术授权.ARM技术具有很高的性能和功效,因而容易被厂商接受.同时,合作伙伴的增多,可获得更多的第三方工具.制造和软件支持,这又会使整个系统 ...
- [ZigBee] 13、ZigBee基础阶段性回顾与加深理解——用定时器1产生PWM来控制LED亮度(七色灯)
引言:PWM对于很多软件工程师可能又熟悉又陌生,以PWM调节LED亮度为例,其本质是在每个周期都偷工减料一些,整体表现出LED欠压亮度不同的效果.像大家看到的七色彩灯其原理也类似,只是用3路PWM分别 ...
- 如何学习FPGA?FPGA学习必备的基础知识
如何学习FPGA?FPGA学习必备的基础知识 时间:2013-08-12 来源:eepw 作者: 关键字:FPGA 基础知识 FPGA已成为现今的技术热点之一,无论学生还是工程师都希望 ...
- 3. 戏说VHDL之入门游戏一:流水灯
一. 流水灯 1.1流水灯原理 流水灯是每个学电子的入门“游戏” ,示意图如图1,其原理极其简单,但是可玩性却极强,可以就8个LED写出不同花样的程序.在1.2中我们列出两个不同思路的代码作为VH ...
随机推荐
- Duilib学习笔记《07》— 资源加载
Duilib的界面表现力能如此丰富,很大程度上得益于贴图描述的简单强大.通过之前的学习及参看相关例子,我们可以发现,在XML布局文件中,不管是窗体背景还是控件,都添加了对应的图片资源以此来美化界面.而 ...
- 拿搬东西来解释udp tcpip bio nio aio aio异步
[群主]雷欧纳德简单理解 tcpip是有通信确认的面对面通信 有打招呼的过程 有建立通道的过程 有保持通道的确认 有具体传输udp是看到对面的人好像在对面等你 就往对面扔东西[群主]雷欧 ...
- centos7 搭建docker内运行rabbitmq,然后再镜像ha方案的完全教程,暂时一个宿主机只能运行一个docker的rabbitmq,但是集群 ha都正常
1.安装centos7.x,配置好网络2.因为docker需要比较高版本的内核,比如使用overlayfs作为默认docker文件系统要3.18,所以先升级内核到3.18以上版本,能直接过4是最佳了检 ...
- WP8__实现ListBox横向滑动及子项绑定图片等控件
<!--实现绑定的图片等信息 ListBox水平滚动--> <Grid> <Grid.Resources> <Style x:Key="horizo ...
- MITM to crack Https connections
Everybody knows that https is http over SSL, and https is a secure way for protecting confidential d ...
- leetcode 8
string类型转换为int类型,需要考虑不同的转换情况. “ 04” 转换结果 4: “ 4 43” 转换结果 4: “a@12 ” 转换结果 0: “12a” ...
- poj3122 pie
方法:二分. 题目意思:要过生日了,我请大家吃pie,然后人数一共是f+1(我自己).每个人的pie不能是拼接的,而且每个人的面积是一样的,这样就用二分枚举. 范围是0-最大的那块pie. 然后用每一 ...
- [原]hdu2602 Bone Collector (01背包)
本文出自:http://blog.csdn.net/svitter 题意:典型到不能再典型的01背包.给了我一遍AC的快感. //=================================== ...
- Windows 和 Linux 下 禁止ping的方法
Windows 和Linux 下 禁止ping的方法 目的: 禁止网络上的其他主机或服务器ping自己的服务器 运行环境: Windows 03.08 linux 方法: Windows 03下: ...
- Oracle登录时提示错误,导致用户无法登录
Oracle登录时提示错误,导致用户无法登录,错误如下 ------------------------------------------------------------------------ ...