Maquina de Moore VHDL

15 01 2008

Parece ser que debido a la inutilidad de los alumnos de Digital del año pasado, este año no entra VHDL en el examen. Que suerte tienen algunos XD.

Este ejercicio lo tuvimos que hacer el año pasado. Consistía en crear el autómata de Moore de los estados de la noria de un parque de atracciones, y una vez hecho esto, crear el código fuente correspondiente al autómata en lenguaje VHDL.


ENTITY noria IS
 PORT( i_d:      in            bit_vector(0 to 1);
  clock,reset:              in     bit;
        mi_md:      out           bit_vector(0 to 1));
                   
END noria;

ARCHITECTURE noria_moore of noria IS

TYPE estados_posibles IS (e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11);

SIGNAL estado:estados_posibles;


BEGIN

 PROCESS (clock,reset)

 BEGIN

 IF reset=’0′ then estado <=e1;

 ELSIF (clock’event and clock =’1′)then

 CASE estado IS

  WHEN e1=>

  if i_d=”10″ then estado <=e2;

  elsif i_d=”01″ then estado <=e3;

  END IF;

               WHEN e2=>

  if i_d=”11″ then estado <=e4;

  elsif i_d=”00″ then estado <=e5;

  END IF;

         WHEN e3 =>

  if i_d=”11″ then estado <=e6;

  elsif i_d=”00″ then estado <=e7;

  END IF;

  WHEN e4 =>

  if i_d=”10″ then estado <=e8;

  elsif i_d=”01″ then estado <=e3;

                END IF;

  WHEN e5 =>

  if i_d=”10″ then estado <=e2;

  elsif i_d=”01″ then estado <=e3;

  END IF;

  WHEN e6 =>

  if i_d=”10″ then estado <=e2;

  elsif i_d=”01″ then estado <=e9;
       
          END IF;

  WHEN e7 =>

  if i_d=”10″ then estado <=e2;

  elsif i_d=”01″ then estado <=e3;

  END IF;

  WHEN e8 =>

  if i_d=”11″ then estado <=e1;
  
                elsif i_d=”00″ then estado =e10;
  
  END IF;

  WHEN e9 =>

  if i_d=”11″ then estado <=e1;

  elsif i_d=”00″ then estado =e11;

  END IF;
 
  WHEN e10 =>
 
  if i_d=”10″ then estado <=e8;

  elsif i_d=”01″ then estado <=e3;

  END IF;

  WHEN e11 =>

  if i_d=”10″ then estado <=e2;
 
          elsif i_d=”01″ then estado <=e9;

  END IF;
 

 END CASE;
END IF;
END PROCESS;

WITH estado SELECT

mi_md <= ”11″ WHEN    e1|e8|e9,
  ”10″ WHEN e2|e4|e5|e11,
  ”01″ WHEN e3|e6|e7|e10;
END noria_moore;


Acciones

Información

Deja un comentario