diff --git a/src/rtps_test_package.vhd b/src/rtps_test_package.vhd index cf82cb5..b5e1c85 100644 --- a/src/rtps_test_package.vhd +++ b/src/rtps_test_package.vhd @@ -12,12 +12,19 @@ use work.rtps_config_package.all; package rtps_test_package is + -- File were the Test Results are stored constant RESULTS_FILE : string := "./Test_Results.txt"; + -- Frame Sizes have to be specified, so that direct memory probing is possible + -- rtps_builtin_endpoint Participant Frame Size constant PARTICIPANT_FRAME_SIZE : natural := 23; + -- rtps_reader Endpoint Frame Size (RELIABLE=TRUE) constant WRITER_ENDPOINT_FRAME_SIZE_A : natural := 12; + -- rtps_reader Endpoint Frame Size (RELIABLE=FALSE) constant WRITER_ENDPOINT_FRAME_SIZE_B : natural := 8; + -- rtps_writer Endpoint Frame Size (RELIABLE=TRUE) constant READER_ENDPOINT_FRAME_SIZE_A : natural := 15; + -- rtps_writer Endpoint Frame Size (RELIABLE=FALSE) constant READER_ENDPOINT_FRAME_SIZE_B : natural := 6; constant DEFAULT_GUIDPREFIX : GUIDPREFIX_TYPE; -- Deferred to Package Body @@ -26,15 +33,19 @@ package rtps_test_package is type MATCH_TYPE is (MATCH, UNMATCH); + -- General Purpose 32-bit wide data container type TEST_PACKET_TYPE is record -- Limit Packet Size to 2^16 (IPv4 size limit) data : WORD_ARRAY_TYPE(0 to (2**16)/4); + -- Last Word Indicator last : std_logic_vector(0 to (2**16)/4); + -- Length of Packet length : natural; end record; constant EMPTY_TEST_PACKET : TEST_PACKET_TYPE; -- Deferred to Package Body + -- Memory Element Representation type TEST_MEMORY_ELEMENT_TYPE is record addr : natural; data : std_logic_vector(WORD_WIDTH-1 downto 0); @@ -94,7 +105,6 @@ package rtps_test_package is constant DEST_LOC : DEST_LOCATOR_LIST_TYPE; -- Deferred to Package Body - -- *OUTPUT HEADER* type OUTPUT_HEADER_TYPE is record src : LOCATOR_TYPE; dest : LOCATOR_TYPE; @@ -102,7 +112,6 @@ package rtps_test_package is constant DEFAULT_OUTPUT_HEADER : OUTPUT_HEADER_TYPE; -- Deferred to Package Body - -- *RTPS HEADER* type RTPS_HEADER_TYPE is record protocol : std_logic_vector(PROTOCOL_WIDTH-1 downto 0); version : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0); @@ -112,44 +121,62 @@ package rtps_test_package is constant DEFAULT_RTPS_HEADER : RTPS_HEADER_TYPE; -- Deferred to Package Body - -- *GENERIC RTPS SUBMESSAGE HEADER* + -- Generic RTPS Submessage Container type RTPS_SUBMESSAGE_TYPE is record + -- ALL submessageID : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0); flags : std_logic_vector(SUBMESSAGE_FLAGS_WIDTH-1 downto 0); submessageLength : std_logic_vector(SUBMESSAGE_LENGTH_WIDTH-1 downto 0); + -- ACKNACK/DATA/GAP/HEARTBEAT/DATAFRAG/NACKFRAG readerId : std_logic_vector(ENTITYID_WIDTH-1 downto 0); writerId : std_logic_vector(ENTITYID_WIDTH-1 downto 0); - extraFlags : std_logic_vector(SUBMESSAGE_DATA_EXTRA_FLAGS_WIDTH-1 downto 0); - octetsToInlineQos : std_logic_vector(SUBMESSAGE_LENGTH_WIDTH-1 downto 0); - readerSNState : SEQUENCENUMBER_SET_TYPE; - count : std_logic_vector(COUNT_WIDTH-1 downto 0); + -- DATA/DATAFRAG/HEARTBEATFRAG/NACKFRAG writerSN : SEQUENCENUMBER_TYPE; - fragmentNumberState : FRAGMENTNUMBER_SET_TYPE; + -- DATA/DATAFRAG inlineQos : TEST_PACKET_TYPE; data : TEST_PACKET_TYPE; + -- DATA + extraFlags : std_logic_vector(SUBMESSAGE_DATA_EXTRA_FLAGS_WIDTH-1 downto 0); + octetsToInlineQos : std_logic_vector(SUBMESSAGE_LENGTH_WIDTH-1 downto 0); + -- DATAFRAG fragmentStartingNumber : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); fragmentsInSubmessage : std_logic_vector(CDR_SHORT_WIDTH-1 downto 0); fragmentSize : std_logic_vector(CDR_SHORT_WIDTH-1 downto 0); sampleSize : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - gapStart : SEQUENCENUMBER_TYPE; - gapList : SEQUENCENUMBER_SET_TYPE; + -- HEARTBEAT/HEARTBEATFRAG/NACKFRAG/ACKNACK + count : std_logic_vector(COUNT_WIDTH-1 downto 0); + -- HEARTBEAT firstSN : SEQUENCENUMBER_TYPE; lastSN : SEQUENCENUMBER_TYPE; + -- HEARTBEATFRAG lastFragmentNum : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); - guidPrefix : GUIDPREFIX_TYPE; + -- NACKFRAG + fragmentNumberState : FRAGMENTNUMBER_SET_TYPE; + -- ACKNACK + readerSNState : SEQUENCENUMBER_SET_TYPE; + -- GAP + gapStart : SEQUENCENUMBER_TYPE; + gapList : SEQUENCENUMBER_SET_TYPE; + -- INFO_REPLY unicastLocatorList : LOCATOR_LIST_TYPE; multicastLocatorList : LOCATOR_LIST_TYPE; - unicastLocator : LOCATOR_TYPE; - multicastLocator : LOCATOR_TYPE; + -- INFO_DEST/INFO_SRC + guidPrefix : GUIDPREFIX_TYPE; + -- INFO_SRC unused : std_logic_vector(31 downto 0); version : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0); vendorId : std_logic_vector(VENDORID_WIDTH-1 downto 0); + -- INFO_TS timestamp : TIME_TYPE; + -- INFO_REPLY_IP4 + unicastLocator : LOCATOR_TYPE; + multicastLocator : LOCATOR_TYPE; end record; constant DEFAULT_RTPS_SUBMESSAGE : RTPS_SUBMESSAGE_TYPE; -- Deferred to Package Body type PARTICIPANT_DATA_TYPE is record + -- Signifies if the Data should be written in Little Endian littleEndian : std_logic; domainId : std_logic_vector(DOMAIN_ID_WIDTH-1 downto 0); domainTag : STRING_WORD_ARRAY_TYPE; @@ -166,15 +193,20 @@ package rtps_test_package is manualLivelinessCount : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); builtinEndpointQoS : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); availableBuiltinEndpoints : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + -- Signifies if the Participant represented by this Record is a match match : MATCH_TYPE; + -- Denotes the Position in the Memory of this Participant Data nr : natural; end record; - constant DEFAULT_PARTICIPANT_DATA : PARTICIPANT_DATA_TYPE; -- Deferred to Pckage Body - constant THIS_PARTICIPANT_DATA : PARTICIPANT_DATA_TYPE; -- Deferred to Pckage Body + constant DEFAULT_PARTICIPANT_DATA : PARTICIPANT_DATA_TYPE; -- Deferred to Package Body + constant THIS_PARTICIPANT_DATA : PARTICIPANT_DATA_TYPE; -- Deferred to Package Body + -- Generic RTPS Endpoint Container type ENDPOINT_DATA_TYPE is record + -- Signifies if the Endoint Data represented by this Record is a Reader Endpoint reader : boolean; + -- Signifies if the Data should be written in Little Endian littleEndian : std_logic; participant : PARTICIPANT_DATA_TYPE; entityId : std_logic_vector(ENTITYID_WIDTH-1 downto 0); @@ -202,22 +234,26 @@ package rtps_test_package is transport_priority : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); lifespan : DURATION_TYPE; destination_order : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); - -- Represent Data as Strings (Ease of Use) - user_data : STRING_WORD_ARRAY_TYPE; - topic_data : STRING_WORD_ARRAY_TYPE; - group_data : STRING_WORD_ARRAY_TYPE; expectsInlineQoS : std_logic_vector(CDR_BOOLEAN_WIDTH-1 downto 0); unicastLocatorList : LOCATOR_LIST_TYPE; multicastLocatorList : LOCATOR_LIST_TYPE; max_size_serialized : std_logic_vector(CDR_LONG_WIDTH-1 downto 0); + -- Represent Data as Strings (Ease of Use) + user_data : STRING_WORD_ARRAY_TYPE; + topic_data : STRING_WORD_ARRAY_TYPE; + group_data : STRING_WORD_ARRAY_TYPE; + -- Signifies if the Endpoint represented by this Record is a match match : MATCH_TYPE; + -- Denotes the Position in the Memory of this Participant Data nr : natural; end record; constant DEFAULT_ENDPOINT_DATA : ENDPOINT_DATA_TYPE; -- Deferred to Package Body type ENDPOINT_DATA_ARRAY_TYPE is array (natural range <>) of ENDPOINT_DATA_TYPE; + -- Cache Change Representation type CACHE_CHANGE_TYPE is record + -- Denotes if the CC contains the Serialized Key serialized_key : boolean; kind : CACHE_CHANGE_KIND_TYPE; writer_guid : GUID_TYPE; @@ -229,24 +265,37 @@ package rtps_test_package is constant DEFAULT_CACHE_CHANGE : CACHE_CHANGE_TYPE; -- Deferred to Package Body + -- DDS Sample Representation type SAMPLE_TYPE is record + -- Instance (KEY_HASH) inst : INSTANCE_HANDLE_TYPE; data : TEST_PACKET_TYPE; + -- Sample State sstate : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); + -- Instance State istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); + -- View State vstate : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); + -- Disposed Generation Count dis_gen_cnt : natural; + -- No Writers Generation Count no_w_gen_cnt : natural; + -- Sample Rank srank : natural; + -- Generation Rank grank : natural; + -- Absolut Generation Rank agrank : natural; + -- Source Timestamp ts : TIME_TYPE; end record; constant DEFAULT_SAMPLE : SAMPLE_TYPE; -- Deferred to Package Body + -- NOTE: The array is currently limited to 15 Samples to limit memory allocation type SAMPLE_ARRAY_TYPE is array (0 to 15) of SAMPLE_TYPE; + -- Representation of a DDS Reader Sample Collection type COLLECTION_TYPE is record s : SAMPLE_ARRAY_TYPE; len : natural; @@ -254,11 +303,17 @@ package rtps_test_package is constant DEFAULT_COLLECTION : COLLECTION_TYPE; -- Deferred to Package Body + -- Representation of DDS Reader Instance State type INSTANCE_CACHE_TYPE is record + -- Instance (KEY_HASH) inst : INSTANCE_HANDLE_TYPE; + -- Instance State istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); + -- Vies State vstate : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); + -- Disposed Generation Count dis_gen_cnt : natural; + -- No Writers Geneation Count no_w_gen_cnt : natural; end record; @@ -266,30 +321,41 @@ package rtps_test_package is type INSTANCE_CACHE_ARRAY_TYPE is array (0 to 15) of INSTANCE_CACHE_TYPE; + -- Representation of DDS Reader internal Memory type DDS_READER_MEM_TYPE is record + -- Sample Memory s : SAMPLE_ARRAY_TYPE; slen : natural; + -- Instance Memory inst : INSTANCE_CACHE_ARRAY_TYPE; ilen : natural; end record; constant DEFAULT_DDS_READER_MEM : DDS_READER_MEM_TYPE; -- Deferred to Package Body + -- Representation of DDS Reader Operations type DDS_READER_TEST_TYPE is record + -- OPERATION & ARGUMENTS opcode : DDS_READER_OPCODE_TYPE; sstate : std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); vstate : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); max_samples : natural; + -- NOTE: Instance is used as Operation Arguments & Expected Return (Last Rejected Instance) inst : INSTANCE_HANDLE_TYPE; + -- EXPECTED RETURN ret_code : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0); + -- STATUS Operation Count count : natural; + -- STATUS Operation Count Change change : natural; + -- STATUS Operation Last Rejected Reason last_reason : std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); end record; constant DEFAULT_DDS_READER_TEST : DDS_READER_TEST_TYPE; -- Deferred to Package Body + -- Represntation of RTPS Writer Operations type RTPS_WRITER_TEST_TYPE is record opcode : HISTORY_CACHE_OPCODE_TYPE; cc : CACHE_CHANGE_TYPE; @@ -298,6 +364,7 @@ package rtps_test_package is constant DEFAULT_RTPS_WRITER_TEST : RTPS_WRITER_TEST_TYPE; -- Deferred to Package Body + -- Representation of RTPS Reader Operations type RTPS_READER_TEST_TYPE is record opcode : HISTORY_CACHE_OPCODE_TYPE; cc : CACHE_CHANGE_TYPE; @@ -308,80 +375,214 @@ package rtps_test_package is constant DEFAULT_RTPS_READER_TEST : RTPS_READER_TEST_TYPE; -- Deferred to Package Body + -- Representation of DDS Writer Operation type DDS_WRITER_TEST_TYPE is record + -- OPERATION & ARGUMENTS opcode : DDS_WRITER_OPCODE_TYPE; cc : CACHE_CHANGE_TYPE; - ret_code : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0); - count : natural; - change : natural; + -- NOTE: Instance is used as Operation Arguments & Expected Return (Deadline Missed Instance) inst : INSTANCE_HANDLE_TYPE; + -- Liveliness Assertion assertion : std_logic; + -- EXPECTED RETURN + ret_code : std_logic_vector(RETURN_CODE_WIDTH-1 downto 0); + -- STATUS Operation Count + count : natural; + -- STATUS Operation Count Change + change : natural; end record; constant DEFAULT_DDS_WRITER_TEST : DDS_WRITER_TEST_TYPE; -- Deferred to Package Body - function test_memory_match (A,B : TEST_MEMORY_TYPE) return boolean; - function to_string (input : TEST_MEMORY_TYPE) return string; + -- *RTPS SPECIFICATION* + -- Writes RTPS Output Header based on "ref" to "output" procedure gen_output_header(ref : in OUTPUT_HEADER_TYPE; output : inout TEST_PACKET_TYPE); + -- Fixes the "Packet Length" Field of the RTPS Output Reader with the current Packet Length + -- This function should be called to fnalize the RTPS packet procedure fix_output_packet(output : inout TEST_PACKET_TYPE); - + -- Writes RTPS Header based on "ref" to "output" procedure gen_rtps_header( ref : in RTPS_HEADER_TYPE; output : inout TEST_PACKET_TYPE); - + -- Write RTPS Submessage based on "ref" to "output" procedure gen_rtps_submessage( ref : in RTPS_SUBMESSAGE_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; loc : in LOCATOR_TYPE; is_meta : in boolean; ts : in TIME_TYPE; src_guid : in GUIDPREFIX_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; participant : PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; endpoint : ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Writes Participant Data based on "ref" to "output" + procedure gen_participant_data( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Like previous procedure, but allows modification of the generated output. + -- The Parameter Field represented by "pid" is always written, not depending on if it has Default value. "Offset" modifies the Parameter Length of the "pid" and represents how + -- many 4-Byte Words to add/subtract from the original value. + -- This allows to generate invalid parameter lists + procedure gen_participant_data( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); + -- Writes Endpoint Data based on "ref" to "output" + procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Like previous procedure, but allows modification of the generated output. + -- The Parameter Field represented by "pid" is always written, not depending on if it has Default value. "Offset" modifies the Parameter Length of the "pid" and represents how + -- many 4-Byte Words to add/subtract from the original value. + -- This allows to generate invalid parameter lists + procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); + -- Generate Participant Message Data + -- participant participant to assert Liveliness + -- manual TRUE if MANUAL_LIVELINESS_UPDATE, FALSE if AUTOMATIC_LIVELINESS_UPDATE + -- extra_data Extra Data in Participant Message + -- output Destination of generated ouput + procedure gen_liveliness_assertion(participant : in PARTICIPANT_DATA_TYPE; manual : in boolean; extra_data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE); + -- Same as previous procedure, but extra_data is EMPTY + procedure gen_liveliness_assertion(participant : in PARTICIPANT_DATA_TYPE; manual : in boolean; output : inout TEST_PACKET_TYPE); + -- Generate DATA Submessage InLine QoS + -- ref Cache Change (Used for PID_KEY_HASH, PID_STATUS_INFO) + -- endpoint Endpoint Data + -- expectsInlineQoS The Endpoint Data related PIDs are only generated if this is TRUE + -- littleEndian If TRUE the generated Data is in little Endian, else in Big Endian + -- output Destination of generated output + procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; endpoint : in ENDPOINT_DATA_TYPE; expectsInlineQoS : in boolean; littleEndian : in std_logic; output : inout TEST_PACKET_TYPE); + -- Like previous procedure, but allows modification of the generated output. + -- The Parameter Field represented by "pid" is always written, not depending on if it has Default value. "Offset" modifies the Parameter Length of the "pid" and represents how + -- many 4-Byte Words to add/subtract from the original value. + -- This allows to generate invalid parameter lists + -- NOTE: "expectsInlineQoS" takes precedence over "pid" (I.e. if expectsInlineQoS=TRUE and pid is Endpoint related, the PID Element will not be generated) + procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; endpoint : in ENDPOINT_DATA_TYPE; expectsInlineQoS : in boolean; littleEndian : in std_logic; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); + -- Like previous procedure, but no Endpoint Data related PIDs are generated (only PID_KEY_HASH, PID_STATUS_INFO) + procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; output : inout TEST_PACKET_TYPE); + -- Generate Parameter List Element + -- pid Parameter ID of element + -- data Parameter Data of element + -- output Destination of generated output + procedure gen_parameter(pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE); + -- Generate Parameter List Sentinel. This procedure should be used to finalize Parameter Lists + procedure gen_sentinel(output : inout TEST_PACKET_TYPE); - function gen_cache_change(ref : RTPS_SUBMESSAGE_TYPE) return CACHE_CHANGE_TYPE; + + -- *RTPS_READER* + -- Generates RTPS Reader ADD_CACHE_CHANGE output (DDS Reader Input) + -- ref Cache Change + -- lifespan_deadline Lifespan Deadline of Sample + -- pos ID (Memory Position) of Source Remote Writer + -- output Destination of generated output procedure gen_add_cache_change_dds(ref : in CACHE_CHANGE_TYPE; lifespan_deadline : in TIME_TYPE; pos : in natural; output : inout TEST_PACKET_TYPE); - procedure gen_participant_data( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_participant_data( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); + + -- *RTPS_HANDLER* + -- Generates RTPS_HANDLER output + -- ref RTPS Submessage + -- loc Source Locator of RTPS Submessage + -- is_meta Indicates if the RTPS Submessage is metatraffic (Destined for Built-in Endpoints) + -- ts Source Timestamp of RTPS Submessage + -- src_guid Source GUID of RTPS Submessage + -- output Destination of generated output + procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; loc : in LOCATOR_TYPE; is_meta : in boolean; ts : in TIME_TYPE; src_guid : in GUIDPREFIX_TYPE; output : inout TEST_PACKET_TYPE); + -- Like the previous procedure, but the source locator & GUID is extracted from the "participant". Timestamp is INVALID and is_meta is set to TRUE. + procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; participant : PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Like the previous procedure, but the source locator & GUID is extracted from the "endpoint". Timestamp is INVALID and is_meta is set to TRUE. + procedure gen_rtps_handler_out(ref : in RTPS_SUBMESSAGE_TYPE; endpoint : ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + + + -- *RTPS_BUILTIN_ENDPOINT* + -- Generate a rtps_builtin_endpoint memory Participant Frame based on "ref". function gen_participant_mem_frame (ref : PARTICIPANT_DATA_TYPE) return TEST_PARTICIPANT_MEMORY_FRAME_TYPE; + -- Generate a rtps_writer memory Participant Frame based on "ref". (A Version) function gen_writer_endpoint_mem_frame_a (ref : ENDPOINT_DATA_TYPE) return TEST_WRITER_ENDPOINT_MEMORY_FRAME_TYPE_A; + -- Generate a rtps_writer memory Participant Frame based on "ref". (B Version) function gen_writer_endpoint_mem_frame_b (ref : ENDPOINT_DATA_TYPE) return TEST_WRITER_ENDPOINT_MEMORY_FRAME_TYPE_B; + -- Generate a rtps_reader memory Participant Frame based on "ref". (A Version) function gen_reader_endpoint_mem_frame_a (ref : ENDPOINT_DATA_TYPE) return TEST_READER_ENDPOINT_MEMORY_FRAME_TYPE_A; + -- Generate a rtps_reader memory Participant Frame based on "ref". (B Version) function gen_reader_endpoint_mem_frame_b (ref : ENDPOINT_DATA_TYPE) return TEST_READER_ENDPOINT_MEMORY_FRAME_TYPE_B; - - procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); + -- Writes a rtps_builtin_endpoint Endpoint Match Frame based on "ref" to "output" procedure gen_endpoint_match_frame( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Writes a rtps_builtin_endpoint Participant Match Frame based on "ref" to "output" procedure gen_participant_match_frame( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + -- Writes a rtps_builtin_endpoint Endpoint Liveliness Update Frame based on "ref" to "output" procedure gen_liveliness_update_frame( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); - function gen_endpoint(id : natural) return ENDPOINT_DATA_TYPE; - function gen_endpoint_array(readers : boolean) return ENDPOINT_DATA_ARRAY_TYPE; - procedure gen_liveliness_assertion(participant : in PARTICIPANT_DATA_TYPE; manual : in boolean; extra_data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE); - procedure gen_liveliness_assertion(participant : in PARTICIPANT_DATA_TYPE; manual : in boolean; output : inout TEST_PACKET_TYPE); - procedure gen_sentinel(output : inout TEST_PACKET_TYPE); - procedure gen_parameter(pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE); - - procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; endpoint : in ENDPOINT_DATA_TYPE; expectsInlineQoS : in boolean; littleEndian : in std_logic; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); - procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; endpoint : in ENDPOINT_DATA_TYPE; expectsInlineQoS : in boolean; littleEndian : in std_logic; output : inout TEST_PACKET_TYPE); - procedure gen_inline_qos(ref : in CACHE_CHANGE_TYPE; output : inout TEST_PACKET_TYPE); - - procedure gen_rand_loc(RV : inout RandomPType; ret : out LOCATOR_TYPE); - procedure gen_rand_entityid(RV : inout RandomPType; reader : boolean; ret : out std_logic_vector(ENTITYID_WIDTH-1 downto 0)); - function int(n : integer; width : natural) return std_logic_vector; - function to_string1 (input : std_logic_vector) return string; - - --procedure add_instance(inst : inout INSTANCE_HANDLE_TYPE; istate : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); mem : inout DDS_READER_MEM_TYPE); - function to_sample(cc : CACHE_CHANGE_TYPE; istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0)) return SAMPLE_TYPE; + -- *DDS_READER* + -- Add Instance to Memory + -- inst Instance (KEY_HASH) + -- istate Instance State + -- mem Target Memory + procedure add_instance(inst : in INSTANCE_HANDLE_TYPE; istate : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); mem : inout DDS_READER_MEM_TYPE); + -- Change Instance State of Instance in Memory + -- inst Instance to be modified (KEY_HASH) + -- istate New instance State + -- mem Target Memory procedure change_istate(inst : INSTANCE_HANDLE_TYPE; istate : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); mem : inout DDS_READER_MEM_TYPE); + -- Add Sample to Memory + -- sample Sample to be added + -- mem Target Memory + -- DESTINATION_ORDER_QOS Determines the position where the Sample is added to the memory. If BY_RECEPTION_TIMESTAMP_DESTINATION_ORDER_QOS the Sample is added + -- to the end of the memory. If BY_SOURCE_TIMESTAMP_DESTINATION_ORDER_QOS the Sample is positioned according to the source timestamp + -- of the Sample (Earliest first). + -- NOTE: This function sets the View State, Disposed Generation Count, and No Writers Generation Count of the added Sample procedure add_sample(sample : inout SAMPLE_TYPE; mem : inout DDS_READER_MEM_TYPE; DESTINATION_ORDER_QOS : in std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0)); + -- Remove Sample from Memory + -- ind Index position of Sample to be removed + -- mem Target Memory procedure remove_sample(ind : in natural; mem : inout DDS_READER_MEM_TYPE); + -- Remove Instance from Memory + -- inst Instance to be removed (KEY_HASH) + -- mem Target Memory procedure remove_inst(inst : in INSTANCE_HANDLE_TYPE; mem : inout DDS_READER_MEM_TYPE); - --function check_instance(istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); vstate : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); mem : DDS_READER_MEM_TYPE; inst : INSTANCE_HANDLE_TYPE) return boolean; - --function find_instance(mem : DDS_READER_MEM_TYPE; inst : INSTANCE_HANDLE_TYPE) return natural; - --procedure gen_collection (mem : inout DDS_READER_MEM_TYPE; col : inout COLLECTION_TYPE; inst : INSTANCE_HANDLE_TYPE; sstate : in std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); istate : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); vstate : in std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); max_samples : in natural; remove : in boolean; sort : in boolean); + -- Check Instance State. returns TRUE if "istate" and "vstate" are equal to the instance State and View State of "inst" in "mem" + function check_instance(istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); vstate : std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); mem : DDS_READER_MEM_TYPE; inst : INSTANCE_HANDLE_TYPE) return boolean; + -- Return index position of Instance "inst" in "mem" + function find_instance(mem : DDS_READER_MEM_TYPE; inst : INSTANCE_HANDLE_TYPE) return natural; + -- Generate DDS Reader Sample Collection + -- mem Source Memory + -- col Generated Collection + -- inst Target Instance of samples in collection (Use HANDLE_NIL for all Instances) + -- sstate Target Sample State of samples in collection + -- istate Target Instance State of samples in collection + -- vstate Target View State of samples in collection + -- max_samples Maximum number of Samples in collection + -- remove If TRUE the selected samples are removed from the source memory "mem" + -- sort If TRUE the collection is sorted by Instance (Samples of the same Instance are consecutive, not depending on their in-memory order) + procedure gen_collection (mem : inout DDS_READER_MEM_TYPE; col : inout COLLECTION_TYPE; inst : INSTANCE_HANDLE_TYPE; sstate : in std_logic_vector(SAMPLE_STATE_KIND_WIDTH-1 downto 0); istate : in std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0); vstate : in std_logic_vector(VIEW_STATE_KIND_WIDTH-1 downto 0); max_samples : in natural; remove : in boolean; sort : in boolean); + -- Wrapper of previous procedure. Extracts arguments from DDS Operation + -- mem Source Memory + -- col Generate Collection + -- opcode DDS Reader Operation + -- PRESENTATION_QOS Target PRESENTATION_QOS + -- ordered Ordered Value of PRESENTATION_QOS procedure gen_collection (mem : inout DDS_READER_MEM_TYPE; col : inout COLLECTION_TYPE; opcode : in DDS_READER_TEST_TYPE; PRESENTATION_QOS : in std_logic_vector(CDR_ENUMERATION_WIDTH-1 downto 0); ordered : in boolean); - -- NOTE: This assume a specific sending order (Multicast before Unicast)! - function get_loc (ref : PARTICIPANT_DATA_TYPE; meta : boolean) return LOCATOR_TYPE; - function get_loc (ref : ENDPOINT_DATA_TYPE) return LOCATOR_TYPE; + -- *HELPER FUNCTIONS* + -- Generate Random Locator + -- RV OSVVM Random Variable + -- ret Generated Random Locator + procedure gen_rand_loc(RV : inout RandomPType; ret : out LOCATOR_TYPE); + -- Generate Random EntityID + -- RV OSVVM Random Variable + -- reader If TRUE the generated ID has the prefix for Reader EntityIDs, else for Writer + -- ret Generated Random EntityID + procedure gen_rand_entityid(RV : inout RandomPType; reader : boolean; ret : out std_logic_vector(ENTITYID_WIDTH-1 downto 0)); + -- Generate SLV from Integer + -- n Unsigned Value of generated SLV + -- width Width of generated SLV + function int(n : integer; width : natural) return std_logic_vector; + -- to_string Function for ScoreBoardPkg_builtin_endpoint + function to_string1 (input : std_logic_vector) return string; + -- Find first valid Locator of Particiapnt Data + -- ref Participant Data to extract Locator from + -- meta If TRUE extracts metatraffic Locator + -- NOTE: This assumes a specific sending order (Multicast before Unicast)! + function get_loc (ref : PARTICIPANT_DATA_TYPE; meta : boolean) return LOCATOR_TYPE; + -- Find first valid Locator of Endpoint Data + -- ref Endpoint Data to extract Locator from + function get_loc (ref : ENDPOINT_DATA_TYPE) return LOCATOR_TYPE; + -- Extract Data from Cache Change "cc" to generate a Sample. + -- cc Cache Change + -- istate Instance State of Sample + function to_sample(cc : CACHE_CHANGE_TYPE; istate : std_logic_vector(INSTANCE_STATE_KIND_WIDTH-1 downto 0)) return SAMPLE_TYPE; + -- Return TRUE if both memory segments are equal, else FALSE + function test_memory_match (A,B : TEST_MEMORY_TYPE) return boolean; + -- Returns String with Length, Start Address, and End Address of the memory Segment + function to_string (input : TEST_MEMORY_TYPE) return string; + -- Generate Endpoint Data based on "id" of the test_config Package + function gen_endpoint(id : natural) return ENDPOINT_DATA_TYPE; + -- Generate all Reader (or Writer if "reader" is FALSE) Endpoints of the test_config Package + function gen_endpoint_array(readers : boolean) return ENDPOINT_DATA_ARRAY_TYPE; + -- Extract Data from RTPS Submessage (Sequence Number, Payload, Serialized_Key) and generate Cache Change + function gen_cache_change(ref : RTPS_SUBMESSAGE_TYPE) return CACHE_CHANGE_TYPE; end package; package body rtps_test_package is @@ -1961,8 +2162,6 @@ package body rtps_test_package is output.last(output.length-1) := '1'; end procedure; - -- The Arguments "pid" and "offset" can be used to modify the parameter generation. More specifically, the length of the parameter denoted by "pid" is modified by "offset" 4-Byte words. - -- Also setting "pid" forces the respective parameter to be writen out even if it is equal to the default value. procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer) is variable tmp : natural := 0; begin