




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、library ieee; -分頻電路entity fen isport(clk:in std_logic;clk1:out std_logic; -實體端口聲明end fen;architecture fen_arc of fen is -結(jié)構(gòu)體描述開始beginprocess(clk -進程開始variable cnt:integer range 0 to 99;beginif clk'event and clk='1' then -高電平到if cnt=99 thencnt:=0; -0開始計數(shù)clk1<='1' -輸出高電平elsecnt:
2、=cnt+1; -加計數(shù)clk1<='0' -輸出低電平end if;end if;end process; -進程描述結(jié)束end fen_arc; -結(jié)構(gòu)體描述結(jié)束-A路控制library ieee;entity Alu isport(clk:in std_logic;ar,ag,al,ay:out std_logic; -紅、綠、黃、左轉(zhuǎn)timas,timag:out std_logic_vector(3 downto 0; -十位、個位計數(shù)end Alu;architecture alu_arc of Alu istype rgly is(red,green,lef
3、t,yellow; -燈亮順序為紅、綠、左轉(zhuǎn)、黃beginprocess(clkvariable a:std_logic; -變量聲明variable ts,tg:std_logic_vector(3 downto 0;variable state:rgly;beginif clk'event and clk='1' then -高電平case state iswhen green=>if a='0' then -綠燈狀態(tài)ts:="0010" -十位計2tg:="0100" -個位計4a:='1
4、9;ag<='0'ar<='1'elseif not(ts="0000" and tg="0001" then -若計數(shù)值不為1if tg="0000" then -若個位為1tg:="1001" -個位置9ts:=ts-1; -十位自減1 elsetg:=tg-1; -個位自減1 end if;elsets:="0000"tg:="0000"a:='0'state:=left; -轉(zhuǎn)為左轉(zhuǎn)燈狀態(tài)end if;end
5、 if;when left=>if a='0' then -左轉(zhuǎn)燈ts:="0000" -十位置0tg:="1001" -個位置9a:='1'aL<='0'ag<='1'elseif not (ts="0000" and tg="0001"thenif tg="0000" thentg:="1001"ts:=ts-1;elsetg:=tg-1;end if;elsets:="0000&
6、quot;tg:="0000"a:='0'state:=yellow;-轉(zhuǎn)為黃燈狀態(tài)end if;end if;when yellow=>if a='0' then -黃燈狀態(tài)ts:="0000" -十位置0tg:="0100" -個位置9a:='1'ay<='0'aL<='1'elseif not(ts="0000" and tg="0001" thenif tg="0000"
7、 thentg:="1001"ts:=ts-1;elsetg:=tg-1;end if;elsets:="0000"tg:="0000"a:='0'state:=red;end if;end if;when red=>if a='0' then -紅燈狀態(tài)ts:="0011" -十位置3tg:="1001" -個位置9a:='1'ar<='0'ay<='1'elseif not(ts="0
8、000" and tg="0001" thenif tg="0000" thentg:="1001"ts:=ts-1 ;elsetg:=tg-1;end if;elsets:="0000"tg:="0000"a:='0'state:=green;end if;end if;end case;timas<=ts;timag<=tg;end if;end process;end alu_arc;-B路燈控制程序。與A路相似。library ieee;entity
9、 blu isport(clk:in std_logic;br,bg,bl,by:out std_logic;timbs,timbg:out std_logic_vector(3 downto 0;end blu;architecture blu_arc of blu istype rgly is(green,left,yellow,red; -燈亮順序為綠、左轉(zhuǎn)、黃、紅beginprocess(clkvariable a:std_logic;variable ts,tg:std_logic_vector(3 downto 0;variable state:rgly;beginif clk
10、39;event and clk='1' thencase state iswhen green=>if a='0' thents:="0010"tg:="0100"a:='1'bg<='0'br<='1'elseif not(ts="0000" and tg="0001" thenif tg="0000" thentg:="1001"ts:=ts-1;elsetg:=tg-1;
11、end if;elsets:="0000"tg:="0000"a:='0'state:=left;end if;end if;when left=>if a='0' thents:="0000"tg:="1001"a:='1'bL<='0'bg<='1'elseif not (ts="0000" and tg="0001"thenif tg="0000" th
12、entg:="1001"ts:=ts-1;elsetg:=tg-1;end if;elsets:="0000"tg:="0000"a:='0'state:=yellow;end if;end if;when yellow=>if a='0' thents:="0000"tg:="0100"a:='1'by<='0'bL<='1'elseif not(ts="0000" and t
13、g="0001" then if tg="0000" thentg:="1001"ts:=ts-1;elsetg:=tg-1;end if;q:out std_logic_vector(6 downto 0; end dispa; architecture xuan_arc of dispa is signal d:std_logic_vector(3 downto 0; signal sel:std_logic_vector(2 downto 0; begin pi:process(clk variable tmp:std_logi
14、c_vector(2 downto 0; begin if clk'event and clk='1' then if tmp="000"then tmp:="001" elsif tmp="001" then tmp:="100" elsif tmp="100" then tmp:="101" elsif tmp="101" then tmp:="000" end if; end if; sel<=tmp
15、; end process pi; po:process(sel begin case sel is when "000"=>z<="1110"d<=d0; -B 路個位計數(shù) when "001"=>z<="1101"d<=d1; -B 路十位計數(shù) when "100"=>z<="1011"d<=d2; -A 路個位計數(shù) when others=>z<="0111"d<=d3; -A
16、路十位計數(shù) end case; end process po; p1:process(d begin case d is when "0000" =>q<="1000000" when "0001" =>q<="1111001" when "0010" =>q<="0100100" when "0011" =>q<="0110000" when "0100" =>q<="0011001"
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年醫(yī)藥市場未來趨勢預測:仿制藥一致性評價下的產(chǎn)業(yè)發(fā)展報告
- 2025至2030麻布手提袋行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 鄧州小升初的數(shù)學試卷
- 福建南平中考數(shù)學試卷
- 2025至2030中國產(chǎn)科手術(shù)器械行業(yè)產(chǎn)業(yè)運行態(tài)勢及投資規(guī)劃深度研究報告
- 2025年食品行業(yè)食品安全追溯體系在食品安全追溯系統(tǒng)開發(fā)中的應用報告
- 2025至2030全球及中國脫鹽和緩沖液交換行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 腫瘤醫(yī)療服務市場動態(tài)報告:2025年精準治療技術(shù)引領(lǐng)市場規(guī)模增長
- 2025至2030中國吹制模行業(yè)產(chǎn)業(yè)運行態(tài)勢及投資規(guī)劃深度研究報告
- 中心城區(qū)排水防澇整治項目投資計劃書
- EPC總承包項目中的進度控制與資源分配
- 最全看圖猜成語 課件
- 腫瘤中心建設(shè)計劃書
- 快題設(shè)計課件
- 工程居間保密協(xié)議
- 成都市2021級(2024屆)高中畢業(yè)班第一次診斷性檢測(一診)英語試卷(含答案)
- 多鐵性材料應用
- 住院病歷點評匯總表
- 摩登家庭第一季臺詞中英對照
- 社會經(jīng)濟咨詢服務合同范本
評論
0/150
提交評論