library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity video_generator_tester is
end video_generator_tester;

architecture test of video_generator_tester is
	signal color : std_logic_vector(17 downto 0);
	
	signal column		:unsigned (8 downto 0);
	signal start_screen :std_logic;
	signal start_row	:std_logic;

	signal clock 	: std_logic;
	signal reset 	: std_logic := '1';
	
	signal vga_clock : std_logic;
	signal vga_h_sync : std_logic;
	signal vga_v_sync : std_logic;
	signal vga_blank : std_logic;
	signal vga_sync : std_logic;
	signal vga_r : unsigned(9 downto 0);
	signal vga_g : unsigned(9 downto 0);
	signal vga_b : unsigned(9 downto 0);

begin
	video_generator_instance: entity work.video_generator port map (
		clock => clock,
		reset => reset, 
		
		color => color,
		col_to_read => column,
		start_row => start_row,
		start_screen => start_screen,
		vga_clock => vga_clock,
		vga_h_sync => vga_h_sync,
		vga_v_sync => vga_v_sync,
		vga_blank => vga_blank,
		vga_sync => vga_sync,
		vga_r => vga_r,
		vga_g => vga_g,
		vga_b => vga_b
	);
	
	process
	begin
		loop
			clock <= '0';
			wait for 10 ns;
			clock <= '1';
			wait for 10 ns;
		end loop;
	end process;
	
	process
	begin
		reset <= '1'; wait for 20 ns;
		reset <= '0'; wait for 20 ns;
		wait for 18 ms;
		report "Don't worry, it's just the end of the simulation." severity failure;
	end process;

--		color <= "000000111111000000 " wait for 20 ns;
--		reset <= '1'; wait for 20 ns;
--		reset <= '0'; wait for 400 ns;
--		assert vga_r <= "0000000000", report "output color green " severity error;
--		assert vga_g <= "1111111111", report "output color green " severity error;
--		assert vga_b <= "0000000000", report "output color green " severity error;
		
--		--col_to_read <=
--		
--		color <= "111111111111000000 " wait for 20 ns;
--		reset <= '1'; wait for 20 ns;
--		reset <= '0'; wait for 400 ns;
--		assert vga_r <= "0000000000", 

	process(clock)
	begin
		if rising_edge(clock) then
			if column = 0 then
				color <= (others => '1');
			elsif column > 100 and column < 110 then
				color <= "111111000000000000";
			elsif column > 150 and column < 160 then
				color <= "000000111111000000";
			elsif column > 200 and column < 210 then
				color <= "000000000000111111";
			elsif column = 319 then
				color <= (others => '1');
			else
				color <= (others => '0');
			end if;
		end if;
	end process;

		  
		
end test;