Professional Documents
Culture Documents
DE SAN MARCOS
(Universidad del Per, Decana de Amrica)
DISEO DIGITAL
LABORATORIO No4
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
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;
begin
proceso1 : process( ep,x)
begin
case ep is
if x='1' then
ef<= s2;
else
ef<= s1;
end if;
if x='1' then
ef<= s3;
else
ef<= s1;
end if;
if x='1' then
ef<= s0;
else
ef<= s4;
end if;
if x='1' then
ef<= s5;
else
ef<= s1;
end if;
if x='1' then
ef<= s3;
else
ef<= s6;
end if;
when s7 =>
if x='1' then
ef<= s0;
z<='0';
else
ef<= s1;
z<= '1';
end if;
end case;
if rising_edge(clk) then
ep<=ef;
end if;
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;
if rising_edge(clk) then
ep <= ef;
if ep=s1 or ep=s2 then
contador <= contador +1;
end if;
end if;
end process reloj;
ef<= ep;
case ep is
if x='1' then
ef<= s0;
else
ef<= s1;
end if;
end if;
if contador=7 then
ef<=s4;
elsif x='1' then
ef<= s1;
else
ef<= s2;
end if;
if x='1' then
ef<= s0;
else
ef<= s1;
end if;
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
contador2<= contador2 + 1;
end if;
end if;
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
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;
begin
ef<=ep;
case ep is
when s0=> q<='1';
if start='1' then ef<=s1; else ef<=s0; end if;
end case;
end process;
end moore;