收藏 分销(赏)

EDA课程设计数字秒表.doc

上传人:精*** 文档编号:10416957 上传时间:2025-05-27 格式:DOC 页数:12 大小:704.01KB 下载积分:8 金币
下载 相关 举报
EDA课程设计数字秒表.doc_第1页
第1页 / 共12页
EDA课程设计数字秒表.doc_第2页
第2页 / 共12页


点击查看更多>>
资源描述
课 程 设 计   题 目 数字秒表设计    院 系 信息工程学院     班  级        姓  名        指导教师 - 12 - 目录 第一章 :系统设计要求..............................................................................................3 第二章 :实验目的......................................................................................................3 第三章 :实验原理......................................................................................................3 第四章 :系统设计方案..............................................................................................3 第五章 :主要VHDL源程序.....................................................................................4 1) 十进制计数器的VHDL源程序..............................................................4 2) 六进制计数器的VHDL源程序..............................................................5 3)蜂鸣器的VHDL源程序..........................................................................5 4)译码器的VHDL源程序..........................................................................6 5)控制选择器的VHDL源程序..................................................................7 6)元原件例化的VHDL源程序..................................................................8 第六章:系统仿真.......................................................................................................10 第七章:系统扩展思路...............................................................................................11 第八章:设计心得总结...............................................................................................11 数字秒表的设计 一、 系统设计要求 1.秒表共有6个输出显示,分别为百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出,这样便于和显示译码器的连接。当计时达60分钟后,蜂鸣器鸣响10声。 2.整个秒表还需有一个启动信号和一个归零信号,以便秒表能随意停止及启动。 3.秒表的逻辑结构较简单,它主要由显示译码器、分频器、十进制计数器、六进制计数器和报警器组成。在整个秒表中最关键的是如何获得一个精确的100HZ计时脉冲。 二、 实验目的 通过本次课设,加深对EDA技术设计的理解,学会用QuartusⅡ工具软件设计基本电路,熟练掌握VHDL语言,为以后工作使用打下坚实的基础。 三、 实验原理 秒表由于其计时精确,分辨率高(0.01秒),在各种竞技场所得到了广泛的应用。秒表的工作原理与数字时基本相同,唯一不同的是秒表的计时时钟信号,由于其分辨率为0.01秒,所以整个秒表的工作时钟是在100Hz的时钟信号下完成。当秒表的计时小于1个小时时,显示的格式是mm-ss-xx(mm表示分钟:0~59;ss表示秒:0~59;xx表示百分之一秒:0~99),当秒表的计时大于或等于一个小时时,显示的和多功能时钟是一样的,就是hh-mm-ss(hh表示小时:0~99),由于秒表的功能和钟表有所不同,所以秒表的hh表示的范围不是0~23,而是0~99,这也是和多功能时钟不一样的地方。在设计秒表的时候,时钟的选择为100Hz。变量的选择:因为xx(0.01秒)和hh(小时)表示的范围都是0~99,所以用两个4位二进制码(BCD码)表示;而ss(秒钟)和mm(分钟)表示的范围是0~59,所以用一个3位的二进制码和一个4位的二进制码(BCD)码表示。显示的时候要注意的问题就是小时的判断,如果小时是00,则显示格式为mm-ss-xx,如果小时不为00,则显示hh-mm-ss。 四、 系统设计方案 秒表的逻辑结构较简单,它主要由显示译码器、分频器、十进制计数器、六进制计数器和报警器组成。 四个10进制计数器:用来分别对百分之一秒、十分之一秒、秒和分进行计数;两个6进制计数器:用来分别对十秒和十分进行计数;分频器:用来产生100HZ计时脉冲;显示译码器:完成对显示的控制。 根据电路持点,用层次设计概念将此设计任务分成若干模块,规定每一模块的功能和各模块之间的接口。按适配划分后的管脚定位,同相关功能块硬件电路接口连线。用VHDL语言描述所有底层模块。清零信号为异步清零。当最高位记到6时 停止计数 显示译码器全部显示零,并发出十声警报声。按下复位按钮后继续计数。 数字秒表拟由单片的CPLD/FPGA来实现,经分析设计要求,拟定整个系统由10个模块组成,原理图如下: 五、 主要VHDL源程序 1. 十进制计数器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count10 is port (clk,start,clr : in std_logic; cout : out std_logic; daout : out std_logic_vector(3 downto 0)); end count10; architecture one of count10 is signal q0 : std_logic_vector(3 downto 0); signal q1 : std_logic; begin process(clk,clr) begin if clr='1' then q0<="0000"; elsif ( clk'event and clk='1') then if start='1' then if q0="1001" then q0<="0000";q1<='1'; else q0<=q0+1;q1<='0'; end if; end if; end if; end process; daout<= q0; cout<=q1; end one; 2. 六进制计数器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count6 is port (clk,start,clr : in std_logic; cout : out std_logic; daout : out std_logic_vector(3 downto 0)); end count6; architecture two of count10 is signal q0 : std_logic_vector(3 downto 0); signal q1 : std_logic; begin process(clk,clr) begin if clr='1' then q0<="0000"; elsif ( clk'event and clk='1') then if start='1' then if q0="0101" then q0<="0000";q1<='1'; else q0<=q0+1;q1<='0'; end if; end if; end if; end process; daout<= q0; cout<=q1; end two; 3. 蜂鸣器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity alarm is port(clk,I:in std_logic; q:out std_logic ); end alarm; architecture ar of alarm is signal n:integer range 0 to 20; signal q0:std_logic; begin process(clk) begin if clk'event and clk='1' then if i='0' then q0<='0'; n<=0; elsif n<=19 and i='1' then q0<=not q0; n<=n+1; else q0<='0'; end if; end if; end process; q<=q0; end ar; 4. 译码器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; entity deled is port(num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0)); end deled ; architecture a of deled is begin process(num) begin case num is when"0000"=>led<="0111111"; when"0001"=>led<="0000110"; when"0010"=>led<="1011011"; when"0011"=>led<="1001111"; when"0100"=>led<="1100110"; when"0101"=>led<="1101101"; when"0110"=>led<="1111101"; when"0111"=>led<="0100111"; when"1000"=>led<="1111111"; when"1001"=>led<="1101111"; when others=>led<="0000000"; end case; end process; end a; 5. 控制选择器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity seltime is port(clr,clk: in bit; dain0,dain1,dain2,dain3,dain4,dain5: in std_logic_vector(3 downto 0); sel: out std_logic_vector(2 downto 0); daout: out std_logic_vector(3 downto 0)); end seltime; architecture a of seltime is signal temp:integer range 0 to 5; begin process(clk) begin if (clr='1') then daout<="0000"; sel<="000"; temp<=0; elsif (clk='1'and clk'event) then if temp=5 then temp<=0; else temp<=temp + 1; end if; case temp is when 0=>sel<="000";daout<=dain0; when 1=>sel<="001";daout<=dain1; when 2=>sel<="010";daout<=dain2; when 3=>sel<="011";daout<=dain3; when 4=>sel<="100";daout<=dain4; when 5=>sel<="101";daout<=dain5; end case; end if; end process; end a; 6. 分频器的VHDL源程序 library ieee; use ieee.std_logic_1164.all; entity div is port(clr,clk: in std_logic; q: buffer std_logic); end div; architecture a of div is signal count:integer range 0 to 99999; begin process(clr,clk) begin if (clk'event and clk='1') then if clr='1' then count<=0; elsif count=99999 then count<=0; q<= not q; else count<=count+1; end if; end if; end process; end a; 7. 元原件例化的VHDL源程序 library ieee; use ieee.std_logic_1164.all; entity mb_top is port ( stop,start,clk:in std_logic; a,b,c,d,e,f,g,speaker:out std_logic; sel:out std_logic_vector(2 downto 0)); end mb_top; architecture a of mb_top is component div port(clr,clk: in std_logic; q: buffer std_logic); end component; component count10 port( clr,start,clk:in std_logic; cout:out std_logic; daout:buffer std_logic_vector(3 downto 0)); end component; component count6 port( clr,start,clk:in std_logic; cout:out std_logic; daout:buffer std_logic_vector(3 downto 0)); end component; component seltime port( clr,clk:in std_logic; dain1:in std_logic_vector(3 downto 0); dain2:in std_logic_vector(3 downto 0); dain3:in std_logic_vector(3 downto 0); dain4:in std_logic_vector(3 downto 0); dain5:in std_logic_vector(3 downto 0); dain6:in std_logic_vector(3 downto 0); sel:out std_logic_vector(2 downto 0); daout:out std_logic_vector(3 downto 0)); end component; component deled port( num:in std_logic_vector(3 downto 0); led:out std_logic_vector(6 downto 0)); end component; component alarm port( clk,i:in std_logic; q:out std_logic); end component; signal div_q,b_cout,s_cout,m_cout,sm_cout,f_cout,sf_cout:std_logic; signal b_daout,s_daout,m_daout,sm_daout,f_daout,sf_daout,seltime_daout:std_logic_vector(3 downto 0); signal ledout:std_logic_vector(6 downto 0); begin a<=ledout(0);b<=ledout(1);c<=ledout(2);d<=ledout(3); e<=ledout(4);f<=ledout(5);g<=ledout(6); u1:div port map(stop,clk,div_q); u2:count10 port map(stop,start,div_q,b_cout,b_daout); u3:count10 port map(stop,start,b_cout,s_cout,s_daout); u4:count10 port map(stop,start,s_cout,m_cout,m_daout); u5:count6 port map(stop,start,m_cout,sm_cout,sm_daout); u6:count10 port map(stop,start,sm_cout,f_cout,f_daout); u7:count6 port map(stop,start,f_cout,sf_cout,sf_daout); u8:seltime port map(stop,div_q,b_daout,s_daout,m_daout,sm_daout,f_daout,sf_daout,sel,seltime_daout); u9:deled port map(seltime_daout,ledout); u10:alarm port map(div_q,sf_cout,speaker); end a; 六、 系统仿真 1. 十进制 2. 六进制 3. 蜂鸣器 4. 译码器 5. 控制选择器 七、 系统扩展思路 根据实验的内容可以适当的添加一些有实际作用和可行性的功能,如可以记录并显示多个数据。根据扩展的内容设计相应的电路和模块来完成扩展的内容。比如记录和显示多个数据,可以用多个秒表进行计数,在秒表电路的后面可以添加一个选择电路,运用选择电路选择需要输出的那个秒表的数值。 八、 设计心得及体会 通过此次课程设计,让我对EDA这门技术有了更深的体会,并更好的学会了使用QuartusⅡ软件进行硬件设计。 在编写程序的过程中,遇到了很多问题,使我发现自己以前学习上存在的不足。通过与同学探讨和请教老师,终于把问题都解决了,并加深了对数字时钟原理和设计思路的了解。同时我也掌握了做课程设计的一般流程,为以后的电子设计这块积累了一定的经验,为以后从事相关工作有一些帮助。最终解决了问题,攥写成报告。 通过对设计对实现和对报告对撰写,深深体会到了VHDL语言和EDA技术的一些技巧和设计思想,在完成设计的过程中,应该具有很清晰地思路,才可以使电路更完美和简便,要敢想敢做但是不应该有投机取巧的心理。在完成每一步的时候都有意想不到的收获也有可能导致错误,所以在设计对过程中要集中精神。在写报告的过程中,更加凸显了细心二字。不可自认为完美,必须按照格式要求来撰写自己的报告,所以必须做到足够的精确。 利用EDA工具,电子设计师可以从概念、算法、协议等开始设计电子系统,大量工作可以通过计算机完成,并可以将电子产品从电路设计、性能分析到设计版图的整个过程的计算机上自动处理完成。在进行设计时并不束缚设计者的想象力,这使得自学、扩展也可以很容易实现。在设计中充分的认识到EDA课程对硬件设计的重要性,若把本门课程学好、学精,对硬件设计将有很大对帮助。以后若有机会我将会利用更多时间来学习EDA技术、更加深入的学习EDA技术。EDA技术以其独有的优点和应用范围有着非常好的发展前景,是近几年电子工业的发展趋向,中国的EDA行业发展十分迅速,有着很大的潜力。所以我们学好这门课程是十分必要的,我们不应该仅仅拘泥于一门课程的学习,要结合各学科的连接点,把我们的知识串联起来。为我们的未来做好知识储备。 以上就我关于这次课程设计的想法,在以后,我会用更多的时间去了解EDA。并且提高自己的知识水平。
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服