-- Scott Sirowy -- February 7th, 2007 -- Component reads memory and outputs appropriate colors to VGA screen library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity rgb_read is Port ( hcount : in std_logic_vector(9 downto 0); vcount : in std_logic_vector(8 downto 0); input : in std_logic_vector(3 downto 0); ram_addr : out std_logic_vector(11 downto 0); red : out std_logic; blue : out std_logic; green : out std_logic ); end rgb_read; architecture arch of rgb_read is begin --create an address that will address all 64x48 locations --Notice we need 6 bits to address 64 horizontal increments, and also 6 bits --for 48 vertical increments, if we want a finer grained increment, we simply --add a few more bits -- ram_addr <= vcount(8 downto 3) & hcount(9 downto 4); process(hcount, vcount) begin --make sure hcount or vcount are still within the screen window if (hcount > "1010000000" or vcount > "111100000") then red <= '0'; green <= '0'; blue <= '0'; else red <= input(0); green <= input(1); blue <= input(2); end if; end process; end arch;