




免费预览已结束,剩余8页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
VHDL课程设计选题:任意进制计数器(100以内)设计班级:学号:11200134姓名:2014/5/2313目录1、设计选题:任意进制计数器(100以内)设计32、设计要求33、设计原理分析34、程序编写、调试及仿真44.1程序编写44.11、n进制计数器顶层程序:44.12、10进制计数器程序:54.13、LED译码器程序:64.14、50M分频器程序:64.15、5分频程序:74.16、10分频程序:84.2功能仿真和芯片时序仿真94.21、5分频仿真波形94.22、50分频仿真波形()94.23、10进制计数器仿真波形94.24、LED译码器仿真波形104.25、78进制计数器仿真波形104.3、芯片引脚设定104.4、适配下载结果115、设计总结111、设计选题:任意进制计数器(100以内)设计2、设计要求 (1)计数基数由输入确定,并采用按键所存,即按键每按下一次,存储计数基数(20100之间),计数基数采用8421BCD码表示,否则改变开关输入无效。(2)计数频率要求为每秒计数1次(仿真时可以调整为每10us计数1次);(3)计数值用共阴数码管静态显示(实验板上自带);(2)设计中系统时钟采用验证电路板上的50MHz晶振作为基准,且设计成同步电路;(4)程序设计尽可能考虑模块化、参数化设计思想,并遵循基本的格式规范,添加适当的注释及文档说明;(5)采用模块化设计方式,底层模块必须进行功能仿真;(6)下载调试并编写设计总结报告。3、设计原理分析先对50MHz时钟信号分频得到1Hz,然后调用两个10进制计数器,计数到所输入的计数周期n后回到初始0的计数状态,每个10进制计数的计数结果通过显示译码送到两位数码管上显示。判断计数器(20-100之间)是否计满计数周期的方式是:将计数基数采用两个8421BCD码表示,分别为ge3:0、shi3:0,将两个计数器计数产生的中间结果分别用“按位异或”(每位使用“(not (cont_tmp10(3) xor shi(3)”的方式实现)分别比对,当ge、shi每位都相同时,则说明计数完毕,重新载入初值”0000”,同时产生进位信号en_out,之后进入下一次计数周期,并以此循环。结构框图如下:4、程序编写、调试及仿真(芯片型号:MAX系列EPM1270T144C5)4.1程序编写4.11、n进制计数器顶层程序:library ieee;use ieee.std_logic_1164.all;entity count_n isport(clk,rst,en:in std_logic; ge,shi:in std_logic_vector(3 downto 0); count_data10,count_data1: out std_logic_vector(6 downto 0); en_out :out std_logic);end count_n;architecture rtl of count_n iscomponent divide_50M port(clk,rst:in std_logic;en_out :out std_logic);end component;component count_10 port(clk,rst,en_in,ld:in std_logic;data_in:in std_logic_vector(3 downto 0);data_out:out std_logic_vector(3 downto 0);en_out :out std_logic);end component;component decode port(data_in:in std_logic_vector(3 downto 0);dis_num :out std_logic_vector(6 downto 0);end component;signal cont_tmp10,cont_tmp1,data_in:std_logic_vector(3 downto 0);signal ld,ks,sec_en,sec_en10,min_out,fuwei:std_logic;begindata_in=0000;ks=sec_en and en;ld=( (not (cont_tmp10(3) xor shi(3) and (not (cont_tmp10(2) xor shi(2) and (not (cont_tmp10(1) xor shi(1) and (not (cont_tmp10(0) xor shi(0) and (not (cont_tmp1(3) xor ge(3) and (not (cont_tmp1(2) xor ge(2) and (not (cont_tmp1(1) xor ge(1) and (not (cont_tmp1(0) xor ge(0) );en_out=ld;U0:divide_50M port map(clk,rst,sec_en);U1:count_10 port map(clk,rst,ks,ld,data_in,cont_tmp1,sec_en10);U2:count_10 port map(clk,rst,sec_en10,ld,data_in,cont_tmp10,min_out);U3:decode port map(cont_tmp1,count_data1);U4:decode port map(cont_tmp10,count_data10);end rtl;4.12、10进制计数器程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity count_10 isport(clk,rst,en_in,ld : in std_logic; data_in : in std_logic_vector(3 downto 0); data_ou t: out std_logic_vector(3 downto 0); en_out :out std_logic);end count_10;architecture rtl of count_10 issignal cont_tmp:std_logic_vector(3 downto 0);begin en_out=en_in and cont_tmp(3) and cont_tmp(0); data_out=cont_tmp;process(clk,rst)begin if(rst=0)then cont_tmp=0000; elsif(clkevent and clk=1)then if(ld=1)then cont_tmp=data_in; elsif(en_in=1)then if(cont_tmp=1001)then cont_tmp=0000; else cont_tmp=cont_tmp+1; end if; end if; end if;end process;end rtl;4.13、LED译码器程序:library ieee;use ieee.std_logic_1164.all;entity decode isport(data_in:in std_logic_vector(3 downto 0); dis_num :out std_logic_vector(6 downto 0);end decode;architecture rtl of decode isbegin with data_in select dis_num=0111111 WHEN 0000, 0000110 WHEN 0001, 1011011 WHEN 0010, 1001111 WHEN 0011, 1100110 WHEN 0100, 1101101 WHEN 0101, 1111101 WHEN 0110, 0000111 WHEN 0111, 1111111 WHEN 1000, 1100111 WHEN 1001, 0000000 WHEN others;end rtl;4.14、50M分频器程序:library ieee;use ieee.std_logic_1164.all;entity divide_50M isport(clk,rst:in std_logic; en_out :out std_logic);end divide_50M;architecture rtl of divide_50M iscomponent divide_5 port(clk,rst,en_in:in std_logic; en_out :out std_logic );end component;component divide_10 port(clk,rst,en_in:in std_logic; en_out :out std_logic );end component;signal en0,en1,en2,en3,en4,en5,en6,en7:std_logic;begin en_out=en7;U0:divide_5 port map(clk,rst,1,en0);U1:divide_10 port map(clk,rst,en0,en1);U2:divide_10 port map(clk,rst,en1,en2);U3:divide_10 port map(clk,rst,en2,en3);U4:divide_10 port map(clk,rst,en3,en4);U5:divide_10 port map(clk,rst,en4,en5);U6:divide_10 port map(clk,rst,en5,en6);U7:divide_10 port map(clk,rst,en6,en7);end rtl;4.15、5分频程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity divide_5 isport(clk,rst,en_in : in std_logic; en_out : out std_logic);end divide_5;architecture rtl of divide_5 issignal cont_tmp:std_logic_vector(2 downto 0);begin en_out=en_in and cont_tmp(2);process(clk,rst)begin if(rst=0)then cont_tmp=000; elsif(clkevent and clk=1)then if(en_in=1)then if(cont_tmp=100)then cont_tmp=000; else cont_tmp=cont_tmp+1; end if; end if; end if;end process;end rtl;4.16、10分频程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity divide_10 isport(clk,rst,en_in:in std_logic; en_out :out std_logic);end divide_10;architecture rtl of divide_10 issignal cont_tmp:std_logic_vector(3 downto 0);begin en_out=en_in and cont_tmp(3) and cont_tmp(0);process(clk,rst)begin if(rst=0)then cont_tmp=0000; elsif(clkevent and clk=1)then if(en_in=1)then if(cont_tmp=1001)then cont_tmp=0000; else cont_tmp=cont_tmp+1; end if; end if; end if;end process;end rtl;4.2功能仿真和芯片时序仿真4.21、5分频仿真波形4.22、50分频仿真波形()因为要有个大数据量,仿真不容易进行,所以在此我们改编仿真50分频的波形。4.23、10进制计数器仿真波形4.24、LED译码器仿真波形4.25、78进制计数器仿真波形4.3、芯片引脚设定4.4、适配下载结果 5、设计总结本设计实现了n进制(20-100之间)计数器的功能设计,涉及到了分频器、译码器、10进制计数器的设计以及从元件例化,然后到调用的层次化、结构化系统设计的方法,整个程序层次清晰,易于理解和实现。实验结构层次如下:在具体设计过程中,系统时钟采用验证电路板上的50MHz晶振作为基准,对50MHz时钟信号分频得到1H
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 国家能源荆门市2025秋招面试专业追问及参考电气工程岗位
- 国家能源鄂尔多斯市2025秋招面试专业追问及参考交通运输岗位
- 国家能源张家口市2025秋招笔试题库含答案
- 商丘市中石油2025秋招笔试模拟题含答案油品分析质检岗
- 中国联通张掖市2025秋招行业解决方案岗位专业追问清单及参考回答
- 大唐电力南充市2025秋招网申填写模板含开放题范文
- 沧州市中储粮2025秋招战略研究博士岗高频笔试题库含答案
- 上饶市中储粮2025秋招面试半结构化模拟题30问及答案
- 国家能源红河自治州2025秋招面试专业追问及参考综合管理岗位
- 周口市中石化2025秋招面试半结构化模拟题及答案炼化装置操作岗
- 物业高端化规定
- 采暖补贴审计方案(3篇)
- 锂电池公司管理制度
- GB/T 17948.7-2025旋转电机绝缘结构功能性评定总则
- 2025年陕西、山西、青海、宁夏高考化学试卷真题(含答案解析)
- 农光互补光伏发电项目发展趋势与前景分析
- 光伏发电建设工程质量监督检查大纲(2023版)
- 老人外出免责协议书
- 数字信号处理理论与应用练习题集
- 处方药销售管理制度2023年零售药店管理制度
- 青春期生殖健康教育
评论
0/150
提交评论