【正文】
use 。(三)各功能模塊設(shè)計(jì)說明及源程序產(chǎn)生1000Hz頻率產(chǎn)生1Hz頻率,定時(shí),鬧鐘,校時(shí)模塊通過裝換不同的狀態(tài),分別實(shí)現(xiàn)計(jì)時(shí),定時(shí),鬧鐘,校時(shí)功能;源程序如下顯示數(shù)碼管,源代碼如下:(四).Modelsim綜合仿真圖四.總結(jié)及體會(huì)通過這次電子設(shè)計(jì)大賽課程設(shè)計(jì),我學(xué)到了很多,對(duì)于原本掌握的不好的數(shù)字邏輯相關(guān)知識(shí),在課程設(shè)計(jì)具體實(shí)踐中有了很深刻的認(rèn)識(shí),在對(duì)于Quartus+Modelsim仿真的操作上也有很大的提高,增加了操作的熟練程度。3)“秒”復(fù)零狀態(tài):在“秒復(fù)零”狀態(tài)下,顯示“分”的數(shù)碼管以1Hz的頻率遞增計(jì)數(shù)。 設(shè)計(jì)精度要求為1S。3. 校時(shí):在set=0,ds=0狀態(tài)下,按下“k鍵”,進(jìn)入“小時(shí)”校準(zhǔn)狀態(tài),之后按下“k鍵”則進(jìn)入“分”校準(zhǔn)狀態(tài),繼續(xù)按下“k鍵”則進(jìn)入“秒校準(zhǔn)”狀態(tài),之后如此循環(huán)。2) 鬧鐘:“分”設(shè)置狀態(tài):在鬧鐘“分”設(shè)置狀態(tài)下,顯示“分”的數(shù)碼管以1Hz的頻率遞增計(jì)數(shù)。故最后還是選擇了VHDL語言的這份。architecture rt3 of frediv_1000 isbegin process(clk) variable count:integer range 0 to 50000。 else clkout = 39。use 。event and clk = 39。 end if。use 。signal sec_ra,min_ra,hour_ra :std_logic_vector(7 downto 0)。 clkout : out std_logic )。039。 min = min_r。else if sel_show(1 downto 0) = 00 thenshizhong sec = sec_r。 process(clk_1Hz) begin if(rising_edge(clk_1Hz))then if(rst=39。cst=39。 chd=39。and ds=39。 end if。039。039。 else if(state=s2)then cht=39。cma=39。csd=39。039。039。039。 end if。 cht=39。cma=39。csd=39。 else if( state=s5)then cht=39。cma=39。csd=39。039。139。039。cmt=39。csa=39。 if(k=39。 end if。039。039。039。039。039。039。cmt=39。csa=39。 if(k=39。039。039。039。 end if。 cha=39。cmd=39。 end if。 min_r = 00000000。 else min_r(7 downto 4) = min_r(7 downto 4) + 1。) then if min_r(3 downto 0) = 0 then min_r(3 downto 0) = 1001。 and cht = 39。 else if (change_2 = 39。 end if。 else sec_r(7 downto 4) = sec_r(7 downto 4) + 1。) then if sec_r(3 downto 0) = 0 then sec_r(3 downto 0) = 1001。 if min_r(3 downto 0) = 9 then min_r(3 downto 0) = 0000。 end if。 else sec_r(3 downto 0) = sec_r(3 downto 0) + 39。 end if。039。) then if min_ra(3 downto 0) = 9 then min_ra(3 downto 0) = 0000。 and cma = 39。 else if (change_1 = 39。 end if。 hour_ra(7 downto 4) = hour_ra(7 downto 4) 1。) then if sec_ra(3 downto 0) = 9 then sec_ra(3 downto 0) = 0000。 and csa = 39。 end if。 end process。 hour_rd = 00000000。 end if。 if min_rd(7 downto 4) = 0 then min_rd(7 downto 4) = 0101。139。039。 end if。 end if。 if sec_rd(7 downto 4) = 0 then sec_rd(7 downto 4) = 0101。 if sec_rd(7 downto 4) = 0 then sec_rd(7 downto 4) = 0101。 else hour_rd(3 downto 0) = hour_rd(3 downto 0) 1。 end if。 end if。139。 and alarm=39。) then fm_1=clk_500Hz。 and min_rd(7 downto 0)=00000000 and hour_r(7 downto 0)=00000000 and sec_rd(7 downto 4)=0 and sec_rd(0)=39。 end if。use 。architecture rt1 of disp issignal min,hour,sec :std_logic_vector(7 downto 0)。 sec,min,hour : out std_logic_vector(7 downto 0))。039。 end if。 then if rst = 39。 fm = fmo。 A = min(3 downto 0)。 A = 1010。0 when 0001 = Y_r = 11111001。8 when 1001 = Y_r = 10010000。 end process。 when 1011 = Y_r = 10111111。2 when 0011 = Y_r = 10110000。 A = 1011。 A = min(7 downto 4)。 Y = Y_r。 then scan_t = 000。 end if。 else if t = 99999 then t := 0。beginU2:adjust port map(rst,clk,k,set,alarm,ds,dsk,change_1,change_2,fmo,sec,min,hour)。signal scan_t :std_logic_vector(2 downto 0)。entity disp isport( rst,clk : in std_logic。 end if。) then fm_1=clk_500Hz。039。 )then fm_1=clk_500Hz。039。 end if。 end if。 end if。 if min_rd(7 downto 4) = 0 then min_rd(7 downto 4) = 0101。 end if。 end if。039。139。 else if(hour_rd(3 downto 0) = 9)then hour_rd(3 downto 0) = 0000。 end if。 end if。039。event and clk_1Hz = 39。 end if。) then if sec_ra(3 downto 0) = 0 then sec_ra(3 downto 0) = 1001。 else sec_ra(7 downto 4) = sec_ra(7 downto 4) + 1。 end if。 else if (change_2 = 39。 and cha = 39。) then if min_ra(3 downto 0) = 0 then min_ra(3 downto 0) = 1001。 else min_ra(7 downto 4) = min_ra(7 downto 4) + 1。 min_ra = 00000000。 end if。 end if。 else min_r(7 downto 4) = min_r(7 downto 4) + 1。 if hour_r(7 downto 4) = 2 then if hour_r(3 downto 0) = 3 then hour_r = 00000000。 else se