




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、EDA設計實驗報告學校:鄭州大學專業:測控技術與儀器班級:一班姓名:史占東輔導老師:郭敏一、設計要求:(1)、能夠顯示年、月、日、時、分、秒、星期;并具有閏年判斷補償功能;(2)、具有整點報時及定時功能;二、實用方法:設計中用到了6個按鍵,在模式5下,K1,K2,K3,K4,ZHENG,NAO;其中K1用于切換顯示模式,剛開始時顯示時間,按兩次K1顯示定時時間,再按兩次K1顯示日期,再按兩次重新顯示時間;K2用于控制中間信號W,每按下兩下中間信號加一,加至8時清零,W=1時,每按兩下K3鍵分鐘加一;W=2時,每按兩下K3鍵小時加一;W=3時,每按兩下K3鍵星期加一;W=4時,每按兩下K3鍵日期
2、加一;W=5時,每按兩下K3鍵月份加一;W=6時,每按兩下K3鍵年低兩位加一;W=7時,每按兩下K3鍵年高兩位加一;W=8時,當K4=0時,每按兩下K3鍵定時分鐘加一;當K4=1時,每按兩下K3鍵定時小時加一;按鍵ZHENG為整點報時的使能端;按鍵NAO為定時鬧鐘的使能端。 三、程序及仿真:(1)24進制計數器程序及仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt24 isport(clk:in std_logic;q1,q2:out std_logic_vecto
3、r(3 downto 0);cout:out std_logic);end cnt24;architecture one of cnt24 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;if q22=2 and q11=3 then q22=0000;q11=0000;cout=1;else cout=0;end if;end if;end process;q1
4、=q11;q2=q22;end;(2)60進制計數器程序及仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);cout:out std_logic);end cnt60;architecture one of cnt60 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(c
5、lk)beginif clkevent and clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;if q22=5 and q11=9 then q22=0000;q11=0000;cout=1;else cout=0;end if;end if;end process;q1=q11;q2=q22;end;(3)天計數器程序及仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity day isport(clk,s1,
6、s2:in std_logic;d1,d2:out std_logic_vector(3 downto 0);cout:out std_logic);end day;architecture one of day issignal q11,q22:std_logic_vector(3 downto 0);signal s1s2:std_logic_vector(1 downto 0);beginprocess(clk,s1,s2)beginif clkevent and clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;s1s2i
7、f q22=3 and q11=1 then q22=0000;q11=0001;cout=1;else coutif q22=3 and q11=0 then q22=0000;q11=0001;cout=1;else coutif q22=2 and q11=8 then q22=0000;q11=0001;cout=1;else coutif q22=2 and q11=9 then q22=0000;q11=0001;cout=1;else coutnull;end case;end if;end process;d1=q11;d2=q22;end;(4)月計數器程序及仿真圖如下:li
8、brary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity month isport(clk,run:in std_logic;m1,m2:out std_logic_vector(3 downto 0);a,b,cout:out std_logic);end month;architecture one of month issignal q1,q2:std_logic_vector(3 downto 0);signal q2q1:std_logic_vector(7 downto 0);begi
9、nprocess(clk)beginif clkevent and clk=1 thenq1=q1+1;if q1=9 then q10);q2=q2+1;end if;if q2=1 and q1=2 then q2=0000;q1=0001;cout=1;else cout=0;end if;end if;q2q1a=0;bif run=1 then a=1;b=1;else a=1;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;bnull;end case;end process;m1=q1;m2=q2;end;(5)年低兩位計數器程
10、序及仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity year isport(clk:in std_logic;y1,y2:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year;architecture one of year issignal q1,q2,q3:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and c
11、lk=1 thenq1=q1+1;if q1=9 then q10);q2=q2+1;end if;if q2=9 and q1=9 then q2=0000;q1=0000;cout=1;else cout=0;end if;end if;end process;process(clk)beginif clkevent and clk=1 thenq3=q3+1;if q3=3 then q30);run=1;else run =0;end if;end if;y1=q1;y2=q2;end process;end;(6)年高兩位計數器程序及仿真圖如下:library ieee;use ie
12、ee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity year1 isport(clk:in std_logic;y3,y4:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year1;architecture one of year1 issignal q1,q2:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq1=q1+1;if q1=9 th
13、en q10);q2=q2+1;end if;if q2=9 and q1=9 then q2=0000;q1=0000;cout=1;else cout=0;end if;end if;end process;process(q1)beginif q1(1 downto 0)/=00 thenrun=1;else run =0;end if;y3=q1;y4=q2;end process;end;(7)星期計數器程序及仿真圖如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cn
14、t7 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);end cnt7;architecture one of cnt7 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq11=q11+1;if q11=7 then q11=0001;end if;end if;q22=0000;end process;q1=q11;q2=q22;end;(8)調節時間及實現定時程序如下:lib
15、rary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tiaoshi isport(sout,fout,hout,dout,mout,yout0:in std_logic;k2,k3:in std_logic;fin,hin,din,min,yin0,yin1,dingshi,win:out std_logic;q:out std_logic_vector(3 downto 0);end tiaoshi;architecture one of tiaoshi issignal w:std_log
16、ic_vector(3 downto 0);beginprocess(k2,k3)beginif k2event and k2=1 then w=w+1;if w=8 then wfin=sout;hin=fout;din=hout;min=dout;yin0=mout;yin1=yout0;dingshi=0;win=hout; qfin=k3;hin=0;din=0;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=k3;din=0;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;
17、min=0;yin0=0;yin1=0;dingshi=0;win=k3; qfin=0;hin=0;din=k3;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=k3;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=k3;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=0;yin1=k3;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=0;yi
18、n1=0;dingshi=k3; qnull;end case;end process;end;(9)切換顯示狀態程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity control isport(fld,fhd,hld,hhd,sl,sh,fl,fh,hl,hh,dl,dh,ml,mh,yl,yh,yl1,yh1,wl,wh:in std_logic_vector(3 downto 0);k1:in std_logic;q1,q2,q3,q4,q5,q6,q7,q8:out s
19、td_logic_vector(3 downto 0);l1:out std_logic_vector(3 downto 0);end control;architecture one of control issignal w:std_logic_vector(1 downto 0);beginprocess(k1)begin if k1event and k1=1 then w=w+1;if w=2 then wq8=yh1;q7=yl1;q6=yh;q5=yl;q4=mh;q3=ml;q2=dh;q1=dl;l1q8=wh;q7=wl;q6=hh;q5=hl;q4=fh;q3=fl;q2=sh;q1=sl;l1q8=0000;q7=0000;q6=0000;q5=0000;q4=hhd;q3=hld;q2=fhd;q1=fld;l1null;end case;end process;end;(10)鬧鐘控制程序如下:library ieee;use ieee.std_l
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- GB/Z 45388.1-2025工業過程測量、控制和自動化第1部分:工業設施和智能電網之間的系統接口
- 天然氣輸配過程中能耗降低技術考核試卷
- 橡膠制品的供應鏈管理與協同創新考核試卷
- 綠色農業與食品安全考核試卷
- 寶石的結晶學與晶體生長研究進展評價考核試卷
- 禮儀用品企業環境管理體系考核試卷
- 遼寧省葫蘆島市六校聯考2025屆普通高中畢業班教學質量監測物理試題含解析
- 昆山杜克大學《學校體育學A》2023-2024學年第一學期期末試卷
- 永州市冷水灘區2025屆三年級數學第二學期期末統考模擬試題含解析
- 山東醫學高等專科學校《數學規劃》2023-2024學年第一學期期末試卷
- 山東省高中名校2025屆高三4月校際聯合檢測大聯考生物試題及答案
- 2025年武漢數學四調試題及答案
- 【MOOC】數學建模精講-西南交通大學 中國大學慕課MOOC答案
- 職業病防護設施與個體防護用品的使用和維護
- 2024年全國高中數學聯賽北京賽區預賽一試試題(解析版)
- 綠化養護服務投標方案(技術標)
- 中國紡織文化智慧樹知到期末考試答案2024年
- (正式版)HGT 6313-2024 化工園區智慧化評價導則
- GB/T 3091-2015低壓流體輸送用焊接鋼管
- 實際控制人股東會決議
- 混凝土攪拌機設計論文
評論
0/150
提交評論