Skip to main content

Maquina de Mealy Ejemplo: Ascensor

entity behavioral is port (
Planta_Baja : in std_logic;
Piso_Uno    : in std_logic;
Piso_Dos    : in std_logic;
salidas     : out std_logic_vector(1 downto 0) -- para polarizar el motor, tierra y voltaje por eso se require los dos bits

);
end behavioral

architecture AscMealy of behavioral is
type ascEstados is (PB, 1, 2);
signal Estados, prox_estados AscEstados;
begin
Process(Planta_Baja, Piso_Uno, Piso_Dos, Estado)
begin
Case PB =>
if (Planta_Baja = '1')then
Prox_estado <= 1;
else
Prox_estado <= PB;
endif;
case 1 =>
if (Piso_Uno = '1')then
Prox_estado <= 2;
else
prox_estado <= 1;
endif;
case 2 =>
if (Piso_Dos = '1')then
Prox_estado <= 1;
else
prox_estado <= 2;
endif;
end Process;

Process (reloj, Reset)
begin
if (Reset = '1')then
estado <= PB;
elsif (clk'event and clk = '1') then
estado <= Prox_estado;
end if;
end Process;

Process (Planta_Baja, Piso_Uno, Piso_Dos, Estado)
begin
case estado is
listan PB =>
if (Planta_Baja = '1') then
salidas <= '10'
else
salidas <= '00'
elsif;
end Process;

end architecture behavioral;

Comments

Popular posts from this blog

Multimetro ( codigo ) vhdl

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity Multimetro is port( clk: in std_logic; tst: inout std_logic_vector (3 downto 0); display: out std_logic_vector (7 downto 0):="00000000"; leds, anodos: out std_logic_vector (3 downto 0):="0000"); end Multimetro; architecture Behavioral of Multimetro is signal barrido: std_logic_vector (1 downto 0):="00"; signal anodo: std_logic_vector (3 downto 0):="0000"; signal contador: std_logic_vector (3 downto 0):="0000"; signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010"; signal x,y,z,w: std_logic_vector (3 downto 0):="0000"; begin process(clk) begin if(clk'event and clk='1') then barrido<=barrido+'1'; if contador contador<=contador+'1'; elsif contador>tst then contador<="0000...

Cronometro (codigo) vhdl

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity cronometro is     Port ( display : out  STD_LOGIC_VECTOR (7 downto 0);            clk, reset, enc : in  STD_LOGIC;            An  : out  STD_LOGIC_VECTOR (3 downto 0)); end cronometro; architecture Behavioral of cronometro is signal contador: std_logic_vector  (3 downto 0) :="0000"; signal segundos: std_logic_vector  (13 downto 0) :="00000000000000"; signal contador1: std_logic_vector  (3 downto 0) :="0000"; signal DecSeg: std_logic_vector  (9 downto 0) :="0000000000"; signal contador2: std_logic_vector  (3 downto 0) :="0000"; signal CentSeg: std_logic_vector  (7 downto 0) :="00000000"; signal Anodos: std_logic_vector (1 downto 0 ):="00"; begin Process (clk, reset, contador, segundos) begin if (clk'event and clk = '1') then ...