Guest
for a project I need to make a vga controller.
The purpose is that their will appear 3 rectangles at the screen.
Is it possible to have a look maybe at the code,since nothing is
appearing at the screen and I have a really hard time to find the
error.
this is the timing
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity vgatiming is
Port ( clock48 : in std_logic;
red : in std_logic;
blue : in std_logic;
green : in std_logic;
out_red : out std_logic;
out_blue : out std_logic;
out_green : out std_logic;
v_sync : out std_logic;
h_sync : out std_logic;
x_pointer : out std_logic_vector(9 downto 0);
y_pointer : out std_logic_vector(9 downto 0));
end vgatiming;
architecture Behavioral of vgatiming is
signal sv_sync : std_logic;
signal sh_sync : std_logic;
signal sx_pointer,sy_pointer : std_logic_vector(9 downto 0);
signal visible,vish,visv : std_logic;
signal clock24: std_logic;
begin
klokdeling: process (clock48)
--variabelen klokdelers
variable tel_klok24 : integer range 0 to 2**2-1;
--einde variabelen klokdelers
begin
if (clock48'event and clock48 = '1') then
tel_klok24 := tel_klok24 + 1;
if (tel_klok24 = 2) then
tel_klok24 := 0;
clock24 <= '1';
else
clock24 <= '0';
end if;
end if;
end process klokdeling;
timing: process (clock24)
begin
if (clock24'EVENT) and (clock24='1')then
-- generatie horizontale timing
-- Horiz_sync ------------------------------------__________--------
-- H_count 0 640 659 755 799
if (sx_pointer = 799)then
sx_pointer <= "0000000000";
else
sx_pointer <= sx_pointer + 1;
end if;
-- generatie horizontale signaal
if (sx_pointer <= 755) and (sx_pointer >= 659) then
sh_sync <= '0';
else
sh_sync <= '1';
end if;
-- generatie verticale timing
-- Vert_sync
-----------------------------------------------_______------------
-- V_count 0 480
493-494 524
if (sy_pointer = 524) and (sx_pointer >= 699) then
sy_pointer <= "0000000000";
else
sy_pointer <= sy_pointer + 1;
end if;
-- generatie vericaal signaal
if (sy_pointer <= 494) and (sx_pointer >= 493) then
sh_sync <= '0';
else
sh_sync <= '1';
end if;
-- generatie visible signaal
if (sx_pointer <= 639) then
vish <= '1';
x_pointer <= sx_pointer;
else
vish <= '0';
end if;
if (sy_pointer <= 479) then
visv <= '1';
y_pointer <= sy_pointer;
else
visv <= '0';
end if;
end if;
-- signalen uitsturen op uitgangen
out_red <= red and visible;
out_green <= green and visible;
out_blue <= blue and visible;
h_sync <= sh_sync;
v_sync <= sv_sync;
end process timing;
-- totale visible signaal = wanneer visv en vish hoog zijn
visible <= vish and visv;
end Behavioral;
this is the top program
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
Library UNISIM;
use UNISIM.vcomponents.all;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity vgatest is
port(clock48 : in std_logic;
R, G, B, H, V : out std_logic ;
ramre : out std_logic;
ramwe : out std_logic;
flashre : out std_logic;
flashwe : out std_logic);
end vgatest;
architecture Behavioral of vgatest is
component vgatiming is
Port ( clock48 : in std_logic;
red : in std_logic;
blue : in std_logic;
green : in std_logic;
out_red : out std_logic;
out_blue : out std_logic;
out_green : out std_logic;
v_sync : out std_logic;
h_sync : out std_logic;
x_pointer : out std_logic_vector(9 downto 0);
y_pointer : out std_logic_vector(9 downto 0));
end component;
signal row, column : std_logic_vector(9 downto 0);
signal red, green, blue : std_logic;
--signal clock_24 : std_logic;
begin
ramre <= '1';
ramwe <= '1';
flashre <= '1';
flashwe <= '1';
-- for debugging: to view the bit order
timing : component vgatiming
port map ( clock48 => clock48, red => red, green => green, blue =>
blue,
y_pointer => row, x_pointer=> column,
out_red => R, out_green => G, out_blue => B, h_sync =>
H, v_sync => V);
-- red square from 0,0 to 360, 350
-- green square from 0,250 to 360, 640
-- blue square from 120,150 to 480,500
RGB : process(row, column)
begin
-- wait until clock = '1';
if row < 360 and column < 350 then
red <= '1';
else
red <= '0';
end if;
if row < 360 and column > 250 and column < 640 then
green <= '1';
else
green <= '0';
end if;
if row > 120 and row < 480 and column > 150 and column < 500 then
blue <= '1';
else
blue <= '0';
end if;
end process;
end Behavioral;
thanks for having a look at it!!
kind regards
The purpose is that their will appear 3 rectangles at the screen.
Is it possible to have a look maybe at the code,since nothing is
appearing at the screen and I have a really hard time to find the
error.
this is the timing
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity vgatiming is
Port ( clock48 : in std_logic;
red : in std_logic;
blue : in std_logic;
green : in std_logic;
out_red : out std_logic;
out_blue : out std_logic;
out_green : out std_logic;
v_sync : out std_logic;
h_sync : out std_logic;
x_pointer : out std_logic_vector(9 downto 0);
y_pointer : out std_logic_vector(9 downto 0));
end vgatiming;
architecture Behavioral of vgatiming is
signal sv_sync : std_logic;
signal sh_sync : std_logic;
signal sx_pointer,sy_pointer : std_logic_vector(9 downto 0);
signal visible,vish,visv : std_logic;
signal clock24: std_logic;
begin
klokdeling: process (clock48)
--variabelen klokdelers
variable tel_klok24 : integer range 0 to 2**2-1;
--einde variabelen klokdelers
begin
if (clock48'event and clock48 = '1') then
tel_klok24 := tel_klok24 + 1;
if (tel_klok24 = 2) then
tel_klok24 := 0;
clock24 <= '1';
else
clock24 <= '0';
end if;
end if;
end process klokdeling;
timing: process (clock24)
begin
if (clock24'EVENT) and (clock24='1')then
-- generatie horizontale timing
-- Horiz_sync ------------------------------------__________--------
-- H_count 0 640 659 755 799
if (sx_pointer = 799)then
sx_pointer <= "0000000000";
else
sx_pointer <= sx_pointer + 1;
end if;
-- generatie horizontale signaal
if (sx_pointer <= 755) and (sx_pointer >= 659) then
sh_sync <= '0';
else
sh_sync <= '1';
end if;
-- generatie verticale timing
-- Vert_sync
-----------------------------------------------_______------------
-- V_count 0 480
493-494 524
if (sy_pointer = 524) and (sx_pointer >= 699) then
sy_pointer <= "0000000000";
else
sy_pointer <= sy_pointer + 1;
end if;
-- generatie vericaal signaal
if (sy_pointer <= 494) and (sx_pointer >= 493) then
sh_sync <= '0';
else
sh_sync <= '1';
end if;
-- generatie visible signaal
if (sx_pointer <= 639) then
vish <= '1';
x_pointer <= sx_pointer;
else
vish <= '0';
end if;
if (sy_pointer <= 479) then
visv <= '1';
y_pointer <= sy_pointer;
else
visv <= '0';
end if;
end if;
-- signalen uitsturen op uitgangen
out_red <= red and visible;
out_green <= green and visible;
out_blue <= blue and visible;
h_sync <= sh_sync;
v_sync <= sv_sync;
end process timing;
-- totale visible signaal = wanneer visv en vish hoog zijn
visible <= vish and visv;
end Behavioral;
this is the top program
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
Library UNISIM;
use UNISIM.vcomponents.all;
-- Uncomment the following lines to use the declarations that are
-- provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;
entity vgatest is
port(clock48 : in std_logic;
R, G, B, H, V : out std_logic ;
ramre : out std_logic;
ramwe : out std_logic;
flashre : out std_logic;
flashwe : out std_logic);
end vgatest;
architecture Behavioral of vgatest is
component vgatiming is
Port ( clock48 : in std_logic;
red : in std_logic;
blue : in std_logic;
green : in std_logic;
out_red : out std_logic;
out_blue : out std_logic;
out_green : out std_logic;
v_sync : out std_logic;
h_sync : out std_logic;
x_pointer : out std_logic_vector(9 downto 0);
y_pointer : out std_logic_vector(9 downto 0));
end component;
signal row, column : std_logic_vector(9 downto 0);
signal red, green, blue : std_logic;
--signal clock_24 : std_logic;
begin
ramre <= '1';
ramwe <= '1';
flashre <= '1';
flashwe <= '1';
-- for debugging: to view the bit order
timing : component vgatiming
port map ( clock48 => clock48, red => red, green => green, blue =>
blue,
y_pointer => row, x_pointer=> column,
out_red => R, out_green => G, out_blue => B, h_sync =>
H, v_sync => V);
-- red square from 0,0 to 360, 350
-- green square from 0,250 to 360, 640
-- blue square from 120,150 to 480,500
RGB : process(row, column)
begin
-- wait until clock = '1';
if row < 360 and column < 350 then
red <= '1';
else
red <= '0';
end if;
if row < 360 and column > 250 and column < 640 then
green <= '1';
else
green <= '0';
end if;
if row > 120 and row < 480 and column > 150 and column < 500 then
blue <= '1';
else
blue <= '0';
end if;
end process;
end Behavioral;
thanks for having a look at it!!
kind regards