EDA數(shù)字時(shí)鐘設(shè)計(jì)_第1頁(yè)
EDA數(shù)字時(shí)鐘設(shè)計(jì)_第2頁(yè)
EDA數(shù)字時(shí)鐘設(shè)計(jì)_第3頁(yè)
EDA數(shù)字時(shí)鐘設(shè)計(jì)_第4頁(yè)
EDA數(shù)字時(shí)鐘設(shè)計(jì)_第5頁(yè)
已閱讀5頁(yè),還剩3頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、Quartus數(shù)字時(shí)鐘設(shè)計(jì) 1. 設(shè)計(jì)功能1. 可以快速設(shè)置時(shí)鐘起始值;2. 在59分50秒時(shí)開始報(bào)時(shí),七聲低音,一聲高音,報(bào)完剛好整點(diǎn)。二.功能實(shí)現(xiàn)1.頂層設(shè)計(jì)(采用BDF文件圖形設(shè)計(jì),文件名:timer.bdf)2. 秒計(jì)時(shí)器模塊設(shè)計(jì)library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity second1 isport(clk1s:in std_logic; reset:in std_logic; sec2,sec1:buffe

2、r std_logic_vector(3 downto 0);-秒的十位和個(gè)位 seco: out std_logic); -秒計(jì)時(shí)器的進(jìn)位輸出end;architecture A of second1 is begin process(clk1s,reset) begin if reset = '0' then sec2 <= "0000" sec1 <= "0000" -清零秒計(jì)時(shí)器 seco <= '0' elsif clk1s'event and clk1s ='1' th

3、en if (sec1 = "1001" and sec2 = "0101") then sec2 <= "0000"sec1 <="0000" -在59秒時(shí)回零 seco <= '1' -進(jìn)位 elsif (sec1 ="1001") then sec1 <="0000" sec2 <= sec2+1; seco <= '0' else sec1 <= sec1+1; seco <= '

4、0' end if; end if;end process;end;3.分計(jì)時(shí)器模塊設(shè)計(jì)library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity minute1 isport(clkm,clk1s,setm:in std_logic; -秒進(jìn)位輸入,1HZ校分時(shí)鐘輸入信號(hào),校分控制信號(hào) min2,min1:buffer std_logic_vector(3 downto 0); -分計(jì)時(shí)器的十位和個(gè)位 minco:out s

5、td_logic);end;architecture A of minute1 is signal clkx:std_logic; begin Pclkm:process(clkm,clk1s,setm) begin -根據(jù)是否校分選擇計(jì)時(shí)時(shí)鐘 if setm ='1' then clkx <= clk1s; -利用clk1s信號(hào)對(duì)分的初值進(jìn)行快速設(shè)置 else clkx <=clkm; -利用秒的進(jìn)位信號(hào)正常計(jì)時(shí) end if;end process;Pcontm:process(clkx) begin if clkx'event and clkx =&#

6、39;1' then if (min1 = "1001" and min2 = "0101") then min1 <="0000"min2 <="0000"minco <='1' -59分時(shí)回零并進(jìn)位 elsif (min1 = "1001") then min1 <="0000"min2 <= min2+1; minco <= '0' else min1 <= min1+1;minco &l

7、t;='0' end if; end if;end process;end;4.時(shí)計(jì)時(shí)器模塊設(shè)計(jì)library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity hour1 is port(clkh,clk1s,seth:in std_logic; hou2,hou1:buffer std_logic_vector(3 downto 0) ); -時(shí)的十位和個(gè)位end;architecture A of hour1 is s

8、ignal clky:std_logic; begin Pclkh:process(clkh,clk1s,seth) Begin -根據(jù)是否校時(shí)選擇計(jì)時(shí)時(shí)鐘 if seth ='1' then clky <=clk1s; -利用clk1s信號(hào)對(duì)時(shí)的初值進(jìn)行快速設(shè)置 else clky <= clkh; -利用分的進(jìn)位信號(hào)正常計(jì)時(shí) end if; end process;Pconth:process(clky) begin if clky'event and clky ='1' then if (hou1="0011" an

9、d hou2 ="0010" ) then hou1 <= "0000"hou2 <= "0000" -23時(shí)回零 elsif (hou1 ="1001") then hou1 <= "0000" hou2 <= hou2+1; else hou1 <= hou1+1; end if; end if;end process;end;5.報(bào)時(shí)模塊設(shè)計(jì)library ieee;use ieee.std_logic_1164.all; use ieee.std_logic

10、_arith.all; use ieee.std_logic_unsigned.all;entity alarm1 is port(clk1s,clk500,clk1k: in std_logic; sec2,sec1,min2,min1: in std_logic_vector(3 downto 0); alarm: out std_logic);end;architecture A of alarm1 is begin process(clk1s) variable flag500:std_logic;variable flag1k:std_logic; begin if clk1s

11、9;event and clk1s = '1' then if(min1 ="1001" and min2="0101" and sec2="0101" ) then -59分50秒時(shí)開始報(bào)時(shí) case sec1 is when "0000" => flag500:='1' when "0010" => flag500:='1' when "0100" => flag500:='1' when

12、"0110" => flag500:='1' when "0111" => flag500:='1' when "1000" => flag500:='1' when "1001" => flag500:='1' -50,52,54,56,58,59秒時(shí)低頻率報(bào)時(shí) when others => flag500:='0'flag1k:='0' end case; else flag500:=&

13、#39;0'flag1k:='0' end if; if (min1 ="0000" and min2="0000" and sec1="0000" and sec2="0000") then flag1k:='1' -整點(diǎn)時(shí)高頻率報(bào)時(shí) end if; end if;if flag500='1' then alarm <=clk500; elsif flag1k='1' then alarm <=clk1k; else alarm <='0'end

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論