---------------------------------------------------------------------------
-- File           : p_addresses.vhd
-- Author(s)      : Nikola Avramovic
-- Created        : February 16th, 2019
---------------------------------------------------------------------------
-- Description    : Addresses use for implementaion of objects 
---------------------------------------------------------------------------

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

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

package p_addresses is
   subtype TYPE_ONE_WORD is unsigned(C_WORD_LENGTH-1 downto 0);
   type TYPE_OBJECT_ADDRESS is array (C_MAX_ADDRESS_PER_OBJECT-1 downto 0) of TYPE_ONE_WORD;

   ----------------------------------------------------------------
   -- Object Generators are defined as 32 bits address
   -- 0 to 127 is reserved for object generator
   ----------------------------------------------------------------
   constant C_OBJECT_GEN_OFFSET_0      : natural  := 16#00#;
   constant C_OBJECT_GEN_MAX_ADDR_0    : natural  := 16#1F#;
   constant C_OBJECT_GEN_OFFSET_1      : natural  := 16#20#;
   constant C_OBJECT_GEN_MAX_ADDR_1    : natural  := 16#3F#;
   constant C_OBJECT_GEN_OFFSET_2      : natural  := 16#40#;
   constant C_OBJECT_GEN_MAX_ADDR_2    : natural  := 16#5F#;

   ----------------------------------------------------------------
   -- Object Monitors are defined as 32 bits address
   -- 128 to 255 is reserved for object generator
   ----------------------------------------------------------------
   constant C_OBJECT_MON_OFFSET_0      : natural  := 16#80#;
   constant C_OBJECT_MON_MAX_ADDR_0    : natural  := 16#9F#;
   constant C_OBJECT_MON_OFFSET_1      : natural  := 16#BF#;
   constant C_OBJECT_MON_MAX_ADDR_1    : natural  := 16#CF#;
   constant C_OBJECT_MON_OFFSET_2      : natural  := 16#D0#;
   constant C_OBJECT_MON_MAX_ADDR_2    : natural  := 16#EF#;

   ----------------------------------------------------------------
   -- Object Generators 0 has status counters on address
   ----------------------------------------------------------------
   constant C_PATTERN_ERROR_0          : natural  := C_OBJECT_GEN_OFFSET_0;
   constant C_PORT_ERROR_0             : natural  := C_PATTERN_ERROR_0 + C_BYTE_LENGTH;
   constant C_MASTER_ERROR_0           : natural  := C_PORT_ERROR_0 + C_BYTE_LENGTH;

end package;

