《(完整版)EDA期末考试题06.docx》由会员分享,可在线阅读,更多相关《(完整版)EDA期末考试题06.docx(9页珍藏版)》请在课桌文档上搜索。
1、A.条件相与的逻辑B.条件相或的逻辑C.条件相异或的避辑D.三态控制电路7 .在一个VHDL设计中Idata是一个信号,数据类型为StdJOgijvcctor,试指出下面那个赋值语句是错误的.DA. idata=uOOOOllliw:B. idata=bt,0000_1111W;C. idata=XAB”;D. idataLED7SLED7SLED7SLED7SLED7SLED7SLED7SLED7SLED7SLED7Snull;三、VHDL程序填空:(10分)下面程序是参数可定制带计数使能异步究位计数器的VHDL描述,试补充完整。N-bitUpConterwithLadrCountEnabl
2、e,andAsyncbronousResetIibraryieee;useIEEE.std_logic_1164.all;useIEEE.std_:Qgic-u11igncd.all;useIEEE.std_logic_arith.all;entityconter-nisgeneric(width:integer:=8);port(data:instd-logic-vector(width-ldowntoO;1.oadren,elk,rst:InstcieIogic;q:outstd_iogic_vector;ndcounter_n;architectrebehaveofcounter-nis
3、signalcount:std_logic_vector(width-ldowntoO);beginprocess(elk,rst)beginIfrst-11,thencontO,);一清零15ifclktevetandclk=,1rthen边沿检测ifload-,lithencont-data;clifen=】,thencount=count+l;endif;endif;endprocess;q-count;endbehave;四、VHDL程序改错:(10分)仔细阅读下列程序,回答问题1.ibraryieee;USEIEEE.STDLOGIC1164.ALL;ENTITYLED7SBGISp
4、ort(Ajinstdlogicvectorodowntoo);CLK:INSTDIXXnC;-51.ed7s:Outstdlogicvector6downtoo);-6ENDLED7SEG;-7ARCHITECTUREoneOFLED7SEGIS8SI弥ALTMP:STDLOGIC;9BEGIN-SYNC:PROCESS(CLKrA)五、阅读下列VHDL程序,画出相应RTL图:GO分)(a)用if语句。(b)用CaSe语句c)用MhendSe语句。(d)用Withselect语句1.ibraryieee;Useieee.Stdlogici164.all;ENTITYthreeISPORT(C
5、lk,dINSTD_LOGIC;Sdot:outTDLOGIC);END;ARCHITECTUREbhvOFthreeISSIGNALtmp:STD_LOGIC;BEGINPliPROCESS(Clk)BEGINIFrising_edge(elk)THENTmp=d;dout三tmp;ENDIF;Endprocesspi;ENDbhv;1.ibraryieee;Useieee.std-logic-l164.all;EntitymymuxisPort(sei:instd-logic-vector(IdowntoO);Ain,Bin:instd-logic-vector(LdowntoO);Cou
6、t:ot5tdlogicvector(1downtoO)Endmymux;ArchitectureoneBeginProcess(sel/BeginIfael-ELsifselCLsifselOfmyrouxisain,bln)u00*thencout-0ImnCQUtHmthenCoUtalorbin-aiorbin;=aiandbin;Elscot=ainnorbi;EndifEndprocess;Endone;ArchiteeturetwoofmynuxisBinProcesssei,ainrbin)Begin-选择信号输入一致他输入Mhe、coutWhe、-coutWhe、coutco
7、tinorbin;ainorbin;inandbin;Endmycir;ArchitectureoneofmycirisSignaltb,tc;beginProcess(clkbeglnIfclkventandclk=1,thentledif;Endprocess;Process(clkrtc)beginIfclk-、Lthencot-tc;end!f;Endprocess;Tc-ainortb;Endone;七、综合题(20分)用VHDL设计两层升降平台控制器图a是一个两层的升降平台示意图,一层和二层各有一个按钮用来呼叫升降图a两层升降平台示意图对应图a的升降平台控制器,拟用VHDL语言设计
8、一个电路模拟其控制逻辑,图b为该VHDL电路的设计模块图。问题1,请完成CmK)O模块的VHDL设计(实体部分已给出,不用写),参考的仿真波形如图C所0iiiTo-ZNUoHillll川IllIIlIlIlMTT|!迎!出出工CoVrV0GBQUO图(Xm100仿真波形图ArchitectureoneofcntlOOIsBeginProcess(clkren)VariableqistdeIogiceVector7downto0);Begin,,:q+1;Endif;Ifq*01100100*thencot=%0,;Elsecout=,l;Endif;Endprocess;Cndone;door
9、updown/2/2Clkrstcallarr图b两层升降平台控IM器设计模块图图b中的CnUOo模块用来控制升降台开关门延时,elev2为升降平台状态控制器。升降台闸门由打开到关闭或由关闭到打开时,elev2模块向CnUOO模块输出个en计数使能信号(高电平有效),cnUOO模块计数溢出(三KX)时Cm100输出COUt信号为高电平,同时CnUOO计数停止。CntlOO模块的实体描述如下所示:1.ibraryieee;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;Entitycnt100isPORTCLKfEN:INSTD
10、_LOGIC;-B,.使能信号CoUT:0UTSTD_LOGIC).-滋出信号Endcnt100:请根据clcv2的VHDL描述画出其状态迁移问题3,根据图b所示升降平台模块图,写出升降平台控制器ELEVJrOP的VHDL顶层描述:1.ibraryieee;Useieee.std-logic-l164.all;EntityelevisInstdlogic;Instdloglcvector(2downto1);Port;:stdloglc;(clkrenacout);(clkrrat,coutrcall.一时钟、越位信号一定时溢出信号2downtol;一呼叫信号downtol);-至U达信号-1
11、15ft5.低电平开11-上升信号一下降信号一延时计数清零、使能信号arr,doorrup,down,ena)问题2,以下是dev2模块的VHDL描述:Iibraryieee;seieee. std-logic_1164. all;en tityelev2isport(elk, COUt callrgjinstd_logic;-时钟、复位信号:instd-logic;-定时溢出信号:instd-logic-vector (2downtol);-呼叫信号arr door:instd_logic_vector (2downtol);一至 U 达信号:outstd_logic; OUtStd_Log
12、ic;:outstd_Logic; outstd-logic;一门控信号,低电平开门endelev2;architectur constan constan constan conatan constan constanbeha CLl: 0P1: UPl: DN2:CL2:0P2:ofelev2isstd-logic-veetor(2 3td-logic-veetor(2 StdeLogiceVector(2 std-logic-vector(2 std-logic-vector(2 std-logic-vector(2一上开信号一一下降信号延时计数清零、使能信号downt。 downto
13、downto downto downto downto“000”; -一楼关门 wIOOr;一楼开门 BCI0;一 一楼上升 wOOl;-二楼下降 wOll;二楼关门“111-;一-二楼开门signalcontrol begin:std_logic_vector (2downto0) j状态控制信号0door-notcontrol(2);up-control(1);down-etrol(O);processelk.rstarrrcallVeriableven三5td-logic;begin)ifrst-1tthenelsifclk,eventandlscontrolifcouBlthen-关门
14、已完毕ifcall(1)=1,thencontrol=lsifcalP5y三nfcth0;encontColelsecontroK=CLl;n=i11;=UPl;enenelsecontrol-CLl;enifcall(1)=,1,thencontrol=OPL;en=,1,elaecontro-CLl;en-0endif1OPlenifrr(2)三,lthecontrol三C.l3econtrol,thecontrol三C;elaecontrolifcout-lthen-关门已完毕ifcall(2三,1rthencontrol=el5ifca0P2;en=Oi;11(1)=,1,thencontrolelsecontrol=DN2;enen1CL2n=1l,;dif;elsecontrol-CL2;enifc6it=1th8Ji一开门已完毕ifcdl1(2,1rthencontrol=elsconOP2en-en1trol三CL2jn三t0;dif;ndi;lsecontrols0P2;enifarr(10=1Lithencontrol=CL1;elsecontrol-CL2;endif;endase;endif;endprocess;endbehav;