EDA数字秒表设计_第1页
EDA数字秒表设计_第2页
EDA数字秒表设计_第3页
EDA数字秒表设计_第4页
EDA数字秒表设计_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

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

文档简介

1、电子设计自动化大作业题 目 数字秒表设计 学 院 控制科学与工程学院班 级 自动化0803 姓 名 学 号 二OO一一年五月十二日题 目:数字秒表的设计一、设计要求:(1)数字秒表的计时精度是10ms; (2)复位开关可以在任何情况下使用,计时在计时过程中,只要按一下复位开关,计时器就清零,并做好下次计时的准备; (3)具有启/停开关,即按一下启/停开关,启动计时器开始计时,再按一下启/停开关则停止计时。 (4)数字秒表的计时范围是0秒59分59.99秒,显示的最长时间为59分59秒二、总体设计:1、总体结构图通过3-8译码器控制8位数码管的亮灭Sel模块选择输入信号控制选择模块输出的数据时钟

2、的分秒和毫秒 输入到CHOICE中通过数据的编码控制数码管的显示2、各模块功能1) SEL模块:将扫描信号输给选择(CHOICE)模块2)选择模块:按扫描信号的指定选择输出3)3-8译码模块:通过SEL给的信号来控制8位数码管位的亮灭4)计时模块:分别对毫秒,秒,分计时 5)显示模块:通过CHOICE模块的输出信号来控制 三、单元模块设计1、模块名: sel模块设计(1)模块功能: CLK为扫描时钟脉冲,SELOUT端不停的发出扫描到的信号(2)端口定义: CLK为信号输入端 SELOUT2.0为选择到的信号输出(3)VHDL源程序library ieee;use ieee.std_logic

3、_1164.all;use ieee.std_logic_unsigned.all;entity sel is port(clk: in std_logic; selout: out std_logic_vector(2 downto 0);end sel;architecture one of sel is signal count: std_logic_vector(2 downto 0);begin process(clk) begin if clk'event and clk='1' then if (count="101") then co

4、unt<="000" else count<=count+1; end if; end if; end process; selout<=count; end one;(4)仿真结果说明:来一个上升沿,SELOUT的值增1,可以证明模块是正确的。2、模块名:选择模块设计(1)模块功能: 按扫描信号的指定选择输出(2)端口定义: a,b,c为控制信号; data13.0, data23.0, data33.0, data43.0, data53.0, data63.0分别是毫秒的低位,毫秒的高位,秒的低位,秒的高位,分的低位,分的高位的数据值; ch_out

5、3.0为选择输出端。(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity choice isport(a,b,c:in std_logic;data1,data2,data3,data4,data5,data6:in std_logic_vector(3 downto 0); ch_out:out std_logic_vector( 3 downto 0);end choice;architecture behave of choice issignal ch:std_

6、logic_vector(2 downto 0);beginch(2)<=c;ch(1)<=b;ch(0)<=a; process(ch)begincase ch iswhen"000"=>ch_out<=data1;when"001"=>ch_out<=data2;when"010"=>ch_out<=data3;when"011"=>ch_out<=data4;when"100"=>ch_out<=data5;wh

7、en"101"=>ch_out<=data6;when others=> null;end case; end process;end behave;(4)仿真结果说明:abc的值递增,ch_out选择输出data1,data2,data3,data4,data5,data6的值,证明模块是正确的3、模块名: 3-8译码模块设计(1)模块功能: 通过SEL给的信号来控制8位数码管位的亮灭。(2)端口定义: 输入端SEL2.0值大小来选择输出Q的值输出端Q7.0来控制灯哪位亮(3)VHDL源程序LIBRARY ieee;use ieee.std_logic_

8、1164.all;use ieee.std_logic_unsigned.all;ENTITY decode3_8 ISPORT(SEL: IN std_logic_vector(2 downto 0); Q: OUT std_logic_vector(7 downto 0);END decode3_8;ARCHITECTURE a OF decode3_8 ISBEGINQ <= "11111110" when sel = 0 else "11111101" when sel = 1 else "11111011" when

9、sel = 2 else "11110111" when sel = 3 else "11101111" when sel = 4 else "11011111" when sel = 5 else "11111111"END a;(4)仿真结果说明:Sel的值递增,Q的相应位会亮,证明模块是正确的。41模块名: 毫秒计时模块设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 reset为复位端 pause为暂停端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输

10、出端(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m100 isport(clk:in std_logic; reset:in std_logic; pause:in std_logic; co:out std_logic; qh:buffer std_logic_vector(3 downto 0); ql:buffer std_logic_vector(3 downto 0);end m100;architecture behave of m100 isbe

11、ginco<='1' when (qh="1001" and ql="1001") else '0' process(clk,reset,pause)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql<=ql; elsif (clk'event and clk='1') thenif (ql=&qu

12、ot;1001") thenql<="0000" if (qh="1001") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if; end process;end behave;(4)仿真结果说明:毫秒为100进制,高位和地位都是10进制,高位到10会有进位,可以证明模块的正确性4.2模块名: 秒计时模块设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 reset为复位端 pause为暂停

13、端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输出端(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m60_sec isport(reset:in std_logic; pause:in std_logic; ci:in std_logic; co:out std_logic; qh:buffer std_logic_vector(3 downto 0); ql:buffer std_logic_vector(3 downto 0);

14、end m60_sec;architecture behave of m60_sec isbegin co<='1' when (qh="0101" and ql="1001" and ci='1') else '0'process(reset,pause,ci)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql

15、<=ql; elsif (ci'event and ci='1') thenif (ql="1001") thenql<="0000" if (qh="0101") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if;end process;end behave;(4)仿真结果说明:秒进制为60进制,高位到6会有进位,低位为10进制,可以证明模块的正确性4.3模块名: 分计时模块

16、设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 reset为复位端 pause为暂停端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输出端(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m60_min isport(reset:in std_logic; pause:in std_logic; ci:in std_logic; qh:buffer std_logic_vector(3 downto 0);

17、ql:buffer std_logic_vector(3 downto 0);end m60_min;architecture behave of m60_min isbeginprocess(reset,pause,ci)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql<=ql; elsif (ci'event and ci='1') thenif (ql="1

18、001") thenql<="0000" if (qh="0101") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if;end process;end behave;(4)仿真结果说明:高位为6进制,低位为10进制,ci为脉冲信号,当ql=9的时候,qh在下一时刻会增1,可以证明模块的正确性5、模块名: 显示模块设计(1)模块功能: 通过CHOICE模块的输出信号来控制(2)端口定义: adr是选择模块结果的输入端

19、q_show是控制数码管段亮的输出端(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity BCD_7 isport(adr:in std_logic_vector(3 downto 0); q_show:out std_logic_vector(6 downto 0);end BCD_7;architecture behave of BCD_7 is beginprocess(adr)begincase adr iswhen "0000"=>q

20、_show<="1111110"when "0001"=>q_show<="0110000"when "0010"=>q_show<="1101101"when "0011"=>q_show<="1111001"when "0100"=>q_show<="0110011"when "0101"=>q_show<="1011011"when "0110"=>q_show<="1011111"when "0111"=>q_show<="1110000"when "1000"=>q_show<="1111111"when "1001"=>q_show<="1111011"when others=>null;end case;end p

温馨提示

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

最新文档

评论

0/150

提交评论