Maquina de Mealy Detector
-
Upload
daniel-arroyo -
Category
Documents
-
view
214 -
download
0
description
Transcript of Maquina de Mealy Detector
UNIVERSIDAD TÉCNICA DE AMBATO
FISEI
Ingeniería en Electrónica y Comunicaciones
VLSI- DEBER
Integrantes:
Abigail Aldás. Edwin Gavilánez. Christian Silva. Daniela Sevilla. Roberto Villacís. Oscar Guzman.
Fecha de envio: 21 de julio
Fecha de entrega: 05 de agosto 2015.
Tema: maquina de Mealy y Moore.
Máquina de mealy
CÓDIGO VHDL
FLIP-FLOP-D
library IEEE;use IEEE.STD_LOGIC_1164.ALL;
entity flip_f_d is Port ( d ,r: in STD_LOGIC; clk : in STD_LOGIC; q : out STD_LOGIC);end flip_f_d;
architecture Behavioral of flip_f_d isbeginprocess (clk)begin
if(clk'event and clk='1') thenq<= d;end if;
end process;
end Behavioral;
INSTANCIACIÓN
library IEEE; -- importar la librería ieeeuse IEEE.STD_LOGIC_1164.ALL; --hacer uso de todos sus metodos
entity det_cod is –asignar nombre a la entidad Port ( x : in STD_LOGIC; --declarar puertos entrada(x, clk) y salida(y) clk : in STD_LOGIC; y : out STD_LOGIC);end det_cod; --cerrar la entidad
architecture Behavioral of det_cod is – asignar nombre a la arquitecturasignal aux1,bux1,a1,b1,y1,A,B:std_logic; --declarar signalsbegina1<= (A and B) or ( x and (not B)); --ecuacion para flipflop Ab1<= ((not x) and (not A)) or ( (not x) and B); --ecuacion para flipflop by1<= ((not x) and A and (not B)) or ( x and (not A) and B); --ecuacion para saliday<=y1; asignar valor a la salidaD1: entity work.flip_f_d -- instanciar flipflop tipo DPORT MAP( --realizar mapeo de puertos
d=>a1, clk=>clk, q=>aux1 );
A<= aux1; --guardar el valor de salida de dicho flip-flopD2: entity work.flip_f_d PORT MAP( d=>b1, clk=>clk, q=>bux1 );
B<=bux1;
end Behavioral;
SIMULACIÓN
TABLA DE VERDAD
X A B A+ B+ DA DB Y0 0 0 0 1 0 1 00 0 1 0 1 0 1 00 1 0 0 0 0 0 10 1 1 X X X X 01 0 0 1 0 1 0 01 0 1 0 0 0 0 11 1 0 1 0 1 0 0
0
1
0
0
1
1
0
0
1
1
1 1 1 X X X X 0
ECUACIONES
DA = AB +XB|
DB = X|A| + X|B
Y = X|AB| + XA|B
MAQUINA DE MOORE
Entidad
Código
library IEEE;use IEEE.STD_LOGIC_1164.ALL; --inclusión de la librería.entity MOORE is --declaración de la entidad. Port ( dato, clk, ena : in STD_LOGIC; --declaración de puertos. q0 : out STD_LOGIC; q1 : out STD_LOGIC);end MOORE; --final de la entidad
architecture Behavioral of MOORE is --inicio de arquitecturatype estados is (a,b,c,d,e); --variable enumerada creada.signal sali: std_logic_vector(1 downto 0); -- signal para ayudarnos.signal aux1: estados;signal aux2: estados;begin
process (clk,ena) --inicio del process.beginif (ena='0')then --condición enable.aux2<=a;elsif (ena='1')thenaux2<=aux1;
if (clk' event and clk='1')then --funcionamiento por clk en --flanco subida
case aux1 is --comparación del estado actual.when a =>if (dato='1')thenaux1<=e; --asignación de estado
--siguiente.else
aux1<=b;end if;
when b =>if (dato='1')thenaux1<=c;else aux1<=b;end if;
when c=>if (dato='1')thenaux1<=e;else aux1<=d;end if;
when d =>if (dato='1')thenaux1<=c;else aux1<=b;end if;
when e =>if (dato='1')thenaux1<=e;else aux1<=d;end if;
end case;end if;end if;end process;
with aux2 select --asignación de salidas a los --estados
sali<="00" when a,"00" when b,"01" when c,"10" when d,"00" when others;
q1<=sali(1); --asignación de la salidaq0<=sali(0);end Behavioral; --fin de arquitectura.