欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    电子设计自动化EDA课程设计电子钟设计.doc

    • 资源ID:4150174       资源大小:84.50KB        全文页数:21页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    电子设计自动化EDA课程设计电子钟设计.doc

    电子设计自动化EDA课程设计题目 电 子 钟 设 计 专业 电子信息科学与技术 班级 电子一班 学号 20104672 姓名 目录一、实验目的-(1)二、实验内容-(1)三、工作原理-(1)四、VHDL源程序代码-(2) 1、 分频模块-(2)2、走时、校时模块-(4)3、闹钟模块-(7)4、秒表模块-(9)5、功能控制模块-(13)6、选择输出模块-(14)7、数码管显示、亮度可调模块-(15)8、总体例化-(17)五、心得体会-(18)一 . 实验目的 练习综合设计能力,熟练应用QuartursII软件,熟练掌握课本知识,设计一个数字钟,以提高自己的动手能力二. 实验内容 基本功能要求 设计一个电子时钟,要求可以显示时、分、秒,用户可以设置时间。 扩展功能要求 秒表功能,闹钟功能,调整数码管亮度 试验箱设置1、 选择模式7;2、 数码管8左边的跳线选择CLOSE;三. 工作原理 数字钟模块分化如下: 分频模块功能控制模块走时/调时选择输出显示数码管显示、亮度可调闹钟选时定时比较秒表 (1) 分频模块可分出1Hz、100 Hz 、1000Hz、5000 Hz,分别用于正常走时、秒表、定时比较和数码管扫描。 (2) 功能控制模块由一个简单加法器实现看,用键7控制,当按一下键7,来一个单脉冲,加法器内部定义信号循环自加实现模式转换,不断控制各功能模块的使能键,实现功能转换。 (3) 走时/调时模块通过使能端选择不同输入时钟,切换两个模式,当en=1时,可以调时,键4为位选键,键1为加数键,en=0时,正常走时。只有在调时时,走时停止,在其他功能时走时正常进行。此模块由时、分、秒三部分组成。 (4) 闹钟模块由两部分组成,闹钟选时和定时比较,选定闹钟时间后,在1000 Hz的驱动下,比较器时刻与正常走时输出比较,当两时间相等时,比较器输出以时钟信号使蜂鸣器发出响声。 (5)秒表模块由计数器实现,键1为清零键,当百分之一秒计满一百进一位,秒计满六十进一位。可显示分、秒、百分之一秒。 (6)选择输出显示模块 ,由一个加法器实现 ,此模块与功能控制模块为同一驱动,选择输出当前功能的输出。(7)数码管显示、亮度可调模块由5000Hz驱动,显示部分分为段选与位选。键7控制选择到亮度调节功能,键1实现亮度调节。四. 各模块VHDL源代码1、分频模块 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div is -分频port(clk:in std_logic; clk1,clk100,clk1000,clk1M:out std_logic); end;architecture one of div issignal clk1_tmp:std_logic;signal clk2_tmp:std_logic;signal clk3_tmp:std_logic;signal clk4_tmp:std_logic;signal cnt1:integer range 0 to 4999999; - 1hz 正常走时signal cnt100:integer range 0 to 49999; -100hz 秒表驱动signal cnt1000:integer range 0 to 4999 ; -1000 扫描闹钟比较器signal cnt1M:integer range 0 to 999; -5000 扫描频率beginP1: process(clk) begin if clk'event and clk='1' then if cnt1<4999999 then cnt1<=cnt1+1; elsecnt1<=0; clk1_tmp<=NOT clk1_tmp ;end if;end if;end process;P2: process(clk) begin if clk'event and clk='1' then if cnt100<49999 then cnt100<=cnt100+1; elsecnt100<=0; clk2_tmp<=NOT clk2_tmp ;end if;end if;end process;P3: process(clk) begin if clk'event and clk='1' then if cnt1000<4999 then cnt1000<=cnt1000+1; elsecnt1000<=0; clk3_tmp<=NOT clk3_tmp ;end if;end if;end process;P4: process(clk) begin if clk'event and clk='1' then if cnt1M<999 then cnt1M<=cnt1M+1; elsecnt1M<=0; clk4_tmp<=not clk4_tmp ;end if;end if;end process;clk1<=clk1_tmp;clk100<=clk2_tmp;clk1000<=clk3_tmp;clk1M<=clk4_tmp;end;2、走时、调时模块(1) 秒走时模块use ieee.std_logic_1164.all; library ieee;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity scnt60 is -秒计时,调时,60进制。port (clk,en:in std_logic; cq : out std_logic_vector(7 downto 0); -3-0 个位 7-4 十位 两位输出 cout:out std_logic); -进位end entity scnt60;architecture behv of scnt60 issignalc1,c2 : std_logic_vector (3 downto 0):= (others=>'0'); begin process(clk) begin if clk'event and clk='1' then if en ='0' then if c1<9 then c1<=c1+1; else c1<=(others=>'0'); if c2<5 then c2<=c2+1; else c2<=(others=>'0'); end if; end if; end if; end if; if c1=9 and c2=5 then cout <='1'-进位 else cout <='0' end if; cq(3 downto 0)<=c1; cq(7 downto 4)<=c2; end process;end architecture;(2)分走时、调时library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity mscnt60 is -分计时,调时,60进制。port (clkin,en,adjust1,add:in std_logic; cq : out std_logic_vector(7 downto 0) -3-0 个位 7-4 十位 两位输出 cout:out std_logic); -进位end entity mscnt60;architecture behv of mscnt60 issignalc1,c2 : std_logic_vector (3 downto 0):= (others=>'0');signal clk:std_logic; begin p1:process(en) -选择计时或调时信号 begin if en='1' then clk<=(add and adjust1); else clk<=clkin; end if; end process; p2: process(clk) begin if clk'event and clk='1' then -简单计数器 if c1<9 then c1<=c1+1; else c1<=(others=>'0'); if c2<5 then c2<=c2+1; else c2<=(others=>'0'); end if; end if; end if; if c1=9 and c2=5 then cout <='1'-进位 else cout <='0' end if; cq(3 downto 0)<=c1; cq(7 downto 4)<=c2; end process;end architecture;(3)时走时、调时library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity hcnt24 is -时计时 24进制port (clkin,en,adjust2,add:in std_logic; cq : out std_logic_vector(7 downto 0); -0-3是个位,4-7是十位 end entity hcnt24 ;architecture behv of hcnt24 issignalc1,c2 : std_logic_vector (3 downto 0):= (others=>'0');signal clk:std_logic; begin p1:process(en) -选择计时与调时信号 begin if en='1' then clk<=(add and adjust2); else clk<=clkin; end if; end process; p2: process(clk) -简单计数器 begin if clk'event and clk='1' then if c1<9 and c2<2 then c1<=c1+1; elsif c1=9 and c2<2 then c2<=c2+1;c1<="0000" elsif c2=2 and c1<3 then c1<=c1+1; else c1<="0000"c2<="0000" end if; end if; cq(3 downto 0)<=c1; cq(7 downto 4)<=c2; end process;end architecture;(4)控制时、分位切换程序 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity adjust is -控制时位与分位 port (choice:in std_logic; adjust1:out std_logic; adjust2:out std_logic); end entity; architecture one of adjust is signal sel: std_logic_vector(1 downto 0); begin p1: process(choice) begin if choice'event and choice='1' then - 位选信号 if sel<1 then sel<=sel+1; else sel<="00" end if; end if; end process; p2:process(sel,choice) -切换时位与分位 begin case sel is when "00" => adjust1<='1'adjust2<='0' when "01" => adjust2<='1'adjust1<='0' when others=>adjust2<='0'adjust1<='0' end case ; end process; end one ; (5)例化语句library ieee;use ieee.std_logic_1164.all; entity lihua is - 走时与调时例化 port (select1 :in std_logic; -键4 clk,add, en :in std_logic; - add键7 mput,sput,hput:out std_logic_vector(7 downto 0) ); end lihua; architecture one of lihua is component scnt60 port (clk,en:in std_logic; cq : out std_logic_vector(7 downto 0); cout:out std_logic); end component; component mscnt60 port (clkin,en,adjust1,add:in std_logic; cq : out std_logic_vector(7 downto 0); cout:out std_logic); end component; component hcnt24 is port (clkin,en,adjust2,add:in std_logic; cq : out std_logic_vector(7 downto 0); end component ; component adjust is port (choice:in std_logic; adjust1:out std_logic; adjust2:out std_logic); end component; signal a,b,c,d,e:std_logic; begin u0: scnt60 port map(clk=>clk,en=>en,cq=>sput,cout=>a); u1: mscnt60 port map(clkin =>a,en=>en,add=>add,adjust1=>c,cq=>mput,cout=>b); u2: hcnt24 port map (clkin=>b,en=>en,add=>add,adjust2=>d,cq=>hput); u3: adjust port map (choice=>select1,adjust1=>c,adjust2=>d);end one;end one ; 3、闹钟模块(1)闹钟选时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;-闹钟选时entity xuanshi is port (add,select2,en:in std_logic; -select2选位 m_clk,h_clk,s_clk:out std_logic_vector(7 downto 0); end xuanshi; architecture one of xuanshi is signal mc1,mc2,hc1,hc2:std_logic_vector(3 downto 0); signal xuanwei :integer range 0 to 1; begin p1: process(add) begin if en='1' then if add'event and add='1' then -分位 if xuanwei=0 then if mc1<9 then mc1<=mc1+1; else mc1<="0000" if mc2<5 then mc2<=mc2+1; else mc2<="0000" end if; end if; elsif xuanwei=1 then -时位 if hc1<9 and hc2<2 then hc1<=hc1+1; elsif hc1=9 and hc2<2 then hc2<=hc2+1 ;hc1<="0000" elsif hc1<3 and hc2=2 then hc1<=hc1+1;hc2<="0000" else hc1<="0000"hc2<="0000" end if; end if; end if; end if; s_clk<="00000000" -调闹钟时,秒输出为零 m_clk(3 downto 0)<=mc1; m_clk(7 downto 4)<=mc2; h_clk(7 downto 4)<=hc2; h_clk(3 downto 0)<=hc1; end process; p2: process(select2) begin if select2'event and select2='1' then if xuanwei <1 then xuanwei <=xuanwei+1; else xuanwei<=0; end if; end if; end process; end architecture;(2)闹钟定时比较器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity dingshi is -闹钟定时响 port(h_clk,h_ala,m_ala,m_clk:in std_logic_vector(7 downto 0); clk:in std_logic; -1000hz,用于检测记时 al_out:out std_logic); -使蜂鸣器响的时钟end entity;architecture one of dingshi issignal a:std_logic_vector(7 downto 0 );signal b:std_logic;begin process(h_clk,h_ala,m_clk,m_ala,clk) begin if clk'event and clk='1' then if h_clk=h_ala and m_clk=m_ala then - 循环自减以实现输出时钟信号 a<="11111111" ; end if; if a>"00000000" then a<=a-1; b <=not b; if b='1'then al_out<='1' else al_out<='0' end if; end if ; end if; end process;end one;4、秒表模块(1)百分之一秒走时library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity run_s is -跑百分之一秒 port(clk,rst,en:in std_logic; m_out : out std_logic_vector(7 downto 0); ms_jw:out std_logic); end entity; architecture one of run_s is signal ms_c1,ms_c2 :std_logic_vector(3 downto 0); begin process(rst,clk) begin if rst='1' then ms_c1<="0000"ms_c2<="0000" -清零 elsif en='1' then if clk'event and clk='1' then if ms_c1<9 then ms_c1<=ms_c1+1; else ms_c1<=(others=>'0'); if ms_c2<9 then ms_c2<=ms_c2+1; else ms_c2<=(others=>'0'); end if ; end if; end if ; end if; if ms_c1=9 and ms_c2=9 then ms_jw <='1'-进位 else ms_jw <='0' end if; m_out(7 downto 4)<=ms_c2; m_out (3 downto 0)<=ms_c1; end process; end one ;(2)秒走时 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity run_ss is -跑秒 port (clk,rst,en:in std_logic; s_out :out std_logic_vector(7 downto 0); s_jw:out std_logic); -进位 end entity; architecture one of run_ss is signal s_c1,s_c2:std_logic_vector(3 downto 0); begin process(clk) begin if rst='1' then s_c1<="0000"s_c2<="0000" -清零 elsif en='1' then if clk'event and clk='1' then if s_c1<9 then s_c1<=s_c1+1; else s_c1<=(others=>'0'); if s_c2<5 then s_c2<=s_c2+1; else s_c2<=(others=>'0'); end if; end if; end if; end if; if s_c1=9 and s_c2=5 then s_jw <='1'-进位 else s_jw <='0' end if; s_out(3 downto 0)<=s_c1 ; s_out(7 downto 4 )<=s_c2; end process; end architecture; (3)分走时library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity run_m is -跑分 port (clk,rst,en:in std_logic; s_out :out std_logic_vector(7 downto 0); end entity; architecture one of run_m is signal s_c1,s_c2:std_logic_vector(3 downto 0); begin process(clk) begin if rst='1' then s_c1<="0000"s_c2<="0000" -清零 elsif en ='1' then if clk'event and clk='1' then

    注意事项

    本文(电子设计自动化EDA课程设计电子钟设计.doc)为本站会员(laozhun)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开