library ieee;
use IEEE.STD_LOGIC_1164.all;
entity bp_detector_secuencia is
end bp_detector_secuencia;
architecture estructural of bp_detector_secuencia is
signal bp_RESET, bp_RELOJ, bp_X, bp_Z : std_logic;
begin
uut: entity work.det_sec(detector_1)
port map ( RESET=>bp_RESET, CLK=>bp_RELOJ, x=>bp_X );
process
begin
bp_RESET <= '1'; -- inicializa al sistema
bp_RELOJ <= '0';
bp_X <= '0';
wait for 50 ns;
bp_RESET <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <='0';
bp_X <= '1';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '0';
wait for 50 ns;
bp_RELOJ <= '1';
wait for 50 ns;
bp_RELOJ <= '0';
bp_X <= '1';
wait for 50 ns;
end process;
end architecture estructural;
Mostrando entradas con la etiqueta detector de secuencias. Mostrar todas las entradas
Mostrando entradas con la etiqueta detector de secuencias. Mostrar todas las entradas
sábado, 9 de julio de 2011
Detector de secuencias
Detecter de secuencias que busca la secuencia 1101y al encontrarla activa la salida Z
library ieee ;
use ieee.std_logic_1164.all ;
entity det_sec is
port ( CLK, RESET, x : in std_logic ;
z : out std_logic );
end det_sec ;
architecture detector_1 of det_sec is
type tipo_estado is ( A, B, C, D ) ;
signal estado, siguiente_estado : tipo_estado ;
begin
process ( CLK, RESET )
begin
if ( RESET = '1' ) then
estado <= A ;
elsif ( CLK'event and CLK = '1' ) then
estado <= siguiente_estado ;
end if;
end process ;
process ( x, estado )
begin
case estado is
when A =>
if x = '1' then
siguiente_estado <= B ;
else
siguiente_estado <= A ;
end if ;
when B =>
if x = '1' then
siguiente_estado <= C ;
else
siguiente_estado <= A ;
end if ;
when C =>
if x = '1' then
siguiente_estado <= C ;
else
siguiente_estado <= D ;
end if;
when D =>
if x = '1' then
siguiente_estado <= B ;
else
siguiente_estado <= A ;
end if ;
end case ;
end process ;
process ( x, estado )
begin
case estado is
when A =>
z <= '0' ;
when B =>
z <= '0' ;
when C =>
z <= '0' ;
when D =>
if x = '1' then
z <= '1' ;
else
z <= '0' ;
end if ;
end case ;
end process ;
end detector_1 ;
library ieee ;
use ieee.std_logic_1164.all ;
entity det_sec is
port ( CLK, RESET, x : in std_logic ;
z : out std_logic );
end det_sec ;
architecture detector_1 of det_sec is
type tipo_estado is ( A, B, C, D ) ;
signal estado, siguiente_estado : tipo_estado ;
begin
process ( CLK, RESET )
begin
if ( RESET = '1' ) then
estado <= A ;
elsif ( CLK'event and CLK = '1' ) then
estado <= siguiente_estado ;
end if;
end process ;
process ( x, estado )
begin
case estado is
when A =>
if x = '1' then
siguiente_estado <= B ;
else
siguiente_estado <= A ;
end if ;
when B =>
if x = '1' then
siguiente_estado <= C ;
else
siguiente_estado <= A ;
end if ;
when C =>
if x = '1' then
siguiente_estado <= C ;
else
siguiente_estado <= D ;
end if;
when D =>
if x = '1' then
siguiente_estado <= B ;
else
siguiente_estado <= A ;
end if ;
end case ;
end process ;
process ( x, estado )
begin
case estado is
when A =>
z <= '0' ;
when B =>
z <= '0' ;
when C =>
z <= '0' ;
when D =>
if x = '1' then
z <= '1' ;
else
z <= '0' ;
end if ;
end case ;
end process ;
end detector_1 ;
Suscribirse a:
Entradas (Atom)