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

下载本文档

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

文档简介

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

2、1. 秒程序模块 有3输入3输出 reset为异步清零当没有信号时清零秒模块的计数 setmin为校分 当有信号时想分模块进一位 daout_a与daout_b为输出的信号分别为秒的高位与低位 enmin 负责向下一个模块进位 clk为时钟信号2. 分钟程序模块 3输入3输出reset为异步清零当没有信号时清零分模块的计数 sethour为校分 当有信号时向时模块进一位 daout_ma 分daout_mb 为输出的信号分别为分的高位与低位 enhour 负责向下一个模块进位 clk为时钟信号3. 小时程序模块有2输入2输出reset为异步清零当没有信号时清零时模块的计数clk为时钟信号 da

3、out_ha daout_hb 为输出的信号分别为时的高位与低位4. 动态扫描模块 有八个输入端,两个输出端 reset为异步清零当没有信号时清零时模块的计数 daout为高位5. 七段译码管模块 有1输入8输出 S为用来接收秒分时模块输出的信号 AH 为转化后的信号用来接数码管6. 整点报时模块 有5输入2输出 Clkspk为时钟信号 Miao_h Miao_l fen_h fen_h为从秒模块时模块接收的信号 Speak 接蜂鸣器, Lamp 接LED作为报时时的闪烁灯五、 模块程序1. 秒模块设计(60计时制)library ieee;use ieee.std_logic_1164.al

4、l;use ieee.std_logic_unsigned.all;entity shijian isport(reset,clk,setmin:in std_logic; daout_a:out std_logic_vector(7 downto 4);输出高位daout_a daout_b:out std_logic_vector(3 downto 0);输出低位daou_b enmin:out std_logic);enmin是向分位进位信号end shijian;architecture behav of shijian issignal count:std_logic_vector(

5、3 downto 0);signal counter:std_logic_vector(3 downto 0);signal carry_out1:std_logic;59秒时的进位信号signal carry_out2:std_logic;beginp1:process(reset,clk)beginif reset=0then59秒时的进位信号 count=0000;counter=0000;若reset为0时,则高、低位异步清零elsif(clkevent and clk=1)then否则clk为上升沿时if(counter5)then if(count=9)then count=000

6、0 counter=counter+1;else count=count+1;end if;carry_out1=0;若高位counter5,低位count=9,则低位清零,高位进一,否则低位进一,59秒时的进位信号carry_out1为0。elseif(count=9)thencount=0000;counter=0000;carry_out1=1;若高位counter为5时,低位count=9,则高、低位清零,59秒时的进位信号carry_out1进位为1。elsecount=count+1;carry_out1=0;低位count加1,59秒时的进位信号carry_out1为0end i

7、f;end if;end if;end process;daout_a(7 downto 4)=counter;高位赋予daout_adaout_b(3 downto 0)=count;低位赋予daout_benmin=carry_out1 or setmin;程序59秒的进位信号或手动给enmin进位end behav;2. 分钟模块设计(60制计时)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fen isport(reset,clk,sethour:in std_logic;

8、 daout_ma:out std_logic_vector(7 downto 4);输出高位信号daout_ma daout_mb:out std_logic_vector(3 downto 0);输出低位信号daout_mb enhour:out std_logic);enhour向时位进位信号end fen;architecture behav of fen issignal count:std_logic_vector(3 downto 0);signal counter:std_logic_vector(3 downto 0);signal carry_out1:std_logic5

9、9分的进位信号carry_out1signal carry_out2:std_logic;beginp1:process(reset,clk)beginif reset=0then count=0000;counter=0000;若reset为0时,则高、低位异步清零elsif(clkevent and clk=1)then否则clk为上升沿时if(counter5)then if(count=9)then count=0000; counter=counter+1;else count=count+1;end if;carry_out1=0;若高位counter5,低位count=9,则低位

10、清零,高位进1,否则低位进1,59分时的进位信号carry_out1为0elseif(count=9)thencount=0000;counter=0000;carry_out1=1;若高位counter为5时,低位count=9,则高、低位清零,59分时的进位信号carry_out1进位为1。elsecount=count+1;carry_out1=0;低位count加1,59分时的进位信号carry_out1为0。end if;end if;end if;end process;p2:process(reset,clk)beginif(clkevent and clk=0)then若clk

