--- Create Date: 08:43:42 03/10/2015 -- Design Name: -- Module Name: MaquinaVentas - 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; entity MaquinaVentas is Port ( clk,rst : in STD_LOGIC; cinco_in : in STD_LOGIC; diez_in : in STD_LOGIC; cora_in : in STD_LOGIC; venta_out : out STD_LOGIC; cinco_out : out STD_LOGIC; diez_out : out STD_LOGIC); end MaquinaVentas; architecture Behavioral of MaquinaVentas is type estado is (st0, st5, st10, st15, st20, st25, st30, st35, st40, st45); signal estado_previo, proximo_estado: estado; begin --- seccin secuencial o inferior de la FSM --process (clk, rst) begin if (rst = '1') then estado_previo <= st0; elsif (clk'event and clk = '1') then estado_previo <= proximo_estado; end if; end process; --- seccin combinacional o superior de la FSM --process (estado_previo, cinco_in, diez_in, cora_in) begin case estado_previo is when st0 => venta_out <= '0'; cinco_out <= '0'; diez_out <= '0'; if (cinco_in = '1') then proximo_estado <= st5; elsif (diez_in = '1') then
elsif
proximo_estado <= st10;
(cora_in = '1') then proximo_estado <= st25;
else when
when
when
when
when
proximo_estado <= st0;
end if; st5 => venta_out <= '0'; cinco_out <= '0'; diez_out <= '0'; if (cinco_in = '1') then proximo_estado <= st10; elsif (diez_in = '1') then proximo_estado <= st15; elsif (cora_in = '1') then proximo_estado <= st30; else proximo_estado <= st5; end if; st10 => venta_out <= '0'; cinco_out <= '0'; diez_out <= '0'; if (cinco_in = '1') then proximo_estado <= st15; elsif (diez_in = '1') then proximo_estado <= st20; elsif (cora_in = '1') then proximo_estado <= st35; else proximo_estado <= st10; end if; st15 => venta_out <= '0'; cinco_out <= '0'; diez_out <= '0'; if (cinco_in = '1') then proximo_estado <= st20; elsif (diez_in = '1') then proximo_estado <= st25; elsif (cora_in = '1') then proximo_estado <= st40; else proximo_estado <= st15; end if; st20 => venta_out <= '0'; cinco_out <= '0'; diez_out <= '0'; if (cinco_in = '1') then proximo_estado <= st25; elsif (diez_in = '1') then proximo_estado <= st30; elsif (cora_in = '1') then proximo_estado <= st45; else proximo_estado <= st20; end if; st25 => venta_out <= '1';