




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
實驗一LIBRARYieee;USEieee.std_logic_1164.all;USEieee.std_logic_unsigned.all;entityadderisport(a,b:instd_logic_vector(15downto0);sum:outstd_logic_vector(15downto0));endadder;architecturezhenofadderisbeginsum<=a+b;endzhen;實驗二libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitymux4isport(sel:instd_logic;a,b:instd_logic_vector(3downto0);y:outstd_logic_vector(3downto0));endmux4;architecturezhenofmux4isbeginprocess(sel,a,b)beginifsel='0'theny<=a;elsey<=b;endif;endprocess;endzhen;實驗三libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitysevenisport(input:std_logic_vector(2downto0);a,b,c,d,e,f,g:outstd_logic);endseven;architecturezhenofsevenisbeginprocess(input)begincaseinputiswhen"000"=>a<='1';b<='1';c<='1';d<='1';e<='1';f<='1';g<='0';when"001"=>a<='0';b<='1';c<='1';d<='0';e<='0';f<='0';g<='0';when"010"=>a<='1';b<='1';c<='0';d<='1';e<='1';f<='0';g<='1';when"011"=>a<='1';b<='1';c<='1';d<='1';e<='0';f<='0';g<='1';whenothers=>a<='1';b<='0';c<='0';d<='1';e<='1';f<='1';g<='1';endcase;endprocess;endzhen;libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityshifterisport(input:instd_logic_vector(7downto0);cnt:instd_logic_vector(1downto0);result:outstd_logic_vector(15downto0));endshifter;architecturezhenofshifterisbeginprocess(cnt,input)variablem:std_logic_vector(15downto0);beginm:="00000000"&input;ifcnt="01"thenforiin7downto0loopm(i+4):=m(i);endloop;m(3downto0):="0000";elsifcnt="10"thenforjin7downto0loopm(j+8):=m(j);endloop;m(7downto0):="00000000";elsenull;endif;result<=m;endprocess;endzhen;實驗五alibraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityregisport(clk,clr,clken:instd_logic;in_reg:instd_logic_vector(15downto0);out_reg:outstd_logic_vector(15downto0));endreg;architecturezhen_aofregisbeginprocess(clk,clr,clken,in_reg)beginif(clk'eventandclk='1')thenif(clr='1'andclken='0')thenout_reg<=in_reg;elsifclr='0'thenout_reg<="0000000000000000";endif;endif;endprocess;endzhen_a;實驗五libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycounter2isport(clk,clr:instd_logic;sum:outstd_logic_vector(1downto0));endcounter2;architecturezhen_bofcounter2isbeginprocess(clk,clr)variablem:std_logic_vector(1downto0);beginifclr='0'thenm:="00";elsifclr='1'thenif(clk'eventandclk='1')thenm:=m+1;endif;endif;sum<=m;endprocess;endzhen_b;libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycontrolisport(clk,rst,start:instd_logic;count:instd_logic_vector(1downto0);done,clken,regclr:outstd_logic;in_sel,shift:outstd_logic_vector(1downto0);state_out:outstd_logic_vector(2downto0));endcontrol;architecturezhen_aofcontrolistypestatesis(idle,lsb,mid,msb,err);signalcurrent_state,next_state:states;beginprocess(clk,rst,start)beginifrst='1'thencurrent_state<=idle;elsif(clk'eventandclk='1')thencurrent_state<=next_state;endif;endprocess;process(current_state,start,count)begincasecurrent_stateiswhenidle=>state_out<="000";ifstart='0'thendone<='0';clken<='1';regclr<='1';elsifstart='1'thendone<='0';clken<='1';regclr<='0';next_state<=lsb;endif;whenlsb=>state_out<="001";if(start='0'andcount="00")thenin_sel<="00";shift<="00";done<='0';clken<='1';regclr<='1';next_state<=mid;elsedone<='0';clken<='1';regclr<='1';next_state<=err;endif;whenmid=>state_out<="010";if(start='0'andcount="01")thenin_sel<="01";shift<="01";done<='0';
clken<='0';regclr<='1';next_state<=mid;elsif(start='0'andcount="10")thenin_sel<="10";shift<="01";done<='0';clken<='0';regclr<='1';next_state<=msb;elsedone<='0';clken<='1';regclr<='1';next_state<=err;endif;whenmsb=>state_out<="011";if(start='0'andcount="11")thenin_sel<="11";shift<="10";done<='1';clken<='0';regclr<='1';next_state<=idle;elsedone<='0';clken<='1';regclr<='1';next_state<=err;endif;whenerr=>state_out<="100";ifstart='1'thendone<='0';clken<='1';regclr<='0';next_state<=lsb;elsedone<='0';clken<='1';regclr<='1';next_state<=err;endif;whenothers=>null;endcase;endprocess;endzhen_a;SimulationWaveformsSimulationmode:FunctionalPointer:Interval:20.0he50.0nsclkenmhi士t--1E0]...1[1]CCiUTlt實驗六bLIBRARYieee;USEieee.std_logic_1164.all;LIBRARYlpm;USElpm.all;ENTITYmult4x4ISPORT(dataa :INSTD_LOGIC_VECTOR(3DOWNTO0);datab :INSTD_LOGIC_VECTOR(3DOWNTO0);result :OUTSTD_LOGIC_VECTOR(7DOWNTO0));ENDmult4x4;ARCHITECTUREzhenOFmult4x4ISSIGNALsub_wire0:STD_LOGIC_VECTOR(7DOWNTO0);COMPONENTlpm_multGENERIC(lpm_hint :STRING;lpm_representation:STRING;lpm_type :STRING;lpm_widtha :NATURAL;lpm_widthb :NATURAL;lpm_widthp :NATURAL);PORT(dataa:INSTD_LOGIC_VECTOR(3DOWNTO0);datab:INSTD_LOGIC_VECTOR(3DOWNTO0);result:OUTSTD_LOGIC_VECTOR(7DOWNTO0));ENDCOMPONENT;BEGINresult<=sub_wire0(7DOWNTO0);lpm_mult_component:lpm_multGENERICMAP(lpm_hint=>"MAXIMIZE_SPEED=5",lpm_representation=>"UNSIGNED",lpm_type=>"LPM_MULT",lpm_widtha=>4,lpm_widthb=>4,lpm_widthp=>8)PORTMAP(dataa=>
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年中國面膜行業(yè)競爭格局及投資戰(zhàn)略研究報告
- 2025-2030年中國鏈鋸行業(yè)十三五規(guī)劃與發(fā)展趨勢預測報告
- 2025-2030年中國資產(chǎn)管理行業(yè)運行動態(tài)與營銷策略研究報告
- 2025-2030年中國聚苯醚行業(yè)風險評估規(guī)劃分析報告
- 南寧理工學院《美國文學選讀》2023-2024學年第二學期期末試卷
- 邢臺醫(yī)學高等專科學?!渡鷳B(tài)文明建設理論與實踐前沿》2023-2024學年第二學期期末試卷
- 江西科技學院《公共管理與服務課程開發(fā)與教材分析》2023-2024學年第二學期期末試卷
- 贛南師范大學科技學院《海報設計(數(shù)字方向)》2023-2024學年第二學期期末試卷
- 2025安徽省安全員知識題庫及答案
- 新生兒早期基本保健課件
- 采礦學課程設計硯北煤礦新井設計全套圖紙
- 大型儲罐計算書
- 檢體診斷-頭頸部檢查(診斷學課件)
- 煤礦提升機作業(yè)理論考試參考題庫(200題)
- 侯馬北車輛段2023年運用機考復習題-曲沃作業(yè)場
- 手術室停電和突然停電應急預案PPT演示課件
- 職業(yè)病危害告知卡(油漆)
- 抗震支吊架安裝檢驗批
- 橋梁各部位加固及橋梁維修技術總結
- GB/T 40336-2021無損檢測泄漏檢測氣體參考漏孔的校準
評論
0/150
提交評論