Está en la página 1de 4

ESCUELA SUPERIOR POLITCNICA DE

CHIMBORAZO
FACULTAD DE INFORMTICA Y ELECTRNICA
ESCUELA DE INGENIERA ELECTRNICA EN
TELECOMUNICACIONES Y REDES

VHDL
Cdigo VHDL mquina despachadora de
refrescos
Semestre: Noveno A
Nombre:

Welington Tapuy 352


Cdigo: 352

Profesor: Ing. Wilson Balden M.Sc.

Riobamba Ecuador

VHDL

Pgina 1

CDIGO VHDL
Library IEEE;
Use IEEE.STD_LOGIC_ll64.ALL;
Use IEEE.STD_LOGIC_ARITH.ALL;
Use IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity maquina is
Port ( CLK,MONEDA,MP,PRECIO,LC,LS : in STD LOGIC;
CAP,LIMPIA,SIRVE,CAMBIO,DEC : out STD LOGIC);
End maquina;

Architecture arq_maq of maquina is


Type estados is (A,B,C,D,E,F,G,H,I);
signal edo_pres, edo_fut: estados;
Begin
p_estados: process (edo_pres, MONEDA,MP,PRECIO,LC,LS)
begin
case (edo_pres) is
when A => CAP<= '0';
LIMPIA <= '0';
SIRVE <= '0';
CAMBIO <= '0';
DEC <= '0';
if MONEDA ='1' then
edo_fut <= B;
else
edo_fut <= A;
end if;
when B => CAP<= '0';
LIMPIA <= '0';
SIRVE <= '0';
CAMBIO <= '0';
DEC <= '0';
if MONEDA ='0' then
edo_fut < =C;
else
edo_fut <= B;
end if;
when C =>CAP<='0';
LIMPIA <= '0';
SIRVE <= '0';
VHDL

Pgina 1

CAMBIO<='0';
DEC <= '0';
if MP = '0' then
edo_fut <= D;
else
edo_fut <= A;
end if;
when D =>CAP <= '0';
LIMPIA <= '0';
DEC <= '0';
if PRECIO = '0' then
edo_fut <= H;
CAMBIO <='1';
else
edo_fut <= E;
SIRVE <= '1'
end if;
when E => LIMFIA <= '0';
CAMBIO <= '0';
DEC <= '0';
if LS='0' then
edo_fut <= E;
SIRVE <= '1';
else
edo_fut <= F;
CAP <= '1';
end if;
when F => LIMFIA < = '0' ;
SIRVE <= '0';
CAMBIO <= '0';
DEC <= '0';
edo_fut <= G;
CAF <= '1';
when G =>CAP<= '0' ;
SIRVE <= '0';
CAMBIO <= '0';
LIMPIA <= '1';
DEC <= '0';
edo_fut <= A;
when I => CAP <= '0';
SIRVE <= '0';
LIMPIA <= 'l';
VHDL

Pgina 2

CAMBIO<= '0';
edo_fut <= D;
DEC <= '1';
end case;
end process p_estados;
p_reloj: process(CLK)
begin
if (CLK' event and CLK= '1' then
edo_pres <= edo_fut;
end if;
end process p_reloj;
end arq_maq;

VHDL

Pgina 3

También podría gustarte