



下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、1、要求:設(shè)計(jì)一個(gè)四位二進(jìn)制計(jì)數(shù)器,將計(jì)數(shù)結(jié)果由數(shù)碼管顯示,顯示結(jié)果為十進(jìn)制數(shù)。數(shù)碼管選通為低電平有效,段碼為高電平有效。分析:VHDL 描述包含五部分:計(jì)數(shù)器、將四位二進(jìn)制數(shù)拆分成十進(jìn)制數(shù)的個(gè)位和十位、二選一的數(shù)據(jù)選擇器、七段譯碼、數(shù)碼管選通控制信號(hào) 線定義為信號(hào)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)制計(jì)數(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ù)的個(gè)位和十位 cnt1=cnt when cnt=1001 else cnt-1010; cnt2=0000 when cnt=1001 else 0001; -七段數(shù)碼管選通控制信號(hào)產(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)制計(jì)數(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. 本站所有資源如無(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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 交通事故責(zé)任財(cái)產(chǎn)保全執(zhí)行合同
- 財(cái)產(chǎn)贈(zèng)與與投資合作合同范本
- 采礦權(quán)抵押貸款合同示范文本
- 融資租賃式餐飲店鋪轉(zhuǎn)讓及運(yùn)營(yíng)管理合同
- 兒童身高管理活動(dòng)方案
- 老人護(hù)理課件
- 老人健康養(yǎng)生課件
- 美術(shù)說(shuō)課課件下載
- 美術(shù)畫(huà)圖案課件
- 防火災(zāi)事故應(yīng)急預(yù)案
- 2025年地區(qū)事業(yè)單位招聘公共基礎(chǔ)知識(shí)重點(diǎn)難點(diǎn)突破試題
- 2025變壓器類(lèi)產(chǎn)品型號(hào)注冊(cè)管理
- 推進(jìn)教師跨學(xué)科教學(xué)能力提升方案
- 職業(yè)院校與企業(yè)深度合作2025年校企合作人才培養(yǎng)質(zhì)量提升策略與實(shí)踐報(bào)告
- 2025黨考試題及答案
- 水路運(yùn)輸安全管理培訓(xùn)
- 中國(guó)支付體系行業(yè)市場(chǎng)運(yùn)行現(xiàn)狀及投資規(guī)劃建議報(bào)告
- 醫(yī)院后勤禮儀培訓(xùn)課件
- 《咕咚》課件 小學(xué)語(yǔ)文一年級(jí)下冊(cè)
- 小學(xué)二年級(jí)下冊(cè)豎式計(jì)算題400道
- LS-T8014-2023高標(biāo)準(zhǔn)糧倉(cāng)建設(shè)標(biāo)準(zhǔn)
評(píng)論
0/150
提交評(píng)論