Escolar Documentos
Profissional Documentos
Cultura Documentos
Código: 12190016
INFORME FINA # 1
CONTADOR DE 0-9999 EN FPGA
I. OBJETIVO
Conocer el VHDL como lenguaje de descripción de hardware para el diseño de
sistemas digitales
Conocer la estructura del lenguaje VHDL y su aplicación en FPGA
Una vez hecho el análisis se propone el siguiente diagrama de bloques del circuito
a implementar:
1
DISEÑO DIGITAL 3-5-2016
2
DISEÑO DIGITAL 3-5-2016
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity contador_9999 is
port( clk: in std_logic;
display: out std_logic_vector(7 downto 0);
ena: out std_logic_vector(3 downto 0));
end contador_9999;
begin
--Primer divisor, divide la frecuencia hasta 1Hz
process(clk)
begin
if clk='1' and clk'event then
cuenta1<=cuenta1+1;
if cuenta1=23999999 then
cuenta1<=(others=>'0');
clk_1hz<= not clk_1hz;
end if;
end if;
end process;
--Segundo divisor, divide la frecuencia para al multiplexado, se eligió 100Hz con
buenos
--resultados
process(clk)
begin
if clk='1' and clk'event then
cuenta2<=cuenta2+1;
if cuenta2=23999 then
cuenta2<=(others=>'0');
clk_mux<= not clk_mux;
end if;
end if;
end process;
--Process del contador, contador de 0 a 9999 con clock de 1hz
process(clk_1hz)
begin
if clk_1hz='1' and clk_1hz'event then
3
DISEÑO DIGITAL 3-5-2016
q1<=q1+1;
if q1=9 then
q1<="0000";
q2<=q2+1;
if q2=9 then
q2<="0000";
q3<=q3+1;
if q3=9 then
q3<="0000";
q4<=q4+1;
if q4=9 then
q4<="0000";
end if;
end if;
end if;
end if;
end if;
end process;
process(clk_mux)
begin
if clk_mux='1' and clk_mux'event then
sel<=sel+1;
if sel=3 then
sel<="00";
end if;
end if;
end process;
--Multiplexor
with sel select Q<= q1 when "00",
q2 when "01",
q3 when "10",
q4 when others;
-- Decodificador de enable
with sel select ena<="1110" when "00",
"1101" when "01",
"1011" when "10",
"0111" when others;
--Decodificador a 7 segmentos
end circuito;
4
DISEÑO DIGITAL 3-5-2016