ImageVerifierCode 换一换
格式:DOCX , 页数:29 ,大小:19.14KB ,
资源ID:5791450      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5791450.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VHDL数字时钟实验报告.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

VHDL数字时钟实验报告.docx

1、VHDL数字时钟实验报告VHDL数字时钟设计一、实验目的:进一步练习VHDL语言设计工程的建立与仿真的步骤和方法、熟悉VHDL语言基本设计实体的编写方法。同时,在已有知识的基础上,简单综合编写程序,仿制简单器械。二、实验环境:PC个人计算机、Windows XP操作系统、Quartus II集成开发环境软件。三、设计要求:运用VHDL语言编写一个数字钟,具体要求:2.具有手动调节小时,分钟的功能。3.具有闹钟的功能,能够在设定的闹钟时间发出闹铃声。1.具有时、分、秒计数的十进制数字显示功能,以24小时循环计时。四、实验步骤:1.定义输入输出信号量port(clk:in std_logic;-时

2、钟speak:out std_logic;-铃dout:out std_logic_vector(7 downto 0);-晶体管显示setclk:in std_logic_vector(2 downto 0);-操作按钮d1,d2,d3,d4,d5,d6: out std_logic);-六个晶体管2.定义结构体中的信号量signal sel:std_logic_vector(2 downto 0);signal hou1:std_logic_vector(3 downto 0);-时分秒的个位和十位signal hou2:std_logic_vector(3 downto 0);signa

3、l min1:std_logic_vector(3 downto 0);signal min2:std_logic_vector(3 downto 0);signal seth1:std_logic_vector(3 downto 0);signal seth2:std_logic_vector(3 downto 0);signal setm1:std_logic_vector(3 downto 0);signal setm2:std_logic_vector(3 downto 0);signal sec1:std_logic_vector(3 downto 0);signal sec2:st

4、d_logic_vector(3 downto 0);signal h1:std_logic_vector(3 downto 0);signal h2:std_logic_vector(3 downto 0);signal m1:std_logic_vector(3 downto 0);signal m2:std_logic_vector(3 downto 0);signal s1:std_logic_vector(3 downto 0);signal s2:std_logic_vector(3 downto 0);signal sph1,sph2,spm1,spm2,sps1,sps2:st

5、d_logic_vector(3 downto 0);signal count_sec:std_logic_vector(9 downto 0);signal sec_co :std_logic;signal co1,co2,co3,co4:std_logic;-进位signal switch :std_logic_vector(1 downto 0);-表示状态3.分频模块用来定义秒count_sec用来计时钟个数,当count_sec=1111111111时,及得到1Hz信号。代码如下:process (clk) is -define a secondbegin if(clkevent a

6、nd clk=1)then if(count_sec=1111111111)then count_sec=0000000000;sec_co=1;else count_sec=count_sec+1;sec_co=0;end if;end if;end process;4时钟正常走时模块该模块使用6个进程实现,分别为秒个位计时、秒十位计时、分个位计时、分十位计时、时个位计时、时十位计时。process(sec_co) is -秒个位begin if switch=00 then -正常状态if sec_co=1 then if sec2=1001 then sec2=0000;co1=1;el

7、se sec2=sec2+1;co1=0;end if;end if;elsif switch=01 then -调时状态sec2=0000;end if;end process;-process (co1) is -秒十位begin if switch=00 then if co1event and co1=1 then if (sec1=0101)then sec1=0000;co2=1;else sec1=sec1+1;co2=0;end if;end if;elsif switch=01 then sec1=0000;end if;end process;-process (co1,c

8、o2) is -分钟个位begin if switch=00 then if co2event and co2=1 then if min2=1001 then min2=0000;co3=1;else min2=min2+1;co3=0;end if;end if;elsif switch=01 then min2=setm2;end if;end process;-process (co3) is -分钟十位begin if switch=00 then if co3=1 then if min1=0101 then min1=0000;co4=1;else min1=min1+1;co4

9、=0;end if;end if;elsif switch=01 then min1=setm1;end if;end process;-process(co4)-小时begin if switch=00 then if co4=1 then if (hou1=0010) then -小时十位为2时,个位满3进一if(hou2=0011)then hou2=0000;hou1=0000;else hou2=hou2+1;end if;else -小时十位为0或1,个位满9进一if(hou2=1001)then hou2=0000;hou1=hou1+1;else hou2=hou2+1;end

10、 if;end if;end if;elsif switch=01 then hou1=seth1;hou2=seth2;end if;end process;5调时模块该进程用来控制时钟状态,switch为“00”时正常显示时间,为“01”时是进行调时,为“10”时是设置闹钟时间。代码如下:process (setclk(0) is begin if(setclk(0)event and setclk(0)=1)then if(switch=10)then switch=00;else switch=switch+1;end if;end if;end process;process (se

11、tclk(2),switch,setclk(1) is begin -setclk(1)为1调分if(switch=01 and setclk(1)=1)then if(setclk(2)event and setclk(2)=1)then if(setm2=1001)then setm2=0000;if(setm1=0101)then setm1=0000;else setm1=setm1+1;end if;else setm2=setm2+1;end if;end if;end if;end process;process (setclk(2),switch,setclk(1) is be

12、gin -setclk(1)为0调时if(switch=01 and setclk(1)=0)then if(setclk(2)event and setclk(2)=1)then if(seth1=0010)then if(seth2=0011)then seth1=0000;seth2=0000;else seth2=seth2+1;end if;else if(seth2=1001)then seth1=seth1+1;seth2=0000;else seth2=seth2+1;end if;end if;end if;end if;end process;6闹钟模块该模块由3个小模块组

13、成,分别为设置闹钟时间、判断闹钟时间是否到达以及闹铃声音模块。(1)设置闹钟时间模块该进程用于设置闹钟时间。信号量switch为10时,表示设置闹钟时间;if(switch=10)then -调闹钟时,显示闹钟设置时间if sel=000 then d1doutdoutdoutdout=XXXXXXXX;end case;elsif sel=001 then d2doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=010 then d3doutdoutdoutdoutdoutdoutdout=XXXX

14、XXXX;end case;elsif sel=011 then d4doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=100 then d5doutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=101 then d6doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;end if;(2)闹铃声音模块通过分频产生蜂鸣,即发出闹铃声音。process (switch)

15、is -闹铃begin -设置闹铃时秒归零if switch=10 then sps1=0000;sps2=0000;end if;end process;process (switch,setclk(2),setclk(1) is begin if(switch=10 and setclk(1)=1)then if(setclk(2)event and setclk(2)=1)then if(spm2=1001)then spm2=0000;if(spm1=0101)then spm1=0000;else spm1=spm1+1;end if;else spm2=spm2+1;end if;

16、end if;end if;end process;process (switch,setclk(2),setclk(1) isbegin if(switch=10 and setclk(1)=0)then if(setclk(2)event and setclk(2)=1)then if(sph1=0010)then if(sph2=0011)then sph1=0000;sph2=0000;else sph2=sph2+1;end if;else if(sph2=1001)then sph2=0000;sph1=sph1+1;else sph2=sph2+1;end if;end if;e

17、nd if;end if;end process;process (clk,sph1,sph2,spm1,spm2,hou1,hou2,min1,min2) is begin if(sph1=hou1 and sph2=hou2 and spm1=min1 and spm2=min2)then speak=clk;else speak=0;end if;end process;7数码管显示模块(1)选择时间显示process(key1,key2,change)begin if(key1=0)and(key2=0)then sec_0=sec_00;sec_1=sec_11;min_0=min_

18、00;min_1=min_11;hour_1=hour_11;hour_0=hour_00;elsif(key1=1)and(key2=0)then sec_0=sec_000;sec_1=sec_111;min_0=min_000;min_1=min_111;hour_0=hour_000;hour_1=hour_111;elsif(key1=0)and(key2=1)then sec_0=sec_0000;sec_1=sec_1111;min_0=min_0000;min_1=min_1111;hour_0=hour_0000;hour_1=hour_1111;end if;end pro

19、cess;(2)数码管时间显示if sel=000 then d1doutdoutdoutdout=XXXXXXXX;end case;elsif sel=001 then d2doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=010 then d3doutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=011 then d4doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=100 then d5doutdoutdoutdoutdoutdoutdout=XXXXXXXX;end case;elsif sel=101 then d6doutdoutdoutdoutdoutdoutdoutdout=11111000;when

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1