Sie sind auf Seite 1von 7

Universidad Nacional de Ingeniera

Facultad de Ingeniera Mecnica


Informe de Laboratorio N 5
Lavadora

Integrantes: Cdigo
-Inglis Vidal Guillermo 20150107J
-Huauya Mamani, Roger 20150002C
-Valencia Guerrero,Cristhian 20150074D
-Quispe Cangalaya, Diego 20150033F
-Sanchez Escate, Zaid 20157004A
-Lazo Quispe, Cristian 20154016I

Curso:

Anlisis y diseo de circuitos digitales

Profesor:

Ing. Daniel Barrera Esparta

Seccin:

A Grupo-03

1
Archivo VHDL Module llamado grupo_03:
library IEEE;

use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.all;

entity grupo_03 is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
moneda_c : in STD_LOGIC;
puerta_l : in STD_LOGIC;
peso_m : in STD_LOGIC;
estados_lavadora : out STD_LOGIC_VECTOR (7 downto 0));
end grupo_03;

architecture Behavioral of grupo_03 is


--Definicion de variables(seal,numericas),clases y objetos
type estados is (inicio,llenado,lavado1,lavado2,secado1,secado2,centrifugado,recesivo);
signal ep: estados;
signal clk_1Hz_s: STD_LOGIC; --1 Segundo count 50000000
signal t: integer range 0 to 15; -- Nos servira como el tiempo que transcurre entre los
estados.
begin

process(clk,reset)
variable T: integer range 0 to 50000000;
begin
if reset='1' then
clk_1Hz_s <= '1';
elsif(rising_edge (clk)) then
T:=T+1;
if ( T<=1) then
clk_1Hz_s <= '1';
elsif( T< 50000) then
clk_1Hz_s <= '0';
else
T:=0;
end if;
end if;
end process;

process(clk_1Hz_s,reset,moneda_c,ep)

begin

if ep=inicio then
if moneda_c= '1' then

2
t<=0;
ep <= llenado;
else
ep <= inicio;
end if;

elsif(reset= '1') then


ep <= inicio;

elsif (rising_edge (clk_1Hz_s)) then


case ep is

when llenado =>


t <=t+1;
if t = 11 then
ep <= lavado1;
t <= 0;
else
ep <= llenado;
end if;

when secado1 =>


t <=t+1;
if (t=11 and peso_m ='1') then
ep <= lavado2;
t <= 0;
elsif( t=11 and peso_m = '0') then
ep <= centrifugado;
t <= 0;
else
ep <= secado1;
end if;

when lavado2 =>


t <= t+1;
if t=8 then
ep <= secado2;
t <= 0;
else
ep <= lavado2;
end if;

when lavado1 =>


t <= t+1;
if t=11 then
ep <= secado1;
t <= 0;
else
ep <= lavado1;
end if;

3
when secado2 =>
t <= t+1;
if t=5 then
ep <= centrifugado;
t <= 0;
else
ep <= secado2;
end if;

when centrifugado =>

t <=t+1;
if t=12 then
ep <= inicio;
t<=0;
elsif puerta_l ='0' then
ep <= recesivo;
else
ep <= centrifugado;
end if;

when recesivo =>

if puerta_l ='1' then


ep <= centrifugado;

else
ep <= recesivo;
end if;

when others =>


ep<= inicio;

end case;
end if;
end process;
-- Valores para las salidas
process(ep)
begin
case ep is
when inicio =>
estados_lavadora <= "00101000";
when llenado =>
estados_lavadora <= "00101001";
when lavado1 =>
estados_lavadora <= "00101010";
when lavado2 =>
estados_lavadora <= "00101101";
when secado1 =>

4
estados_lavadora <= "00101011";
when secado2 =>
estados_lavadora <= "00101110";
when centrifugado =>
estados_lavadora <= "00101100";
when recesivo =>
estados_lavadora <= "00101111";
end case;
end process;
end Behavioral;

Archivo VHDL Test Bench llamado lavadora:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

-- Uncomment the following library declaration if using


-- arithmetic functions with Signed or Unsigned values
--USE ieee.numeric_std.ALL;

ENTITY lavadora IS
END lavadora;

ARCHITECTURE behavior OF lavadora IS

-- Component Declaration for the Unit Under Test (UUT)

COMPONENT grupo_03
PORT(
clk : IN std_logic;
reset : IN std_logic;
moneda_c : IN std_logic;
puerta_l : IN std_logic;
peso_m : IN std_logic;
estados_lavadora : OUT std_logic_vector(7 downto 0)
);
END COMPONENT;

--Inputs
signal clk : std_logic := '0';
signal reset : std_logic := '0';
signal moneda_c : std_logic := '0';
signal puerta_l : std_logic := '0';
signal peso_m : std_logic := '0';

--Outputs
signal estados_lavadora : std_logic_vector(7 downto 0);

5
-- Clock period definitions
constant clk_period : time := 10 ns;

BEGIN

-- Instantiate the Unit Under Test (UUT)


uut: grupo_03 PORT MAP (
clk => clk,
reset => reset,
moneda_c => moneda_c,
puerta_l => puerta_l,
peso_m => peso_m,
estados_lavadora => estados_lavadora
);

-- Clock process definitions


clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/4;--Importante
end process;

-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;

wait for clk_period*10;

-- insert stimulus here


reset <= '0';
moneda_c <= '1';
puerta_l <= '1';
peso_m <= '1';

wait;
end process;

END;

6
Imagen de la simulacin:

Das könnte Ihnen auch gefallen