-------------------------------------------------------------------------------
-- Title       : palet
-- Project     : 
-------------------------------------------------------------------------------
-- File        : palet.vhd
-- Author      : Frederic Lochon
-- Company     : 
-- Last update : 2002/12/10
-- Platform    : 
-------------------------------------------------------------------------------
-- Description :
-- detection approximative de zones de couleur (a choisir au moment de la
-- synthese)
-------------------------------------------------------------------------------
-- Modification history :
-- 2002/11/28 : created
-- 2006/02/11 : rewritten
-------------------------------------------------------------------------------

LIBRARY ieee, work;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
USE ieee.std_logic_unsigned.all;

ENTITY fenetre IS

	PORT (
		cpt_line	: IN  integer range 0 to 511;
		cpt_row	    : IN  integer range 0 to 1023;
		clock		: in std_logic;

		win      : OUT std_logic;
		end_of_frame : out std_logic;
		new_frame_n : out std_logic
	);

END fenetre ;

ARCHITECTURE carree OF fenetre IS 
  
	BEGIN

	windows : process (clock, cpt_line, cpt_row)
	begin
		if rising_edge(clock) then
			if cpt_line < 10 or cpt_line > 276 or cpt_row < 10 or cpt_row > 700 then
				win <= '0';
			else
				win <= '1';
			end if;
			if cpt_line = 276 then
				end_of_frame <= '1';
			else
				end_of_frame <= '0';
			end if;
			if cpt_line = 0 and cpt_row = 1 then
				new_frame_n <= '0';
			else
				new_frame_n <= '1';
			end if;
		end if;
	end process;


-------------------------------------------------------------------------------

end carree;

