Inicio del diseño de la unidad vga
Esta semana hemos iniciado el trabajo de diseño en vhdl de nuestro sistema digital. Hemos comenzado por los circuitos que compondran la unidad de video encargada de generar una señal VGA para su posterior visualización en un monitor. Los circuitos diseñados hasta el momento son: un generador de pulsos de sincronismo horizontal, un generador de pulsos de sincronismo vertical, un contador de ciclos de reloj para la señal de sincronismo horizontal, un contador de ciclos de reloj para la señal de sincronismo vertical y un generador de la señal de sincronismo de blanking.
A continuacion se puede observar el contenido de la primera version de cada uno de los ficheros vhd.
———————————————————————————-
– Company: Universidad de Vigo
– Engineer: Pablo Porta González
– Antonio José Vázquez Álvarez
– Create Date: 17:13:09 04/13/2008
– Design Name:
– Module Name: Generador_pulsosync_horizontal – pulso_sincronia_horizontal
– Project Name: Osciloscopio_Digital
– Target Devices: xc3s200
– Tool versions: ise Foundation 8.2i
– Description: Circuito generador de la senhal de sincronismo horizontal para
– una senhal VGA (fin de la linea)
– Dependencies:
–
– Revision:
– Revision 0.01 – File Created
– Additional Comments:
–
———————————————————————————-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
—- Uncomment the following library declaration if instantiating
—- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity Generador_pulsosync_horizontal is
Port ( clk50MHZ : in STD_LOGIC; –senhal de reloj
reset : in STD_LOGIC; –senhal de reset sincrono
contador_horizontal : in STD_LOGIC_VECTOR (10 downto 0); –contador del numero de pixeles
Pulso_sync_horizontal : out STD_LOGIC); –senhal de sincronia horizontal
end Generador_pulsosync_horizontal;
architecture pulso_sincronia_horizontal of Generador_pulsosync_horizontal is
–Declaracion de senhales auxiliares
———————————————————————————-
SIGNAL h_ctr: integer range 1586 downto 0; –contador de estado (tenemos 1586 ciclos de reloj para una linea)
SIGNAL pulsoH_aux, cambio_estado: STD_LOGIC;–senhal de pulso de sincronia horizontal auxiliar, estado del pulso
–Descripcion del circuito
———————————————————————————-
begin
Pulso_sync_horizontal<=pulsoH_aux;
h_ctr<=CONV_INTEGER (contador_horizontal); –conversion de tipos (vector->entero)
–generacion del pulso de sincronia horizontal
———————————————————————————–
PULSO: Process (clk50MHZ,reset,cambio_estado)
begin
if reset = ’1′ then
pulsoH_aux <= ’1′;
elsif clk50MHz=’1′ and clk50MHz’event then
if cambio_estado = ’1′ then –comprobamos si el pulso horizontal ha de cambiar de estado
pulsoH_aux <= not pulsoH_aux;
else
pulsoH_aux <= pulsoH_aux;
end if;
end if;
end process; –end PULSO
–el pulso horizontal debe cambiar de estado en instantes determinados
———————————————————————————–
ESTADO: Process (h_ctr)
begin
if (h_ctr = 1326) or (h_ctr = 1514) then
cambio_estado <= ’1′;
else
cambio_estado <= ’0′;
end if;
end process;–end ESTADO
end pulso_sincronia_horizontal;
———————————————————————————-
– Company: Universidad de Vigo
– Engineer: Pablo Porta González
– Antonio José Vázquez Álvarez
– Create Date: 17:46:33 04/13/2008
– Design Name:
– Module Name: Generador_pulsosync_vertical – Behavioral
– Project Name: Osciloscopio_Digital
– Target Devices: xc3s200
– Tool versions: ise Foundation 8.2i
– Description: generador del pulso de sincronia vertical para una señal VGA
– (fin del cuadro de imagen)
– Dependencies:
–
– Revision:
– Revision 0.01 – File Created
– Additional Comments:
–
———————————————————————————-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
—- Uncomment the following library declaration if instantiating
—- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity Generador_pulsosync_vertical is
Port ( reset : in STD_LOGIC; –senhal de reset sincrono
clk50MHZ : in STD_LOGIC; –senhal de de reloj
contador_vertical : in STD_LOGIC_VECTOR (9 downto 0); –contador vertical
pulso_sync_vertical : out STD_LOGIC); –pulso de sincronia vertical
end Generador_pulsosync_vertical;
architecture pulso_sincronia_vertical of Generador_pulsosync_vertical is
–Declaracion de senhales auxiliares
——————————————————————————–
SIGNAL V_ctr: integer range 524 downto 0;
–Descripcion del circuito
——————————————————————————–
begin
V_ctr <= CONV_INTEGER (contador_vertical); –conversion de tipos (vector->entero)
–generador del pulso de sincronia vertical
——————————————————————————–
PULSO:Process (clk50MHz,reset,V_ctr)
begin
if reset = ’1′ then
pulso_sync_vertical <= ’1′;
elsif clk50MHz=’1′ and clk50MHz’event then
if (V_ctr >= 500) and (V_ctr <= 502) then
pulso_sync_vertical <= ’0′;
else
pulso_sync_vertical <= ’1′;
end if;
end if;
end process;–end PULSO
end pulso_sincronia_vertical;
———————————————————————————-
– Company: Universidad de Vigo
– Engineer: Pablo Porta González
– Antonio José Vázquez Álvarez
– Create Date: 19:52:14 04/13/2008
– Design Name:
– Module Name: CTR_horizontal – contaje_horizontal
– Project Name: Osciloscopio_Digital
– Target Devices: xc3s200
– Tool versions: ise Foundation 8.2i
– Description: contador de los ciclos de reloj necesarios para el sincronismo horizontal
–
– Dependencies:
–
– Revision:
– Revision 0.01 – File Created
– Additional Comments:
–
———————————————————————————-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
—- Uncomment the following library declaration if instantiating
—- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity CTR_horizontal is
Port ( clk50MHZ : in STD_LOGIC; –senhal de reloj
reset : in STD_LOGIC; –senhal de reset sincrono
senhal_contaje : out STD_LOGIC_VECTOR (10 downto 0)); –vector de contaje
end CTR_horizontal;
architecture contaje_horizontal of CTR_horizontal is
–Declaracion de senhales auxiliares
———————————————————————————–
SIGNAL contaje_int: integer range 1586 downto 0; –senhal de contaje
–Descripcion del circuito
———————————————————————————–
begin
senhal_contaje <= CONV_STD_LOGIC_VECTOR (contaje_int,11); –conversion de tipos (entero->vector)
–Proceso de contaje
———————————————————————————–
CUENTA: Process (clk50MHZ,reset,contaje_int)
begin
if reset = ’1′ then contaje_int <= 0;
elsif (clk50MHZ = ’1′ and clk50MHZ’event) then
if contaje_int = 1586 then
contaje_int <= 0; –en el estado 1,586 volvemos a cero
else
contaje_int <= contaje_int + 1;
end if;
end if;
end Process; –end CUENTA
end contaje_horizontal;
———————————————————————————-
– Company: Universidad de Vigo
– Engineer: Pablo Porta González
– Antonio José Vázquez Álvarez
– Create Date: 20:25:01 04/13/2008
– Design Name:
– Module Name: CTR_vertical – contaje_vertical
– Project Name: Osciloscopio_Digital
– Target Devices: xc3s200
– Tool versions: ise Foundation 8.2i
– Description: Contador de ciclos de reloj para la senhal de sincronismo vertical
–
– Dependencies:
–
– Revision:
– Revision 0.01 – File Created
– Additional Comments:
–
———————————————————————————-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
—- Uncomment the following library declaration if instantiating
—- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity CTR_vertical is
Port ( Sync_horizontal : in STD_LOGIC;
senhal_contaje : out STD_LOGIC_VECTOR (9 downto 0);
reset : in STD_LOGIC;
clk50MHZ : in STD_LOGIC);
end CTR_vertical;
architecture contaje_vertical of CTR_vertical is
–Declaracion de senhales auxiliares
——————————————————————
SIGNAL contaje_int : integer range 524 downto 0;
SIGNAL H_sync_aux,H_sync_t_1,Fa_H_sync: STD_LOGIC; –senhales para el computo del flanco de reloj
–Descripcion del circuito
——————————————————————
begin
senhal_contaje <= CONV_STD_LOGIC_VECTOR (contaje_int, 10); –conversion de tipos (entero->vector)
–Detector de flancos ascendentes para el sincronismo horizontal
——————————————————————-
DETECTOR: Process (reset,clk50MHz,H_sync_aux,H_sync_t_1)
begin
if reset = ’1′ then H_sync_aux <= ’0′;
H_sync_t_1 <= ’0′;
elsif (clk50MHz = ’1′ and clk50MHz’event) then
H_sync_t_1 <= H_sync_aux;
H_sync_aux <= Sync_horizontal;
end if;
FA_H_sync <= H_sync_aux and not H_sync_t_1;
end process;–end DETECTOR
–contador vertical
——————————————————————
CONTADOR: Process (FA_H_sync,reset,contaje_int,clk50MHz)
begin
if reset = ’1′ then
contaje_int <= 0;
elsif (clk50MHz=’1′ and clk50MHz’event) then
if FA_H_sync = ’1′ then
if contaje_int = 524 then
contaje_int <= 0;
else
contaje_int <= contaje_int + 1;
end if;
end if;
end if;
end process;–end CONTADOR
end contaje_vertical;
———————————————————————————-
– Company: Universidad de Vigo
– Engineer: Pablo Porta González
– Antonio José Vázquez Álvarez
– Create Date: 18:09:04 04/13/2008
– Design Name:
– Module Name: Generador_blanking – pulso_de_blanking
– Project Name: Osciloscopio_Digital
– Target Devices: xc3s200
– Tool versions: ise Foundation 8.2i
– Description: generador del pulso de blanking para la senhal VGA
–
– Dependencies:
–
– Revision:
– Revision 0.01 – File Created
– Additional Comments:
–
———————————————————————————-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
—- Uncomment the following library declaration if instantiating
—- any Xilinx primitives in this code.
–library UNISIM;
–use UNISIM.VComponents.all;
entity Generador_blanking is
Port ( clk50MHZ : in STD_LOGIC; –senhal de reloj
contador_vertical : in STD_LOGIC_VECTOR (9 downto 0); –contador vertical
contador_horizontal : in STD_LOGIC_VECTOR (10 downto 0); –contador horizontal
reset : in STD_LOGIC; –senhal de reset
pulso_blank : out STD_LOGIC); –pulso de blanking
end Generador_blanking;
architecture pulso_de_blanking of Generador_blanking is
–Declaracion de senhales auxiliares
———————————————————————————-
SIGNAL H_ctr : integer range 1586 downto 0; –senhales de conteo
SIGNAL V_ctr : integer range 524 downto 0;
–Descripcion del circuito
———————————————————————————-
begin
H_ctr <= CONV_INTEGER (contador_horizontal); –conversion de tipos (vector->entero)
V_ctr <= CONV_INTEGER (contador_vertical);
–generacion del pulso de blankeo
BLANKEO:Process (H_ctr,V_ctr)
begin
if ((H_ctr >= 1258) and (H_ctr <= 1586)) or
((V_ctr >= 480) and (V_ctr <= 524)) then
pulso_blank <= ’0′;
else
pulso_blank <= ’1′;
end if;
end process;–end BLANKEO
end pulso_de_blanking;
para facilitar su consulta tambien se ha colgado la primera version de los ficheros en la carpeta skydrive.