当前位置:文档之家› 大连理工大学数字电路课程设计报告:多功能数字时钟设计

大连理工大学数字电路课程设计报告:多功能数字时钟设计

大连理工大学本科实验报告题目:多功能数字时钟设计课程名称:数字电路与系统课程设计学院(系):信息与通信工程学院专业:电子信息工程班级:学生姓名:学号:完成日期:2014年7月16日2014 年7 月16 日题目:多功能数字时钟设计1 设计要求1) 具有“时”、“分”、“秒”及“模式”的十进制数字显示功能;2) 具有手动校时、校分功能,并能快速调节、一键复位(复位时间12时00分00秒);3) 具有整点报时功能,从00分00秒起,亮灯十秒钟;4) 具有秒表功能(精确至百分之一秒),具有开关键,可暂停、可一键清零;5) 具有闹钟功能,手动设置时间,并可快速调节,具有开关键,可一键复位(复位时间12时00分00秒),闹钟时间到亮灯十秒钟进行提醒;6) 具有倒计时功能(精确至百分之一秒),可手动设置倒计时时间,若无输入,系统默认60秒倒计时,且具有开关键,计时时间到亮灯十秒钟进行提醒,可一键复位(复位时间默认60秒)。

2 设计分析及系统方案设计2.1 模式选择模块:按键一进行模式选择,并利用数码管显示出当前模式。

模式一:时钟显示功能;模式二:时钟调节功能;模式三:闹钟功能;模式四:秒表功能;模式五:倒计时功能。

2.2 数字钟的基本功能部分:包括时、分、秒的显示,手动调时,以及整点报时部分。

基本模块是由振荡器、分频器、计数器、译码器、显示器等几部分组成。

利用DE2硬件中提供的50MHZ晶振,经过分频得到周期为1s的时钟脉冲。

将该信号送入计数器进行计算,并把累加结果以“时”“分”“秒”的形式通过译码器由数码管显示出来。

具有复位按键1,在时钟模式下按下复位键后对时钟进行复位,复位时间12时00分00秒。

进入手动调时功能时,通过按键调节时间,每按下依次按键2,时钟时针加一,按下按键2一秒内未松手,时钟时针每秒钟加十;按键1对分针进行控制,原理与时针相同并通过译码器由七位数码管显示。

从00分00秒开始,数字钟进入整点报时功能(本设计中以一个LED灯代替蜂鸣器,进行报时),亮灯10秒钟进行提示。

2.3多功能数字钟的秒表功能部分:计时范围从00分00.00秒至59分59.99秒。

可由复位键0异步清零,并由开关1控制计时开始与停止。

将DE2硬件中的50MHZ晶振经过分频获得周期为0.01秒的时钟脉冲,将信号送入计数器进行计算,并把累计结果通过译码器由七位数码管显示2.4多功能数字钟的闹钟功能部分:进入闹钟功能模式后,通过按键2(设定小时)和按键1(设定分钟)设定闹钟时间,当按下按键一秒内未松手时,可进行快速设定时间。

当时钟进入闹钟设定的时间(判断时钟的时信号时针,分针分别与闹钟设定的时信号时针、分针是否相等),则以LED灯连续亮10秒钟进行提示,并由开关0控制闹钟的开和关。

2.5 多功能数字钟的倒计时功能部分:可通过按键3(设定分针)和按键2(设定秒针)设定倒计时开始,当按下按键一秒内未松手时,可进行快速设定时间。

当没有手动时间设定时,系统默认为60秒倒计时。

倒计时的时钟与数字钟的时钟相同,每迎到一个1s时钟上升沿,则计数器减一。

计数器减至00时,分钟位、秒钟位保持为00。

倒计时结束时(即00分00秒),倒计时信号灯亮10秒钟进行提示,并由开关2控制倒计时的开始于停止。

本设计通过数据选择器控制译码器,使数码管独立显示,各功能之间互不影响。

当mode=“000”时,时钟功能,则对时钟信号进行译码,数码管显示时钟数据; 当mode=“001”时,时间校准功能,则对时钟信号进行译码,数码管显示闹钟数据; 当mode=“010”时,闹钟功能,则对闹钟信号进行译码,数码管显示闹钟信号数据; 当mode=“011”时,秒表功能,则对秒表信号进行译码,数码管显示秒表信号数据。

当mode=“100”时,则倒计时功能,对倒计时钟信号进行译码,数码管显示倒计时信号数据。

系统总体结构框图如下所示:3系统以及模块硬件电路设计3.1分频电路参数计算:666150100010001501015010001000.150101501000100.015010T sT sT s=⨯⨯⨯=⨯=⨯⨯⨯=⨯=⨯⨯⨯=⨯3.2系统硬件电路设计系统硬件模拟图:50MHZ KEY[0] KEY[1] KEY[2] KEY[3] Sw[0] Sw[1] LED[djs] LED[nz]分别与数码管相连Sw[2]LED[bs]4 系统的VHDL设计4.1顶层设计library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity liyabin is --实体声明,及系统输入与输出port(clk,rst,add,dec,selectmode,startmb,startnz,startdjs:in std_logic;qgs,qgg,qss,qsg,qfs,qfg,qms,qmg:buffer std_logic_vector(6 downto 0);ledbs,lednz,leddjs:out std_logic);end;architecture data of liyabin iscomponent mode --模式循环模块元件例化port(selectmode:in std_logic;mode:buffer std_logic_vector(2 downto 0));end component;component gnxz --功能选择模块元件例化port(zt:in std_logic_vector(2 downto 0);sz1,sz2,sz3,sz4,sz5,sz6:in std_logic_vector(3 downto 0);--时钟显示信号mb1,mb2,mb3,mb4,mb5,mb6:in std_logic_vector(3 downto 0);--秒表显示信号nz3,nz4,nz5,nz6:in std_logic_vector(3 downto 0);--闹钟显示信号djs1,djs2,djs3,djs4,djs5,djs6:in std_logic_vector(3 downto 0);--倒计时显示信号s1,s2,s3,s4,s5,s6,s7,s8:out std_logic_vector(3 downto 0)--输出,送入显示模块用数码管进行显示);end component;component fp --分频模块元件例化port(clk,rst:in std_logic;clk10ms,clk100ms,clk1s:out std_logic);end component;component sz --时钟模块元件例化port(zt:in std_logic_vector(2 downto 0);clk,clk100ms,rst,add,dec:in std_logic;sz1,sz2,sz3,sz4,sz5,sz6:buffer std_logic_vector(3 downto 0);ledbs: out std_logic);end component;component nz --闹钟模块元件例化port(startnz,add,dec,rst,clk,clk100ms:in std_logic;zt:in std_logic_vector(2 downto 0);sz2,sz3,sz4,sz5,sz6:in std_logic_vector(3 downto 0);--时钟显示信号nz3,nz4,nz5,nz6:buffer std_logic_vector(3 downto 0);--闹钟显示信号]lednz:out std_logic --闹钟提示灯输出);end component;component mb --秒表模块元件例化port(zt:in std_logic_vector(2 downto 0);clk,rst,startmb:in std_logic;mb1,mb2,mb3,mb4,mb5,mb6:buffer std_logic_vector(3 downto 0));end component;component djs --倒计时模块元件例化port(rst,startdjs,add,dec,clk,clk100ms:in std_logic;zt:in std_logic_vector(2 downto 0);djs1,djs2,djs3,djs4,djs5,djs6:buffer std_logic_vector(3 downto 0);leddjs:out std_logic);end component;component xs --显示模块元件例化port(xsin:in std_logic_vector(3 downto 0);--xsout:out std_logic_vector(6 downto 0));end component;signal clk10ms,clk100ms,clk1s,clk1m,clk1h :std_logic; --分频脉冲信号级进位脉冲信号signal sz1,sz2,sz3,sz4,sz5,sz6,sz33,sz55:std_logic_vector(3 downto 0);--时钟显示信号signal nz3,nz4,nz5,nz6:std_logic_vector(3 downto 0);--闹钟显示信号signal mb1,mb2,mb3,mb4,mb5,mb6:std_logic_vector(3 downto 0);--秒表显示信号signal djs1,djs2,djs3,djs4,djs5,djs6:std_logic_vector(3 downto 0);--倒计时显示信号signal s1,s2,s3,s4,s5,s6,s7,s8:std_logic_vector(3 downto 0);--显示信号signal zt:std_logic_vector(2 downto 0);begin --结构体------------------------------模式循环模块------------------------------u1:mode port map(selectmode,zt);------------------------------功能选择模块-----------------------------u2:gnxz port map(zt,sz1,sz2,sz3,sz4,sz5,sz6,mb1,mb2,mb3,mb4,mb5,mb6,nz3,nz4,nz5,nz6,djs1,djs2,djs3,djs4,s1,s2,s3,s4,s5,s6,s7,s8);--------------------------------分频模块--------------------------------u3:fp port map(clk,rst,clk10ms,clk100ms,clk1s);--------------------------------时钟模块--------------------------------u4:sz port map(zt,clk1s,clk100ms,rst,add,dec,sz1,sz2,sz3,sz4,sz5,sz6,ledbs); --------------------------------闹钟模块-------------------------------u5:nz port map(startnz,add,dec,rst,clk1s,clk100ms,zt,sz2,sz3,sz4,sz5,sz6,nz3,nz4,nz5,nz6,lednz);--------------------------------秒表模块--------------------------------u6:mb port map(zt,clk10ms,rst,startmb,mb1,mb2,mb3,mb4,mb5,mb6);--------------------------------倒计时模块------------------------------u7:djs port map(rst,startdjs,add,dec,clk10ms,clk100ms,zt,djs1,djs2,djs3,djs4,djs5,djs6,leddjs);--------------------------------------显示模块-----------------------------------------show1: xs port map(s1,qmg);show2: xs port map(s2,qms);show3: xs port map(s3,qfg);show4: xs port map(s4,qfs);show5: xs port map(s5,qsg);show6: xs port map(s6,qss);show7: xs port map(s7,qgg);show8: xs port map(s8,qgs);end; --结束4.2 分频模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fp isport(clk,rst:in std_logic;clk10ms,clk100ms,clk1s:out std_logic);end;architecture data of fp isbegin--50兆分频,产生clk1s,作为始时钟的秒计时脉冲process(clk,rst)variable num:integer range 0 to 49999999;beginif rst='0' thennum:=0;elsif rising_edge(clk) thenif num=49999999 thennum:=0;clk1s<='1';elsenum:=num+1;clk1s<='0';end if;end if;end process;--5兆分频,产生clk100ms(即clk0.1s),作为快速调整时间的脉冲信号process(clk,rst)variable num:integer range 0 to 4999999;beginif rst='0' thennum:=0;elsif rising_edge(clk) thenif num=4999999 thennum:=0;clk100ms<='1';elsenum:=num+1;clk100ms<='0';end if;end if;end process;--5兆分频,产生clk10ms(即clk0.01s)作为秒表计时脉冲process(clk,rst)variable num:integer range 0 to 499999;beginif rst='0' thennum:=0;elsif rising_edge(clk) thenif num=499999 thennum:=0;clk10ms<='1';elsenum:=num+1;clk10ms<='0';end if;end if;end process;end;4.3模式循环模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mode is --实体声明port(selectmode:in std_logic;mode:buffer std_logic_vector(2 downto 0));end;architecture data of mode isbeginprocess(selectmode)beginif rising_edge(selectmode) then --模式循环计数器if mode="100" thenmode<="000";else mode<=mode+1;end if;end if;end process;end;4.4功能选择模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity gnxz is --实体声明port(zt:in std_logic_vector(2 downto 0);sz1,sz2,sz3,sz4,sz5,sz6:in std_logic_vector(3 downto 0);--时钟显示信号mb1,mb2,mb3,mb4,mb5,mb6:in std_logic_vector(3 downto 0);--秒表显示信号nz1,nz2,nz3,nz4,nz5,nz6:in std_logic_vector(3 downto 0);--闹钟显示信号djs1,djs2,djs3,djs4,djs5,djs6:in std_logic_vector(3 downto 0);--倒计时显示信号s1,s2,s3,s4,s5,s6,s7,s8:out std_logic_vector(3 downto 0)--输出,送入显示模块用数码管进行显示);end;architecture data of gnxz isbeginprocess(zt,sz1,sz2,sz3,sz4,sz5,sz6, --选择译码器数日信号nz3,nz4,nz5,nz6,mb1,mb2,mb3,mb4,mb5,mb6,djs1,djs2,djs3,djs4,djs5,djs6)beginif zt="000" then--1时钟显示s1<=sz1;s2<=sz2;s3<=sz3;s4<=sz4;s5<=sz5;s6<=sz6;s7<="0001";s8<="1111";elsif zt="001" then--2调整s1<=sz1;s2<=sz2;s3<=sz3;s4<=sz4;s5<=sz5;s6<=sz6;s7<="0010";s8<="1111";elsif zt="010" then--3闹钟s1<="0000";s2<="0000";s3<=nz3;s4<=nz4;s5<=nz5;s6<=nz6;s7<="0011";s8<="1111";elsif zt="011" then--4秒表s1<=mb1;s2<=mb2;s3<=mb3;s4<=mb4;s5<=mb5;s6<=mb6;s7<="0100";s8<="1111";elsif zt="100" then--5倒计时s1<=djs1;s2<=djs2;s3<=djs3;s4<=djs4;s5<=djs5;s6<=djs6;s7<="0101";s8<="1111";else s1<=sz1;s2<=sz2;s3<=sz3;s4<=sz4;s5<=sz5;s6<=sz6;s7<="0001";s8<="1111";end if;end process;end;4.5显示模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xs isport(xsin:in std_logic_vector(3 downto 0);xsout:out std_logic_vector(6 downto 0));end;architecture data of xs isbeginprocess(xsin) --显示译码器begincase xsin iswhen "0000"=>xsout<="1000000";when "0001"=>xsout<="1111001";when "0010"=>xsout<="0100100";when "0011"=>xsout<="0110000";when "0100"=>xsout<="0011001";when "0101"=>xsout<="0010010";when "0110"=>xsout<="0000010";when "0111"=>xsout<="1111000";when "1000"=>xsout<="0000000";when "1001"=>xsout<="0010000";when others=>xsout<="1111111";end case;end process;end;4.6 时钟及其调整模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity sz is --实体声明port(zt:in std_logic_vector(2 downto 0);clk,clk100ms,rst,add,dec:in std_logic;sz1,sz2,sz3,sz4,sz5,sz6:buffer std_logic_vector(3 downto 0);ledbs: out std_logic);end;architecture data of sz issignal clk1m,clk1h,clk1m0,clk1h0:std_logic; --进位脉冲信号signal js,js1:std_logic_vector(0 downto 0); --按键计时信号beginprocess(zt,js,clk100ms,clk1m0,add,dec)--时间校准选择脉冲分针部分beginif zt="001" and js="1" thenclk1m<=clk100ms;elsif zt="001" and js/="1" thenclk1m<=clk1m0 or not dec;else clk1m<=clk1m0;end if;end process;process(zt,js1,clk100ms,clk1h0)--时间校准选择脉冲时针部分beginif zt="001" and js1="1" thenclk1h<=clk100ms;elsif zt="001" and js1/="1" thenclk1h<=clk1h0 or not dec;else clk1h<=clk1h0;end if;end process;process(zt,clk,rst,add,dec) --时钟分针按键计时beginif zt="000" and rst='0' thensz2<="0000";sz1<="0000";elseif zt="001" and dec='0' thenif rising_edge(clk) thenjs<=js+1;if js="1" thenjs<="1";end if;end if;else js<="0";end if;if zt="001" and add='0' then --时钟时针按键计时if rising_edge(clk) thenjs1<=js1+1;if js1="1" thenjs1<="1";end if;end if;else js1<="0";end if;if rising_edge(clk) then --时钟秒针计数器if sz2="0101" and sz1="1001" thensz2<="0000";sz1<="0000";clk1m0<='1';elsif sz1="1001" thensz1<="0000";sz2<=sz2+1;clk1m0<='0';else sz1<=sz1+1;clk1m0<='0';end if;end if;end if;end process;process(zt,clk1m,rst) --时钟分针计数器beginif zt="000" and rst='0' thensz4<="0000";sz3<="0000";elsif rising_edge(clk1m) thenif sz4="0101" and sz3="1001" thensz4<="0000";sz3<="0000";clk1h0<='1';elsif sz3="1001" thensz3<="0000";sz4<=sz4+1;clk1h0<='0';else sz3<=sz3+1;clk1h0<='0';end if;end if;end process;process(clk1h,rst,zt) --时钟时针计数器beginif zt="000" and rst='0' thensz6<="0001";sz5<="0010";elsif rising_edge(clk1h) thenif sz6="0010" and sz5="0011" thensz6<="0000";sz5<="0000";elsif sz5="1001" thensz5<="0000";sz6<=sz6+1;else sz5<=sz5+1;end if;end if;end process;process(sz1,sz2,sz3,sz4) --整点报时beginif sz4="0000" and sz3="0000" and sz2="0000" then ledbs<='1';else ledbs<='0';end if;end process;end;4.7闹钟模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity nz isport(startnz,add,dec,rst,clk,clk100ms:in std_logic;zt:in std_logic_vector(2 downto 0);sz2,sz3,sz4,sz5,sz6:in std_logic_vector(3 downto 0);--时钟显示信号nz3,nz4,nz5,nz6:buffer std_logic_vector(3 downto 0);--闹钟显示信号]lednz:out std_logic);end;architecture data of nz issignal js,js1:std_logic_vector(0 downto 0);--按键计时信号signal clkd,clkg:std_logic; --进位脉冲信号beginprocess(js,clk100ms,dec)beginif js="1" then --分针按键计时clkd<=clk100ms;else clkd<=not dec;end if;end process;process(js1,clk100ms,add) --时针按键计时beginif js1="1" thenclkg<=clk100ms;else clkg<=not add;end if;end process;process(zt,add,dec,rst,clk,clkg,clkd) --闹钟时间手动设置beginif zt="010" thenif rst='0' thennz6<="0001";nz5<="0010";nz4<="0000";nz3<="0000"; --闹钟复位12:00:00elseif dec='0' thenif rising_edge(clk) thenjs<=js+1;if js="1" thenjs<="1";end if;end if;else js<="0";end if;if add='0' thenif rising_edge(clk) thenjs1<=js1+1;if js1="1" thenjs1<="1";end if;end if;else js1<="0";end if;if falling_edge(clkd) then --闹钟手动设置分钟if nz4="0101" and nz3="1001" thennz4<="0000";nz3<="0000";elsif nz3="1001" thennz3<="0000";nz4<=nz4+1;else nz3<=nz3+1;end if;end if;if falling_edge(clkg) then --闹钟手动设置时钟if nz6="0010" and nz5="0011" thennz6<="0000";nz5<="0000";elsif nz5="1001" thennz5<="0000";nz6<=nz6+1;else nz5<=nz5+1;end if;end if;end if;end if;end process;process(startnz,nz6,nz5,nz4,nz3,sz2,sz3,sz4,sz5,sz6) ----闹钟判断及提示beginif startnz='1' thenif nz6=sz6 and nz5=sz5 and nz4=sz4 and nz3=sz3 and sz2="0000" then lednz<='1';else lednz<='0';end if;else lednz<='0';end if;end process;end;4.8秒表模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mb is --实体声明port(zt:in std_logic_vector(2 downto 0);clk,rst,startmb:in std_logic;mb1,mb2,mb3,mb4,mb5,mb6:buffer std_logic_vector(3 downto 0) );end ;architecture data of mb issignal clk10ms,clk1s,clk1m:std_logic; --进位脉冲信号beginprocess(zt,clk,startmb,rst) --秒表脉冲计数器beginif zt="011" and rst='0' thenmb2<="0000";mb1<="0000";elsif startmb='1' thenif rising_edge(clk) thenif mb2="1001" and mb1="1001" thenmb2<="0000";mb1<="0000";clk1s<='1';elsif mb1="1001" thenmb1<="0000";mb2<=mb2+1;clk1s<='0';else mb1<=mb1+1;clk1s<='0';end if;end if;end if;end process;process(zt,clk1s,rst) --秒表分针计数器beginif zt="011" and rst='0' thenmb4<="0000";mb3<="0000";elsif rising_edge(clk1s) thenif mb4="0101" and mb3="1001" thenmb4<="0000";mb3<="0000";clk1m<='1';elsif mb3="1001" thenmb3<="0000";mb4<=mb4+1;clk1m<='0';else mb3<=mb3+1;clk1m<='0';end if;end if;end process;process(zt,clk1m,rst) --秒表时针计数器if zt="011" and rst='0' thenmb6<="0000";mb5<="0000";elsif rising_edge(clk1m) thenif mb6="0101" and mb5="1001" thenmb5<="0000";mb6<="0000";elsif mb5="1001" thenmb5<="0000";mb6<=mb6+1;else mb5<=mb5+1;end if;end if;end process;end;4.9 倒计时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity djs is --实体声明port(rst,startdjs,add,dec,clk,clk100ms:in std_logic; --按键及脉冲输入zt:in std_logic_vector(2 downto 0); --状态输入djs1,djs2,djs3,djs4,djs5,djs6:buffer std_logic_vector(3 downto 0);--倒计时显示输出leddjs:out std_logic --倒计时提示灯);end;architecture data of djs issignal clk1s,clk1m,clkd,clkg:std_logic; --进位脉冲signal js,js1:std_logic_vector(0 downto 0); --按键计时信号signal s1,s2,s3,s4,s5,s6,ss1,ss2,ss3,ss4,ss5,ss6:std_logic_vector(3 downto 0); --倒计时设置时间信号和倒计时减法器时间信号begin --结构体process(js,clk100ms,dec)--分针按键计时beginif js="1" thenclkd<=clk100ms;else clkd<=not dec;end if;end process;process(js1,clk100ms,add)--时针按键计时if js1="1" thenclkg<=clk100ms;else clkg<=not add;end if;end process;process(zt,add,dec,rst,startdjs,clk,clkd,clkg)--倒计时设置时间beginif zt="100" and rst='0' then --异步复位s6<="0000";s5<="0000";s4<="0101";s3<="1001";elsif zt="100" and startdjs='0' thenif dec='0' thenif rising_edge(clk) thenjs<=js+1;if js="1" thenjs<="1";end if;end if;else js<="0";end if;if add='0' thenif rising_edge(clk) thenjs1<=js1+1;if js1="1" thenjs1<="1";end if;end if;else js1<="0";end if;if rising_edge(clkd) thenif s4="0101" and s3="1001" thens4<="0000";s3<="0000";elsif s3="1001" thens3<="0000";s4<=s4+1;else s3<=s3+1;end if;end if;if rising_edge(clkg) thenif s6="0101" and s5="1001" thens6<="0000";s5<="0000";elsif s5="1001" thens5<="0000";s6<=s6+1;else s5<=s5+1;end if;end if;end if;end process;process(zt,startdjs,clk,s1,s2,s3,s4,s5,s6,ss1,ss2,ss3,ss4,ss5,ss6)--倒计时减法器beginif zt="100" and startdjs='0' thenss1<="0000";ss2<="0000";elsif zt="100" and startdjs='1' thenif rising_edge(clk) thenif ss3="0000" and ss4="0000" and ss5="0000" and ss6="0000" then ss2<="0000" ;ss1<="0000";elsif ss2="0000" and ss1="0000" thenss2<="1001";ss1<="1001";clk1s<='1';elsif ss1="0000" thenss1<="1001";ss2<=ss2-1;clk1s<='0';else ss1<=ss1-1;clk1s<='0';end if;end if;end if;end process;process(zt,startdjs,clk1s,s3,s4)--倒计时减法器秒针部分beginif zt="100" and startdjs='0' thenss3<=s3;ss4<=s4;elsif rising_edge(clk1s) thenif ss3="0000" and ss4="0000" and ss5="0000" and ss6="0000" then ss3<="0000" ;ss4<="0000";elsif ss3="0000" and ss4="0000" thenss3<="1001";ss4<="0101";clk1m<='1';elsif ss3="0000" thenss3<="1001";ss4<=ss4-1;clk1m<='0';else ss3<=ss3-1;clk1m<='0';end if;end if;end process;process(zt,startdjs,clk1m,s5,s6)--倒计时减法器分针部分beginif zt="100" and startdjs='0' thenss5<=s5;ss6<=s6;elsif rising_edge(clk1m) thenif ss5="0000" and ss6="0000" thenss5<="0000";ss6<="0000";elsif s5="0000" thenss5<="1001";ss6<=ss6-1;else ss5<=ss5-1;end if;end if;end process;process(zt,startdjs,djs6,djs5,djs3,djs4) --倒计时时间到提示beginif zt="100" and startdjs='1' thenif djs6="0000" and djs5="0000" and djs4="0000" and djs3/="0000"thenleddjs<='1';elsif djs2="0000" and djs3="0000" and djs4="0000" and djs1="0000" thenleddjs<='0';else leddjs<='0';end if;else leddjs<='0';end if;end process;process(zt,startdjs,s1,s2,s3,s4,s5,s6,ss1,ss2,ss3,ss4,ss5,ss6) --设置时间与减法器时间切换进程beginif zt="100" and startdjs='1' thendjs5<=ss5;djs6<=ss6;djs3<=ss3;djs4<=ss4;djs2<=ss2;djs1<=ss1;else djs5<=s5;djs6<=s6;djs3<=s3;djs4<=s4;djs2<=s2;djs1<=s1;end if;end process;end;5 结论以及结果说明5.1 结论:本设计基于VHDL 硬件描述语言,在windows7(32bit)计算机上运行Quartus II Version 6.0进行编程及仿真,将程序下载带DE2实验平台,主芯片为Cyclone II EP2C35F672C6NK上运行。

相关主题