第一篇:EDA实现多功能数字钟
EDA实现多功能数字钟
实
验 报 告
专业班级:
学生姓名:
学生学号:
目录
一、内容摘要
二、实验要求
三、各底层模块设计
四、总体方案
五、心得体会
一、实验内容
利用 QuartusII 软件,结合所学的数字电路的知识设计一个 24 时多功能数 字钟,具有正常分、秒计时,动态显示的功能。分析整个电路的工作原理,分别说明各子模块的设计原理和调试、仿真、编 程的过程。
二、实验任务:
用 FPGA 器件和 EDA 技术实现多功能数字钟的设计
已知条件:
1、MAX+Plus 软件
2、FPGA 实验开发装置
基本功能:
1、以数字形式显示时、分、秒的时间;
2、小时计数器为 24 进制;
3、分、秒计数器为 60 进制。
三、底层模块设计(电路原理图及仿真)
1、小时计数器为24进制 电路原理图
仿真图
封装图
2、分、秒计时器都为60进制 电路原理图
仿真图
封装图
四、总体方案
按照上述实验要求,本次电子数字时钟实验,通过两个模 60 计数器及一个模 24 计数器级联既可以实现计时模块。多功能数字钟的主体部分 电路原理图
仿真图
封装图
五、心得体会
刚刚开始觉得做这个电子实验报告挺难的,因为对软件的不熟悉和对这个实验操作的也不熟悉,对着老师给的资料也做了很长时间,就是仿真的时候有些该注意的没有注意,导致仿真失败,但是后来还是自己慢慢拿的请教同学、老师哪里出了问题,后来才做出来了,把60进制的做出来了,后来的24进制按照老师给的电路原理图也成功了仿真出来,我用了很长时间才编写出来,现在看看,也没有那么难了。同时请教老师,和同学、通过实验掌握一些逻辑组合器件的基本功能和用法。总之,我很感谢这次实验可以给我这样的机会,这个实验给了我很对的收获,我相信这会对我以后的学习很有帮助。
第二篇:eda 实现多功能数字钟
一、标题:EDA实现多功能数字钟
二、任务书:设计要求是用FPGA器件和EDA技术实现多功能数字钟的设计,⑴ 控制功能包括①以数字形式显示时、分、秒的时间;②小时计数器为24进制;③分、秒计数器为60进制;④有两个使能端起到校时、校分的作用,同时按无效;⑤每小时的59分51、53、55、57、59分别以四长声一短声进行模拟电台仿真;⑥让信号灯在晚上19点至早上5点亮;⑵ 在Max+plusⅡ软件系统平台上建立多功能数字钟电路的顶层电路文件并完成编译和仿真,并对器件进行下载检查。
三、关键词:数字钟 原理电路 编译 仿真 下载
四、数字钟电路系统的组成框图:
五、各功能模块设计、仿真波形及其分析说明:
1、小时计时模块:
仿真波形:
分析说明:
当小时的高四位为0、1时,小时的低四位为九时,在下一个时钟的上跳延来了之后,高四位加一;当小时的高四位为2,同时低四位为3时,小时的高低四位都清零。实现从00到23的循环计数。
2、分钟计时模块:
仿真波形:
分析说明:
当分钟的高四位为0、1、2、3、4时,小时的低四位为九时,在下一个时钟的上跳延来了之后,高四位加一;当分钟的高四位为5时,同时低四位为9时,分钟的高低四位都清零,实现从00到59的循环计数。
3、秒计时模块(与分计时模块相同);
4、校时、校分模块:
仿真波形:
分析说明:
SWM、SWH两开关先设置1,秒时钟,分时钟,小时时钟分别设置为不同频率的时钟,当开关SWM置0即按下时,秒时钟CPS对分钟进行校对,即如图所示CPM在SWM为0时频率与CPS相同;同理,当SWH为0时用秒时钟对小时进行校对,即CPH在SWH为0时频率与CPS相同。当SWM、SWH都不为0时,分钟、小时正常计时。
5、整点报时模块:
仿真波形:
分析说明:
为实现时钟在59分51秒53秒55秒57秒时,以低音报时,当为59分59秒时以高音报时;所以将M[7..0]从高位到低位设置为0101 1001转换成十进制即为59分,秒的十位都为5所以S7到S4设置为0101,秒的个位1、3、5、7、9,即0001、0011、0101、0111、1001,从S3到S0只有当S3设置为1的时候秒个位为9,通过分频以1000HZ输出以实现高音报时;1、3、5、7时S0都为0,为能同时确定1、3、5、7则将S0设置为0,S1、S2则为任意。如波形所示,S3取一段设置为1时,输出FU变为1000HZ的高频报时,其余状态一致为500HZ低频报时,从而实现预期情况。
6、时段控制模块:
仿真波形:
分析说明:
从19点到凌晨5点(含5点),灯亮,即完成时段控制。
六、顶层逻辑电路图、仿真波形及分析结论:
建立一个顶层文件如图:
仿真波形如下:
分析结论:
经仿真波形分析①走时正常;②能〝校时〞〝校分〞;③整点报时;④时段控制到位。功能完全符合设计要求,可以下载。
七、定义芯片管脚号(列表示意)及下载过程:
1、由于提供的实验箱的七段显示器是扫描形式工作,需要进行译码以及选择扫描,需添加模块:
该模块有三部分组成,包括一个8进制计数器,一个3-8数据选择器及七段显示译码器:
将该模块连入最后的顶层文件中,即可进行下载工作。
2、按键扫描模块:由于试验箱提供的按键系统为4*4扫描矩阵,需将横向或纵向按键设置0或1,该模块只需要在顶层文件中接4个output出来接地,如图:
3、分配输入、输出信号在器件上的引脚号:
4、引脚分配表:
5、对器件进行下载:
选MAX+plus II/Programmer,弹出编程对话框,如图:
检查编程文件名和器件,正确,接上硬件后,点击器件编程。即完成下载。
八、课程设计中遇到问题及解决方法
Q1:下载后,秒钟不进位
A:检查原理电路发现输入输出接错位,经更正正常; Q2:到59分51秒等不闹钟
A:检查蜂鸣器是否接错管脚,下载器上套线是否接好,最后发现是套线的问题,解决后,正常鸣叫。
九、课程设计项目最终结论
通过各模块级联最后成功下载,实现了两个使能对分秒校时,整点仿电台报时以及时段控制的多功能数字钟。
十、心得体会:
实验过程中最然遇到了很多困难,从画图到理解电路图,还有接触没有接触过的下载,把纸上的东西用到了硬件中,质的改变。看到成功的数字钟,很有成就感。好像听到的蜂鸣声是从未听到过的美妙乐曲。课设给我们指引了又一工作方向,培养对这些的兴趣,对以后工作应该很有帮助,所以坚定了我课后还要多看书多学习这方面知识的信念。
十一、参阅教材及文献:
《电子线路实验设计仿真讲义》
按钮,直接对
第三篇:EDA课程设计——多功能数字钟
哈尔滨工业大学(威海)电子学课程设计报告
带有整点报时的数字钟设计与制作
姓名: 蒋栋栋 班级: 0802503 学号: 080250331 指导教师:
井岩
目录
一、课程设计的性质、目的和任务„„„„„„„„„„„„3
二、课程设计基本要求„„„„„„„„„„„„„„„„„3
三、设计课题要求„„„„„„„„„„„„„„„„„„„3
四、课程设计所需要仪器„„„„„„„„„„„„„„„„4
五、设计步骤„„„„„„„„„„„„„„„„„„„„„4
1、整体设计框图„„„„„„„„„„„„„„„„„„„4
2、各个模块的设计与仿真„„„„„„„„„„„„„„„4
2.1分频模块„„„„„„„„„„„„„„„„„„„„„„„4
2.2计数器模块„„„„„„„„„„„„„„„„„„„„„„6
2.3控制模块„„„„„„„„„„„„„„„„„„„„„„10
2.4数码管分配„„„„„„„„„„„„„„„„„„„„„13
2.5显示模块„„„„„„„„„„„„„„„„„„„„„„14
2.6报时模块„„„„„„„„„„„„„„„„„„„„„„16
六、调试中遇到的问题及解决的方法„„„„„„„„„„„18
七、心得体会„„„„„„„„„„„„„„„„„„„„„18
一、课程设计的性质、目的和任务
创新精神和实践能力二者之中,实践能力是基础和根本。这是由于创新基于实践、源于实践,实践出真知,实践检验真理。实践活动是创新的源泉,也是人才成长的必由之路。
通过课程设计的锻炼,要求学生掌握电路的一般设计方法,具备初步的独立设计能力,提高综合运用所学的理论知识独立分析和解决问题的能力,培养学生的创新精神。
二、课程设计基本要求
掌握现代大规模集成数字逻辑电路的应用设计方法,进一步掌握电子仪器的正确使用方法,以及掌握利用计算机进行电子设计自动化(EDA)的基本方法。
三、设计课题要求
(1)构造一个24小时制的数字钟。要求能显示时、分、秒。(2)要求时、分、秒能各自独立的进行调整。
(3)能利用喇叭作整点报时。从59分50秒时开始报时,每隔一秒报时一秒,到达00分00秒时,整点报时。整点报时声的频率应与其它的报时声频有明显区别。
#设计提示(仅供参考):(1)对频率输入的考虑
数字钟内所需的时钟频率有:基准时钟应为周期一秒的标准信号。报时频率可选用1KHz和2KHz左右(两种频率相差八度音,即频率相差一倍)。另外,为防止按键反跳、抖动,微动开关输入应采用寄存器输入形式,其时钟应为几十赫兹。
(2)计时部分计数器设计的考虑 分、秒计数器均为模60计数器。
小时计数为模24计数器,同理可建一个24进制计数器的模块。(3)校时设计的考虑
数字钟校准有3个控制键:时校准、分校准和秒校准。
微动开关不工作,计数器正常工作。按下微动开关后,计数器以8Hz频率连续计数(若只按一下,则计数器增加一位),可调用元件库中的逻辑门建一个控制按键的模块,即建立开关去抖动电路(见书70页)。
(4)报时设计的考虑
可以将高频时钟分频得到约2KHz和1KHz的音频,作为数字钟的报时频率。当电子钟显示XX:59:50时,数字钟开始报时“DO“,持续一秒,而且每隔一秒报一下,直至显示XX:00:00时报“DI”,持续一秒后停止。最后输出至喇叭。应调用元件库中的逻辑门建一个控制报时的模块。
(5)建一个七段译码的模块
因在系统可编程器件实验箱上的数码管没有经过译码,故要用AHDL语言写一个七段译码的模块,且应考虑数码管为共阳极。数码管上的点(D2、D4、D6)应置Vcc。
四、课程设计所需要仪器
1、计算机一台
2、quartusⅡ软件
3、FPGA开发板
五、设计步骤
1、模块介绍
(1)分频模块:产生1Hz、1KHz、2KHz频率(2)计数器模块:生成60进制、24进制计数器(3)控制模块:按键控制、按键消抖
(4)显示模块:7段数码管显示器,分别显示小时、分钟、秒(5)报时模块:进行整点报时
2、各个模块的设计与仿真
2.1分频模块
CLK晶振频率50MHZ,分成2KHZ,1KHZ,1HZ的信号。基准1HZ信号作为时钟计时的秒计数时钟信号;分频的1KHZ,2KHZ信号用于报时电路的不同声讯。
程序代码:
library ieee;use ieee.std_logic_1164.all;entity fre is port(clk ,sel: in std_logic;clk1hz,clk1khz,clk2khz:out std_logic);end fre;architecture beh of fre is signal data1khz,data2khz,data1hz : std_logic := '0';begin clk1hz <= data1hz;clk1khz <= data1khz;clk2khz <= data2khz;clk1khz_pro : process(clk)--产生1khz信号 variable cnt : integer range 0 to 24999;begin if clk'event and clk='1' then if cnt = 24999 then cnt := 0;data1khz <= not data1khz;else cnt := cnt + 1;end if;end if;end process clk1khz_pro;clk2khz_pro : process(clk)--variable cnt : integer range 0 to 12499;begin if clk'event and clk='1' then if cnt = 12499 then cnt := 0;data2khz <= not data2khz;else cnt := cnt + 1;end if;end if;end process clk2khz_pro;clk1hz_pro : process(data1khz)--variable cnt : integer range 0 to 499;begin if data1khz'event and data1khz='1' then if sel='0' then cnt:=0;else if cnt = 499 then cnt := 0;data1hz <= not data1hz;else cnt := cnt + 1;end if;end if;end if;end process clk1hz_pro;end beh;
输入模块电路图:
产生2khz信号 产生1hz 信号 5 freclkclk1hzclk2khzinst selclk1khz2.2计数器模块
由秒计数器,分计数器,时计数器组成了最基本的数字钟计时电路,两个六十进制计数器与二十四进制计数器组合构成。
程序代码:
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use IEEE.STD_LOGIC_ARITH.ALL;
entity shuzizhong is port(clk_change : in std_logic;s_en,m_en,h_en:in std_logic;sel:in std_logic;secout,minout,hourout :out std_logic;sl,sh,ml,mh,hl,hh:out std_logic_vector(3 downto 0);a:out std_logic_vector(15downto 0));end shuzizhong;architecture behav of shuzizhong is
signal low_rega,high_rega,low_regb,high_regb,low_regc,high_regc :std_logic_vector(3 downto 0):=“0000”;signal sout,mout,hout :std_logic :='0';begin--秒的60进制进制 counter_sec_l : process(clk_change,s_en)begin
sl<=low_rega;sh<=high_rega;ml<=low_regb;mh<=high_regb;hl<=low_regc;hh<=high_regc;6 if clk_change'event and clk_change='1' then if s_en='1' then if low_rega=“1001” then low_rega <= “0000”;else low_rega <= low_rega+'1';end if;end if;end if;end process counter_sec_l;counter_sec_h : process(clk_change,s_en,low_rega)begin if clk_change'event and clk_change='1' then if s_en='1' then if low_rega=“1001” then if high_rega =“0101”then high_rega <= “0000”;else high_rega <= high_rega+'1';end if;end if;end if;end if;end process counter_sec_h;sout <= '1' when low_rega=“1001” and high_rega=“0101” else '0';
----分钟的60进制设置 counter_min_l : process(clk_change,m_en)begin if clk_change'event and clk_change='1' then if m_en='1' then if sout='1'or sel='0' then if low_regb=“1001” then low_regb <= “0000”;else low_regb <= low_regb+'1';end if;end if;end if;end if;end process counter_min_l;counter_min_h : process(clk_change,m_en,low_regb)begin if clk_change'event and clk_change='1' then 7 if sout='1'or sel='0' then if m_en='1' then if low_regb=“1001” then
if high_regb =“0101”then
high_regb <= “0000”;else high_regb <= high_regb+'1';end if;end if;end if;end if;end if;end process counter_min_h;mout <= '1' when low_regb=“1001” and high_regb=“0101”and sout='1' else '0';--小时的24进制设置 counter_hour_l : process(clk_change,h_en)begin if clk_change'event and clk_change='1' then if h_en='1' then if mout='1'or sel='0' then if low_regc=“1001”or hout='1' then low_regc <= “0000”;else low_regc <= low_regc+'1';end if;end if;end if;end if;end process counter_hour_l;counter_hour_h : process(clk_change,h_en,hout)begin if clk_change'event and clk_change='1' then if mout='1'or sel='0' then if h_en='1' then if hout='1' then high_regc<=“0000”;else if low_regc=“1001” then high_regc <= high_regc+'1';end if;end if;end if;8 end if;end if;end process counter_hour_h;hout <= '1' when low_regc=“0011” and high_regc=“0010” else '0';secout<=sout;minout<=mout;hourout<=hout;a<=high_regb&low_regb&high_rega&low_rega;end behav;
输入模块电路图:
shuzizhongclk_changes_enm_enh_enselsecoutminouthouroutsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]a[15..0]inst
2.3控制模块
分五个状态0状态正常计时,按下按键进入下一状态开始调时模式1,按下按键进入调秒模式2,按下按键进入调分模式3,按下按键进入调小时模式4.按下按键恢复正常计时模式。
程序代码:
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity key_press is port(set ,mode: in std_logic;clk1khz,clk1hz: in std_logic;secout,minout: in std_logic;clk_change,clk2hz_en:out std_logic;sel,s_ce,m_ce,h_ce:out std_logic;s_en,m_en,h_en:out std_logic);end key_press;architecture beh of key_press is 9 signal key1,key2:std_logic;signal sce_reg, mce_reg ,hce_reg:std_logic;signal ssl,ssen,mmen,hhen:std_logic;signal con : integer range 0 to 4 :=0;--按键按下(延时)begin
key_press2 : process(set,clk1khz)variable cnt :integer range 0 to 999;begin if set='0' then if clk1khz'event and clk1khz='1'then if cnt=50 and set='0' then cnt :=cnt+1;key2 <= '1';else cnt:=cnt+1;key2 <= '0';end if;end if;else cnt:=0;key2<='0';end if;end process key_press2;key_press1 : process(mode,clk1khz)variable cnt :integer range 0 to 999;begin if mode='0' then if clk1khz'event and clk1khz='1'then if cnt=50 and mode='0' then cnt :=cnt+1;key1 <= '1';else cnt:=cnt+1;key1 <= '0';end if;end if;else cnt:=0;key1<='0';end if;end process key_press1;count : process(key1,key2)begin if key1'event and key1='1' then if con=4 then con<=0;else con<=con+1;end if;end if;10 end process count;con_pro : process(con)begin case con is when 0 => ssl<='1';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='0';when 1 => ssl<='0';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='1';when 2 => ssl<='0';sce_reg <= '1';ssen <='1';mce_reg <= '0';mmen <='0';hce_reg <= '0';hhen <='0';clk2hz_en <='1';when 3 => ssl<='0';sce_reg <= '0';ssen <='0';mce_reg <= '1';mmen <='1';hce_reg <= '0';hhen <='0';clk2hz_en <='1';when 4 => ssl<='0';sce_reg <= '0';ssen <='0';mce_reg <= '0';mmen <='0';hce_reg <= '1';hhen <='1';clk2hz_en <='1';when others => ssl<='0';sce_reg <= '0';ssen <='1';mce_reg <= '0';mmen <='1';hce_reg <= '0';hhen <='1';clk2hz_en <='0';end case;end process con_pro;sel_pro : process(ssl)begin case ssl is when '0'=> s_ce<=sce_reg;m_ce<=mce_reg;h_ce<=hce_reg;clk_change<=key2;when '1'=> s_ce<=ssen;11 m_ce<=mmen;h_ce<=hhen;clk_change<=clk1hz;when others=> s_ce<=ssen;m_ce<=secout;h_ce<=minout;clk_change<=clk1hz;end case;end process sel_pro;sel<=ssl;s_en<=ssen;m_en<=mmen;h_en<=hhen;end beh;
输入模块电路图: key_presssetclk_changemodeclk2hz_enclk1khzselclk1hzs_cesecoutm_ceminouth_ces_enm_enh_eninst
2.4数码管分配
程序代码:
library ieee;use ieee.std_logic_1164.all;entity display is port(datain : in std_logic_vector(3 downto 0);dataout : out std_logic_vector(7 downto 0));end display;architecture duan of display is begin process(datain)begin case datain is 12 when “0000” => dataout <=“11000000”;--dp,g,f,e,d,c,b,a when “0001” => dataout <=“11111001”;when “0010” => dataout <=“10100100”;when “0011” => dataout <=“10110000”;when “0100” => dataout <=“10011001”;when “0101” => dataout <=“10010010”;when “0110” => dataout <=“10000010”;when “0111” => dataout <=“11111000”;when “1000” => dataout <=“10000000”;when “1001” => dataout <=“10010000”;when “1010” => dataout <=“10111111”;when “1011” => dataout <=“10000011”;when “1100” => dataout <=“10100111”;when “1101” => dataout <=“10100001”;when “1110” => dataout <=“10000110”;when “1111” => dataout <=“10001110”;when others => null;end case;end process;end;
输入模块电路图:
displaydatain[3..0]dataout[7..0]inst
2.5显示模块
使用七段数码管显示小时、分钟与秒
程序代码:
library ieee;use ieee.std_logic_1164.all;entity scan is port(clk1khz : in std_logic;sl,sh,ml,mh,hl,hh : in std_logic_vector(3 downto 0);clk2hz_en : in std_logic;s_ce,m_ce,h_ce : in std_logic;en_out : out std_logic_vector(7 downto 0);13 dataout : out std_logic_vector(3 downto 0));end scan;architecture beh of scan is signal cnt : integer range 0 to 7;signal en : std_logic_vector(7 downto 0);signal clk2hz : std_logic;signal h_ce_reg,m_ce_reg,s_ce_reg : std_logic;begin h_ce_reg <= not h_ce;m_ce_reg <= not m_ce;s_ce_reg <= not s_ce;cnt_pro : process(clk1khz)begin if clk1khz'event and clk1khz='1' then if cnt = 7 then cnt <= 0;else cnt <= cnt + 1;end if;end if;end process cnt_pro;clk2hz_pro :process(clk1khz)variable c : integer range 0 to 499 := 0;begin if clk1khz'event and clk1khz='1' then if clk2hz_en ='1' then if c =499 then c := 0;clk2hz <= not clk2hz;else c := c + 1;end if;else clk2hz <= '0';end if;end if;end process clk2hz_pro;scan_pro : process(cnt,sl,sh,ml,mh,hl,hh)begin case cnt is when 0 => dataout <= sl;en <= “11111110”;when 1 => dataout <= sh;en <= “11111101”;when 2 => dataout <= ml;en <= “11110111”;when 3 => dataout <= mh;en <= “11101111”;when 4 => dataout <= hl;en <= “10111111”;14 when 5 => dataout <= hh;en <= “01111111”;when 6 => dataout <= “1010”;en <= “11111011”;when 7 => dataout <= “1010”;en <= “11011111”;when others => null;end case;end process scan_pro;
en_out <= en or((clk2hz & clk2hz)or(h_ce_reg & h_ce_reg))& clk2hz &((clk2hz & clk2hz)or(m_ce_reg & m_ce_reg))& clk2hz &((clk2hz & clk2hz)or(s_ce_reg & s_ce_reg));end beh;
输入模块电路图:
scanclk1khzen_out[7..0]sl[3..0]dataout[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]clk2hz_ens_cem_ceh_ceinst
2.6报时模块
利用蜂鸣器进行整点报时
程序代码:
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use IEEE.STD_LOGIC_ARITH.ALL;--整点报时 entity baoshi is port(clk1khz,clk2khz : in std_logic;a:in std_logic_vector(15 downto 0);sel:in std_logic;bell:out std_logic);end baoshi;architecture zhong of baoshi is signal c1,ring:std_logic;begin ring_bell :process(clk1khz,clk2khz)15 begin case a is when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk1khz;when “***0” => c1<=clk2khz;when “***0” => c1<=clk2khz;when others => c1<='0';end case;end process ring_bell;
bs: process(c1)begin if sel='1' then if c1='1' then ring<='0';else ring<='1';end if;end if;end process bs;bell<=ring;
end zhong;
输入模块电路图:
baoshiclk1khzbellclk2khza[15..0]selinst
整体模块电路图
displayshuzizhongs_enm_enh_enselclk_changes_enm_enh_enselsecoutminouthouroutsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]hh[3..0]setmodefreclkINPUTVCCINPUTVCCdata[3..0]datain[3..0]secoutminoutinst1scanclk1khzclk1khzsl[3..0]sh[3..0]ml[3..0]mh[3..0]hl[3..0]a[15..0]dataout[7..0]OUTPUTdataout[7..0]en_out[7..0]dataout[3..0]OUTPUTen_out[7..0]data[3..0]key_presssetclk1khzmodeclk1khzclk1hzsecoutminoutclk_changeclk2hz_ensels_cem_ceh_ces_enm_enh_eninst6s_enm_enh_enselinst7a[15..0]INPUTVCChh[3..0]clk2hz_ens_cem_ceh_ceinst4baoshiclk1khzclk2khza[15..0]selclk1khzbellclk2khza[15..0]sel++selclkclk1hzselclk1khzclk2khzinst2clk1khzclk2khzsecoutminoutOUTPUTbellinst
六、调试中遇到的问题及解决的方法:
1、编程时,经常导致语法错误,如:“;”没有写上,变量类型没有预先标明,前后变量名字由于缺少一个或多一个字母而导致出错。解决办法:对照错误,认真检查程序,看哪个地方的标点,变量没有写上或标明。
2、进行编译或波形仿真时,经常得到的不是预想中的结果。
解决办法:将需要编译或进行仿真的实体文件置顶,经检错无误后,进行波形仿真,在仿真之前需要合理设置仿真结束时间和信号周期。
3、在控制时间的显示的时候,由于变量太多多发现不能完全的控制住变量,导致显示的时候出现了乱码,数码管显示不正常 解决办法:减少变量,仔细推敲,合理命名。
七、心得体会
一个多星期的课程设计让我受益匪浅,也让我真正明白理论与实践相结合的重要性。通过具体实践才能让自己清楚哪些知识已经掌握,哪些知识仍需巩固加强。与此同时,我也对EDA以及VHDL语言有了进一步了解,对于其结构、语法、功能等认识不少。当然,我目前所做的还仅仅只是一些基本操作,要想真正将其融会贯通还需要今后更多的学习与实践。虽然只是一个小设计,我却也从中学到了不少设计流程和一些相关问题。设计是一个十分严谨的过程,容不得随意和马虎。要想快速而高效地完成一项设计,必须先有一个清晰明了的设计思路,设想好一个整体框架,然后在此基础上,逐渐将各个部分功能进行完善。在设计的过程中,也曾遇到不少困难,但正所谓坚持就是胜利,要想取得成功,必须要有努力付出,这样所取得的结果才更有意义。
第四篇:用状态机实现的EDA多功能数字钟课程设计VHDL代码
设计并实现具有一定功能的数字钟
1、该数字钟可以实现3个功能:计时功能、整点报时功能和重置时间功能,因此有3个功能:计时、重置时间、复位。
2、对所有设计的小系统能够正确分析;
3、基于VHDL语言描述系统的功能;
4、在quartus 2环境中编译通过;
5、仿真通过并得到正确的波形;
6、给出相应的设计报告。
其中计时模块有4部分构成:秒计时器(second)、分计时器(minute)、时计时器(hour)、日计时器(date)、月计时器(mouth)、年计时器(year)
1)秒计时器(second)是由一个60进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,秒计时器清0;set 为置数信号,当set为0时,秒计时器置数,置s1的值。clk为驱动秒计时器的时钟,sec为秒计时器的输出,ensec为秒计时器的进位信号,作为下一级的时钟输入信号。
2)分计时器(minute)是由一个60进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,分计时器清0;set 为置数信号,当set为0时,分计时器置数,置m1的值。clkm为驱动分计时器工作的时钟,与ensec相连接;min为分计时器的输出;enmin为分计时器的进位信号,作为下一级的时钟输入信号。
3)时计时器(hour)是由一个24进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,时计时器清0;set 为置数信号,当set为0时,时计时器置数,置h1的值。clkh为驱动时计时器工作的时钟,与enmin相连接;hour为时计时器的输出;enhour为时计时器的进位信号,作为下一级的时钟输入信号。
4)日计时器(date1)是由一个60进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,星期计时器清0;set 为置数信号,当set为0时,星期计时器置数,置d1的值。clkd为驱动星期计时器工作的时钟,与enhour相连接;date为日计时器的输出,endate为分计时器的进位信号,作为下一级的时钟输入信号,由于月份的天数存在天数不同,闰年2月的天数为28天等情况,还设计了一个润年判别器,准确显示时间。
5)月计时器(mouth)是由一个60进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,星期计时器清0;set 为置数信号,当set为0时,星期计时器置数,置mou1的值,clkmou为驱动星期计时器工作的时钟,与enday相连接;mou为日计时器的输出,enmou为分计时器的进位信号,作为下一级的时钟输入信号。6)计时器(year)是由一个60进制的计数器构成的,具有清0、置数和计数功能。其中reset为清0信号,当reset为0时,星期计时器清0;set 为置数信号,当set为0时,星期计时器置数,置y1的值,clky为驱动星期计时器工作的时钟,与enmou相连接;year为日计时器的输出。VHDL程序
1、屏幕切换模块
运用状态机进行屏幕切换,分别显示年月日,以及时分秒 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity mux3 is
Port(clk,Reset,sel : in std_logic;
int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12:IN STD_LOGIC_VECTOR(3 DOWNTO 0);--rst must
a1,a2,a3,a4,a5,a6: out std_logic_vector(3 downto 0));end mux3;
architecture Behavioral of mux3 is
TYPE states IS(st0, st1, st2, st3, st4, st5, st6, st7);
SIGNAL STX: states;
begin
COM1 : PROCESS(STX,int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,int12)
BEGIN--决定转换状态的进程
CASE STX IS
WHEN st0 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;
WHEN st1 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;
WHEN st2 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;
WHEN st3 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;
WHEN st4 => a1<=int7;a2<=int8;a3<=int9;a4<=int10;a5<=int11;a6<=int12;
WHEN st5 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;
WHEN st6 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;
WHEN st7 => a1<=int1;a2<=int2;a3<=int3;a4<=int4;a5<=int5;a6<=int6;
WHEN OTHERS => NULL;
END CASE;
END PROCESS COM1;REG: PROCESS(clk,Reset,sel)
--主控时序进程
BEGIN
IF Reset = '1' THEN
STX<= st0;
--异步复位
ELSIF clk='1' AND clk'EVENT THEN
if sel='1' then
CASE STX IS
WHEN st0=>STX<=st1;
WHEN st1=>STX<=st2;
WHEN st2=>STX<=st3;
WHEN st3=>STX<=st4;
WHEN st4=>STX<=st5;
WHEN st5=>STX<=st6;
WHEN st6=>STX<=st7;
WHEN st7=>STX<=st0;
END CASE;
END IF;
END if;END PROCESS;
2、显示切换程序 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity mux1 is
Port(clk,ina,inb,sel,Reset : in std_logic;
result : out std_logic);end mux1;
architecture Behavioral of mux1 is
TYPE state IS(st0,st1,st2,st3,st4,st5,st6,st7);
SIGNAL STX:state;begin REG1: PROCESS(ina,inb,STX)
BEGIN
CASE STX IS
WHEN st0=>result<=ina;
WHEN st1=>result<=ina;
WHEN st2=>result<=inb;
WHEN st3=>result<=inb;
WHEN st4=>result<=inb;
WHEN st5=>result<=inb;
WHEN st6=>result<=inb;
WHEN st7=>result<=inb;
END CASE;
END PROCESS;REG2:PROCESS(clk,sel,Reset)BEGIN IF(Reset='1')THEN
STX<=st0;ELSIF(clk'EVENT AND clk='1')THEN
if sel='1' then CASE STX IS WHEN st0=>STX<=st1;WHEN st1=>STX<=st2;WHEN st2=>STX<=st3;WHEN st3=>STX<=st4;WHEN st4=>STX<=st5;WHEN st5=>STX<=st6;WHEN st6=>STX<=st7;WHEN st7=>STX<=st0;
END CASE;END IF;end if;END PROCESS REG2;
end Behavioral;
3、置数操作模块
运用状态机,进行置数操作 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity mux is
Port(clk,ina,inb,sel,Reset : in std_logic;
r1,r2,r3,r4,r5,r6 : out std_logic);end mux;
architecture Behavioral of mux is TYPE state IS(st0,st1,st2,st3,st4,st5,st6,st7);
SIGNAL STX:state;begin PROCESS(ina,inb,STX)BEGIN CASE STX IS WHEN st0=>r1<=ina;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';WHEN st1=>r1<=ina;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';WHEN st2=>r1<='0';r2<='0';r3<='0';r4<='0';r5<='0';r6<=inb;WHEN st3=>r1<='0';r2<='0';r3<='0';r4<='0';r5<=inb;r6<='0';WHEN st4=>r1<='0';r2<='0';r3<='0';r4<=inb;r5<='0';r6<='0';WHEN st5=>r1<='0';r2<='0';r3<=inb;r4<='0';r5<='0';r6<='0';WHEN st6=>r1<='0';r2<=inb;r3<='0';r4<='0';r5<='0';r6<='0';WHEN st7=>r1<=inb;r2<='0';r3<='0';r4<='0';r5<='0';r6<='0';END CASE;END PROCESS;PROCESS(clk,sel,Reset)BEGIN IF(Reset='1')THEN STX<=st0;ELSIF(clk'EVENT AND clk='1')THEN if sel='1' then CASE STX IS WHEN st0=>STX<=st1;WHEN st1=>STX<=st2;WHEN st2=>STX<=st3;WHEN st3=>STX<=st4;WHEN st4=>STX<=st5;WHEN st5=>STX<=st6;WHEN st6=>STX<=st7;WHEN st7=>STX<=st0;
END CASE;END IF;end if;END PROCESS;end Behavioral;end Behavioral;
4、秒显示模块 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity secute1 is
Port(clkm,set,reset : in std_logic;
sec2,sec1 : inout std_logic_vector(3 downto 0);
ensec : out std_logic);end secute1;
architecture Behavioral of secute1 is
begin
Process(clkm,reset,set)
Begin
If reset='1' then sec2<=“0000”;sec1<=“0000”;
Elsif set='1' then sec2<=“0101”;sec1<=“1000”;
Elsif(clkm'event and clkm='1')then
if sec2=“0101” AND sec1=“1001” then sec2<=“0000”;sec1<=“0000”;ensec<='1';
elsif sec1=“1001” then sec2<=sec2+'1';sec1<=“0000”;ensec<='0';
else sec1<=sec1+'1';ensec<='0';
end if;end if;End process;end Behavioral;
5、分显示模块 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity minute1 is
Port(clkm,set,reset : in std_logic;
min2,min1 : inout std_logic_vector(3 downto 0);
enmin : out std_logic);end minute1;
architecture Behavioral of minute1 is
begin
Process(clkm,reset,set)
Begin
If reset='1' then min2<=“0000”;min1<=“0000”;
Elsif set='1' then min2<=“0101”;min1<=“1000”;
Elsif(clkm'event and clkm='1')then
if min2=“0101” AND min1=“1001” then min2<=“0000”;min1<=“0000”;enmin<='1';
elsif min1=“1001” then min2<=min2+'1';min1<=“0000”;enmin<='0';
else min1<=min1+'1';enmin<='0';
end if;end if;End process;end Behavioral;
6、小时显示模块 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity hour1 is
Port(clkh,set,reset: in std_logic;
hor2,hor1 : inout std_logic_vector(3 downto 0);
enhour : out std_logic);end hour1;
architecture Behavioral of hour1 is
begin Process(clkh,reset,set)
Begin
If reset='1' then hor2<=“0000”;hor1<=“0000”;
Elsif set='1' then hor2<=“0010”;hor1<=“0011”;
Elsif(clkh'event and clkh='1')then
if hor2=“0010” AND hor1=“0011” then hor2<=“0000”;hor1<=“0000”;enhour<='1';
elsif hor1=“1001” then hor2<=hor2+'1';hor1<=“0000”;enhour<='0';
else hor1<=hor1+'1';enhour<='0';
end if;
end if;End process;end Behavioral;
7、日显示模块(已加入闰年判断功能)library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity date1 is
Port(clkd,set : in std_logic;
dat2,dat1 : inout std_logic_vector(3 downto 0);
endate : out std_logic);end date1;
architecture Behavioral of date1 is
begin
Process(clkd,set)
Begin
if set='1' then dat2<=“0010”;dat1<=“1000”;
Elsif(clkd'event and clkd='1')then
if dat2=“0011” AND dat1=“0000” then dat2<=“0000”;dat1<=“0001”;endate<='1';elsif dat1=“1001” then dat2<=dat2+'1';dat1<=“0000”;endate<='0';
else dat1<=dat1+'1';endate<='0';
end if;end if;End process;end Behavioral;
8、月显示模块 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity month1 is
Port(clkn,set: in std_logic;
mon2,mon1 : inout std_logic_vector(3 downto 0);
enmon : out std_logic);end month1;
architecture Behavioral of month1 is
begin
Process(clkn,set)
Begin
if set='1' then mon2<=“0000”;mon1<=“0110”;
Elsif(clkn'event and clkn='1')then
if mon2=“0001” AND mon1=“0010” then mon2<=“0000”;mon1<=“0001”;enmon<='1';
elsif mon1=“1001” then mon2<=mon2+'1';mon1<=“0000”;enmon<='0';
else mon1<=mon1+'1';enmon<='0';
end if;end if;End process;
9、年显示模块 library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
--Uncomment the following lines to use the declarations that are--provided for instantiating Xilinx primitive components.--library UNISIM;--use UNISIM.VComponents.all;
entity yearth1 is
Port(clkn,set: in std_logic;
year2,year1 : inout std_logic_vector(3 downto 0);
enyear : out std_logic);end yearth1;
architecture Behavioral of yearth1 is
begin
Process(clkn,set)
Begin
if set='1' then year2<=“0001”;year1<=“0001”;
Elsif(clkn'event and clkn='1')then
if year2=“1001” AND year1=“1001” then year2<=“0000”;year1<=“0001”;
elsif year1=“1001” then year2<=year2+'1';year1<=“0000”;enyear<='0';
else year1<=year1+'1';enyear<='0';
end if;end if;
end Behavioral;
第五篇:EDA数字钟设计
数字钟
一、实验目的
1、掌握多位计数器相连的设计方法。
2、掌握十进制,六进制,二十四进制计数器的设计方法。
3、掌握扬声器的驱动及报时的设计。
4、LED灯的花样显示。
5、掌握CPLD技术的层次化设计方法。
二、实验器材
1、主芯片Altera EPF10K10LC84-4。2、8个LED灯。
3、扬声器。4、4位数码显示管。5、8个按键开关(清零,调小时,调分钟)。
三、实验内容
根据电路特点,运用层次设计概念设计。将此设计任务分成若干模块,规定每一模块的功能和各模块之间的接口。
1、时计时程序: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;
entity hour is
port(reset,clk : in std_logic;
daout : out std_logic_vector(7 downto 0));end hour;
architecture behav of hour is
signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);begin
p1: process(reset,clk)
begin
if reset='0' then
count<=“0000”;
counter<=“0000”;
elsif(clk'event and clk='1')then
if(counter<2)then
if(count=9)then
count<=“0000”;
counter<=counter + 1;
else
count<=count+1;
end if;
else
if(count=3)
then
counter<=“0000”;
else
count<=count+1;
count<=“0000”;
end if;
end if;
end if;
end process;
daout(7 downto 4)<=counter;daout(3 downto 0)<=count;
end behav;
2、分计时程序: library ieee;
use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;
entity minute is
port(reset,clk,sethour: in std_logic;
daout : out std_logic_vector(7 downto 0);
enhour : out std_logic);end minute;
architecture behav of minute is
signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);signal carry_out1 : std_logic;signal carry_out2 : std_logic;begin
p1: process(reset,clk)begin
if reset='0' then
count<=“0000”;
counter<=“0000”;
elsif(clk'event and clk='1')then
if(counter<5)then
if(count=9)then
count<=“0000”;
counter<=counter + 1;
else
count<=count+1;
end if;
carry_out1<='0';
else
if(count=9)then
count<=“0000”;
counter<=“0000”;
carry_out1<='1';
else
count<=count+1;
carry_out1<='0';
end if;
end if;end if;end process;
p2: process(clk)begin
if(clk'event and clk='0')then
if(counter=0)then
if(count=0)then
carry_out2<='0';
end if;
else
carry_out2<='1';
end if;end if;end process;
daout(7 downto 4)<=counter;daout(3 downto 0)<=count;enhour<=(carry_out1 and carry_out2)or sethour;end behav;
3、秒计时程序: library ieee;
use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;
entity second is
port(reset,clk,setmin : in std_logic;
daout : out std_logic_vector(7 downto 0);
enmin : out std_logic);end second;
architecture behav of second is
signal count : std_logic_vector(3 downto 0);signal counter : std_logic_vector(3 downto 0);signal carry_out1 : std_logic;signal carry_out2 : std_logic;begin
p1: process(reset,clk)begin
if reset='0' then
count<=“0000”;
counter<=“0000”;
elsif(clk'event and clk='1')then
if(counter<5)
then
if
(count=9)
then
count<=“0000”;
counter<=counter + 1;
else
count<=count+1;
end if;
carry_out1<='0';
else
if(count=9)
then
count<=“0000”;
counter<=“0000”;
carry_out1<='1';
else
count<=count+1;
carry_out1<='0';
end if;
end if;end if;end process;daout(7 downto
4)<=counter;
daout(3
downto
0)<=count;enmin<=carry_out1 or setmin;end behav;6
4、alert程序: library ieee;
use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;
entity alert is port(clkspk : in std_logic;
second : in std_logic_vector(7 downto 0);
minute : in std_logic_vector(7 downto 0);
speak : out std_logic;
lamp : out std_logic_vector(8 downto 0));end alert;
architecture behav of alert is signal divclkspk2 : std_logic;begin p1: process(clkspk)begin
if(clkspk'event and clkspk='1')then
divclkspk2<=not divclkspk2;
end if;end process;p2: process(second,minute)begin if(minute=“01011001”)then case second is
when “01010001”=>lamp<=“000000001”;speak<=divclkspk2;when “01010010”=>lamp<=“000000010”;speak<='0';when “01010011”=>lamp<=“000000100”;speak<=divclkspk2;when “01010100”=>lamp<=“000001000”;speak<='0';when “01010101”=>lamp<=“000010000”;speak<=divclkspk2;when “01010110”=>lamp<=“000100000”;speak<='0';when “01010111”=>lamp<=“001000000”;speak<=divclkspk2;when “01011000”=>lamp<=“010000000”;speak<='0';when “01011001”=>lamp<=“100000000”;speak<=clkspk;when others=>lamp<=“000000000”;end case;end if;end process;end behav;8
5、seltime程序 library ieee;
use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;
entity seltime is port(ckdsp : in std_logic;
reset : in std_logic;
second : in std_logic_vector(7 downto 0);
minute : in std_logic_vector(7 downto 0);
hour : in std_logic_vector(7 downto 0);
daout : out std_logic_vector(3 downto 0);
sel : out std_logic_vector(2 downto 0));end seltime;
architecture behav of seltime is signal sec : std_logic_vector(2 downto 0);begin
process(reset,ckdsp)begin
if(reset='0')then sec<=“000”;
elsif(ckdsp'event and ckdsp='1')then
sec<=“000”;else
sec<=sec+1;end if;end if;end process;
process(sec,second,minute,hour)begin case sec is
when “000”=>daout<=second(3 downto 0);when “001”=>daout<=second(7 downto 4);when “011”=>daout<=minute(3 downto 0);when “100”=>daout<=minute(7 downto 4);when “110”=>daout<=hour(3 downto 0);when “111”=>daout<=hour(7 downto 4);when others=>daout<=“1111”;end case;end process;
if(sec=“111”)then
sel<=sec;end behav;
6、deled程序: LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_unsigned.all;
ENTITY deled IS PORT(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 IS
SIGNAL DATA:STD_LOGIC_VECTOR(3 DOWNTO 0);SIGNAL DOUT:STD_LOGIC_VECTOR(7 DOWNTO 0);BEGIN DATA<=S;PROCESS(DATA)BEGIN
CASE DATA IS
WHEN “0000”=>DOUT<=“00111111”;WHEN “0001”=>DOUT<=“00000110”;WHEN “0010”=>DOUT<=“01011011”;WHEN “0011”=>DOUT<=“01001111”;WHEN “0100”=>DOUT<=“01100110”;WHEN “0101”=>DOUT<=“01101101”;WHEN “0110”=>DOUT<=“01111101”;WHEN “0111”=>DOUT<=“00000111”;WHEN “1000”=>DOUT<=“01111111”;WHEN “1001”=>DOUT<=“01101111”;WHEN “1010”=>DOUT<=“01110111”;WHEN “1011”=>DOUT<=“01111100”;WHEN “1100”=>DOUT<=“00111001”;WHEN “1101”=>DOUT<=“01011110”;WHEN “1110”=>DOUT<=“01111001”;WHEN “1111”=>DOUT<=“01000000”;WHEN OTHERS=>DOUT<=“00000000”;END 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;
7、顶层原理图:
四、实验结果 顶层原理图仿真波形:
五、心得体会
1、系统设计进要行充分的方案论证,不可盲目就动手去做;
2、实验中对每一个细节部分都要全面思考,要对特殊情况进行处理;
3、对于数字系统,要考虑同步、异步问题;
4、数字电路的理论分析要结合时序图;
5、遇到问题,要顺藤摸瓜,分析清楚,不可胡乱改动,每做一次改变都要有充分的理由;
6、模块化设计方法的优点在于其简洁性,但是在实验设计中也发现,在实验最终电路确定之前,要尽量减少模块重叠嵌套,因为在总的电路敲定之前,电路还不成熟,很多地方需要改进,如果在开始时就进行多层模块化,里层模块电路的修改将影响其外层的全部电路,这样就是牵一发动全身,很显然,这样将导致电 数字钟课程设计 电路设计的低效,所以在设计过程中,一定要尽量减少超过两层的模块;
7、遇到问题花了很长时间没有解决掉,要学会想他人请教,别人的不经意一点,可能就能把自己带出思维死区。