基于vhdl语言的数字时钟设计说明书内容摘要:

001) and (count1631 )then count=count+7。 elsif (count1631) then count=count+1。 else count=000001。 dount=dount+1。 end if。 end if。 end process。 monthout=dount。 dateout=count。 end fun。 11 扫描显示模块设计 该模块的作用是将时钟产生的微秒、秒、分、小时、星期和日期信号 以扫描的形式显示输出。 其中一控制信号实现数码管的复用,控制显示微秒、秒、分 、小时或星期、日期。 输入: clk1 为 扫描时钟 , reset 为清零复位键 , ms、 sec、 min、 hour、 month、 date、 week分别为微秒 、 秒 、 分 、 小时 、月、日、星期显示信号, showweek 为控制信号 输出: dp 为 数码管小数点显示 信号 led 为七段数码管显示信号 sel为位选信号 源代码如下: library ieee。 use。 use。 use。 entity seltime is port( clk1,reset,showweek:in std_logic。 ms,sec,min,hour:in std_logic_vector(6 downto 0)。 month:in std_logic_vector(4 downto 0)。 date:in std_logic_vector(5 downto 0)。 week:in std_logic_vector(3 downto 0)。 dp:out std_logic。 led:out std_logic_vector(6 downto 0)。 sel:out std_logic_vector(7 downto 0))。 end entity seltime。 architecture fun of seltime is signal count:std_logic_vector(3 downto 0)。 signal daout:std_logic_vector(3 downto 0)。 signal d:std_logic_vector(4 downto 0)。 begin p1 : process(clk1,reset) begin if(reset=39。 039。 )then count=0000。 elsif(clk139。 event and clk1=39。 139。 ) then if(count1101)then count=0000。 d=countamp。 showweek。 else count=count+1。 d=countamp。 showweek。 end if。 end if。 end process p1。 p2: process(d) begin case d is when00011 =daout=ms(3 downto 0)。 sel=01111111。 dp=39。 139。 when00101=daout(3)=39。 039。 daout(2 downto 0)=ms(6downto4)。 sel=10111111。 dp=39。 139。 when00111 =daout=sec(3 downto 0)。 sel=11111110。 dp=39。 039。 12 when01001=daout(3)=39。 039。 daout(2downto0)=sec(6 downto 4)。 sel=11111101。 dp=39。 139。 when01011 =daout=min(3 downto 0)。 sel=11111011。 dp=39。 039。 when01101=daout(3)=39。 039。 daout(2downto0)=min(6downto 4)。 sel=11110111。 dp=39。 139。 when01111 =daout=hour(3 downto 0)。 sel=11101111。 dp=39。 039。 when10001=daout(3downto2)=00。 daout(1downto0)=hour(5downto4)。 sel=11011111。 dp=39。 139。 when10010 =daout=week。 sel=01111111。 dp=39。 139。 when10100 =daout=date(3 downto 0)。 sel=11111110。 dp=39。 139。 when10110=daout(3downto2)=00。 daout(1downto0)=date(5downto4)。 sel=11111101。 dp=39。 139。 when11000 =daout=month(3 downto 0)。 sel=11111011。 dp=39。 139。 when11010 =daout(3 downto 1)=000。 daout(0)=month(4)。 sel=11110111。 dp=39。 139。 when others=sel=11111111。 end case。 end process p2。 p3: process(daout) begin case daout is when0000=led=0000001。 when0001=led=1001111。 when0010=led=0010010。 when0011=led=0000110。 when0100=led=1001100。 when0101=led=0100100。 when0110=led=0100000。 when0111=led=0001111。 when1000=led=0000000。 when1001=led=0000100。 when others=null。 end case。 end process p3。 end fun。 整点报时模块设计 该模块的作用是 当时钟计数到整点时蜂鸣器 报警,以实现整点报时功能。 输入: clk 计数时钟信号, speaksec 秒输出信号, speakmin 分输出信号 输出:报警信号 源代码如下: library ieee。 use。 use。 entity speaker is port(clk:in std_logic。 speaksec:in std_logic_vector(6 downto 0)。 speakmin:in std_logic_vector(6 downto 0)。 speak:out std_logic)。 end entity speaker。 architecture fun of speaker is begin process(clk,speakmin) begin 13 if(clk 39。 event and clk=39。 139。 )then if(speakmin=0000000 and speaksec=0000000)then speak=39。 139。 else speak=39。 039。 end if。 end if。 end process。 end fun。 五 :附录 顶层文件源代码 : library ieee。 use。 entity clock_top is port(clk_in,reset,setmin,sethour,setweek,setstop,showweek:in std_logic。 dp:out std_logic。 sel:out std_logic_vector(7 downto 0)。 led:out std_logic_vector(6 downto 0)。 speak: out std_logic)。 end clock_top。 architecture a of clock_top is COMPONENT div PORT(clk_in,setstop: in std_logic。 clk_out1,clk_out2: out STD_LOGIC)。 END COMPONENT。 COMPONENT msecond PORT(clk,reset: in std_logic。 daout:out std_logic_vector(6 downto 0)。 ensecond:out std_logic)。 END COMPONENT。 COMPONENT second PORT(clk,setclk,reset,setmin: in std_logic。 daout:out std_logic_vector(6 downto 0)。 enmin:OUT STD_LOGIC)。 END COMPONENT。 COMPONENT minute PORT(clk,setclk,reset,sethour:in std_logic。 enhour:out std_logic。 daout:out std_logic_vector(6 downto 0))。 END COMPONENT。 COMPONENT hour PORT(clk,setclk,reset,setweek:in std_logic。 enweek:out std_logic。 daout:out std_logic_vector(6 downto 0))。 END COMPONENT。 COMPONENT weeker 14 PORT(clk,reset:in std_logic。 weekout:out std_logic_vector(3 downto 0))。 END COMPONENT。 COMPONENT date PORT(clk,reset:in std_logic。 monthout:out std_logic_vector(4 downto 0)。 dateout:out std_logic_vector(5 downto 0))。 END COMPONENT。 COMPONENT seltime port(clk1,reset,showweek:in std_logic。 ms,sec,min,hour:in std_logic_vector(6 downto 0)。 week:in std_logic_vector(3 downto 0)。 month:in std_logic_vector(4 downto 0)。 date:in std_logic_vector(5 downto 0)。 dp:out std_logic。 sel:out std_logic_vector(7 downto 0)。 led:out std_logic_vector(6 downto 0))。 END COMPONENT。 COMPONENT speaker PORT(clk:in std_logic。 speaksec:in std_logic_vector(6 downto 0)。 speakmin:in std_logic_vector(6 downto 0)。 speak:out std_logic)。 END COMPONENT。 signal da0out,dalout,dallout,dalllout:std_logic_vector(6 downto 0)。 signal dallllout:std_logic_vector(3 downto 0)。 signal month0out:std_logic_vector(4 downto 0)。 signal date0out:std_logic_vector(5 downto 0)。 signal ensecond_re,enmin_re,enhour_re,enweek_re,dp_re,clk00,clk01:std_logic。 begin u1:div port map (clk_in=clk_in, setstop=setstop, clk_out1=clk00, clk_ou。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。