You are on page 1of 16

UNIVERSIDAD NACIONAL MAYOR

DE SAN MARCOS
(Universidad del Per, Decana de Amrica)

FACULTAD DE INGENIERIA ELECTRNICA


E.A.P. ING. ELECTRNICA

CURSO : DISEO DIGITAL


NOMBRE : RAMIREZ MARTINEZ LUIS IGNACIO
CODIGO : 12190164
HORARIO : LUNES 8 11 AM.
PROFESOR : ING. ALFREDO GRANADOS LY
FECHA : 10-11-2017
INFORME : 4
UNIVERSIDAD NACIONAL MAYOR DE SAN MARCOS
FACULTAD DE INGENIERA ELCTRICA Y
ELECTRNICA
ESCUELA DE INGENIERA ELECTRNICA

DISEO DIGITAL

LABORATORIO No4

ESTILO ALGORTMICO PARA EL DISEO E


IMPLEMENTACIN DE MQUINAS DE
ESTADO EN FPGA
Circuitos a implementar durante el desarrollo de laboratorio:

1. Implementacin de un contador para la siguiente cuenta: 0,7,4,3,1, 0,7,4,3,1 que tenga una
seal de RESET y fuerce al estado inicial. Utilice mquina de estado (utilice MEMoore).

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity preg1 is

port ( clk : in std_logic;


q : out std_logic_vector( 2 downto 0));
end preg1;

architecture moore of preg1 is

type estados is ( s0, s1, s2, s3 , s4);


signal ep, ef: estados;
begin
process( clk)
begin

if rising_edge(clk) then
ep<= ef;
end if;
end process;
process( ep)

begin

case ep is
when s0=>
q<="000";
ef<=s1;
when s1 =>
q<= "111";
ef <= s2;
when s2 =>
q<="100";
ef<=s3;
when s3=>
q<="011";
ef<=s4;
when s4=>
q<="001";
ef<=s0;
end case;
end process;

end moore;
2. Implemente un detector para la siguiente secuencia: 01101010 debe tenar la capacidad de
traslape. Utilice MEF-Mealy.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity diag2 is
port ( clk, x : in std_logic;
z : out std_logic) ;
end diag2;

architecture arq_diagrama of diag2 is


type estados is ( s0,s1,s2,s3,s4,s5,s6,s7);
signal ep, ef : estados;

begin
proceso1 : process( ep,x)
begin

case ep is

when s0 => z<= '0';


if x='1' then
ef<= s0;
else
ef<= s1;
end if;

when s1 => z<= '0';

if x='1' then
ef<= s2;
else
ef<= s1;
end if;

when s2 => z<= '0';

if x='1' then
ef<= s3;
else
ef<= s1;
end if;

when s3 => z<= '0';

if x='1' then
ef<= s0;
else
ef<= s4;
end if;

when s4 => z<= '0';

if x='1' then
ef<= s5;
else
ef<= s1;
end if;

when s5 => z<= '0';

if x='1' then
ef<= s3;
else
ef<= s6;
end if;

when s6 => z<= '0';


if x='1' then
ef<= s7;
else
ef<= s1;
end if;

when s7 =>

if x='1' then
ef<= s0;
z<='0';
else
ef<= s1;
z<= '1';
end if;

end case;

end process proceso1;

proceso2 : process( clk)


begin

if rising_edge(clk) then

ep<=ef;
end if;

end process proceso2;

end arq_diagrama;
3. Se desea implementar un circuito que genere el bit de paridad impar de un dato de 8 bits
(data_in) que llega serialmente. La secuencia de los datos se inicia con un bit de START que
siempre es 0, seguido de los 8 bits de datos. La secuencia original (data_in) no tiene el bit de
paridad.

Se debe generar la cadena de salida (data_out) de manera seguida a la cadena de entrada (data_in)
pero con el bit de paridad impar despus del octavo bit de dato (un ejemplo se muestra en el grfico
anterior).
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity diag3 is
port ( clk, x : in std_logic;
q : out std_logic);

