Вы находитесь на странице: 1из 7

UNIVERSIDAD NACIONAL MAYOR DE SAN MARCOS

FACULTAD DE INGENIERA ELECTRNICA


ESCUELA DE INGENIERA ELECTRNICA

DISEO DIGITAL
LABORATORIO No3

USO DEL:
1. PROCESS (VHDL)

PARA EL DISEO DE ELEMENTOS DIVISORES DE FRECUENCIA,


TEMPORIZADORES Y GENERADOR PWM

Profesor: Alfredo Granados Ly

1.- Implementar un divisor de frecuencia que cumpla con la siguiente tabla de verdad:
SEL
00
01
10
11

Fout
CLK/4
CLK/16
CLK/64
CLK

Solucin:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity DIVISOR1 is
port(clk: in std_logic;
selec: in std_logic_vector(1 downto 0);
z: out std_logic);
end DIVISOR1;
architecture SOLUCION of DIVISOR1 is
signal CUENTA: std_logic_vector(5 downto 0);
begin
process(clk)
begin
if clk='1' and clk'event then
CUENTA <= CUENTA+1;
end if;
end process;
z <= CUENTA(1) when selec="00" else
CUENTA(3) when selec="01" else
CUENTA(5) when selec="10" else clk;
end SOLUCION;

2.- Implementar un divisor de frecuencia que cumpla con la siguiente tabla de verdad:
SEL Fout
000
CLK/1
001
CLK/2
010
CLK/3
011
CLK/4
100
CLK/5
otros 0

Solucin:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity DIVISOR2 is
port(clk: in std_logic;
selec: in std_logic_vector(2 downto 0);
z: out std_logic);
end DIVISOR2;
architecture SOLUCION of DIVISOR2 is
signal CUENTA1: std_logic_vector(1 downto 0);
signal CUENTA2: std_logic_vector(1 downto 0);
signal CUENTA3: std_logic_vector(2 downto 0);
begin
process(clk)
begin
if clk='1' and clk'event then
CUENTA1 <= CUENTA1+1;
CUENTA2 <= CUENTA2+1;
CUENTA3 <= CUENTA3+1;
if CUENTA2 = 2 then
CUENTA2 <= "00";
end if;
if CUENTA3 = 4 then
CUENTA3 <= "000";
end if;
end if;
end process;
with selec select z <= clk when "000",
CUENTA1(0) when "001",
CUENTA2(1) when "010",
CUENTA1(1) when "011",
CUENTA3(2) when "100",
'0' when others;
end SOLUCION;

------

clk/1
clk/2
clk/3
clk/4
clk/5

3.- Implementar un circuito que genere 1Hz a partir de 48MHz, debe tener un
habilitador.
Solucin:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity DIV_1HZ is
port(clk,ena: in std_logic;
z: buffer std_logic);
end DIV_1HZ;
architecture SOLUCION of DIV_1HZ is
signal CUENTA: std_logic_vector(24 downto 0);
begin
process(ena,clk)
begin
if ena='0' then
CUENTA <= (others=>'0');
z <= '0';
elsif clk='1' and clk'event then
CUENTA <= CUENTA+1;
if CUENTA = 24000000 then
CUENTA <= (others=>'0');
z <= not z;
end if;
end if;
end process;
end SOLUCION;

4.- Implementar un circuito para temporizar 10ms, la salida debe activarse en el


momento que transcurre el tiempo de 10ms. Debe tener una seal de entrada que
habilite el temporizador y otra que reinicie el temporizador (que a su vez borre la
salida). Considere una frecuencia de entrada de 48MHz.
Solucin:

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

entity TEMPORIZADOR is
port(clk,ena,reset: in std_logic;
z: buffer std_logic);
end TEMPORIZADOR;
architecture SOLUCION of TEMPORIZADOR is
signal CUENTA: std_logic_vector(18 downto 0);
signal HABILITADO: std_logic;
begin
process(clk,reset)
begin
if reset='1' then
habilitado <= '0';
elsif clk='1'and clk'event then
if ena='1' then
habilitado <= '1';
end if;
end if;
end process;
process(clk,reset)
begin
if reset='1' then
CUENTA <= (others=>'0');
z <= '0';
elsif clk='1' and clk'event then
if HABILITADO = '1' then
CUENTA <= CUENTA+1;
if CUENTA = 480077 then
CUENTA <= (others=>'0');
z <= '1';
end if;
end if;
end if;
end process;
end SOLUCION;

Problemas propuestos:
5.- Implementar un circuito que genere la siguiente forma de onda:
SEL DC
00
10%
01
25%
10
75%
11
90%
Sabiendo que la seal de reloj es de 48MHz y la salida tiene una frecuencia de 1KHz.
6.- Implementar un circuito divisor de frecuencia programable
SEL
000
001
010
011
100
101
110
111

Fout
0
CLK/2
CLK/10
CLK/50
CLK/100
CLK/200
CLK/1000
1

7.- Implementar un circuito para temporizar:


SEL
00
01
10
11

Tiempo
10ms
100ms
500ms
1000ms

8.- Implementar un circuito para generar una seal PWM con la siguiente caracterstica:
Resolucin: 10 bits.
Escalador: x1, x2, x4, x8, x16
El ciclo de trabajo (DC) se define con 110 bits de entrada.
Tiene habilitador.
9.- Implementar un reloj que cuente los segundos y minutos (MM:SS) y que muestre la
informacin en 4 display a 7 segmentos del tipo nodo comn y comparten los mismos
pines de los segmentos. Utilice el componente diseado en la pregunta 3 como generador
de reloj.

Вам также может понравиться