



下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、1、要求:設(shè)計一個四位二進(jìn)制計數(shù)器,將計數(shù)結(jié)果由數(shù)碼管顯示,顯示結(jié)果為十進(jìn)制數(shù)。數(shù)碼管選通為低電平有效,段碼為高電平有效。分析:VHDL 描述包含五部分:計數(shù)器、將四位二進(jìn)制數(shù)拆分成十進(jìn)制數(shù)的個位和十位、二選一的數(shù)據(jù)選擇器、七段譯碼、數(shù)碼管選通控制信號 線定義為信號library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter3 is Port ( clk:in STD_LOGIC; clk1 : in STD_LOG
2、IC; clr : in STD_LOGIC; en : in STD_LOGIC; co : out STD_LOGIC; scanout:out std_logic_vector(1 downto 0; ledout:out std_logic_vector(6 downto 0; end counter3; architecture Behavioral of counter3 is signal cnt:std_logic_vector(3 downto 0; signal cnt1:std_logic_vector(3 downto 0; signal cnt2:std_logic_
3、vector(3 downto 0; signal hex:std_logic_vector(3 downto 0; signal scan:std_logic_vector(1 downto 0;enclrsignal led:std_logic_vector(6 downto 0; begin -四位二進(jìn)制計數(shù)器 process(clk begin if clkevent and clk=1 then if clr=1 then cnt0; co=0; elsif en=1 then if cnt=1111 then cnt=0000; co=1; else cnt=cnt+1; co=0
4、; end if; end if; end if; end process; -將二進(jìn)制數(shù)拆分成十進(jìn)制數(shù)的個位和十位 cnt1=cnt when cnt=1001 else cnt-1010; cnt2=0000 when cnt=1001 else 0001; -七段數(shù)碼管選通控制信號產(chǎn)生 process(clk1,clr begin if clr=1 then scan=10 then scan=01; else scan=scan+1;end if;end if;end process; scanout=scan; -二選一數(shù)據(jù)選擇器with scan select hex=cnt1 w
5、hen 01, cnt2 when others;ledout=not led; -七段譯碼with hex select led=1111001 when 0001, 0100100 when 0010,0110000 when 0011,0011001 when 0100,0010010 when 0101,0000010 when 0110,1111000 when 0111, 0000000 when 1000,0010000 when 1001, 0001000 when 1010,0000011 when 1011,1000110 when 1100,0100001 when 11
6、01, 0000110 when 1110,0001110 when 1111,1000000 when others;end Behavioral; 2、八位二進(jìn)制計數(shù)器結(jié)果有兩位七段數(shù)碼管顯示 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; - Uncomment the following library declaration ifinstantiating - any Xilinx primitives in this c
7、ode. -library UNISIM; -use UNISIM.VComponents.all; entity counter8 isPort ( clk:in std_logic; clk1 : in STD_LOGIC;clr : in STD_LOGIC; en : in STD_LOGIC; co : out STD_LOGIC;scanout:out std_logic_vector(1 downto 0; ledout : out STD_LOGIC_VECTOR (6 downto 0; end counter8; architecture Behavioral of cou
8、nter8 is signal cnt:std_logic_vector(7 downto 0; signal hex:std_logic_vector(3 downto 0; signal scan:std_logic_vector(1 downto 0; signal led:std_logic_vector(6 downto 0; begin process(clk begin if clkevent and clk=1 thenif clr=1 thencnt0; co=0;elsif en=1 thenif cnt=11111111 then cnt=00000000;co=1;el
9、secnt=cnt+1;co=0;end if; end if;end if; end process; process(clk1,clr begin if clr=1 then scan=10 then scan=01; else scan=scan+1; end if; end if; end process; scanout=scan; with scan select hex=cnt(3 downto 0 when 01, cnt(7 downto 4 when others; ledout=not led; with hex select led=1111001 when 0001, 0100100 when 0010, 0110000 when 0011, 0011001 when 0100, 0010010 when 0101, 0000010 when 0110, 1111000 when 0111, 0000000 when 1000, 0010000 when 1001,
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學(xué)年吉林省白山長白縣聯(lián)考七上數(shù)學(xué)期末質(zhì)量檢測模擬試題含解析
- 別墅門樓改建方案(3篇)
- 林業(yè)局扶貧幫扶活動方案
- 機關(guān)移風(fēng)易俗活動方案
- 朝陽公園七一活動方案
- 員工持股激勵方案(3篇)
- 幼兒心理健康:我高興我快樂
- 木梳體驗活動方案
- 安全用火主題班會
- 健康飲食書籍分享指南
- 《飛機電子顯示器顯示符號》
- 國開大學(xué)2023年01月11282《社會學(xué)概論(本)》期末考試答案
- 頭等大事:脫發(fā)青年自救指南
- 中特第五講社會建設(shè)天津大學(xué)
- 密封條范文模板(A4打印版)
- 施工現(xiàn)場安全交底15篇
- 高處作業(yè)審批表
- 急救醫(yī)學(xué)模擬中心建設(shè)方案
- 三維激光掃描技術(shù)與應(yīng)用實例-PPT課件
- 農(nóng)用地評價方法
- (新知杯)2017-2011上海市初中數(shù)學(xué)競賽試卷
評論
0/150
提交評論