Está en la página 1de 4

library ieee;

use ieee.std_logic_1164.all;
entity ESTACION is
port (clk, ent, sal:in std_logic;
P_sal, P_ent: out std_logic);
end ESTACION;
architecture arq_estacion of ESTACION is
type estados is (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10);
signal edo_presente, edo_futuro: estados;

begin
proceso1: process(edo_presente, ent, sal)
begin
case edo_presente is
when e0 =>
if (ent='0' and sal='0') then
edo_futuro<= e0;
P_sal<='0';
P_ent<='1';
end if;
when e1 =>
if (ent='0' and sal='0') then
edo_futuro <= e1;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e1;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e0;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e2;
P_sal<='0';
P_ent<='1';
end if;
when e2 =>
if (ent='0' and sal='0') then
edo_futuro <= e2;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e2;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e1;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e3;
P_sal<='0';
P_ent<='1';
end if;
when e3 =>
if (ent='0' and sal='0') then
edo_futuro <= e3;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e3;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e2;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e4;
P_sal<='0';
P_ent<='1';
end if;
when e4 =>
if (ent='0' and sal='0') then
edo_futuro <= e4;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e4;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e3;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e5;
P_sal<='0';
P_ent<='1';
end if;
when e5 =>
if (ent='0' and sal='0') then
edo_futuro <= e5;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e5;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e4;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e6;
P_sal<='0';
P_ent<='1';
end if;
when e6 =>
if (ent='0' and sal='0') then
edo_futuro <= e6;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e6;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e5;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e7;
P_sal<='0';
P_ent<='1';
end if;
when e7 =>
if (ent='0' and sal='0') then
edo_futuro <= e7;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e7;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e6;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e8;
P_sal<='0';
P_ent<='1';
end if;
when e8 =>
if (ent='0' and sal='0') then
edo_futuro <= e8;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e8;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e7;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e9;
P_sal<='0';
P_ent<='1';
end if;
when e9 =>
if (ent='0' and sal='0') then
edo_futuro <= e9;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e9;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e8;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e10;
P_sal<='0';
P_ent<='1';
end if;
when e10 =>
if (ent='0' and sal='0') then
edo_futuro <= e10;
P_sal<='0';
P_ent<='0';
elsif (ent='1' and sal='1') then
edo_futuro <= e10;
P_sal<='1';
P_ent<='1';
elsif (ent='0' and sal='1') then
edo_futuro <= e9;
P_sal<='1';
P_ent<='0';
elsif (ent='1' and sal='0') then
edo_futuro <= e10;
P_sal<='0';
P_ent<='0';
end if;
end case;
end process proceso1;
proceso2: process (clk)
begin
if(clk'event and clk='1')then
edo_presente <=
edo_futuro;
end if;
end process proceso2;
end arq_estacion;

También podría gustarte