?? traffic.vhd
字號:
library ieee;use ieee.std_logic_1164.all;Entity traffic is port ( Clk: in std_logic; sensor: in std_logic );End traffic;Architecture traffic1 of traffic istype state_type is (R,G,Y,L);signal NS,EW: state_type;signal state, next_state: integer range 1 to 12 ;Begin process1: process(clk,sensor) begin if ((clk'event) and (clk='1')) then case state is when 1 to 4=> NS<=G;EW<=R;next_state<=state+1; when 5=> NS<=Y;EW<=R;next_state<=6; when 6 to 9=> NS<=R;EW<=G;next_state<=state+1; when 10=> if (sensor='1') then NS<=R;EW<=G; next_state<=11; else NS<=R;EW<=G; next_state<=1; end if; when 11=> NS<=L;EW<=R;next_state<=12; when 12=> NS<=L;EW<=R;next_state<=1; end case; end if; end process; process2: process(clk) begin if (clk'event and clk='1') then state<=next_state; end if; end process;end Architecture traffic1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -