--------------------------------控制主模块-------------------------------library ieee; ----------交通灯控制 use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity traffic is port(clk1,clk1k:in std_logic; change,reset:in std_logic; num:out integer range 0 to 9; lights:out std_logic_vector(7 downto 0); sel:out std_logic_vector(5 downto 0)); end traffic; architecture a of traffic is type states is(s1,s2,s3,s4,s5,s6,s7); signal state:states; signal num1,num2,num3,num4:integer range 0 to 9; signal ch:std_logic:='0'; signal count:integer range 1 to 50 :=1; begin u1:process(change)----紧急状态按键 begin if(change='1')then -------标志位 ch<=not ch; end if; end process; u2:process(clk1,ch,reset)-------计时器清零 恢复初始状态 begin if(clk1'event and clk1='1')then if (reset='1') then count<=50; else if(ch='1')then count<=count; elsif(count=1)then count<=50; else count<=count-1; end if; end if; end if; end process;
u3:process(ch,count)----根据时间来选择交通灯状态
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库毕业设计77北京邮电大学字系统与逻辑综合实验交通灯控制器(9)在线全文阅读。
相关推荐: