📄 elevator_car.txt
字号:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
entity elevator_car is
PORT(
reset : in std_logic; --for the initaliseren of the schakeling (level of the elevator cage = 0)
stop : in std_logic; --the need stopper in the elevator cage
level_request : in std_logic_vector(2 downto 0); --level of the new passenger
level_destination : in std_logic_vector(2 downto 0); --requested floor from passenger inside elevator
move_up : out std_logic;
move_down : out std_logic;
sensor_door : in std_logic_vector(2 downto 0); --sensor that reproduces or open the elevator or closed is
movement_door : out std_logic_vector(2 downto 0); --Gives defense or the doors open or go closed.
locatie_lift : in std_logic_vector(2 downto 0); --reproduction of the location
clk : in std_logic); --lift clock signal
end elevator_car;
architecture behav of elevator_car is
signal A : std_logic;
signal registerinfo : std_logic_vector(2 downto 0);
signal B : std_logic;
signal level_request2 : std_logic_vector(2 downto 0);
signal i : integer;
signal leveldestination : std_logic_vector(2 downto 0);
signal regSig : std_logic;
begin
process(clk, locatie_lift, level_request, level_destination) --rise
begin
leveldestination <= level_destination;
if rising_edge(clk) then
if (level_request > locatie_lift) then
move_up <= '1';
move_down <= '0';
if (level_request2 /= leveldestination) then
registerinfo <= niveaubestemming; --make record (3downto0)
leveldestination <= level_request2;
elsif (level_request2 = leveldestination) then --between call up
move_up <= '1';
move_down <= '0';
end if;
if (locatie_lift /= registerinfo) then
move_up <= '1';
move_down <= '0';
elsif (locatie_lift = registerinfo) then
move_up <= '0';
move_down <= '0';
end if;
elsif (level_request < locatie_lift) then
move_down <= '1';
move_up <= '0';
if (level_request2 /= leveldestination) then
registerinfo <= leveldestination;--make register (3downto0)
leveldestination <= level_request2;
elsif (level_request2 = leveldestination) then --between call up
move_up <= '0';
move_down <= '1';
end if;
if (locatie_lift /= registerinfo) then
move_up <= '0';
move_down <= '1';
elsif (locatie_lift = registerinfo) then
move_up <= '0';
move_down <= '0';
end if;
elsif (level_request = locatie_lift) then
move_up <= '0';
move_down <= '0';
end if;
end if;
end process;
process(clk, reset)
begin
if rising_edge(clk) then
if (reset = '1') then
move_up <= '0';
move_down <= '0';
end if;
end if;
end process;
process(clk, locatie_lift)
begin
if rising_edge(clk) then
if (locatie_lift = "00") then
move_down <= '0';
elsif (locatie_lift = "11") then
move_up <= '0';
end if;
end if;
end process;
process(clk, stop)
begin
if rising_edge(clk) then
if (stop = '1') then
move_up <= '0';
move_down <= '0';
end if;
end if;
end process;
process(clk, sensor_door)
begin
if rising_edge(clk) then
[color=redB] <= (level_destination= level_request);[/color]
if (level_destination= level_request) then
reqSig<='1';--assuming that reqSig is where you want to place the value and it's of type std_logic
else reqSig<='0';
end if;
i <= 0;
if B=1 then
movement_door <= "10"; -- door opens
if (sensor_door = "10") then -- door totally open
movement_door <= "00"; -- door stop
for i in 0 to 200 loop
i <= (i + 1);
end loop;
end if;
movement_door <= "01"; -- door closes
if (sensor_door = "00") then -- door closed
movement_door <= "00"; -- door stop
for i in 0 to 200 loop
i <= (i + 1);
end loop;
end if;
end if;
end if;
end process;
end architecture;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -