EDA-数字秒表设计

上传人:yh****1 文档编号:127494424 上传时间:2020-04-02 格式:DOC 页数:18 大小:144KB
返回 下载 相关 举报
EDA-数字秒表设计_第1页
第1页 / 共18页
EDA-数字秒表设计_第2页
第2页 / 共18页
EDA-数字秒表设计_第3页
第3页 / 共18页
EDA-数字秒表设计_第4页
第4页 / 共18页
EDA-数字秒表设计_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《EDA-数字秒表设计》由会员分享,可在线阅读,更多相关《EDA-数字秒表设计(18页珍藏版)》请在金锄头文库上搜索。

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_logi

3、c_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 clkevent and clk=1 then if (count=101) then count=000; else count=count+

4、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_out3.0为选择输出端。(3)VHDL源程序library ieee;use ieee.std_log

5、ic_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_logic_vector(2 downto 0);beginch(2)=c;ch(1)=b;ch(

6、0)ch_outch_outch_outch_outch_outch_out 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_1164.all;use ieee

7、.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 sel = 2 else 11110111 when sel = 3 else 11101111 when sel

8、 = 4 else 11011111 when sel = 5 else 11111111;END a;(4)仿真结果说明:Sel的值递增,Q的相应位会亮,证明模块是正确的。41模块名: 毫秒计时模块设计(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 m100 isport(

9、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 isbeginco=1 when (qh=1001 and ql=1001) else 0; process(clk,reset,pause)begin if(reset=0) thenqh=0000;ql=0000

10、; elsif(pause=0)then qh=qh; ql=ql; elsif (clkevent and clk=1) thenif (ql=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为信号时钟输入端 rese

11、t为复位端 pause为暂停端 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);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=ql;

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 建筑资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号