?? control.vhd
字號:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity control is
port (
up:in STD_LOGIC;
down:in STD_LOGIC;
run_stop:in STD_LOGIC;
wai_t: in std_logic_vector(2 downto 0);
lift:in std_logic_vector(2 downto 0);
ladd: out std_logic_vector(1 downto 0);
);
end control;
architecture a of control is
begin
process(up,down,lift,wai_t,run_stop)--該進程完成電梯將來運行狀態的判斷輸出
begin
if (run_stop='1') then
if (wai_t="101") then
if ((up or down)="000000") then ladd(1)<='0';
else
case lift is
when "000"=>if ((up(1) or down(1))>'0') then ladd(1)<='0';
else ladd<="11";
end if;
when "001"=>if ((up(2) or down(2))>'0') then ladd(1)<='0';
elsif(((ladd(0)='1') and ((up(6 downto 3) or down(6 downto 3))>"0000")) or ((up(1) or down(1))='0')) then ladd<="11";
else ladd<="10";
end if;
when "010"=>if ((up(3) or down(3))>'0') then ladd(1)<='0';
elsif(((ladd(0)='1') and ((up(6 downto 4) or down(6 downto 4))>"000")) or ((up(2 downto 1) or down(2 downto 1))="00")) then ladd<="11";
else ladd<="10";
end if;
when "011"=>if ((up(4) or down(4))>'0') then ladd(1)<='0';
elsif(((ladd(0)='1') and ((up(6 downto 5) or down(6 downto 5))>"00")) or ((up(3 downto 1) or down(3 downto 1))="000")) then ladd<="11";
else ladd<="10";
end if;
when "100"=>if ((up(5) or down(5))>'0') then ladd(1)<='0';
elsif(((ladd(0)='1') and ((up(6) or down(6))>'0')) or ((up(4 downto 1) or down(4 downto 1))="0000")) then ladd<="11";
else ladd<="10";
end if;
when others=>null;
end case;
end if;
end if;
else ladd<="00";
end if;
end process;
end a;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -