![實驗408021301張阿偉_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/5/82f82a00-efc3-4979-b79a-9b87a6f739ca/82f82a00-efc3-4979-b79a-9b87a6f739ca1.gif)
![實驗408021301張阿偉_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/5/82f82a00-efc3-4979-b79a-9b87a6f739ca/82f82a00-efc3-4979-b79a-9b87a6f739ca2.gif)
![實驗408021301張阿偉_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/5/82f82a00-efc3-4979-b79a-9b87a6f739ca/82f82a00-efc3-4979-b79a-9b87a6f739ca3.gif)
![實驗408021301張阿偉_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/5/82f82a00-efc3-4979-b79a-9b87a6f739ca/82f82a00-efc3-4979-b79a-9b87a6f739ca4.gif)
![實驗408021301張阿偉_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/5/82f82a00-efc3-4979-b79a-9b87a6f739ca/82f82a00-efc3-4979-b79a-9b87a6f739ca5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、 基于Quartus II的硬件描述語言電路設(shè)計一、實驗要求 基本要求 1: 由四個數(shù)碼管顯示的計時電路, 低兩位按照 20 進(jìn)制設(shè)計,高兩位按照 11進(jìn)制設(shè)計。附加要求 1: 該計時電路具有校準(zhǔn)功能,可以按 1Hz 頻率校準(zhǔn)高兩位的顯示,可以按 10Hz頻率校準(zhǔn)低兩位的顯示;附加要求 2: 高兩位的進(jìn)制可以任意設(shè)置。(不需要從新編譯電路)附加要求 3:在計數(shù)到達(dá)某整點(diǎn)值時例如 0300 的時刻 (該值可以根據(jù)老師的要求設(shè)置),4盞 LED 燈一起按照 10Hz 閃爍 5 秒鐘。2、 實驗代碼與器件顯示1. 選擇器的VHDL源文件module xuanze(clk0,clk1,choose,c
2、lk);input clk0;input clk1;input choose;output clk;reg clk;always if ( choose = 1'b1 ) beginclk <= clk0;end else if ( choose = 1'b0 ) beginclk <= clk1;endEndmodule生成的器件:選擇器功能描述:選擇1kHz和10kHz其中一個作為輸出信號2. 分頻器的VHDL源文件library ieee;use ieee.std_logic_1164.all;use IEEE.STD_LOGIC_ARITH.ALL;use
3、IEEE.STD_LOGIC_UNSIGNED.ALL;entity fenpin isport(clk:in std_logic;-input clk 50MHzclk_1Hz :out std_logic;clk_10Hz :out std_logic);-輸出clkend fenpin;architecture fwm of fenpin isconstant m:integer:=2500000;signal tmp1:std_logic;signal tmp2:std_logic;beginprocess(clk)variable cout1:integer:=0;variable
4、cout2:integer:=0;beginif clk'event and clk='1' thencout1:=cout1+1;cout2:=cout2+1;if cout1<=m*10 then tmp1<='0'elsif cout1<m*20 then tmp1<='1'else cout1:=0;end if;if cout2<=m then tmp2<='0'elsif cout2<m*2 then tmp2<='1'else cout2:=0;
5、end if;end if;end process;clk_1Hz<=tmp1;clk_10Hz<=tmp2;end fwm;生成的器件:分頻器功能描述:輸入50MHz的時鐘信號,經(jīng)分頻器后輸出頻率為1Hz和10Hz的兩個信號。3. 計數(shù)器的VHDL源文件(2個)LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;entity djishu isport(clk : in std_logic;d1 : out std_logic_vector(3 downto 0);d2 : out st
6、d_logic_vector(3 downto 0);c : out std_logic);END djishu;architecture fwm of djishu issignal dat1:std_logic_vector(3 downto 0);signal dat2:std_logic_vector(3 downto 0);BEGINprocess(clk)begin if clk'event and clk = '1' thenif dat1 = "1001" thendat1 <="0000"if dat2 =
7、 "0001" thendat2 <="0000"c<='1'elsedat2<=dat2+1;c<='0'end if;else dat1<=dat1+1; c<='0'end if;end if;end process;d1 <= dat1;d2 <= dat2;end fwm;生成的器件:低位計數(shù)器功能:將輸出轉(zhuǎn)換為兩位十進(jìn)制數(shù)LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;use ieee.std_logic_arit
8、h.all;USE IEEE.STD_LOGIC_UNSIGNED.ALL;entity gjishu isport(clk : in std_logic;jinzhi : in std_logic_vector(4 downto 0);g1 : out std_logic_vector(3 downto 0);g2 : out std_logic_vector(3 downto 0);END gjishu;architecture fwm of gjishu issignal dat1:std_logic_vector(4 downto 0);signal dat2:std_logic_ve
9、ctor(4 downto 0);signal data1:std_logic_vector(3 downto 0);signal data2:std_logic_vector(3 downto 0);BEGINprocess(jinzhi,clk)variable q1:integer range 0 to 255;variable q2:integer range 0 to 255;variable a:integer range 0 to 255;begin if clk'event and clk = '1' thena := conv_integer(jinz
10、hi);if a = 0 thenif dat1 = "01010" thendat1 <="00000"elsedat1<=dat1+1;end if;q1:=(conv_integer(dat1);q2:=(q1/10);data1 <=conv_std_logic_vector(q1 rem 10,4);data2 <=conv_std_logic_vector(q2 rem 10,4);elseif dat1 = (jinzhi-"00001") thendat1 <="00000&qu
11、ot;elsedat1<=dat1+1;end if;q1:=(conv_integer(dat1);q2:=(q1/10);data1 <=conv_std_logic_vector(q1 rem 10,4);data2 <=conv_std_logic_vector(q2 rem 10,4);end if;end if;end process;g1 <= data1;g2 <= data2;end fwm;生成的器件:高位計數(shù)器功能:將輸出轉(zhuǎn)換為兩位十進(jìn)制數(shù)【十位+個位】4. 譯碼器的VHDL源文件LIBRARY IEEE;USE IEEE.STD_LOGIC
12、_1164.ALL;ENTITY yimaqi ISPORT(data_in:IN STD_LOGIC_VECTOR(3 DOWNTO 0);dis_out:OUT STD_LOGIC_VECTOR(6 DOWNTO 0);END yimaqi;ARCHITECTURE fwm OF yimaqi ISBEGINPROCESS(data_in)BEGINCASE data_in ISWHEN"0000"=>dis_out<="1000000"WHEN"0001"=>dis_out<="1111001&
13、quot;WHEN"0010"=>dis_out<="0100100"WHEN"0011"=>dis_out<="0110000"WHEN"0100"=>dis_out<="0011001"WHEN"0101"=>dis_out<="0010010"WHEN"0110"=>dis_out<="0000010"WHEN"0111&
14、quot;=>dis_out<="1111000"WHEN"1000"=>dis_out<="0000000"WHEN"1001"=>dis_out<="0010000"WHEN OTHERS=>dis_out<="1111111"END CASE;END PROCESS;END fwm;生成的器件:七段譯碼器5. 控制LED閃爍的VHDL源文件module LED( clk,d1,d2,g1,g2,out );input cl
15、k;input 3:0 d1;input 3:0 d2;input 3:0 g1;input 3:0 g2;output 3:0 out;reg 3:0 out = 4'b0000;parameter T5s = 6'd50;reg 5:0 count; reg flag;always ( posedge clk )beginif ( g2 = 4'd0 && g1 =4'd0 && d2 = 4'd0 && d1 = 4'd0 )flag <= 1'b1;if ( flag = 1'b1 )begincount <= count + 1'b1;out <= out;if( count = T5s )beginflag <= 1'b0;out <= 4'b0000;count <= 6'
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO/CIE 11664-5:2024 EN Colorimetry - Part 5: CIE 1976 L*u*v* colour space and u,v'uniform chromaticity scale diagram
- 【正版授權(quán)】 ISO 15004-2:2024 EN Ophthalmic instruments - Fundamental requirements and test methods - Part 2: Light hazard protection
- 2025年基因工程項目合作計劃書
- 2025年冷光源:EL冷光片項目合作計劃書
- 2025年度公路橋梁鋼筋供應(yīng)與施工承包協(xié)議
- 2025年度辦公樓物業(yè)環(huán)境監(jiān)測與改善服務(wù)協(xié)議
- 2025年度特色餐飲店品牌獨(dú)家承包經(jīng)營合同協(xié)議
- 2025年度全國巡演活動場地租賃合同范本
- 急診病人流量預(yù)測與管理計劃
- 2025年無菌包裝用包裝材料合作協(xié)議書
- 信息科技公司項目融資計劃書
- 內(nèi)賬財務(wù)管理制度
- 評標(biāo)專家培訓(xùn)
- 道教建廟申請書
- 泰山英文簡介
- 公司組織知識清單范例
- 小學(xué)二年級有余數(shù)的除法口算題匯總(共300題)
- 2023年部編高中語文選擇性必修上之海明威的冰山理論和電報體風(fēng)格
- WTE朗文英語 1B 單詞卡片
- 網(wǎng)咖成本預(yù)算明細(xì)表
- 2023年上半年重慶三峽融資擔(dān)保集團(tuán)股份限公司招聘6人上岸筆試歷年難、易錯點(diǎn)考題附帶參考答案與詳解
評論
0/150
提交評論