rtps-fpga/src/rtps_package.vhd
Greek 4530688c8b Add test 2 of RTPS Reader
Test user traffic handling (DATA, HEARTBEAT, GAP).
Compiling and Passing
2021-02-21 00:02:22 +01:00

695 lines
49 KiB
VHDL

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.CEIL;
use ieee.math_real.TRUNC;
package rtps_package is
--*****DDSI-RTPS 2.3*****
-- *WIDTHS*
constant WORD_WIDTH : natural := 32;
constant BYTE_WIDTH : natural := 8;
constant UDP_PORT_WIDTH : natural := 16;
constant IPv4_ADDRESS_WIDTH : natural := 32;
constant UDP_HEADER_LENGTH_WIDTH : natural := 16;
-- CDR ENCODING WIDTHS
constant CDR_CHAR_WIDTH : natural := 8;
constant CDR_OCTET_WIDTH : natural := 8;
constant CDR_BOOLEAN_WIDTH : natural := 8;
constant CDR_SHORT_WIDTH : natural := 16;
constant CDR_ENUMERATION_SHORT_WIDTH : natural := 16;
constant CDR_LONG_WIDTH : natural := 32;
constant CDR_FLOAT_WIDTH : natural := 32;
constant CDR_ENUMERATION_WIDTH : natural := 32;
constant CDR_LONG_LONG_WIDTH : natural := 64;
constant CDR_DOUBLE_WIDTH : natural := 64;
constant CDR_LONG_DOUBLE_WIDTH : natural := 64;
-- RTPS
-- NOTE: Widths not defined with a CDR Width are defined as byte arrays (Same Endian representation)
constant GUIDPREFIX_WIDTH : natural := 96;
constant ENTITYID_WIDTH : natural := 32;
constant GUID_WIDTH : natural := GUIDPREFIX_WIDTH + ENTITYID_WIDTH;
constant PROTOCOL_WIDTH : natural := 32;
constant PROTOCOLVERSION_WIDTH : natural := 16;
constant VENDORID_WIDTH : natural := 16;
constant SUBMESSAGE_ID_WIDTH : natural := CDR_OCTET_WIDTH;
constant SUBMESSAGE_FLAGS_WIDTH : natural := CDR_OCTET_WIDTH;
constant SUBMESSAGE_LENGTH_WIDTH : natural := CDR_SHORT_WIDTH;
constant DOMAIN_ID_WIDTH : natural := CDR_LONG_WIDTH;
constant PARAMETER_ID_WIDTH : natural := CDR_SHORT_WIDTH;
constant PARAMETER_LENGTH_WIDTH : natural := CDR_SHORT_WIDTH;
constant PAYLOAD_REPRESENTATION_ID_WIDTH : natural := 16;
constant PAYLOAD_REPRESENTATION_OPTIONS_WIDTH : natural := 16;
constant PARTICIPANT_MESSAGE_KIND_WIDTH : natural := 32;
constant LOCATOR_KIND_WIDTH : natural := CDR_LONG_WIDTH;
constant COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant SUBMESSAGE_DATA_EXTRA_FLAGS_WIDTH : natural := 16;
constant MAX_BITMAP_WIDTH : natural := 256;
constant KEY_HASH_WIDTH : natural := 128;
constant STATUS_INFO_WIDTH : natural := 32;
-- DDS
constant RETURN_CODE_WIDTH : natural := CDR_LONG_WIDTH;
constant STATUS_KIND_WIDTH : natural := CDR_LONG_WIDTH;
constant SAMPLE_STATE_KIND_WIDTH : natural := CDR_LONG_WIDTH;
constant VIEW_STATE_KIND_WIDTH : natural := CDR_LONG_WIDTH;
constant INSTANCE_STATE_KIND_WIDTH : natural := CDR_LONG_WIDTH;
constant QOS_POLICY_ID_WIDTH : natural := CDR_LONG_WIDTH;
constant MAX_SAMPLES_WIDTH : natural := CDR_LONG_WIDTH;
constant DISPOSED_GENERATION_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant NO_WRITERS_GENERATION_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant SAMPLE_RANK_WIDTH : natural := CDR_LONG_WIDTH;
constant GENERATION_RANK_WIDTH : natural := CDR_LONG_WIDTH;
constant ABSOLUTE_GENERATION_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant INCONSISTENT_TOPIC_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant SAMPLE_LOST_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant SAMPLE_REJECTED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant LIVELINESS_LOST_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant LIVELINESS_CHANGED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant OFFERED_DEADLINE_MISSED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant REQUESTED_DEADLINE_MISSED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant OFFERED_INCOMPATIBLE_QOS_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant REQUESTED_INCOMPATIBLE_QOS_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant PUBLICATION_MATCHED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
constant SUBSCRIPTION_MATCHED_STATUS_COUNT_WIDTH : natural := CDR_LONG_WIDTH;
-- *TYPES DEFINITION*
-- Generic Types
type DOUBLE_WORD_ARRAY is array (0 to 1) of unsigned(WORD_WIDTH-1 downto 0);
-- RTPS
-- TODO: Define unconstrained WORD_ARRAY and define constrained subtypes
subtype SEQUENCENUMBER_TYPE is DOUBLE_WORD_ARRAY;
subtype DURATION_TYPE is DOUBLE_WORD_ARRAY;
subtype TIME_TYPE is DOUBLE_WORD_ARRAY;
type GUIDPREFIX_TYPE is array (0 to (GUIDPREFIX_WIDTH/WORD_WIDTH)-1) of std_logic_vector(WORD_WIDTH-1 downto 0);
type GUID_TYPE is array (0 to (GUID_WIDTH/WORD_WIDTH)-1) of std_logic_vector(WORD_WIDTH-1 downto 0);
type BITMAP_TYPE is array (0 to (MAX_BITMAP_WIDTH/WORD_WIDTH)-1) of std_logic_vector(0 to WORD_WIDTH-1);
type KEY_HASH_TYPE is array (0 to (KEY_HASH_WIDTH/WORD_WIDTH)-1) of std_logic_vector(WORD_WIDTH-1 downto 0);
-- DDS
subtype INSTANCE_HANDLE_TYPE is KEY_HASH_TYPE;
subtype PUBLICATION_HANDLE_TYPE is GUID_TYPE;
-- Helper Function
function gen_duration(s,ns : integer) return DURATION_TYPE;
-- *PREDEFINED VALUES*
constant DEFAULT_IPv4_META_ADDRESS : std_logic_vector(IPv4_ADDRESS_WIDTH-1 downto 0) := x"EFFF0001"; -- Default Multicast Ipv4 Address (239.255.0.1)
constant DURATION_ZERO : DURATION_TYPE := (others => (others => '0'));
constant DURATION_INFINITE : DURATION_TYPE := (x"7fffffff", x"ffffffff");
constant TIME_ZERO : TIME_TYPE := (others => (others => '0'));
constant TIME_INVALID : TIME_TYPE := (others => (others => '1'));
constant TIME_INFINITE : TIME_TYPE := (x"ffffffff", x"fffffffe");
constant FIRST_SEQUENCENUMBER : SEQUENCENUMBER_TYPE := (x"00000000", x"00000001");
constant SEQUENCENUMBER_UNKNOWN : SEQUENCENUMBER_TYPE := (x"ffffffff", x"00000000");
constant PROTOCOL_RTPS : std_logic_vector(PROTOCOL_WIDTH-1 downto 0) := x"52545053"; -- 'RTPS' in Ascii code
constant PROTOCOLVERSION_1_0 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0100";
constant PROTOCOLVERSION_1_1 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0101";
constant PROTOCOLVERSION_2_0 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0200";
constant PROTOCOLVERSION_2_1 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0201";
constant PROTOCOLVERSION_2_2 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0202";
constant PROTOCOLVERSION_2_4 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0204";
constant VENDORID_UNKNOWN : std_logic_vector(VENDORID_WIDTH-1 downto 0) := (others => '0');
constant GUIDPREFIX_UNKNOWN : GUIDPREFIX_TYPE := (others => (others => '0'));
constant GUID_UNKNOWN : GUID_TYPE := (others => (others => '0'));
constant UDP_PORT_INVALID : std_logic_vector(UDP_PORT_WIDTH-1 downto 0) := (others => '0');
constant IPv4_ADDRESS_INVALID : std_logic_vector(IPv4_ADDRESS_WIDTH-1 downto 0) := (others => '0');
constant LENGTH_UNLIMITED : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := std_logic_vector(to_signed(-1,CDR_LONG_WIDTH));
-- DDS
constant HANDLE_NIL : INSTANCE_HANDLE_TYPE := (others => (others => '0'));
-- *RETURN CODES* (DDS)
constant RETCODE_OK : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,RETURN_CODE_WIDTH));
constant RETCODE_ERROR : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,RETURN_CODE_WIDTH));
constant RETCODE_UNSUPPORTED : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,RETURN_CODE_WIDTH));
constant RETCODE_BAD_PARAMETER : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(3,RETURN_CODE_WIDTH));
constant RETCODE_PRECONDITION_NOT_MET : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(4,RETURN_CODE_WIDTH));
constant RETCODE_OUT_OF_RESOURCES : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(5,RETURN_CODE_WIDTH));
constant RETCODE_NOT_ENABLED : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(6,RETURN_CODE_WIDTH));
constant RETCODE_IMMUTABLE_POLICY : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(7,RETURN_CODE_WIDTH));
constant RETCODE_INCONSISTENT_POLICY : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(8,RETURN_CODE_WIDTH));
constant RETCODE_ALREADY_DELETED : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(9,RETURN_CODE_WIDTH));
constant RETCODE_TIMEOUT : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(10,RETURN_CODE_WIDTH));
constant RETCODE_NO_DATA : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(11,RETURN_CODE_WIDTH));
constant RETCODE_ILLEGAL_OPERATION : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(12,RETURN_CODE_WIDTH));
-- *STATUS KIND* (DDS)
constant INCONSISTENT_TOPIC_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000001";
constant OFFERED_DEADLINE_MISSED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000002";
constant REQUESTED_DEADLINE_MISSED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000004";
constant OFFERED_INCOMPATIBLE_QOS_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000020";
constant REQUESTED_INCOMPATIBLE_QOS_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000040";
constant SAMPLE_LOST_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000080";
constant SAMPLE_REJECTED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000100";
constant DATA_ON_READERS_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000200";
constant DATA_AVAILABLE_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000400";
constant LIVELINESS_LOST_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00000800";
constant LIVELINESS_CHANGED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00001000";
constant PUBLICATION_MATCHED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00002000";
constant SUBSCRIPTION_MATCHED_STATUS : std_logic_vector(STATUS_KIND_WIDTH-1 downto 0) := x"00004000";
-- *SAMPLE STATE KIND* (DDS)
constant READ_SAMPLE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000001";
constant NOT_READ_SAMPLE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000002";
constant ANY_SAMPLE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"FFFFFFFF";
-- *VIEW STATE KIND* (DDS)
constant NEW_VIEW_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000001";
constant NOT_NEW_VIEW_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000002";
constant ANY_VIEW_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"FFFFFFFF";
-- *INSTANCE STATE KIND* (DDS)
constant ALIVE_INSTANCE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000001";
constant NOT_ALIVE_DISPOSED_INSTANCE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000002";
constant NOT_ALIVE_NO_WRITERS_INSTANCE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000004";
constant NOT_ALIVE_INSTANCE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"00000006";
constant ANY_INSTANCE_STATE : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0) := x"FFFFFFFF";
-- *SAMPLE REJECTED STATUS KIND* (DDS)
constant NOT_REJECTED : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant REJECTED_BY_INSTANCES_LIMIT : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant REJECTED_BY_SAMPLES_LIMIT : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_ENUMERATION_WIDTH));
constant REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(3,CDR_ENUMERATION_WIDTH));
-- *QOS POLICY ID* (DDS)
constant INVALID_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,QOS_POLICY_ID_WIDTH));
constant USERDATA_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,QOS_POLICY_ID_WIDTH));
constant DURABILITY_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,QOS_POLICY_ID_WIDTH));
constant PRESENTATION_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(3,QOS_POLICY_ID_WIDTH));
constant DEADLINE_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(4,QOS_POLICY_ID_WIDTH));
constant LATENCYBUDGET_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(5,QOS_POLICY_ID_WIDTH));
constant OWNERSHIP_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(6,QOS_POLICY_ID_WIDTH));
constant OWNERSHIPSTRENGTH_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(7,QOS_POLICY_ID_WIDTH));
constant LIVELINESS_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(8,QOS_POLICY_ID_WIDTH));
constant TIMEBASEDFILTER_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(9,QOS_POLICY_ID_WIDTH));
constant PARTITION_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(10,QOS_POLICY_ID_WIDTH));
constant RELIABILITY_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(11,QOS_POLICY_ID_WIDTH));
constant DESTINATIONORDER_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(12,QOS_POLICY_ID_WIDTH));
constant HISTORY_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(13,QOS_POLICY_ID_WIDTH));
constant RESOURCELIMITS_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(14,QOS_POLICY_ID_WIDTH));
constant ENTITYFACTORY_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(15,QOS_POLICY_ID_WIDTH));
constant WRITERDATALIFECYCLE_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(16,QOS_POLICY_ID_WIDTH));
constant READERDATALIFECYCLE_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(17,QOS_POLICY_ID_WIDTH));
constant TOPICDATA_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(18,QOS_POLICY_ID_WIDTH));
constant GROUPDATA_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(19,QOS_POLICY_ID_WIDTH));
constant TRANSPORTPRIORITY_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(20,QOS_POLICY_ID_WIDTH));
constant LIFESPAN_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(21,QOS_POLICY_ID_WIDTH));
constant DURABILITYSERVICE_QOS_POLICY_ID : std_logic_vector(QOS_POLICY_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(22,QOS_POLICY_ID_WIDTH));
-- *STATUS INFO*
constant STATUS_INFO_DISPOSED_FLAG : natural := 0;
constant STATUS_INFO_UNREGISTERED_FLAG : natural := 1;
constant STATUS_INFO_FILTERED_FLAG : natural := 2;
-- *SUBMESSAGE IDs*
constant SID_PAD : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"01";
constant SID_ACKNACK : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"06";
constant SID_HEARTBEAT : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"07";
constant SID_GAP : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"08";
constant SID_INFO_TS : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"09";
constant SID_INFO_SRC : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0c";
constant SID_INFO_REPLY_IP4 : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0d";
constant SID_INFO_DST : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0e";
constant SID_INFO_REPLY : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0f";
constant SID_NACK_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"12";
constant SID_HEARTBEAT_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"13";
constant SID_DATA : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"15";
constant SID_DATA_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"16";
-- *SUBMESSAGE FLAG POSITIONS*
-- NOTE: The KEY and NON_STANDARD_PAYOAD Flags for the DATA_FRAG Submessage are off by one (-1) from this positions
constant SUBMESSAGE_ENDIAN_FLAG_POS : natural := 0;
constant SUBMESSAGE_FINAL_FLAG_POS : natural := 1;
constant SUBMESSAGE_INLINE_QOS_FLAG_POS : natural := 1;
constant SUBMESSAGE_DATA_FLAG_POS : natural := 2;
constant SUBMESSAGE_KEY_FLAG_POS : natural := 3;
constant SUBMESSAGE_NON_STANDARD_PAYLOAD_FLAG_POS : natural := 4;
constant SUBMESSAGE_LIVELINESS_FLAG_POS : natural := 2;
constant SUBMESSAGE_MULTICAST_FLAG_POS : natural := 1;
constant SUBMESSAGE_INVALIDATE_FLAG_POS : natural := 1;
-- *PARAMETER IDs*
constant PID_PAD : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0000";
constant PID_SENTINEL : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0001";
constant PID_PARTICIPANT_LEASE_DURATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0002";
constant PID_TIME_BASED_FILTER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0004";
constant PID_TOPIC_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0005";
constant PID_OWNERSHIP_STRENGTH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0006";
constant PID_TYPE_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0007";
constant PID_DOMAIN_ID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"000f";
constant PID_DOMAIN_TAG : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"4014";
constant PID_PROTOCOL_VERSION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0015";
constant PID_VENDORID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0016";
constant PID_RELIABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001a";
constant PID_LIVELINESS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001b";
constant PID_DURABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001d";
constant PID_DURABILITY_SERVICE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001e";
constant PID_OWNERSHIP : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001f";
constant PID_PRESENTATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0021";
constant PID_DEADLINE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0023";
constant PID_DESTINATION_ORDER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0025";
constant PID_LATENCY_BUDGET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0027";
constant PID_PARTITION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0029";
constant PID_LIFESPAN : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002b";
constant PID_USER_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002c";
constant PID_GROUP_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002d";
constant PID_TOPIC_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002e";
constant PID_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002f";
constant PID_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0030";
constant PID_DEFAULT_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0031";
constant PID_METATRAFFIC_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0032";
constant PID_METATRAFFIC_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0033";
constant PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0034";
constant PID_CONTENT_FILTER_PROPERTY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0035";
constant PID_HISTORY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0040";
constant PID_RESOURCE_LIMITS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0041";
constant PID_EXPECTS_INLINE_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0043";
constant PID_DEFAULT_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0048";
constant PID_TRANSPORT_PRIORITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0049";
constant PID_PARTICIPANT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0050";
constant PID_GROUP_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0052";
constant PID_BUILTIN_ENDPOINT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0058";
constant PID_PROPERTY_LIST : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0059";
constant PID_ENDPOINT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"005a";
constant PID_DATA_MAX_SIZE_SERIALIZED : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0060";
constant PID_ENTITY_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0062";
constant PID_BUILTIN_ENDPOINT_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0077";
-- INLINE-QOS ONLY
constant PID_CONTENT_FILTER_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0055";
constant PID_COHERENT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0056";
constant PID_DIRECTED_WRITE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0057";
constant PID_ORIGINAL_WRITER_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0061";
constant PID_GROUP_COHERENT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0063";
constant PID_GROUP_SEQ_NUM : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0064";
constant PID_WRITER_GROUP_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0065";
constant PID_SECURE_WRITER_GROUP_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0066";
constant PID_KEY_HASH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0070";
constant PID_STATUS_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0071";
-- XTYPES 1.3
constant PID_EXTENDED : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"7F01";
constant PID_LIST_END : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"7F02";
constant PID_IGNORE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"3F03";
-- *PAYLOAD REPRESENTATION IDENTIFIERS*
constant CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0000";
constant CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0001";
constant PL_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0002";
constant PL_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0003";
constant XML : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0004";
constant CDR2_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0010";
constant CDR2_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0011";
constant PL_CDR2_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0012";
constant PL_CDR2_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0013";
constant D_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0014";
constant D_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0015";
-- *ENTITY ID*
constant ENTITYID_UNKNOWN : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');
constant ENTITYID_PARTICIPANT : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000001c1");
constant ENTITYID_SEDP_BUILTIN_TOPICS_ANNOUNCER : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000002c2");
constant ENTITYID_SEDP_BUILTIN_TOPICS_DETECTOR : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000002c7");
constant ENTITYID_SEDP_BUILTIN_PUBLICATIONS_ANNOUNCER : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000003c2");
constant ENTITYID_SEDP_BUILTIN_PUBLICATIONS_DETECTOR : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000003c7");
constant ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_ANNOUNCER : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000004c2");
constant ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_DETECTOR : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000004c7");
constant ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000100c2");
constant ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000100c7");
constant ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER: std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000200c2");
constant ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER: std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000200c7");
-- *ENTITY KIND* (Last Byte of Entity ID)
subtype ENTITY_KIND_H_RANGE is natural range 7 downto 6;
subtype ENTITY_KIND_L_RANGE is natural range 5 downto 0;
--FOLLOWING MAP TO ENTITY_KIND_H
constant USER_DEFINED_ENTITY : std_logic_vector(ENTITY_KIND_H_RANGE) := "00";
constant BUILT_IN_ENTITY : std_logic_vector(ENTITY_KIND_H_RANGE) := "11";
constant VENDOR_SPECIFIC_ENTITY : std_logic_vector(ENTITY_KIND_H_RANGE) := "01";
--FOLLOWING MAP TO ENTITY_KIND_L
constant UNKNOWN_KIND : std_logic_vector(ENTITY_KIND_L_RANGE) := (others => '0');
constant WRITER_WITH_KEY : std_logic_vector(ENTITY_KIND_L_RANGE) := "000010";
constant WRITER_NO_KEY : std_logic_vector(ENTITY_KIND_L_RANGE) := "000011";
constant READER_NO_KEY : std_logic_vector(ENTITY_KIND_L_RANGE) := "000100";
constant READER_WITH_KEY : std_logic_vector(ENTITY_KIND_L_RANGE) := "000111";
constant WRITER_GROUP : std_logic_vector(ENTITY_KIND_L_RANGE) := "001000";
constant READER_GROUP : std_logic_vector(ENTITY_KIND_L_RANGE) := "001001";
-- *LOCATOR KIND*
constant LOCATOR_KIND_INVALID : std_logic_vector := std_logic_vector(to_signed(-1,LOCATOR_KIND_WIDTH));
constant LOCATOR_KIND_RESERVERD : std_logic_vector := std_logic_vector(to_signed(0,LOCATOR_KIND_WIDTH));
constant LOCATOR_KIND_UDPv4 : std_logic_vector := std_logic_vector(to_signed(1,LOCATOR_KIND_WIDTH));
constant LOCATOR_KIND_UDPv6 : std_logic_vector := std_logic_vector(to_signed(2,LOCATOR_KIND_WIDTH));
-- *DDS QoS*
-- DURABILITY
constant VOLATILE_DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant TRANSIENT_LOCAL_DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant TRANSIENT_DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_ENUMERATION_WIDTH));
constant PERSISTENT_DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(3,CDR_ENUMERATION_WIDTH));
constant DEFAULT_DURABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := VOLATILE_DURABILITY_QOS;
-- PRESENTATION
constant INSTANCE_PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant TOPIC_PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant GROUP_PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_ENUMERATION_WIDTH));
constant DEFAULT_PRESENTATION_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := INSTANCE_PRESENTATION_QOS;
-- COHERENT ACCESS (PRESENTATION)
constant DEFAULT_COHERENT_ACCESS : boolean := FALSE;
-- ORDERED ACCESS (PRESENTATION)
constant DEFAULT_ORDERED_ACCESS : boolean := FALSE;
-- DEADLINE
constant DEFAULT_DEADLINE_QOS : DURATION_TYPE := DURATION_INFINITE;
-- LATENCY BUDGET
constant DEFAULT_LATENCY_BUDGET_QOS : DURATION_TYPE := DURATION_ZERO;
-- OWNERSHIP
constant SHARED_OWNERSHIP_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant EXCLUSIVE_OWNERSHIP_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant DEFAULT_OWNERSHIP_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := SHARED_OWNERSHIP_QOS;
-- OWNERSHIP STRENGTH
constant DEFAULT_OWNERSHIP_STRENGTH_QOS : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0');
-- LIVELINESS
constant AUTOMATIC_LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant MANUAL_BY_PARTICIPANT_LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant MANUAL_BY_TOPIC_LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_ENUMERATION_WIDTH));
constant DEFAULT_LIVELINESS_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := AUTOMATIC_LIVELINESS_QOS;
-- LEASE DURATION (LIVELINESS)
constant DEFAULT_LEASE_DURATION : DURATION_TYPE := DURATION_INFINITE;
-- TIME_BASED_FILTER
constant DEFAULT_TIME_BASED_FILTER_QOS : DURATION_TYPE := DURATION_ZERO;
-- RELIABILITY
constant BEST_EFFORT_RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant RELIABLE_RELIABILITY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(2,CDR_ENUMERATION_WIDTH));
constant DEFAULT_RELIABILTY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := RELIABLE_RELIABILITY_QOS;
-- MAX BLOCKING TIME (RELIABILITY)
constant DEFAULT_MAX_BLOCKING_TIME : DURATION_TYPE; --Deferred to Package Body (100 ms)
-- TRANSPORT_PRIORITY
constant DEFAULT_TRANSPORT_PRIORITY_QOS : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0');
-- LIFESPAN
constant DEFAULT_LIFESPAN_QOS : DURATION_TYPE := DURATION_INFINITE;
-- DESTINATION ORDER
constant BY_RECEPTION_TIMESTAMP_DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant BY_SOURCE_TIMESTAMP_DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant DEFAULT_DESTINATION_ORDER_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := BY_RECEPTION_TIMESTAMP_DESTINATION_ORDER_QOS;
-- HISTORY
constant KEEP_LAST_HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_WIDTH));
constant KEEP_ALL_HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_WIDTH));
constant DEFAULT_HISTORY_QOS : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := KEEP_LAST_HISTORY_QOS;
-- DEPTH (HISTORY)
constant DEFAULT_HISTORY_DEPTH : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_LONG_WIDTH));
-- RESOURCE_LIMITS
constant DEFAULT_MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
constant DEFAULT_MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
constant DEFAULT_MAX_SAMPLES_PER_INSTANCE : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
-- WRITER_DATA_LIFECYCLE
constant DEFAULT_AUTODISPOSE_UNREGISTERED_INSTANCES : boolean := TRUE;
-- READER_DATA_LIFECYCLE
constant DEFAULT_AUTOPURGE_NOWRITER_SAMPLES_DELAY : DURATION_TYPE := DURATION_INFINITE;
constant DEFAULT_AUTOPURGE_DISPOSED_SAMPLES_DELAY : DURATION_TYPE := DURATION_INFINITE;
-- TYPE_CONSISTENCY (DDS XTYPES 1.3)
constant DISALLOW_TYPE_COERCION : std_logic_vector(CDR_ENUMERATION_SHORT_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_ENUMERATION_SHORT_WIDTH));
constant ALLOW_TYPE_COERCION : std_logic_vector(CDR_ENUMERATION_SHORT_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_ENUMERATION_SHORT_WIDTH));
-- DURABILITY SERVICE (DURABILITY)
constant DEFAULT_DURABILITY_SERVICE_CLEANUP_DELAY : DURATION_TYPE := DURATION_ZERO;
constant DEFAULT_DURABILITY_SERVICE_HISTORY : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0) := KEEP_LAST_HISTORY_QOS;
constant DEFAULT_DURABILITY_SERVICE_HISTORY_DEPTH : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(1,CDR_LONG_WIDTH));
constant DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
constant DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
constant DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE: std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := LENGTH_UNLIMITED;
constant DEFAULT_PARTICIPANT_LEASE_DURATION : DURATION_TYPE; -- Deferred to package Body (100 s)
constant DEFAULT_EXPECTS_INLINE_QOS : std_logic := '0';
constant DEFAULT_BUILTIN_ENDPOINT_QOS : std_logic_vector(CDR_LONG_WIDTH-1 downto 0) := (others => '0');
-- *BUILTIN ENDPOINT SET POSITIONS*
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER : natural := 0;
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR : natural := 1;
constant DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER : natural := 2;
constant DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR : natural := 3;
constant DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER : natural := 4;
constant DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR : natural := 5;
constant BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER : natural := 10;
constant BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER : natural := 11;
constant DISC_BUILTIN_ENDPOINT_TOPICS_ANNOUNCER : natural := 28;
constant DISC_BUILTIN_ENDPOINT_TOPICS_DETECTOR : natural := 29;
-- *BUILTIN ENDPOINT QOS BITMASK*
-- XXX: We use some of the unused bits of the 32-bit bitmask when stored in the buffer for internal purposes. (see "builtin_endpoint" Entity)
constant BEST_EFFORT_PARTICIPANT_MESSAGE_DATA_READER : natural := 0;
-- *PARTICIPANT MESSAGE KIND*
constant PARTICIPANT_MESSAGE_DATA_KIND_UNKNOWN : std_logic_vector(PARTICIPANT_MESSAGE_KIND_WIDTH-1 downto 0) := (others => '0');
constant PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE : std_logic_vector(PARTICIPANT_MESSAGE_KIND_WIDTH-1 downto 0) := x"00000001";
constant PARTICIPANT_MESSAGE_DATA_KIND_MANUAL_LIVELINESS_UPDATE : std_logic_vector(PARTICIPANT_MESSAGE_KIND_WIDTH-1 downto 0) := x"00000002";
--*CUSTOM TYPES*
type CACHE_CHANGE_KIND_TYPE is (ALIVE, ALIVE_FILTERED, NOT_ALIVE_DISPOSED, NOT_ALIVE_UNREGISTERED);
type USER_BOOLEAN_ARRAY_TYPE is array (natural range <>) of boolean;
subtype USER_STRING_TYPE is string(1 to 256);
type USER_STRING_ARRAY_TYPE is array (natural range <>) of USER_STRING_TYPE;
type USER_DURATION_ARRAY_TYPE is array (natural range <>) of DURATION_TYPE;
type USER_ENUMERATION_ARRAY_TYPE is array (natural range <>) of std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0);
type USER_LONG_ARRAY_TYPE is array (natural range <>) of std_logic_vector(CDR_LONG_WIDTH-1 downto 0);
constant DEFAULT_USER_DOMAIN_TAG : USER_STRING_TYPE := (others => NUL);
function to_guid(A : GUIDPREFIX_TYPE; B : std_logic_vector(ENTITYID_WIDTH-1 downto 0)) return GUID_TYPE;
-- *OVERLOAD FUNCTIONS*
function convert_from_double_word (input: DOUBLE_WORD_ARRAY) return unsigned;
function convert_to_double_word (input: unsigned(63 downto 0)) return DOUBLE_WORD_ARRAY;
function ">" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function ">" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function ">" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function "<" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function "<" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function "<" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function ">=" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function ">=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function ">=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function "<=" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function "<=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function "<=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function "=" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function "=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function "=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function "/=" (L,R: DOUBLE_WORD_ARRAY) return boolean;
function "/=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean;
function "/=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean;
function "+" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function "+" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY;
function "+" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function "-" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function "-" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY;
function "-" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function min(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function max(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY;
function to_integer(dw : DOUBLE_WORD_ARRAY) return integer;
end package;
package body rtps_package is
function gen_duration(s,ns : integer) return DURATION_TYPE is
variable ret : DURATION_TYPE := (others => (others => '0'));
-- "unit" is the value of "ret(1)" equal to 1 nanosecond
-- (1 / 2^-32) * 10^-9
constant unit : real := 4.294967296;
constant sec : natural := 10**9;
constant half_sec : natural := sec/2;
begin
assert (ns < 10**9) report "ns argument has to be less than a second" severity failure;
ret(0) := to_unsigned(s, WORD_WIDTH);
-- If Fraction Bit is >= 500 ms it cannot be represented as a natural (because naturals/integers are signed).
-- So we handle that manualy
if (ns >= half_sec) then
ret(1) := to_unsigned(natural(CEIL(real(ns-half_sec)*unit)),WORD_WIDTH);
ret(1)(31) := '1';
else
ret(1) := to_unsigned(natural(CEIL(real(ns)*unit)),WORD_WIDTH);
end if;
return ret;
end function;
constant DEFAULT_MAX_BLOCKING_TIME : DURATION_TYPE := gen_duration(0,100 * (10**6)); -- 100 ms
constant DEFAULT_PARTICIPANT_LEASE_DURATION : DURATION_TYPE := gen_duration(100, 0); -- 100 s
function convert_from_double_word (input: DOUBLE_WORD_ARRAY) return unsigned is
variable ret : unsigned(63 downto 0) := (others => '0');
begin
ret(63 downto 32) := input(0);
ret(31 downto 0) := input(1);
return ret;
end function;
function convert_to_double_word (input: unsigned(63 downto 0)) return DOUBLE_WORD_ARRAY is
variable ret : DOUBLE_WORD_ARRAY := (others => (others => '0'));
begin
ret(0) := input(63 downto 32);
ret(1) := input(31 downto 0);
return ret;
end function;
function ">" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) > convert_from_double_word(R);
end function;
function ">" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) > R;
end function;
function ">" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L > convert_from_double_word(R);
end function;
function "<" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) < convert_from_double_word(R);
end function;
function "<" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) < R;
end function;
function "<" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L < convert_from_double_word(R);
end function;
function ">=" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) >= convert_from_double_word(R);
end function;
function ">=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) >= R;
end function;
function ">=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L >= convert_from_double_word(R);
end function;
function "<=" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) <= convert_from_double_word(R);
end function;
function "<=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) <= R;
end function;
function "<=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L <= convert_from_double_word(R);
end function;
function "=" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) = convert_from_double_word(R);
end function;
function "=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) = R;
end function;
function "=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L = convert_from_double_word(R);
end function;
function "/=" (L,R: DOUBLE_WORD_ARRAY) return boolean is
begin
return convert_from_double_word(L) /= convert_from_double_word(R);
end function;
function "/=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is
begin
return convert_from_double_word(L) /= R;
end function;
function "/=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is
begin
return L /= convert_from_double_word(R);
end function;
function "+" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(convert_from_double_word(L) + convert_from_double_word(R));
end function;
function "+" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(convert_from_double_word(L) + R);
end function;
function "+" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(L + convert_from_double_word(R));
end function;
function "-" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(convert_from_double_word(L) - convert_from_double_word(R));
end function;
function "-" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(convert_from_double_word(L) - R);
end function;
function "-" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
begin
return convert_to_double_word(L - convert_from_double_word(R));
end function;
function min(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
variable ret : DOUBLE_WORD_ARRAY;
begin
if L < R then
ret := L;
else
ret := R;
end if;
return ret;
end function;
function max(L, R : DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is
variable ret : DOUBLE_WORD_ARRAY;
begin
if L > R then
ret := L;
else
ret := R;
end if;
return ret;
end function;
function to_integer(dw : DOUBLE_WORD_ARRAY) return integer is
begin
return to_integer(dw(0));
end function;
function to_guid(A : GUIDPREFIX_TYPE; B : std_logic_vector(ENTITYID_WIDTH-1 downto 0)) return GUID_TYPE is
variable ret : GUID_TYPE := GUID_UNKNOWN;
begin
for i in 0 to GUIDPREFIX_TYPE'length-1 loop
ret(i) := A(i);
end loop;
ret(3) := B;
return ret;
end function;
end package body;