EDA实验交通灯设计

EDA实验交通灯设计

ID:39548800

大小:274.00 KB

页数:4页

时间:2019-07-06

EDA实验交通灯设计_第1页
EDA实验交通灯设计_第2页
EDA实验交通灯设计_第3页
EDA实验交通灯设计_第4页
资源描述:

《EDA实验交通灯设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;useieee.std_logic_unsigned.all;ENTITYlightISPORT(rst,fastclk:INSTD_LOGIC;light_a_green,light_a_red,light_a_yellow:OUTSTD_LOGIC;light_b_green,light_b_red,light_b_yellow:OUTSTD_LOGIC;duanma:outstd_logic_vector(7downto0

2、);weixuan:outstd_logic_vector(2downto0));ENDENTITYlight;ARCHITECTUREbehaveOFlightISTYPEstatesIS(s0,s1,s2,s3,s4);SIGNALcs:states:=s0;SIGNALcount:INTEGERRANGE0TO18;signaltime_a,time_b:integerrange0to9;signalflag:bit;signalclk:std_logic;signaldvdcnt:integerr

3、ange0to50;BEGINdivid:process(fastclk)beginiffastclk'eventandfastclk='1'thenifdvdcnt=49thendvdcnt<=0;clk<=notclk;--100dividelsedvdcnt<=dvdcnt+1;endif;endif;endprocessdivid;COM:PROCESS(cs)BEGINCASEcsISWHENs0=>light_a_green<='0';light_a_red<='1';light_a_yell

4、ow<='0';light_b_green<='0';light_b_red<='1';light_b_yellow<='0';WHENs1=>light_a_green<='0';light_a_red<='1';light_a_yellow<='0';light_b_green<='1';light_b_red<='0';light_b_yellow<='0';WHENs2=>light_a_green<='0';light_a_red<='1';light_a_yellow<='0';light_b

5、_green<='0';light_b_red<='0';light_b_yellow<='1';WHENs3=>light_a_green<='1';light_a_red<='0';light_a_yellow<='0';light_b_green<='0';light_b_red<='1';light_b_yellow<='0';WHENs4=>light_a_green<='0';light_a_red<='0';light_a_yellow<='1';light_b_green<='0';lig

6、ht_b_red<='1';light_b_yellow<='0';WHENOTHERS=>null;ENDCASE;ENDPROCESSCOM;REG:PROCESS(rst,clk)BEGINifrst='1'thencs<=s0;count<=0;elsIFclk'EVENTANDclk='1'THENIFcount=18THENcount<=1;ELSEcount<=count+1;endif;CASEcountISWHEN01=>time_a<=9;time_b<=6;cs<=s1;WHEN02

7、=>time_a<=8;time_b<=5;WHEN03=>time_a<=7;time_b<=4;WHEN04=>time_a<=6;time_b<=3;WHEN05=>time_a<=5;time_b<=2;WHEN06=>time_a<=4;time_b<=1;WHEN07=>time_a<=3;time_b<=3;cs<=s2;WHEN08=>time_a<=2;time_b<=2;WHEN09=>time_a<=1;time_b<=1;WHEN10=>time_a<=6;time_b<=9;cs

8、<=s3;WHEN11=>time_a<=5;time_b<=8;WHEN12=>time_a<=4;time_b<=7;WHEN13=>time_a<=3;time_b<=6;WHEN14=>time_a<=2;time_b<=5;WHEN15=>time_a<=1;time_b<=4;WHEN16=>time_a<=3;time_b<=3;cs<=s4;WHEN17=>time_a<=2;time_b<=2;WHEN18=

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。