11、为下降沿时 if(counter=0)then if(count=0)then carry_out2=0;若高位counter为零,低位为零,则59分时的进位信号carry_out2为0end if;else carry_out2=1;否则进位为1end if;end if;end process;daout_ma(7 downto 4)=counter;高位赋予daout_madaout_mb(3 downto 0)=count;低位赋予daout_mbenhour=(carry_out1 and carry_out2)or sethour;程序两个59分的进位信号或手动给enmin进位en

12、d behav;3. 小时模块设计(24小时制)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xiaoshi isport(reset,clk:in std_logic; daout_ha:out std_logic_vector(7 downto 4);输出高位daout_ha daout_hb:out std_logic_vector(3 downto 0);输出地位daout_hbend xiaoshi;architecture behav of xiaoshi issign

13、al count:std_logic_vector(3 downto 0);signal counter:std_logic_vector(3 downto 0);beginp1:process(reset,clk)beginif reset=0then count=0000;counter=0000;若reset为0时,则高、低位异步清零if(counter2)thenelsif(clkevent and clk=1)then否则clk上升沿来到时if(counter2)then if(count=9)then count=0000; counter=counter+1;else count

14、=count+1;若高位counter2,低位count=9,则低位清零,高位进1,否则低位进1。end if;elseif(count=3)thencount=0000;counter=0000;elsecount=count+1;若高位counter=2,低位count=3,则高、低位清零,否则低位进一。end if;end if;end if;end process;daout_ha(7 downto 4)=counter;高位赋予daout_hadaout_hb(3 downto 0)=count;地位赋予daout_hbend behav;4. 动态扫描模块设计library iee

15、e;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity seltime isport( ckdsp:in std_logic; reset:in std_logic; shijian_s:in std_logic_vector(7 downto 4);秒模块高位模块输入 shijian_g:in std_logic_vector(3 downto 0);秒模块低位模块输入 fen_s:in std_logic_vector(7 downto 4); fen_g:in std_logic_vector(3 down

16、to 0); xiaoshi_s:in std_logic_vector(7 downto 4); xiaoshi_g:in std_logic_vector(3 downto 0); daout:out std_logic_vector(3 downto 0); sel:out std_logic_vector(2 downto 0);end seltime;architecture behav of seltime issignal sec:std_logic_vector(2 downto 0);beginprocess(reset,ckdsp)beginif(reset=0)then

17、sec=000;elsif(ckdspevent and ckdsp=1)thenif(sec=101)then sec=000;else secdaoutdaoutdaoutdaoutdaoutdaoutdaout=XXXX;end case;end process;sel=sec;end behav;5. 整点报时模式library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity alert isport( clkspk:in std_logic;时钟信号 shijian_s:in std_lo

18、gic_vector(7 downto 4); shijian_g:in std_logic_vector(3 downto 0); fen_s:in std_logic_vector(7 downto 4); fen_g:in std_logic_vector(3 downto 0); speak:out std_logic;输出speak lamp:out std_logic_vector(8 downto 0);输出lampend alert;architecture behav of alert issignal divclkspk2:std_logic;beginp1:process

19、(clkspk)beginif(clkspkevent and clkspk=1)then当clkspk为上升沿时divclkspk2lamp=000000001;speaklamp=000000010;speaklamp=000000100;speaklamp=000001000;speaklamp=000010000;speaklamp=000100000;speaklamp=001000000;speaklamp=010000000;speaklamp=100000000;speaklamp=000000000;当秒为其他值时无效end case;end if;end process;e

20、nd behav;6.7段译码显示模块设计library ieee;use ieee.std_logic_1164.all;entity deled isport( s:in std_logic_vector(3 downto 0); a,b,c,d,e,f,g,h:out std_logic);end deled;architecture behav of deled issignal data:std_logic_vector(3 downto 0);signal dout:std_logic_vector(7 downto 0);begindatadoutdoutdoutdoutdout

21、doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=00000000;当data为其他值时,将00000000赋给doutend case;end process;h=dout(7);g=dout(6);f=dout(5);e=dout(4);d=dout(3);c=dout(2);b=dout(1);a=dout(0);end behav;六、 仿真波形1. 秒模块仿真波形当信号reset输入时,各输出端口信号正常。并且当reset为0时,清零正常。2 分模块仿真波形当信号reset输入时,各输出端口信号正常。并且当reset为0时,清零正常。3.时

温馨提示

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

评论

0/150

提交评论