end diag3;

architecture solucion of diag3 is


type estados is ( s0,s1,s2,s3,s4);
signal ep, ef : estados;

signal contador: std_logic_vector( 2 downto 0);


begin
reloj : process( clk)
begin

if rising_edge(clk) then
ep <= ef;
if ep=s1 or ep=s2 then
contador <= contador +1;

end if;
end if;
end process reloj;

combi: process( ep,x)


begin

ef<= ep;
case ep is

when s0=> q<='0';

if x='1' then
ef<= s0;
else
ef<= s1;
end if;

when s1=> q<=x;


if contador=7 then
ef<=s3;
elsif x='1' then
ef<= s2;
else
ef<= s1;

end if;

when s2=> q<=x;

if contador=7 then
ef<=s4;
elsif x='1' then
ef<= s1;

else
ef<= s2;

end if;

when s3=> q<='1';

if x='1' then
ef<= s0;
else
ef<= s1;
end if;

when s4=> q<='0';

if x='1' then
ef<= s0;
else
ef<= s1;
end if;

end case;
end process combi;

end solucion;
4. Se desea implementar el siguiente circuito:

Cuando se pulse START por primera vez debe sonar la sirena de acuerdo a la seal Fout, la segunda
vez que se pulse START debe dejar de sonar.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity sonido is
port ( clk: in std_logic;
start: in std_logic;
p : out std_logic);
end sonido;
architecture moore of sonido is
type estados is (S0,S1);
signal ep,ef: estados;
signal contador : std_logic_vector( 3 downto 0);
signal clr2 :std_logic;
signal contador2 : std_logic_vector( 2 downto 0);
begin

sound : process( clk)


begin
if rising_edge( clk) then
ep <= ef;
if ep= S1 then
contador<= contador + 1;
if contador = 9 then
contador<="0000";
clr2<=not clr2;
end if;

contador2<= contador2 + 1;

end if;
end if;

end process sound;

combi: process(ep, start)


begin
ef <= ep;
case ep is
when S0=> p<='0';
if start='1' then
ef <= S1;
else
ef <= S0;
end if;
when S1=>
if start='1' then
ef<= S0;
else
ef<= S1;

if clr2='1' then
p<=contador2(1);
else
p<='0';
end if;

end if;

end case;
end process combi;
end moore;
5. Se desea implementar un circuito transmisor de datos seriales. El dato se recibe de manera
paralela a 8 bits cuando se activa la seal START. Los datos deben salir acompaados de un bit
de inicio (START: que siempre es cero) y un bit de parada (STOP: que siempre es uno). La
velocidad de transmisin es de 9600 bps (bits por segundo). La frecuencia de reloj es de 1MHz.

use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity serial is

port ( p : in std_logic_vector( 7 downto 0);


clk ,start : in std_logic;
q : out std_logic);
end serial;
architecture moore of serial is

type estados is ( s0, s1, s2, s3 , s4,s5,s6,s7,s8,s9,sp);


signal ep, ef: estados;
signal Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8 : std_logic;
begin
process( clk)
begin

if rising_edge(clk) then
ep<= ef;
Q1<=p(7); Q2<=p(6); Q3<=p(5); Q4<=p(4); Q5<=p(3);
Q6<=p(2); Q7<=p(1); Q8<=p(0);
end if;
end process;

process( start, ep)

begin
ef<=ep;
case ep is
when s0=> q<='1';
if start='1' then ef<=s1; else ef<=s0; end if;

when s1 => q<='0'; ef <= s2;

when s2 => q<=Q1; ef<=s3;

when s3=> q<=Q2; ef<=s4;

when s4=> q<= Q3; ef<=s5;

when s5=> q<= Q4; ef<=s6;

when s6=> q<= Q5; ef<=s7;

when s7=> q<= Q6; ef<=s8;


when s8=> q<= Q7; ef<=s9;
when s9=> q<= Q8; ef<=sp;
when sp=> q<= '1'; ef<=s0;

end case;
end process;

end moore;

You might also like