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 ...
随机推荐
- APUE第五章:标准IO库
5.2流和file对象 #include <wchar.h> int fwide(FILE *fp, int mode); Returns: positive if stream is w ...
- .Net性能优化时应该关注的数据
解决性能问题的时候,我往往会让客户添加下面一些计数器进行性能收集. Process object下的所有计数器: Processor object下的所有计数器: System object下的所有计 ...
- js DOM的几个常用方法
<div id="div1">这是个测试</div> <p </p> <p </p> //js DOM的几个常用方法 / ...
- setjmp 与 longjmp
setjmp和longjmp是C语言独有的,只有将它们结合起来使用,才能达到程序控制流有效转移的目的,按照程序员的预先设计的意图,去实现对程序中可能出现的异常进行集中处理. 先来看一下这两个函数的定义 ...
- C# Webservice 解决在运行配置文件中指定的扩展时出现异常。 ---> System.Web.HttpException: 超过了最大请求长度问
摘自: http://blog.csdn.net/gulijiang2008/article/details/4482993 请在服务器端配置 方法一: 在通过WebService处理大数据量数据时出 ...
- leetcode 107
107. Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order trav ...
- Chrome不能登录和同步的解决方法
打开 C:\Windows\System32\drivers\etc 下的 hosts文件 #SmartHosts START #Google Services START .docs.google. ...
- RECT 数据结构
数据结构RECT定义了一个矩形的左上角和右下角的坐标 ? 1 2 3 4 5 6 7 8 typedef struct _RECT{ LONG left; LONG t ...
- Show Users Assigned to a Specific Role
In a previous post I showed you how to know what Roles are assigned to a specific user. But here is ...
- js 实现栈
function Stack() { this.dataStore = []; this.top = 0; this.push=push; this.pop=pop; this.peek=peek; ...