Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Lavadora
Lavadora
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity lavadora is
Port ( p : in STD_LOGIC;
l : in STD_LOGIC;
v : in STD_LOGIC;
clk : in STD_LOGIC;
s: out STD_LOGIC;
m: out STD_LOGIC;
e: out STD_LOGIC;
end laser;
begin
--Divisor de frecuencias
process(clk)
begin
if rising_edge(clk) then
q <= q + 1;
end if;
end process;
--maquina de estados
process(p,l,v,presente)
begin
case presente is
when s0 =>
p <= '0';
if p= '0' then
e<= '0';
m<= '0';
s<= '0';
else
end if;
when s1 =>
l<= '0';
if l= '0' then
e<= '1';
else
end if;
when s2 =>
l <= '1';
m<= '1';
when s3 =>
l <= '1';
m<= '1';
when s4 =>
l <= '1';
m<= '1';
when s5 =>
l <= '1';
siguiente <=s6;
m<= '1';
when s6 =>
l <= '1';
siguiente <=s7;
m<= '1';
when s7=>
v<= '1';
if l= '1' then
s<= '1';
else
end if;
end case;
end process;
process(q(25),siguiente)
begin
if rising_edge(q(25)) then
end if;
end process;
end Behavioral;
segunda opción:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity lavadora is
Port ( p : in STD_LOGIC;
clk : in STD_LOGIC;
s: out STD_LOGIC;
m: out STD_LOGIC;
e: out STD_LOGIC;
end laser;
begin
--Divisor de frecuencias
process(clk)
begin
if rising_edge(clk) then
q <= q + 1;
end if;
end process;
--maquina de estados
process(p,presente)
begin
case presente is
when s0 =>
p <= '0';
if p= '0' then
siguiente <= s0;
e<= '0';
m<= '0';
s<= '0';
else
end if;
when s1 =>
p<= '0';
if l= '0' then
e<= '1';
else
end if;
when s2 =>
p <= '1';
m<= '1';
when s3 =>
p<= '1';
m<= '1';
when s4 =>
p <= '1';
m<= '1';
when s5 =>
p<= '1';
siguiente <=s6;
m<= '1';
when s6 =>
p <= '1';
siguiente <=s7;
m<= '1';
when s7=>
p<= '1';
if l= '1' then
m<= '0';
s<= '1';
else
end if;
end case;
end process;
process(q(25),siguiente)
begin
if rising_edge(q(25)) then
end if;
end process;
end Behavioral;