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 ...
随机推荐
- 编程规范 html部分
不管有多少人共同参与同一项目,一定要确保每一行代码都像是同一个人编写的. HTML 部分 语法 对于属性的定义,确保全部使用双引号,绝不要使用单引号. 为每个 HTML 页面的第一行添加标准模式(st ...
- Android 6 Marshmallow USB调试授权
Google在Android在5.1版之后进行了重大变革,推出了Android 6 Marshmallow,我们先看看当它接上工作站时,有什么样的状况出现. 如图1所示,会弹出一个窗口,[是否允许此计 ...
- 模仿QQ空间 网页设计
目的:1.通过模仿QQ空间,全自主写代码,熟悉网页设计的流程 2.熟练的掌握HTML.CSS.JS的应用 3.将在此过程中遇到的问题及其解决方法记录在此,以便取用. 开始: 一.登陆界面(index. ...
- about control %CPU
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #define timesize 200000 ...
- javaSE第十四天
第十四天 92 1. 正则表达式(理解) 92 (1)定义: 92 (2)常见规则 92 A:字符 92 B:字符类 93 C:预定义字符类 93 D:边界匹 ...
- linux安装ftp服务器
Ftp(文件传输协议) 概念 FTP是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为“文传协议”.用于Internet上的控制文件的双向传输.同时,它也是一个应用 ...
- [原]My first Python
我的第一个Python程序: print 'hello world' raw_input ("print any key to continue...") 在python3.4下应 ...
- oracle11g导入到10g
oracle11g导入到10g http://www.doc88.com/p-0827386468478.html
- 软件工程 speedsnail 冲刺2
2015-5-6 完成任务:snail的对象: 遇到问题:关闭了speedsnail,背景音乐还在响: 明日任务:snail的移动功能.
- 详解Oracle临时表的几种用法及意义
Oracle临时表可以说是提高数据库处理性能的好方法,在没有必要存储时,只存储在Oracle临时表空间中.希望本文能对大家有所帮助. 1 .前言 Oracle Logo 目前所有使用 Oracle 作 ...