資源描述:
《eda技術(shù)實用教程課后答案---潘松,黃繼業(yè)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫。
1、3-3給出一個4選1多路選擇器的VHDL描述。選通控制端有四個輸入:S0、S1、S2、S3。當(dāng)且僅當(dāng)S0=0時:Y=A;S1=0時:Y=B;S2=0時:Y=C;S3=0時:Y=D。--解:4選1多路選擇器VHDL程序設(shè)計。LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYmux41aISPORT(A,B,C,D:INSTD_LOGIC;S0,S1,S2,S3:INSTD_LOGIC;Y:OUTSTD_LOGIC);ENDENTITYmux41a;ARCHITECTUREoneOFmux41aISSIGNALS0_3
2、:STD_LOGIC_VECTOR(3DOWNTO0);BEGINS0_3<=S0&S1&S2&S3;y<=AWHENS0_3="0111"ELSEBWHENS0_3="1011"ELSECWHENS0_3="1101"ELSEDWHENS0_3="1110"ELSE'Z';ENDARCHITECTUREone;3-4給出1位全減器的VHDL描述;最終實現(xiàn)8位全減器。要求:1)首先設(shè)計1位半減器,然后用例化語句將它們連接起來,圖4-20中h_suber是半減器,diff是輸出差(diff=x-y),s_out是借位輸出(s_out=1,x3、in是借位輸入。cyinxindiff_outba圖3-191位全加器--解(1.1):實現(xiàn)1位半減器h_suber(diff=x-y;s_out=1,x4、1;--解(1.2):采用例化實現(xiàn)圖4-20的1位全減器LIBRARYIEEE;--1位二進(jìn)制全減器順層設(shè)計描述USEIEEE.STD_LOGIC_1164.ALL;ENTITYf_suberISPORT(xin,yin,sub_in:INSTD_LOGIC;sub_out,diff_out:OUTSTD_LOGIC);ENDENTITYf_suber;ARCHITECTUREfs1OFf_suberISCOMPONENTh_suber--調(diào)用半減器聲明語句PORT(x,y:INSTD_LOGIC;diff,s_out:OUTSTD_LOGIC);END
5、COMPONENT;SIGNALa,b,c:STD_LOGIC;--定義1個信號作為內(nèi)部的連接線。BEGINu1:h_suberPORTMAP(x=>xin,y=>yin,diff=>a,s_out=>b);u2:h_suberPORTMAP(x=>a,y=>sub_in,diff=>diff_out,s_out=>c);sub_out<=cORb;ENDARCHITECTUREfs1;(2)以1位全減器為基本硬件,構(gòu)成串行借位的8位減法器,要求用例化語句來完成此項設(shè)計(減法運算是x-y-sun_in=difft)。xinsub_outyinu0sub_
6、indiff_outx0y0sindiff0xinsub_outyinu1sub_indiff_outx1y1diff1xinsub_outyinu7sub_indiff_outx7y7soutdiff7……………….……………….串行借位的8位減法器a0a1a6--解(2):采用例化方法,以1位全減器為基本硬件;實現(xiàn)串行借位的8位減法器(上圖所示)。LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYsuber_8ISPORT(x0,x1,x2,x3,x4,x5,x6,x7:INSTD_LOGIC;y0,y1,y2
7、,y3,y4,y5,y6,y7,sin:INSTD_LOGIC;diff0,diff1,diff2,diff3:OUTSTD_LOGIC;diff4,diff5,diff6,diff7,sout:OUTSTD_LOGIC);ENDENTITYsuber_8;ARCHITECTUREs8OFsuber_8ISCOMPONENTf_suber--調(diào)用全減器聲明語句PORT(xin,yin,sub_in:INSTD_LOGIC;sub_out,diff_out:OUTSTD_LOGIC);ENDCOMPONENT;SIGNALa0,a1,a2,a3,a4,a5
8、,a6:STD_LOGIC;--定義1個信號作為內(nèi)部的連接線。BEGINu0:f