EDA课程设计 交通灯控制器

EDA课程设计 交通灯控制器

ID:38264870

大小:12.28 KB

页数:6页

时间:2019-06-07

EDA课程设计  交通灯控制器_第1页
EDA课程设计  交通灯控制器_第2页
EDA课程设计  交通灯控制器_第3页
EDA课程设计  交通灯控制器_第4页
EDA课程设计  交通灯控制器_第5页
资源描述:

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

1、libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;useieee.std_logic_arith.all;entityEDA1isport(clk,en:instd_logic;lampa,lampb:outstd_logic_vector(3downto0);acount,bcount:outstd_logic_vector(7downto0));endEDA1;architectureaofEDA1issignalnuma,numb:st

2、d_logic_vector(7downto0);signaltempa,tempb:std_logic;signalstatea,stateb:std_logic_vector(2downto0);signalared,bred,agreen,bgreen,ayellow,byellow,aleft,bleft:std_logic_vector(7downto0);beginacount<=numa;bcount<=numb;x1:process(en)beginifen='0'thenared<="01010101";ayel

3、low<="00000101";agreen<="01000000";aleft<="00010101";bred<="01100101";byellow<="00000101";bgreen<="00110000";bleft<="00010101";endif;endprocess;x2:process(clk,en)beginifclk='1'andclk'eventthenifen='1'theniftempa='0'thentempa<='1';casestateaiswhen"000"=>numa<=agreen;la

4、mpa<="0010";statea<="001";when"001"=>numa<=ayellow;lampa<="0100";statea<="010";when"010"=>numa<=aleft;lampa<="0001";statea<="011";when"011"=>numa<=ayellow;lampa<="0100";statea<="100";when"100"=>numa<=ared;lampa<="1000";statea<="000";whenothers=>lampa<="1000";endcase;e

5、lseif(numa>1)thenifnuma(3downto0)=0thennuma(3downto0)<="1001";numa(7downto4)<=numa(7downto4)-1;elsenuma(3downto0)<=numa(3downto0)-1;endif;elseifnuma=1thentempa<='0';numa<=numa-1;endif;endif;endif;elselampa<="1000";statea<="000";tempa<='0';endif;endif;endprocessx2;x3:p

6、rocess(clk,en)beginifclk='1'andclk'eventthenifen='1'theniftempb='0'thentempb<='1';casestatebiswhen"000"=>numb<=bred;lampb<="1000";stateb<="001";when"001"=>numb<=bgreen;lampb<="0010";stateb<="010";when"010"=>numb<=byellow;lampb<="0100";stateb<="011";when"011"=>numb<=bl

7、eft;lampb<="0001";stateb<="100";when"100"=>numb<=byellow;lampb<="0100";stateb<="000";whenothers=>lampb<="1000";endcase;elseif(numb>1)thenifnumb(3downto0)=0thennumb(3downto0)<="1001";numb(7downto4)<=numb(7downto4)-1;elsenumb(3downto0)<=numb(3downto0)-1;endif;elseifnumb

8、=1thentempb<='0';numb<=numb-1;endif;endif;endif;elselampb<="1000";stateb<="000";tempb<='0';endif;endif;endprocessx3;enda;lib

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

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

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