当前位置:文档之家› EDA数字钟设计-毕业论文

EDA数字钟设计-毕业论文

EDA数字钟设计目录1.设计思路 (3)1.1总体结构 (3)2.方案论证与选择 (3)2.1.数字钟方案论证与选择 (3)3.单元模块设计部分 (3)6模块的设计 (3)3.2.SEL61模块的设计 (4)3.3.DISP模块的设计 (5)3.4.K4模块的设计 (6)T10模块的设计 (6)T6模块的设计 (7)T101模块的设计 (8)T61模块的设计 (9)3.4.5 CNT23模块的设计 (10)4.系统仿真 (11)4.1.数字钟仿真图 (11)4.2.数字钟编译报告 (12)4.3.数字钟原理图 (12)vEDA数字钟设计中文摘要:数字钟学习的目的是掌握各类计数器及它们相连的设计方法;掌握多个数码管显示的原理与方法;掌握FPGA技术的层次化设计方法;掌握用VHDL语言的设计思想以及整个数字系统的设计。

此数字钟具有时,分,秒计数显示功能,以24小时为计数循环;能实现清零,调节小时,分钟以及整点报时的功能。

关键词:数字钟,计数器,数码管,FPGA,VHDL1.设计思路基于VHDL语言,用Top_Down的思想进行设计。

1.1 确定总体结构,如图1-1所示。

图1-12. 方案论证与选择2.1 数字钟方案论证与选择:方案一是用CN6无进位六进制计数器选择数码管的亮灭以及对应的数,循环扫描显示,用SEL61六选一选择器选择给定的信号输出对应的数送到七段码译码器。

K4模块进行复位,设置小时和分,输出整点报时信号和时,分,秒信号。

作品中选方案二。

方案二也采用自顶向下的设计方法,它由秒计数模块,分计数模块,小时计数模块,报警模块,秒分时设置模块和译码模块六部分组成。

两者设计方式,功能实现方面都差不多,作品中选择的是方案一。

3. 单元模块设计部分单元模块设计部分分四个部分,介绍数字钟选择显示数码管和对应的数模块CN6,信号选择模块SEL61,七段码译码器模块DISP和复位,秒,分,时显示,设置模块。

3.1 CN6模块的设计即无进位的六进制计数器,由此提供选择信号,可提供选择信号,选择显示的数码管及对应的数,循环扫描显示。

如图1-2图1-2library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cn6 isport(res,clk : in std_logic;cout : out std_logic_vector(2 downto 0)); end cn6;architecture rtl of cn6 issignal q : std_logic_vector(2 downto 0); beginprocess(res,clk)beginif res='0' thenq<="000";elsif(clk'event and clk='1') thenif(q=5) thenq<="000";elseq<=q+1;end if;end if;end process;cout<=q;end rtl;3.2 SEL61模块的设计即六选一选择器,如图1-3所示,对于给定的信号,输出对应的数,送到七段码译码器。

图1-3library ieee;use ieee.std_logic_1164.all;entity sel61 isport(sel : in std_logic_vector(2 downto 0);a,b,c,d,e,f : in std_logic_vector(3 downto 0);q : out std_logic_vector(3 downto 0));end;architecture rtl of sel61 isbeginprocess(a,b,c,d,e,f,sel)variable cout : std_logic_vector(3 downto 0);begincase sel iswhen "000"=>cout:=a;when "001"=>cout:=b;when "010"=>cout:=c;when "011"=>cout:=d;when "100"=>cout:=e;when others=>cout:=f;end case;q <=cout;end process;end rtl;3.3 DISP模块的设计即七段译码器,如图1-4所示,对于输入的4位BCD码进行译码,输出7位,Q0~Q6分别外接数码管a~g段显示。

图1-4library ieee;use ieee.std_logic_1164.all;entity disp isport(d : in std_logic_vector(3 downto 0);q : out std_logic_vector(6 downto 0));end;architecture one of disp isbeginprocess(d)begincase d iswhen "0000"=>q<="0111111";when "0001"=>q<="0000110";when "0010"=>q<="1011011";when "0011"=>q<="1001111";when "0100"=>q<="1100110";when "0101"=>q<="1101101";when"0110"=>q<="1111101";when "0111"=>q<="0100111";when"1000"=>q<="1111111";when"1001"=>q<="1101111";when others=>q<="0000000";end case;end process;end one;3.4 K4模块的设计图1-5如图1-5,RES是整个系统的复位键,低电平有效,复位时,各个输出都为零,时间显示0时0分0秒;clk是输入时钟,提供秒信号,上升沿触发,每出发一次,时间增加一秒;HRTMP,MIN10TMP,MINTMPKEYI可以分别设置小时位,10分位,分位,起到调时的作用,高电平有效,有效时,每来一个CLK时钟(1s),所对应的位都将以各自的计数循环;RING是整点报时;SEC,SEC10,MIN,MIN10,HR,HR10都输出四位BCD码,用于计数。

3.4.1 CNT10模块设计10进制计数器。

CLK为秒信号;RES是复位信号,与CLK同步;EN为选通信号;COUT3..0]输出秒个位;CA是进位信号。

如图1-6所示。

图1-6library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt10 isport(en,res,clk: in std_logic;ca : out std_logic;cout : out std_logic_vector(3 downto 0)); end;architecture rtl of cnt10 issignal q : std_logic_vector(3 downto 0);beginp1 : process(en,clk,res)beginif(clk'event and clk='1') thenif(res='0') thenq<="0000";elsif(en='1') thenif(q=9) thenq<="0000";elseq<=q+1;end if;end if;end if;end process p1;p2 : process(q)beginif(q=9) thenca<=en;elseca<='0';end if;end process p2;cout<=q;end rtl;3.4.2 CNT6模块设计即进制计数器,CLK为秒信号;RES为复位信号,与CLK同步;EN为选通信号;COUT[3..0]输出秒的十位;CA是进位信号。

如图1-7所示。

图1-7library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt6 isport(en,res,clk: in std_logic;ca : out std_logic;cout : out std_logic_vector(3 downto 0));end;architecture rtl of cnt6 issignal q : std_logic_vector(3 downto 0);beginp1 : process(en,clk,res)beginif(clk'event and clk='1') thenif(res='0') thenq<="0000";elsif(en='1') thenif(q=5) thenq<="0000";elseq<=q+1;end if;end if;end if;end process p1;p2 : process(q)beginif(q=5) thenca<=en;elseca<='0';end if;end process p2;cout<=q;end rtl;3.4.3 CNT101模块设计即十进制计数器,输出分的个位。

EN接CNT6的进位CA,产生正常的时钟;EN2由外部断口控制,可用来调节时间,高电平有效,输出将以秒的速度递增循环。

相关主题