📄 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 + -