eda整点报时时钟设计_第1页
eda整点报时时钟设计_第2页
eda整点报时时钟设计_第3页
eda整点报时时钟设计_第4页
eda整点报时时钟设计_第5页
已阅读5页,还剩32页未读, 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、EDA技术应用课程设计报告题目名称:多功能数字钟专业班级:姓名:学号:小组成员 :指导教师:设计时 间:15-12-0115-12-25一、设计目的1.使得更加了解EDA的应用2. 熟悉VHDL的编程。3. 对于编程语句的编辑与纠错有较大的提升4. 提升对于设计方面的能力二、设计要求1. 数字钟具有“时”、“分”、“秒”显示功能,其中时功能为24小时 制。2. 数字钟具有校时和校分功能。3. 数字钟具有整点报时功能。七段译码管通过分别作出秒模块、分钟模块、小时模块、整点报时模块, 导入动态扫描模块,再由其输出到数码管输出四、模块设计1. 秒程序模块shijianI-! resetdaout_a

2、7.4elkdaout_b3.0set minenmin-$-aIinst 有3输入3输出 reset为异步清零当没有信号时清零秒模块的计数 setmin为校分 当有信号时想分模块进一位 daout_a与daout_b为输出的信号分别为秒的高位与低位 enmin负责向下一个模块进位 elk为时钟信号2. 分钟程序模块 严,hid 4 L !厶 4 I. B 4 _= d 土 d J =* li 3:feni .i ? 、| r&set daout_ma7.4_丁*i elkdaout_nib3.0r sethourenhour H -:! =:.1 insti;.:+ i,金.3输入3输出 r

3、eset为异步清零当没有信号时清零分模块的计数 sethour为校分 当有信号时向时模块进一位 daout_ma分daout_mb为输出的信号分别为分的高位与低位enhour负责向下一个模块进位elk为时钟信号3. 小时程序模块-xiaoshiresetdaout_ha7.4elkdaout_hb3.01-Iminst2有2输入2输出 reset为异步清零当没有信号时清零时模块的计数 elk为时钟信号daout_ha daout_hb 为输出的信号分别为时的高位与低位4. 动态扫描模块rieisrri-iF卜*ir J1jq.421】咒iaoshi_g3.工r :ila,aLinstiSr $

4、 、 有八个输入端,两个输出端 reset为异步清零当没有信号时清零时模块的计数 daout为高位5. 七段译码管模块 有1输入8输出 S为用来接收秒分时模块输出的信号 AH为转化后的信号用来接数码管6. 整点报时模块有5输入2输出 Clkspk为时钟信号 Miao_h Miaofen_h fen_h为从秒模块时模块接收的信号 Speak接蜂鸣器, Lamp接LED作为报时时的闪烁灯五、模块程序1. 秒模块设计(60计时制) library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all;en tity s

5、hijia n isport(reset,clk,setmi n:i n std_logic;daout_a:out stdo gic_vector(7 dow nto 4); 输出高位 daout_adaout_b:out std_logic_vector(3 dow nto 0);输出低位 daou_benmin :out std_logic);enmin是向分位进位信号 end shijia n;architecture behav of shijia n issig nal coun t:std_logic_vector(3 dow nto 0);sig nal coun ter:st

6、d_logic_vector(3 dow nto 0);signal carry_out1:std_logic; 59 秒时的进位信号sig nal carry_out2:std_logic;begi np1:process(reset,clk)begi nif reset=0then59秒时的进位信号cou nt=OOOO;cou nter=OOOO;若reset为0时,则高、低位异步清零elsif(clkeve nt and clk=1)the n否则clk为上升沿时if(co un ter5)the nif(co un t=9)the ncou nt=0000coun ter=co un

7、 ter+1;elsecoun t=co un t+1;end if;carry_out1=0:若高位counter5,低位count=9,则低位清零,高位进一,否则低位进一,59秒时的进位信号carry_out1为0。elseif(co un t=9)the ncou nt=0000;cou nter=0000;carry_out1=1:若高位counter为5时,低位count=9,则高、低位清零,59秒时的进位信号carry_out1进位为1else coun t=co un t+1;carry_out1=0:低位count力口 1, 59秒时的进位信号 carry_out1 为0end

8、 if;end if;end if;end process;daout_a(7 downto 4)=counter;高位赋予 daout_adaout_b(3 downto 0)=count;低位赋予 daout_benminv=carry_out1 or setmin;程序 59秒的进位信号或手动给enmin进位end behav;2. 分钟模块设计(60制计时)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all;en tity fen is port(reset,clk,sethour:i

9、n std_logic;daout_ma:out std_logic_vector(7 dow nto 4); 输出高位信号 daout_madaout_mb:out std_logic_vector(3 dow nto 0);输出低位信号 daout_mben hour:out std_logic);enhour向时位进位信号end fen;architecture behav of fen issig nal coun t:std_logic_vector(3 dow nto 0);sig nal coun ter:std_logic_vector(3 dow nto 0);sig nal

10、 carry_out1:std_logic59分的进位信号 carry_out1sig nal carry_out2:std_logic;begi np1:process(reset,clk)begi nif reset=0the ncou nt=OOOO;cou nter=OOOO;若reset为0时,则高、低位异步清零elsif(clkeve nt and clk=1)the n否则clk为上升沿时if(co un ter5)the nif(co un t=9)the ncou nt=OOOO;coun ter=co un ter+1;elsecoun t=co un t+1;end if

11、;carry_out1=O:若高位counter5,低位count=9,则低位清零,高位进1,否则低位进1, 59分时的进位信号carry_out1为0elseif(co un t=9)the ncou nt=0000;cou nter=0000;carry_out1=1:若高位counter为5时,低位count=9 ,则高、低位清零,59分时的进位信号carry_out1进位为1。elsecoun t=co un t+1;carry_out1=0:低位count力口 1, 59分时的进位信号 carry_out1 为0。end if;end if;end if;end process;p2

12、:process(reset,clk)begi nif(clkevent and clk=0)then若 clk 为下降沿时if(co un ter=0)the nif(co un t=0)the ncarry_out2=0:若高位counter为零,低位为零,则59分时的进位信号carry_out2 为 0end if;elsecarry_out2=1:否则进位为 1end if;end if;end process;daout_ma(7 dow nto 4)=co un ter;高位赋予 daout_madaout_mb(3 dow nto 0)=co unt;低位赋予 daout_mbe

13、n hour=(carry_out1 and carry_out2)or sethour;程序两个59分的进位信号或手动给 enmin进位end behav;3. 小时模块设计(24小时制) library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all;en tity xiaoshi is port(reset,clk:i n std_logic;daout_ha:out std_logic_vector(7 dow nto 4);-输出高位daout_hadaout_hb:out std_logic_v

14、ector(3 dow nto 0);输出地位daout_hbend xiaoshi;architecture behav of xiaoshi is sig nal coun t:std_logic_vector(3 dow nto 0); sig nal coun ter:std_logic_vector(3 dow nto 0); begi np1:process(reset,clk)begi nif reset=0the ncou nt=0000;cou nter=0000;若reset为0时,则高、低位异步清零if(co un ter2)the n elsif(clkeve nt a

15、nd clk=1)the n否则clk上升沿来到时if(co un ter2)the nif(co un t=9)the ncou nt=OOOO;coun ter=co un ter+1;elsecoun t=co un t+1;若高位counter2,低位count=9,则低位清零,高位进1,否则低位进1。end if;elseif(co un t=3)the ncou nt=OOOO;cou nter=OOOO;elsecoun t=co un t+1;若高位counter=2,低位count=3,则高、低位清零,否则低位进一。end if;end if;end if;end proce

16、ss;daout_ha(7 dow nto 4)v=co un ter;高位赋予 daout_hadaout_hb(3 dow nto 0)=co unt;地位赋予daout_hbend behav;4. 动态扫描模块设计library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all;en tity seltime isport(ckdsp:i n std_logic;reset:i n std_logic;shijia n_s:i n stdo gic_vector(7 dow nto 4);-秒模块高位

17、模块输入shijia n_g:i n stdo gic_vector(3 dow nto 0);-秒模块低位模块输入fen _s:i n std_logic_vector(7 dow nto 4);fen _g:i n std_logic_vector(3 dow nto 0); xiaoshi_s:i n stdo gic_vector(7 dow nto 4); xiaoshi_g:i n std_logic_vector(3 dow nto 0); daout:out std_logic_vector(3 dow nto 0); sel:out std_logic_vector(2 do

18、w nto 0);end seltime;architecture behav of seltime issig nal sec:std_logic_vector(2 dow nto 0);begi n process(reset,ckdsp)begi nif(reset=0)the nsec=000;elsif(ckdspeve nt and ckdsp=1)the n if(sec=101)the nsec=000;elsesecdaoutdaoutdaoutdaoutdaoutdaoutdaout=XXXX;end case;end process;sel=sec;end behav;5

19、. 整点报时模式library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all;en tity alert isport(shijia n_s:i n stdo gic_vector(7 dow nto 4);shijia n_g:i n stdo gic_vector(3 dow nto 0);fen _s:i n std_logic_vector(7 dow nto 4);fen _g:i n std_logic_vector(3 dow nto 0);speak:out std_logic;输出 sp

20、eaklamp:out std_logic_vector(8 dow nto 0);输出lampend alert;architecture behav of alert issig nal divclkspk2:stdo gic;begi np1:process(clkspk)begi nif(clkspkeve nt and clkspk=1)the n当clkspk为上升沿时divclkspk2lampv=000000001;speaklampv=OOOOOOO1O;speakv=O:whe n0011=lampv=000000100;speaklampv=OOOOO1OOO;speak

21、v=O:whe n0101=lampv=000010000;speakv=divclkspk2;whe nO11O=lampv=OOO1OOOOO;speakv=O:whe n0111=lampv=001000000;speakv=divclkspk2;whe n1OOO=lampv=O1OOOOOOO;speakv=O:whe n1001=lampv=100000000;speakv=clkspk;当59秒信号给lamp,时钟信号给speak,准备整点报时whe n others=lampv=000000000;当秒为其他值时无效end case;end if;end process;end

22、 behav;6.7段译码显示模块设计 library ieee;use ieee.std_logic_1164.all;en tity deled isport(s:i n std_logic_vector(3 dow nto 0);a,b,c,d,e,f,g,h:out std_logic);end deled;architecture behav of deled issig nal data:std_logic_vector(3 dow nto 0);sig nal dout:std_logic_vector(7 dow nto 0);begi ndatadoutdoutdoutdou

23、tdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=00000000;当data为其他值时,将 00000000赋给dout end case;end process;h=dout(7);gv=dout(6);fv=dout(5);e=dout(4);d=dout(3);c=dout(2);b=dout(1);a041kAL国 d6.ou.t_aA if*j d.Mut_bA oil-EEwninA 1V 12rsetA113A I4III一 1t-18.375 帼P pE 10. Q HE | 18.苛5 nsJ&0. 0 n=120.

24、0 仏iso. a nsEDO. 0 毗320.0 皿380 0 nsLrLrLnrLrLrLrLrLrLrvLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrLrVuLrLrLrLrLrLrLrLrLrLrcni i当信号reset输入时,各输出端口信号正常。并且当reset为0时,清零正常。3.时模块波形当信号reset输入时,各输出端口信号正常。4. 动态扫描模块毎 jelime 爲d| Eonphticrt Repot - Fbw 血nwnaiyG sidline vnfimuldLiium Fiupoil - 5imulcitiDn W-twFiviHF当信号reset输入时,各输出端口信号正常。5. 整点报时波形吕MlIuViluv Set t b-nfi.-耳 Si milViLwi- FTfl Swu*y iR 嵯誓 SLnultLOJi+_ inul i du 亡时*密no i mt旧护 5/ UFE4*当S输入0-9是译码器分别输出不同的值与程序相同7.数字钟Sanul*d- FuacEwdi色 delEdvhdSiimljkl j on Hidk Pusili annl坟node Fuct aonalMaslw Tire B:17 45

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论