library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

use work.freq_table.all;

entity display_boxes is
    Port ( interest_colour_in : in std_logic_vector(7 downto 0);
           line_counter_in 	: in integer;
           pixel_counter_in 	: in integer;
           nObject_found_out 	: out std_logic;
		 
		 PCLK_in			: in std_logic; 
		 PREF_in			: in std_logic;
		 SCLK_in			: in std_logic;
		 data_UV_in		: in std_logic_vector(7 downto 0);					
		 
		 );
end display_boxes;

architecture Behavioral of display_boxes is

   signal resetin_1			: std_logic;
   signal resetout_1		: std_logic;
   signal datardy_1			: std_logic;
   signal record_1			: std_logic;
   signal outrdy_1			: std_logic;
   signal data_out1			: std_logic_vector(7 downto 0);
   signal object_found_1		: std_logic; --high if the square has the most occuring colour as the
   								   --colour of interest

   --how long each side of the square is in pixels
   constant SQUARE_WIDTH		: integer := 50;


begin

   pixelcount1: frequency_table port map(
   	reset_in => resetin_1,
	reset_out => resetout_1,
	dataclk_in => PCLK_in,
	dataclk90_in => PREF_in,
	dbldataclk_in => SCLK_in,
	data_in => data_UV_in,
	data_rdy_in => datardy_1,
	record_in => record_1,
	lowerlimit_in => LOWERCAP_LIMIT,
	upperlimit_in => UPPERCAP_LIMIT,
	data_rdy_out => outrdy_1,
	sort_addr_in => "000",
	data_out => data_out1);

	datardy_1 <= '1' when (pixel_counter > ((SQUARE_WIDTH * 1) - SQUARE_WIDTH) and pixel_counter < (SQUARE_WIDTH * 1)) else '0';




end Behavioral;
