欢迎来到天天文库
浏览记录
ID:40643410
大小:86.50 KB
页数:4页
时间:2019-08-05
《基于VHDL语言的交通灯设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、动态扫描电路;LIBRARYieee;USEieee.std_logic_1164.all;ENTITYCTLISPORT(reset:INSTD_LOGIC;clk:INSTD_LOGIC;TL,TS,TY,S:INSTD_LOGIC;ST:outstd_logic;CODE_OUT:OUTSTD_LOGIC_VECTOR(1DOWNTO0));ENDCTL;ARCHITECTUREaOFCTLISSIGNALstate:STD_LOGIC_VECTOR(1DOWNTO0);BEGINCODE_OUT<=S
2、TATE;com:process(CLK,TL,TS,TY,S)beginIFCLK'EVENTANDCLK='1'THENcasestateiswhen"00"=>ifTL='1'ANDS='1'thenstate<="01";ST<='1';elsestate<="00";ST<='0';endif;when"01"=>ifTY='1'thenstate<="10";ST<='1';elsestate<="01";ST<='0';endif;when"10"=>ifTS='1'ORS='0'thensta
3、te<="11";ST<='1';elsestate<="10";ST<='0';endif;when"11"=>ifTY='1'thenstate<="00";ST<='1';elsestate<="11";ST<='0';endif;WHENOTHERS=>NULL;endcase;ENDIF;endprocess;ENDa;时间电路;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYTIMEISPORT
4、(CLK,ST:INSTD_LOGIC;TL,TS,TY:OUTSTD_LOGIC);ENDTIME;ARCHITECTUREAOFTIMEISSIGNALS60:INTEGERRANGE0TO59;SIGNALS30:INTEGERRANGE0TO29;SIGNALS5:INTEGERRANGE0TO4;BEGINPROCESS(CLK,ST)BEGINIFCLK'EVENTANDCLK='1'THENIFST='1'THENS60<=0;TL<='0';ELSIFS60=59THENTL<='1';ELS
5、ES60<=S60+1;ENDIF;ENDIF;ENDPROCESS;PROCESS(CLK,ST)BEGINIFCLK'EVENTANDCLK='1'THENIFST='1'THENS30<=0;TS<='0';ELSIFS30=29THENTS<='1';ELSES30<=S30+1;ENDIF;ENDIF;ENDPROCESS;PROCESS(CLK,ST)BEGINIFCLK'EVENTANDCLK='1'THENIFST='1'THENS5<=0;TY<='0';ELSIFS5=4THENTY<='
6、1';ELSES5<=S5+1;ENDIF;ENDIF;ENDPROCESS;ENDA;译码电路;LIBRARYieee;USEieee.std_logic_1164.all;ENTITYyimaqi2ISPORT(CODE_OUT:inSTD_LOGIC_VECTOR(1DOWNTO0);deng:OUTSTD_LOGIC_VECTOR(5DOWNTO0));endyimaqi2;ARCHITECTUREaOFyimaqi2ISbeginprocess(CODE_OUT)begincaseCODE_OUTi
7、swhen"00"=>deng<="100001";when"01"=>deng<="010001";when"10"=>deng<="001100";when"11"=>deng<="001010";whenothers=>null;endcase;endprocess;enda;
此文档下载收益归作者所有