You are on page 1of 3

Lavadora.

vhd 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

Fri Jun 28 11:11:26 2013

----------------------------------------------------------------------------------- Company: -- Engineer: --- Create Date: 09:17:56 06/28/2013 -- Design Name: -- Module Name: Lavadora - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: --- Dependencies: --- Revision: -- Revision 0.01 - File Created -- Additional Comments: ----------------------------------------------------------------------------------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; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Lavadora is Port ( clk : in STD_LOGIC; start : in STD_LOGIC; vacio : in STD_LOGIC; lleno : in STD_LOGIC; vaciar : out STD_LOGIC; llenar : out STD_LOGIC; lento : out STD_LOGIC; rapido : out STD_LOGIC; direccion : out STD_LOGIC); end Lavadora; architecture Behavioral of Lavadora is constant diezsec:integer :=1; constant cincomin:integer :=5; constant diezmin:integer :=10; type estados is (inicial, lavado, vacio1, enjuagar, vacio2, exprimir); signal signal signal signal diraux: std_logic: ='0'; tiempo: integer range 0 to 1023; subtiempo: integer range 0 to 1023; presente: estados: =inicial;

begin

Page 1

Lavadora.vhd 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 maquina: process(clk) begin if clk = '1' then case presente is when inicial => if start = '1' then presente <= lavado; end if; vaciar <= '1'; llenar <= '0'; lento <= '0'; rapido <= '0'; diraux <= '0'; tiempo <= 0; subtiempo <= 0; when lavado => vaciar <= '0'; if lleno = '0' then llenar <= '1'; else llenar <= '0'; lento <= '1'; if subtiempo = diezsec then diraux <= not diraux; subtiempo <= subtiempo + 1; else subtiempo <= subtiempo + 1; end if; tiempo <= tiempo + 1; if tiempo = diezmin then presente <= vacio1; end if; end if; when vacio1 => vaciar <= '1'; lento <= '0'; if vacio = '1' then presente <= enjuagar; end if; tiempo <= 0; if vacio = '1' then presente <= enjuagar; end if; tiempo <= 0; subtiempo <= 0; when enjuagar => vaciar <= '0'; if lleno = '0' then llenar <= '1'; else llenar <= '0'; lento <= '1'; if subtiempo = diezsec then diraux <= not diraux; subtiempo <= 0; else subtiempo <= subtiempo - 1; end if;

Fri Jun 28 11:11:26 2013

Page 2

Lavadora.vhd 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 tiempo <= tiempo -1; if tiempo = cincomin then presente <= vacio2; end if; end if; when vacio2 => vaciar <= '1'; lento <= '0'; if vacio = '1' then presente <= exprimir; end if; tiempo <= 0; subtiempo <= 0; when exprimir => rapido <= '1'; tiempo <= tiempo + 1; if tiempo = cincomin then presente <= inicial; end if; end case; end if; end process maquina; alternado: process(clk) begin if lleno ='1' then direccion <= clk; else direccion <= '0'; end if; end process alternado;

Fri Jun 28 11:11:26 2013

end Behavioral;

Page 3

You might also like