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

use work.math_pkg.all;
use work.rtps_package.all;
use work.ros_package.all;
use work.GoalInfo_package;

package CancelGoal_package is
    -- REQUEST
    constant RQ_GOAL_INFO_GOAL_ID_MAX_DEPTH     : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH;
    constant RQ_GOAL_INFO_GOAL_ID_ADDR_WIDTH    : natural := GoalInfo_package.GOAL_ID_ADDR_WIDTH;
    
    constant RQ_MAX_GOAL_INFO_GOAL_ID_SIZE          : natural := GoalInfo_package.MAX_GOAL_ID_SIZE;
    constant RQ_MAX_GOAL_INFO_STAMP_SEC_SIZE        : natural := GoalInfo_package.MAX_STAMP_SEC_SIZE;
    constant RQ_MAX_GOAL_INFO_STAMP_NANOSEC_SIZE    : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE;
    constant RQ_MAX_GOAL_INFO_STAMP_SIZE            : natural := GoalInfo_package.MAX_STAMP_SIZE;
    constant RQ_MAX_GOAL_INFO_SIZE                  : natural := RQ_MAX_GOAL_INFO_GOAL_ID_SIZE + RQ_MAX_GOAL_INFO_STAMP_SIZE;
    constant RQ_MAX_CANCELGOAL_SIZE                 : natural := RQ_MAX_GOAL_INFO_SIZE;
    
    -- RESPONSE
    constant RR_ERROR_NONE              : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_INT8_WIDTH));
    constant RR_ERROR_REJECTED          : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_INT8_WIDTH));
    constant RR_ERROR_UNKNOWN_GOAL_ID   : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_INT8_WIDTH));
    constant RR_ERROR_GOAL_TERMINATED   : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(3,CDR_INT8_WIDTH));
    
    constant RR_GOALS_CANCELING_GOAL_ID_MAX_DEPTH   : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH;
    constant RR_GOALS_CANCELING_GOAL_ID_ADDR_WIDTH  : natural := GoalInfo_package.GOAL_ID_ADDR_WIDTH;
    constant RR_GOALS_CANCELING_MAX_DEPTH           : natural := 100;
    constant RR_GOALS_CANCELING_ADDR_WIDTH          : natural := log2c(RR_GOALS_CANCELING_MAX_DEPTH);
    
    constant RR_MAX_RETURN_CODE_SIZE                    : natural := 1;
    constant RR_MAX_GOALS_CANCELING_GOAL_ID_SIZE        : natural := GoalInfo_package.MAX_GOAL_ID_SIZE;
    constant RR_MAX_GOALS_CANCELING_STAMP_SEC_SIZE      : natural := GoalInfo_package.MAX_STAMP_SEC_SIZE;
    constant RR_MAX_GOALS_CANCELING_STAMP_NANOSEC_SIZE  : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE;
    constant RR_MAX_GOALS_CANCELING_STAMP_SIZE          : natural := GoalInfo_package.MAX_STAMP_SIZE;
    constant RR_MAX_GOALS_CANCELING_SIZE                : natural := RR_GOALS_CANCELING_MAX_DEPTH * GoalInfo_package.MAX_GOALINFO_SIZE;
    constant RR_MAX_CANCELGOAL_SIZE                     : natural := RR_MAX_RETURN_CODE_SIZE + RR_MAX_GOALS_CANCELING_SIZE;
end package;