From 472af656b3494760db14e1c09b6e5489c398ee14 Mon Sep 17 00:00:00 2001 From: Greek Date: Sat, 28 Nov 2020 10:12:35 +0100 Subject: [PATCH] * Added rtps_builtin_endpoint_test3 - Compiling and Passing --- sim/rtps_builtin_endpoint_test3.do | 72 + src/TODO.txt | 1 + .../Level_0/rtps_builtin_endpoint_test2.vhd | 49 +- .../Level_0/rtps_builtin_endpoint_test3.vhd | 1189 +++++++++++++++++ src/Tests/testbench.pro | 4 +- src/rtps_builtin_endpoint.vhd | 37 +- src/rtps_test_package.vhd | 134 +- 7 files changed, 1408 insertions(+), 78 deletions(-) create mode 100644 sim/rtps_builtin_endpoint_test3.do create mode 100644 src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd diff --git a/sim/rtps_builtin_endpoint_test3.do b/sim/rtps_builtin_endpoint_test3.do new file mode 100644 index 0000000..c590df2 --- /dev/null +++ b/sim/rtps_builtin_endpoint_test3.do @@ -0,0 +1,72 @@ +onerror {resume} +quietly WaveActivateNextPane {} 0 +add wave -noupdate -divider SYSTEM +add wave -noupdate /rtps_builtin_endpoint_test3/uut/clk +add wave -noupdate /rtps_builtin_endpoint_test3/uut/reset +add wave -noupdate -divider INPUT +add wave -noupdate /rtps_builtin_endpoint_test3/uut/empty +add wave -noupdate /rtps_builtin_endpoint_test3/uut/rd +add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test3/uut/data_in +add wave -noupdate /rtps_builtin_endpoint_test3/uut/last_word_in +add wave -noupdate /rtps_builtin_endpoint_test3/uut/last_word_in_latch +add wave -noupdate -divider OUTPUT +add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test3/uut/data_out +add wave -noupdate /rtps_builtin_endpoint_test3/uut/endpoint_wr +add wave -noupdate /rtps_builtin_endpoint_test3/uut/last_word_out +add wave -noupdate -divider TESTBENCH +add wave -noupdate /rtps_builtin_endpoint_test3/start +add wave -noupdate /rtps_builtin_endpoint_test3/stim_stage +add wave -noupdate /rtps_builtin_endpoint_test3/stimulus.length +add wave -noupdate /rtps_builtin_endpoint_test3/cnt_stim +add wave -noupdate /rtps_builtin_endpoint_test3/packet_sent +add wave -noupdate /rtps_builtin_endpoint_test3/SB.ItemNumberVar +add wave -noupdate -divider {MAIN FSM} +add wave -noupdate /rtps_builtin_endpoint_test3/uut/stage +add wave -noupdate /rtps_builtin_endpoint_test3/uut/stage_next +add wave -noupdate /rtps_builtin_endpoint_test3/uut/cnt +add wave -noupdate /rtps_builtin_endpoint_test3/uut/endpoint_mask +add wave -noupdate /rtps_builtin_endpoint_test3/uut/participant_match +add wave -noupdate -divider {MEM FSM} +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_opcode +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_op_start +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_op_done +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_stage +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_stage_next +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_cnt +add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test3/uut/mem_addr_base +add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test3/uut/addr_res +add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test3/uut/last_addr +add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test3/uut/max_participant_addr +add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test3/uut/max_endpoint_addr +add wave -noupdate -divider GUARD +add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test3/uut/read_cnt +add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test3/uut/parameter_end +add wave -noupdate /rtps_builtin_endpoint_test3/uut/parse_prc/rd_guard +add wave -noupdate -divider MEMORY +add wave -noupdate -group MEMORY -radix unsigned /rtps_builtin_endpoint_test3/uut/ram_inst/addr +add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test3/uut/ram_inst/wen +add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test3/uut/ram_inst/ren +add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test3/uut/ram_inst/wr_data +add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test3/uut/ram_inst/rd_data +add wave -noupdate -divider MISC +add wave -noupdate /rtps_builtin_endpoint_test3/uut/update_participant_flags +add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test3/uut/mem_seq_nr +add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test3/uut/seq_nr +TreeUpdate [SetDefaultTree] +WaveRestoreCursors {Begin {32125000 ps} 1} {Error {35025000 ps} 1} {Cursor {33675000 ps} 0} +quietly wave cursor active 3 +configure wave -namecolwidth 149 +configure wave -valuecolwidth 144 +configure wave -justifyvalue left +configure wave -signalnamewidth 1 +configure wave -snapdistance 10 +configure wave -datasetprefix 0 +configure wave -rowmargin 4 +configure wave -childrowmargin 2 +configure wave -gridoffset 0 +configure wave -gridperiod 1 +configure wave -griddelta 40 +configure wave -timeline 0 +configure wave -timelineunits ns +update +WaveRestoreZoom {33245026 ps} {34393368 ps} diff --git a/src/TODO.txt b/src/TODO.txt index 5215764..af6bfad 100644 --- a/src/TODO.txt +++ b/src/TODO.txt @@ -53,6 +53,7 @@ * We can determine if a Endpoint is a Reader or Writer via the Entity ID. Is it illegal to get a SEDP with incompatible source (Reader Entity ID from Publications Announcer?) * Can we make an array of records of uncontrained strings? That we we could make an array of variable sized strings... * Should I also check for Minor_Version >= 4? +* If a DATA Submessage is invalid in any way, the Sequence Number is never marked as received, and thus processing of remote Endpoints could stall on corrupt Messages. * Fast-RTPS doen not follow DDSI-RTPS Specification - Open Github Issue diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd index a217c7e..284fe6a 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd @@ -189,6 +189,7 @@ begin variable p2_sn, p2_snp, p2_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); variable user_data, topic_data, group_data : STRING_WORD_ARRAY_TYPE := EMPTY_STRING; + variable partition : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; -- Wrapper to use procedure as function impure function gen_rand_loc_2 return LOCATOR_TYPE is @@ -320,6 +321,13 @@ begin group_data := convert_string("GROUP_DATA" & (11 to 256 => NUL)); topic_data := convert_string("TOPIC_DATA" & (11 to 256 => NUL)); + -- Partition + partition.data(0) := int(10, CDR_LONG_WIDTH); + partition.data(1) := x"50415254"; + partition.data(2) := x"4954494f"; + partition.data(3) := x"4e000000"; + partition.length := 4; + Log("Initiating Test", INFO); stim_done <= '0'; start <= '0'; @@ -589,16 +597,13 @@ begin sub_p.data := EMPTY_TEST_PACKET; p2_snp := p2_snp + 1; - Log("ignore Participant 2 Writer [incompatible MAX_SERIALIZED_PAYLOAD]", INFO); + Log("Ignore Participant 2 Writer [Incompatible MAX_SERIALIZED_PAYLOAD]", INFO); sub_p.writerSN := p2_snp; endpoint := DEFAULT_ENDPOINT_DATA; endpoint.entityId := gen_rand_entityid_2(FALSE); endpoint.participant := p2; endpoint.topic_name := ENDPOINT_TOPIC(0); endpoint.type_name := ENDPOINT_TYPE(0); - endpoint.user_data := user_data; - endpoint.topic_data := topic_data; - endpoint.group_data := group_data; endpoint.max_size_serialized:= std_logic_vector(to_unsigned(66000, CDR_LONG_WIDTH)); gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); @@ -610,6 +615,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; p2_snp := p2_snp + 1; + Log("Ignore Participant 2 Writer [Non-Default Partition]", INFO); + sub_p.writerSN := p2_snp; + endpoint := DEFAULT_ENDPOINT_DATA; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.participant := p2; + endpoint.topic_name := ENDPOINT_TOPIC(0); + endpoint.type_name := ENDPOINT_TYPE(0); + gen_endpoint_data(endpoint, sub_p.data); + gen_parameter(PID_PARTITION, partition, sub_p.data); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p2_snp := p2_snp + 1; + -- Readers Log("Ignore Participant 2 Reader [Durability Persistent]", INFO); @@ -691,6 +714,24 @@ begin sub_s.data := EMPTY_TEST_PACKET; p2_sns := p2_sns + 1; + Log("Ignore Participant 2 Reader [Non-Default Partition]", INFO); + sub_s.writerSN := p2_sns; + endpoint := DEFAULT_ENDPOINT_DATA; + endpoint.entityId := gen_rand_entityid_2(TRUE); + endpoint.participant := p2; + endpoint.topic_name := ENDPOINT_TOPIC(0); + endpoint.type_name := ENDPOINT_TYPE(0); + gen_endpoint_data(endpoint, sub_s.data); + gen_parameter(PID_PARTITION, partition, sub_s.data); + gen_sentinel(sub_s.data); + gen_rtps_handler_out(sub_s, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_s.data := EMPTY_TEST_PACKET; + p2_sns := p2_sns + 1; + -- Reader/Writer Match/Unmatch Log("Match Participant 2 Writer [Default]", INFO); diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd new file mode 100644 index 0000000..3e28686 --- /dev/null +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd @@ -0,0 +1,1189 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library osvvm; -- Utility Library +context osvvm.OsvvmContext; + +use work.rtps_package.all; +use work.user_config.all; +use work.rtps_config_package.all; +use work.rtps_test_package.all; + + +entity rtps_builtin_endpoint_test3 is +end entity; + +architecture testbench of rtps_builtin_endpoint_test3 is + + -- *COMPONENT DECLARATION* + component rtps_builtin_endpoint is + port ( + clk : in std_logic; + reset : in std_logic; + empty : in std_logic; + rd : out std_logic; + data_in : in std_logic_vector(WORD_WIDTH-1 downto 0); + data_out : out std_logic_vector(WORD_WIDTH-1 downto 0); + last_word_in : in std_logic; + time : in TIME_TYPE; + endpoint_full : in std_logic_vector(0 to NUM_ENDPOINTS-1); + endpoint_wr : out std_logic_vector(0 to NUM_ENDPOINTS-1); + rtps_wr : out std_logic; + rtps_full : in std_logic; + last_word_out : out std_logic; + alive : in std_logic_vector(0 to NUM_ENDPOINTS-1) + ); + end component; + + -- *TYPE DECLARATION* + type TEST_STAGE_TYPE is (IDLE, BUSY); + type MATCH_MATRIX_TYPE is array (0 to NUM_WRITERS-1) of std_logic_vector(0 to NUM_READERS-1); + + -- *SIGNAL DECLARATION* + signal clk, in_empty, rd_sig, last_word_in, last_word_out: std_logic := '0'; + signal reset : std_logic := '1'; + signal endpoint_wr, endpoint_full : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); + signal data_in, data_out : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal stim_stage : TEST_STAGE_TYPE := IDLE; + shared variable stimulus, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + signal packet_sent : std_logic := '0'; + signal cnt_stim : natural := 0; + signal start : std_logic := '0'; + shared variable SB_out : work.ScoreBoardPkg_builtin_endpoint.ScoreBoardPType; + shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + signal stim_done, check_done, mem_check : std_logic := '0'; + + -- *FUNCTION DECLARATION* + procedure wait_on_complete is + begin + wait until rising_edge(packet_sent); + end procedure; + +begin + + -- Unit Under Test + uut : rtps_builtin_endpoint + port map ( + clk => clk, + reset => reset, + empty => in_empty or packet_sent, + rd => rd_sig, + data_in => data_in, + data_out => data_out, + last_word_in => last_word_in, + time => TIME_ZERO, + endpoint_full => endpoint_full, + endpoint_wr => endpoint_wr, + rtps_wr => open, + rtps_full => '0', + last_word_out => last_word_out, + alive => (others => '0') + ); + + stimulus_prc : process + variable sub, sub_p, sub_s : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; + variable check_cnt : natural := 0; + variable RV : RandomPType; + variable p0, participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; + variable fixed_readers : ENDPOINT_DATA_ARRAY_TYPE(0 to NUM_READERS-1) := gen_endpoint_array(TRUE); + variable fixed_writers : ENDPOINT_DATA_ARRAY_TYPE(0 to NUM_WRITERS-1) := gen_endpoint_array(FALSE); + variable e0, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; + variable p0_sn, p0_snp, p0_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; + variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); + + -- Wrapper to use procedure as function + impure function gen_rand_loc_2 return LOCATOR_TYPE is + variable ret : LOCATOR_TYPE := EMPTY_LOCATOR; + begin + gen_rand_loc(RV, ret); + return ret; + end function; + + impure function gen_rand_entityid_2(reader : boolean) return std_logic_vector is + variable ret : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0'); + begin + gen_rand_entityid(RV, reader, ret); + return ret; + end function; + + procedure push_reference is + begin + for i in 0 to reference.length-1 loop + SB_out.Push(wr_sig & reference.last(i) & reference.data(i)); + end loop; + end procedure; + + impure function gen_rand_guid_prefix return GUIDPREFIX_TYPE is + variable ret : GUIDPREFIX_TYPE; + begin + ret := (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), 2 => RV.RandSlv(WORD_WIDTH)); + return ret; + end function; + + procedure start_test is + begin + start <= '1'; + wait until rising_edge(clk); + start <= '0'; + mem_check <= '0'; + wait until rising_edge(clk); + end procedure; + begin + + assert (TEST_STRING = "TEST_CONFIG_1") report "user_config incompatible with testbench." severity FAILURE; + + SetAlertLogName("L0-rtps_builtin_endpoint-input_handling"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + -- Participant RTPS Submessage + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER; + sub.readerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + + -- Publisher Endpoint RTPS Submessage + sub_p := DEFAULT_RTPS_SUBMESSAGE; + sub_p.submessageID := SID_DATA; + sub_p.writerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_ANNOUNCER; + sub_p.readerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_DETECTOR; + sub_p.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + + -- Subscriber Endpoint RTPS Submessage + sub_s := DEFAULT_RTPS_SUBMESSAGE; + sub_s.submessageID := SID_DATA; + sub_s.writerId := ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_ANNOUNCER; + sub_s.readerId := ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_DETECTOR; + sub_s.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + + -- Participant 0 + p0.guidPrefix := gen_rand_guid_prefix; + p0.nr := 0; + p0.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1'; + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1'; + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1'; + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1'; + p0.expectsInlineQoS(0) := '1'; + p0.leaseDuration := gen_duration(10,0); + p0.builtinEndpointQoS(0):= '1'; + + e0.participant := p0; + e0.topic_name := ENDPOINT_TOPIC(0); + e0.type_name := ENDPOINT_TYPE(0); + + Log("Initiating Test", INFO); + mem_check <= '1'; + stim_done <= '0'; + start <= '0'; + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + Log("Match Participant 0 (Used for Endpoint Matching)", INFO); + sub.writerSN := p0_sn; + gen_participant_data(p0, sub.data); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, p0, stimulus); + SB_mem.Push(gen_participant_mem_frame(p0)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_PARTICIPANT_GUID* + Log("Ignore Participant 1 [Invalid PID_PARTICIPANT_GUID]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 1; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_PARTICIPANT_GUID, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 1 [Extra Bytes in PID_PARTICIPANT_GUID]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 1; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_PARTICIPANT_GUID, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_DOMAIN_ID* + Log("Ignore Participant 2 [Invalid PID_DOMAIN_ID]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 2; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_DOMAIN_ID, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 2 [Extra Bytes in PID_DOMAIN_ID]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 2; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_DOMAIN_ID, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_DOMAIN_TAG* + Log("Ignore Participant 3 [Invalid PID_DOMAIN_TAG]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 3; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_DOMAIN_TAG, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 3 [Extra Bytes in PID_DOMAIN_TAG]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 3; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_DOMAIN_TAG, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_PROTOCOL_VERSION* + Log("Ignore Participant 4 [Invalid PID_PROTOCOL_VERSION]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 4; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_PROTOCOL_VERSION, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 4 [Extra Bytes in PID_PROTOCOL_VERSION]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 4; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_PROTOCOL_VERSION, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_PARTICIPANT_LEASE_DURATION* + Log("Ignore Participant 5 [Invalid PID_PARTICIPANT_LEASE_DURATION]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 5; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_PARTICIPANT_LEASE_DURATION, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 5 [Extra Bytes in PID_PARTICIPANT_LEASE_DURATION]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 5; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_PARTICIPANT_LEASE_DURATION, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_BUILTIN_ENDPOINT_SET* + Log("Ignore Participant 6 [Invalid PID_BUILTIN_ENDPOINT_SET]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 6; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_BUILTIN_ENDPOINT_SET, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 6 [Extra Bytes in PID_BUILTIN_ENDPOINT_SET]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 6; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_BUILTIN_ENDPOINT_SET, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_DEFAULT_UNICAST_LOCATOR* + Log("Ignore Participant 7 [Invalid PID_DEFAULT_UNICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 7; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_DEFAULT_UNICAST_LOCATOR, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 7 [Extra Bytes in PID_DEFAULT_UNICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 7; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_DEFAULT_UNICAST_LOCATOR, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_DEFAULT_MULTICAST_LOCATOR* + Log("Ignore Participant 8 [Invalid PID_DEFAULT_MULTICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.defaultMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 8; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_DEFAULT_MULTICAST_LOCATOR, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 8 [Extra Bytes in PID_DEFAULT_MULTICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.defaultMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 8; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_DEFAULT_MULTICAST_LOCATOR, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_METATRAFFIC_UNICAST_LOCATOR* + Log("Ignore Participant 9 [Invalid PID_METATRAFFIC_UNICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.metatrafficUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 9; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_METATRAFFIC_UNICAST_LOCATOR, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 9 [Extra Bytes in PID_METATRAFFIC_UNICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.metatrafficUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 9; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_METATRAFFIC_UNICAST_LOCATOR, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_METATRAFFIC_MULTICAST_LOCATOR* + Log("Ignore Participant 10 [Invalid PID_METATRAFFIC_MULTICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.metatrafficMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 10; + participant.match := UNMATCH; + gen_participant_data(participant, sub.data, PID_METATRAFFIC_MULTICAST_LOCATOR, -1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + Log("Match Participant 10 [Extra Bytes in PID_METATRAFFIC_MULTICAST_LOCATOR]", INFO); + sub.writerSN := p0_sn; + participant := p0; + participant.metatrafficMulticastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := 10; + participant.match := MATCH; + gen_participant_data(participant, sub.data, PID_METATRAFFIC_MULTICAST_LOCATOR, +1); + gen_sentinel(sub.data); + gen_rtps_handler_out(sub, participant, stimulus); + SB_mem.Push(gen_participant_mem_frame(participant)); + start_test; + mem_check <= '1'; + wait_on_complete; + check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p0_sn := p0_sn + 1; + + -- *PID_TOPIC_NAME* + Log("Ignore Endpoint [Invalid PID_TOPIC_NAME]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_TOPIC_NAME, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_TOPIC_NAME]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_TOPIC_NAME, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_TYPE_NAME* + Log("Ignore Endpoint [Invalid PID_TYPE_NAME]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_TYPE_NAME, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_TYPE_NAME]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_TYPE_NAME, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_DURABILITY* + Log("Ignore Endpoint [Invalid PID_DURABILITY]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DURABILITY, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_DURABILITY]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DURABILITY, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_DEADLINE* + Log("Ignore Endpoint [Invalid PID_DEADLINE]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DEADLINE, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_DEADLINE]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DEADLINE, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_LIVELINESS* + Log("Ignore Endpoint [Invalid PID_LIVELINESS]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_LIVELINESS, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_LIVELINESS]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_LIVELINESS, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_RELIABILITY* + Log("Ignore Endpoint [Invalid PID_RELIABILITY]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_RELIABILITY, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_RELIABILITY]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_RELIABILITY, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_DESTINATION_ORDER* + Log("Ignore Endpoint [Invalid PID_DESTINATION_ORDER]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DESTINATION_ORDER, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_DESTINATION_ORDER]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_DESTINATION_ORDER, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_OWNERSHIP* + Log("Ignore Endpoint [Invalid PID_OWNERSHIP]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_OWNERSHIP, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_OWNERSHIP]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_OWNERSHIP, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_PRESENTATION* + Log("Ignore Endpoint [Invalid PID_PRESENTATION]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_PRESENTATION, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_PRESENTATION]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_PRESENTATION, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_LATENCY_BUDGET* + Log("Ignore Endpoint [Invalid PID_LATENCY_BUDGET]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_LATENCY_BUDGET, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_LATENCY_BUDGET]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_LATENCY_BUDGET, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_ENDPOINT_GUID* + Log("Ignore Endpoint [Invalid PID_ENDPOINT_GUID]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_ENDPOINT_GUID, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_ENDPOINT_GUID]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_ENDPOINT_GUID, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_EXPECTS_INLINE_QOS* + Log("Ignore Endpoint [Invalid PID_EXPECTS_INLINE_QOS]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_EXPECTS_INLINE_QOS, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_EXPECTS_INLINE_QOS]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + gen_endpoint_data(endpoint, sub_p.data, PID_EXPECTS_INLINE_QOS, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_DATA_MAX_SIZE_SERIALIZED* + Log("Ignore Endpoint [Invalid PID_DATA_MAX_SIZE_SERIALIZED]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.max_size_serialized:= int(65000, CDR_LONG_WIDTH); + gen_endpoint_data(endpoint, sub_p.data, PID_DATA_MAX_SIZE_SERIALIZED, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_DATA_MAX_SIZE_SERIALIZED]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.max_size_serialized:= int(65000, CDR_LONG_WIDTH); + gen_endpoint_data(endpoint, sub_p.data, PID_DATA_MAX_SIZE_SERIALIZED, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_UNICAST_LOCATOR* + Log("Ignore Endpoint [Invalid PID_UNICAST_LOCATOR]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + gen_endpoint_data(endpoint, sub_p.data, PID_UNICAST_LOCATOR, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_UNICAST_LOCATOR]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + gen_endpoint_data(endpoint, sub_p.data, PID_UNICAST_LOCATOR, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + -- *PID_MULTICAST_LOCATOR* + Log("Ignore Endpoint [Invalid PID_MULTICAST_LOCATOR]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.multicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + gen_endpoint_data(endpoint, sub_p.data, PID_MULTICAST_LOCATOR, -1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + + Log("Match Endpoint [Extra Bytes in PID_MULTICAST_LOCATOR]", INFO); + sub_p.writerSN := p0_snp; + endpoint := e0; + endpoint.entityId := gen_rand_entityid_2(FALSE); + endpoint.multicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + gen_endpoint_data(endpoint, sub_p.data, PID_MULTICAST_LOCATOR, +1); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + gen_match_frame(endpoint, reference); + wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); + push_reference; + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + p0_snp := p0_snp + 1; + + TranscriptOpen(RESULTS_FILE, APPEND_MODE); + SetTranscriptMirror; + stim_done <= '1'; + wait until check_done = '1'; + AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + ReportAlerts; + TranscriptClose; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for 25 ns; + clk <= '1'; + wait for 25 ns; + end process; + + in_empty_prc : process + begin + in_empty <= '0'; + wait until rd_sig = '1'; + wait until rising_edge(clk); + in_empty <= '1'; + wait until rising_edge(clk); + end process; + + endpoint_full_prc : process + begin + endpoint_full <= (others => '0'); + wait until (or endpoint_wr) = '1'; + wait until rising_edge(clk); + endpoint_full <= (others => '1'); + wait until rising_edge(clk); + end process; + + alert_prc : process(all) + begin + if rising_edge(clk) then + alertif(in_empty = '1' and rd_sig = '1', "Input FIFO read signal high while empty signal high", ERROR); + alertif(endpoint_full /= (0 to NUM_ENDPOINTS-1 => '0') and (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')), "Endpoint FIFO write signal high while full signal high", ERROR); + end if; + end process; + + input_prc : process(all) + begin + data_in <= stimulus.data(cnt_stim); + last_word_in <= stimulus.last(cnt_stim); + case (stim_stage) is + when IDLE => + packet_sent <= '1'; + when BUSY => + packet_sent <= '0'; + end case; + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim <= 0; + stim_stage <= IDLE; + else + case (stim_stage) is + when IDLE => + if (start = '1') then + stim_stage <= BUSY; + cnt_stim <= 0; + end if; + when BUSY => + if (cnt_stim = stimulus.length) then + stim_stage <= IDLE; + elsif (rd_sig = '1') then + cnt_stim <= cnt_stim + 1; + end if; + end case; + end if; + end if; + end process; + + output_check_prc : process(all) + begin + check_done <= '0'; + if rising_edge(clk) then + if (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')) then + SB_out.Check(endpoint_wr & last_word_out & data_out); + end if; + if (stim_done = '1' and SB_out.empty) then + check_done <= '1'; + end if; + end if; + end process; + + mem_check_prc : process + alias mem is <>; + alias mem_op_done is <>; + variable reference : TEST_PARTICIPANT_MEMORY_FRAME_TYPE; + begin + -- SAFEGUARD: (Prevent Fall-through Behavior) + if (reset /= '0') then + wait until reset = '0'; + end if; + -- NOTE: The first read after the packet is sent signifies that the State Machine has begun processing the next packet. + -- The memory operation that could still be in progress is the last one concerning the last sent packet. + wait on packet_sent until (packet_sent = '1' and mem_check = '1'); + if (rd_sig /= '1') then + wait until rd_sig = '1'; + end if; + if (mem_op_done /= '1') then + wait until mem_op_done = '1'; + end if; + if (not SB_mem.empty) then + SB_mem.Pop(reference); + for i in 0 to reference'length-1 loop + AffirmIf(?? (mem(reference(i).addr) ?= reference(i).data), "Address: " & integer'image(reference(i).addr) & " Received: " & to_hstring(mem(reference(i).addr)) & " Expected: " & to_hstring(reference(i).data)); + end loop; + end if; + end process; + + watchdog : process + begin + wait for 1 ms; + Alert("Test timeout", FAILURE); + std.env.stop; + end process; + +end architecture; \ No newline at end of file diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index dced516..a0f7fa8 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -17,8 +17,10 @@ analyze ScoreBoard_test_memory.vhd analyze Level_0/rtps_builtin_endpoint_test1.vhd analyze ScoreBoard_builtin_endpoint.vhd analyze Level_0/rtps_builtin_endpoint_test2.vhd +analyze Level_0/rtps_builtin_endpoint_test3.vhd #simulate rtps_handler_test1 #simulate rtps_handler_test2 #simulate rtps_builtin_endpoint_test1 -simulate rtps_builtin_endpoint_test2 \ No newline at end of file +#simulate rtps_builtin_endpoint_test2 +simulate rtps_builtin_endpoint_test3 \ No newline at end of file diff --git a/src/rtps_builtin_endpoint.vhd b/src/rtps_builtin_endpoint.vhd index f4e31ae..8113146 100644 --- a/src/rtps_builtin_endpoint.vhd +++ b/src/rtps_builtin_endpoint.vhd @@ -374,7 +374,7 @@ architecture arch of rtps_builtin_endpoint is -- RTPS PARAMETER LIST HEADER alias parameter_id : std_logic_vector(15 downto 0) is data_in(31 downto 16); alias parameter_length : std_logic_vector(15 downto 0) is data_in(15 downto 0); - alias must_undersand : std_logic is parameter_id(14); + alias must_understand : std_logic is parameter_id(14); -- RTPS DATA PAYLOAD HEADER alias representation_id : std_logic_vector(15 downto 0) is data_in(31 downto 16); alias representation_options : std_logic_vector(15 downto 0) is data_in(15 downto 0); @@ -1710,7 +1710,8 @@ begin -- Ignore in-line QoS -- Only relevant for Endpoint Discovery Protocol if(qos_flag = '0' and message_type = EDP) then - stage_next <= RXO_RELIABILITY; + stage_next <= RXO_RELIABILITY; + cnt_next <= 0; rcvd_next(RELIABILITY_QOS_RCVD_FLAG) <= '1'; end if; when PID_DESTINATION_ORDER => @@ -1886,7 +1887,7 @@ begin null; when others => -- If MUST_UNDERSTAND Flag is set, we have incompatible communication. Drop Packet - if (must_undersand = '1') then + if (must_understand = '1') then stage_next <= SKIP_PACKET; -- Else skip Uknown Parameter else @@ -2243,18 +2244,26 @@ begin -- Input FIFO Guard if (empty = '0') then rd_guard := '1'; + cnt_next <= cnt + 1; - -- Check QoS Compatibility (Unmark match on incompatibility) - -- COMPATIBLE (DDS v1.4): offered >= requested, with BEST_EFFORT < RELIABLE - for i in 0 to NUM_ENDPOINTS-1 loop - if (not check_qos_compatibility(is_subscriber, '1', unsigned(data_in_swapped), unsigned(ENDPOINT_RELIABILITY_QOS(i)))) then - endpoint_mask_next(i) <= '0'; - end if; - end loop; - - -- NOTE: The max_blocking_time value is ignored - -- DONE - stage_next <= SKIP_PARAMETER; + case (cnt) is + when 0 => + -- Check QoS Compatibility (Unmark match on incompatibility) + -- COMPATIBLE (DDS v1.4): offered >= requested, with BEST_EFFORT < RELIABLE + for i in 0 to NUM_ENDPOINTS-1 loop + if (not check_qos_compatibility(is_subscriber, '1', unsigned(data_in_swapped), unsigned(ENDPOINT_RELIABILITY_QOS(i)))) then + endpoint_mask_next(i) <= '0'; + end if; + end loop; + when 1 => + -- NOTE: The max_blocking_time value is ignored + null; + when 2 => + -- DONE + stage_next <= SKIP_PARAMETER; + when others => + null; + end case; end if; when RXO_DESTINATION_ORDER => -- Input FIFO Guard diff --git a/src/rtps_test_package.vhd b/src/rtps_test_package.vhd index 731c338..9096f7b 100644 --- a/src/rtps_test_package.vhd +++ b/src/rtps_test_package.vhd @@ -227,7 +227,7 @@ package rtps_test_package is function gen_endpoint_array(readers : boolean) return ENDPOINT_DATA_ARRAY_TYPE; procedure gen_sentinel(output : inout TEST_PACKET_TYPE); - procedure gen_parameter(pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); length : in natural; data : in TEST_PACKET_TYPE; 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_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)); @@ -935,7 +935,7 @@ package body rtps_test_package is output.length := output.length + 1; -- GUID if (pid = PID_PARTICIPANT_GUID) then - assert (16+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (16+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_PARTICIPANT_GUID & endian_swap(ref.littleEndian, int(16+(offset*4), PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_PARTICIPANT_GUID & endian_swap(ref.littleEndian, int(16, PARAMETER_LENGTH_WIDTH)); @@ -954,7 +954,7 @@ package body rtps_test_package is end if; -- DOMAIN ID if (pid = PID_DOMAIN_ID) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DOMAIN_ID & endian_swap(ref.littleEndian, int(4+(offset*4), PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DOMAIN_ID & endian_swap(ref.littleEndian, int(4, PARAMETER_LENGTH_WIDTH)); @@ -966,10 +966,10 @@ package body rtps_test_package is output.length := output.length + offset; end if; -- DOMAIN TAG - if (ref.domainTag /= DEFAULT_DOMAIN_TAG) then + if (ref.domainTag /= DEFAULT_DOMAIN_TAG or pid = PID_DOMAIN_TAG) then tmp := string_len(ref.domainTag); if (pid = PID_DOMAIN_TAG) then - assert (((round_div(tmp,4)+1)*4)+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (((round_div(tmp,4)+1)*4)+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DOMAIN_TAG & endian_swap(ref.littleEndian, int(((round_div(tmp,4)+1)*4)+(offset*4), PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DOMAIN_TAG & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4, PARAMETER_LENGTH_WIDTH)); @@ -987,7 +987,7 @@ package body rtps_test_package is end if; -- PROTOCOL VERSION if (pid = PID_PROTOCOL_VERSION) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_PROTOCOL_VERSION & endian_swap(ref.littleEndian, int(4+(offset*4), PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_PROTOCOL_VERSION & endian_swap(ref.littleEndian, int(4, PARAMETER_LENGTH_WIDTH)); @@ -1001,7 +1001,7 @@ package body rtps_test_package is end if; -- VENDORID if (pid = PID_VENDORID) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_VENDORID & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_VENDORID & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1014,9 +1014,9 @@ package body rtps_test_package is output.length := output.length + offset; end if; -- EXPECTS IN-LINE QOS - if (ref.expectsInlineQoS(0) /= DEFAULT_EXPECTS_INLINE_QOS) then + if (ref.expectsInlineQoS(0) /= DEFAULT_EXPECTS_INLINE_QOS or pid = PID_EXPECTS_INLINE_QOS) then if (pid = PID_EXPECTS_INLINE_QOS) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_EXPECTS_INLINE_QOS & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_EXPECTS_INLINE_QOS & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1034,7 +1034,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.metatrafficMulticastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_METATRAFFIC_MULTICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_METATRAFFIC_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1062,7 +1062,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.metatrafficUnicastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_METATRAFFIC_UNICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_METATRAFFIC_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_METATRAFFIC_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1090,7 +1090,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.defaultMulticastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_DEFAULT_MULTICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DEFAULT_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DEFAULT_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1119,7 +1119,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.defaultUnicastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_DEFAULT_UNICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DEFAULT_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DEFAULT_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1143,9 +1143,9 @@ package body rtps_test_package is end loop; end if; -- LEASE DURATION - if (ref.leaseDuration /= DEFAULT_PARTICIPANT_LEASE_DURATION) then + if (ref.leaseDuration /= DEFAULT_PARTICIPANT_LEASE_DURATION or pid = PID_PARTICIPANT_LEASE_DURATION) then if (pid = PID_PARTICIPANT_LEASE_DURATION) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_PARTICIPANT_LEASE_DURATION & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_PARTICIPANT_LEASE_DURATION & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1161,7 +1161,7 @@ package body rtps_test_package is end if; -- AVAILABLE ENDPOINTS if (pid = PID_BUILTIN_ENDPOINT_SET) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_BUILTIN_ENDPOINT_SET & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_BUILTIN_ENDPOINT_SET & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1172,9 +1172,22 @@ package body rtps_test_package is if (pid = PID_BUILTIN_ENDPOINT_SET) then output.length := output.length + offset; end if; + -- BUILTIN ENDPOINT QOS + if (pid = PID_BUILTIN_ENDPOINT_QOS) then + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; + output.data(output.length) := PID_BUILTIN_ENDPOINT_QOS & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); + else + output.data(output.length) := PID_BUILTIN_ENDPOINT_QOS & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); + end if; + output.length := output.length + 1; + output.data(output.length) := endian_swap(ref.littleEndian, ref.builtinEndpointQoS); + output.length := output.length + 1; + if (pid = PID_BUILTIN_ENDPOINT_QOS) then + output.length := output.length + offset; + end if; -- MANUAL LIVELINESS COUNT if (pid = PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1281,6 +1294,8 @@ package body rtps_test_package is return ret; end function; + -- 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 @@ -1293,7 +1308,7 @@ package body rtps_test_package is output.length := output.length + 1; -- GUID if (pid = PID_ENDPOINT_GUID) then - assert (16+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (16+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_ENDPOINT_GUID & endian_swap(ref.littleEndian, int(16+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_ENDPOINT_GUID & endian_swap(ref.littleEndian, int(16,PARAMETER_LENGTH_WIDTH)); @@ -1311,9 +1326,9 @@ package body rtps_test_package is output.length := output.length + offset; end if; -- EXPECTS IN-LINE QOS - if (ref.expectsInlineQoS(0) /= '0') then + if (ref.expectsInlineQoS(0) /= DEFAULT_EXPECTS_INLINE_QOS or pid = PID_EXPECTS_INLINE_QOS) then if (pid = PID_EXPECTS_INLINE_QOS) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_EXPECTS_INLINE_QOS & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_EXPECTS_INLINE_QOS & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1327,9 +1342,9 @@ package body rtps_test_package is end if; end if; -- TOPIC NAME - tmp := string_len(ref.topic_name); + tmp := string_len(ref.topic_name); if (pid = PID_TOPIC_NAME) then - assert (((round_div(tmp,4)+1)*4)+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (((round_div(tmp,4)+1)*4)+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_TOPIC_NAME & endian_swap(ref.littleEndian, int(((round_div(tmp,4)+1)*4)+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_TOPIC_NAME & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4,PARAMETER_LENGTH_WIDTH)); @@ -1345,9 +1360,9 @@ package body rtps_test_package is output.length := output.length + offset; end if; -- TYPE NAME - tmp := string_len(ref.type_name); + tmp := string_len(ref.type_name); if (pid = PID_TYPE_NAME) then - assert (((round_div(tmp,4)+1)*4)+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (((round_div(tmp,4)+1)*4)+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_TYPE_NAME & endian_swap(ref.littleEndian, int(((round_div(tmp,4)+1)*4)+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_TYPE_NAME & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4,PARAMETER_LENGTH_WIDTH)); @@ -1363,9 +1378,9 @@ package body rtps_test_package is output.length := output.length + offset; end if; -- DURABILITY - if (ref.durability /= DEFAULT_DURABILITY_QOS) then + if (ref.durability /= DEFAULT_DURABILITY_QOS or pid = PID_DURABILITY) then if (pid = PID_DURABILITY) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DURABILITY & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DURABILITY & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1380,9 +1395,9 @@ package body rtps_test_package is -- DURABILITY SERVICE if (ref.durability_service_cleanup_delay /= DEFAULT_DURABILITY_SERVICE_CLEANUP_DELAY or ref.durability_service_history /= DEFAULT_DURABILITY_SERVICE_HISTORY or ref.durability_service_history_depth /= DEFAULT_DURABILITY_SERVICE_HISTORY_DEPTH or ref.durability_service_max_samples /= DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES or - ref.durability_service_max_instances /= DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES or ref.durability_service_max_samples_per_instances /= DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE) then + ref.durability_service_max_instances /= DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES or ref.durability_service_max_samples_per_instances /= DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE or pid = PID_DURABILITY_SERVICE) then if (pid = PID_DURABILITY_SERVICE) then - assert (28+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (28+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DURABILITY_SERVICE & endian_swap(ref.littleEndian, int(28+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DURABILITY_SERVICE & endian_swap(ref.littleEndian, int(28,PARAMETER_LENGTH_WIDTH)); @@ -1407,9 +1422,9 @@ package body rtps_test_package is end if; end if; -- PRESENTATION - if (ref.presentation /= DEFAULT_PRESENTATION_QOS or ref.coherent_access(0) /= boolean_to_std_logic(DEFAULT_COHERENT_ACCESS) or ref.ordered_access(0) /= boolean_to_std_logic(DEFAULT_ORDERED_ACCESS)) then + if (ref.presentation /= DEFAULT_PRESENTATION_QOS or ref.coherent_access(0) /= boolean_to_std_logic(DEFAULT_COHERENT_ACCESS) or ref.ordered_access(0) /= boolean_to_std_logic(DEFAULT_ORDERED_ACCESS) or pid = PID_PRESENTATION) then if (pid = PID_PRESENTATION) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_PRESENTATION & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_PRESENTATION & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1424,9 +1439,9 @@ package body rtps_test_package is end if; end if; -- DEADLINE - if (ref.deadline /= DEFAULT_DEADLINE_QOS) then + if (ref.deadline /= DEFAULT_DEADLINE_QOS or pid = PID_DEADLINE) then if (pid = PID_DEADLINE) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DEADLINE & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DEADLINE & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1441,9 +1456,9 @@ package body rtps_test_package is end if; end if; -- LATENCY BUDGET - if (ref.latency_budget /= DEFAULT_LATENCY_BUDGET_QOS) then + if (ref.latency_budget /= DEFAULT_LATENCY_BUDGET_QOS or pid = PID_LATENCY_BUDGET) then if (pid = PID_LATENCY_BUDGET) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_LATENCY_BUDGET & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_LATENCY_BUDGET & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1458,9 +1473,9 @@ package body rtps_test_package is end if; end if; -- OWNERSHIP - if (ref.ownership /= DEFAULT_OWNERSHIP_QOS) then + if (ref.ownership /= DEFAULT_OWNERSHIP_QOS or pid = PID_OWNERSHIP) then if (pid = PID_OWNERSHIP) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_OWNERSHIP & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_OWNERSHIP & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1473,9 +1488,9 @@ package body rtps_test_package is end if; end if; -- OWNERSHIP STRENGTH - if (ref.ownership /= DEFAULT_OWNERSHIP_STRENGTH_QOS) then + if (ref.ownership /= DEFAULT_OWNERSHIP_STRENGTH_QOS or pid = PID_OWNERSHIP_STRENGTH) then if (pid = PID_OWNERSHIP_STRENGTH) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_OWNERSHIP_STRENGTH & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_OWNERSHIP_STRENGTH & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1488,9 +1503,9 @@ package body rtps_test_package is end if; end if; -- LIVELINESS - if (ref.liveliness /= DEFAULT_LIVELINESS_QOS or ref.leaseDuration /= DEFAULT_LEASE_DURATION) then + if (ref.liveliness /= DEFAULT_LIVELINESS_QOS or ref.leaseDuration /= DEFAULT_LEASE_DURATION or pid = PID_LIVELINESS) then if (pid = PID_LIVELINESS) then - assert (12+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (12+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_LIVELINESS & endian_swap(ref.littleEndian, int(12+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_LIVELINESS & endian_swap(ref.littleEndian, int(12,PARAMETER_LENGTH_WIDTH)); @@ -1507,9 +1522,9 @@ package body rtps_test_package is end if; end if; -- TIME BASED FILTER - if (ref.time_based_filter /= DEFAULT_TIME_BASED_FILTER_QOS) then + if (ref.time_based_filter /= DEFAULT_TIME_BASED_FILTER_QOS or pid = PID_TIME_BASED_FILTER) then if (pid = PID_TIME_BASED_FILTER) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_TIME_BASED_FILTER & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_TIME_BASED_FILTER & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1524,9 +1539,9 @@ package body rtps_test_package is end if; end if; -- RELIABILITY - if (ref.reliability /= DEFAULT_RELIABILTY_QOS or ref.max_blocking_time /= DEFAULT_MAX_BLOCKING_TIME) then + if (ref.reliability /= DEFAULT_RELIABILTY_QOS or ref.max_blocking_time /= DEFAULT_MAX_BLOCKING_TIME or pid = PID_RELIABILITY) then if (pid = PID_RELIABILITY) then - assert (12+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (12+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_RELIABILITY & endian_swap(ref.littleEndian, int(12+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_RELIABILITY & endian_swap(ref.littleEndian, int(12,PARAMETER_LENGTH_WIDTH)); @@ -1543,9 +1558,9 @@ package body rtps_test_package is end if; end if; -- TRANSPORT PRIORITY - if (ref.transportnpriority /= DEFAULT_TRANSPORT_PRIORITY_QOS) then + if (ref.transportnpriority /= DEFAULT_TRANSPORT_PRIORITY_QOS or pid = PID_TRANSPORT_PRIORITY) then if (pid = PID_TRANSPORT_PRIORITY) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_TRANSPORT_PRIORITY & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_TRANSPORT_PRIORITY & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1558,9 +1573,9 @@ package body rtps_test_package is end if; end if; -- LIFESPAN - if (ref.lifespan /= DEFAULT_LIFESPAN_QOS) then + if (ref.lifespan /= DEFAULT_LIFESPAN_QOS or pid = PID_LIFESPAN) then if (pid = PID_LIFESPAN) then - assert (8+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (8+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_LIFESPAN & endian_swap(ref.littleEndian, int(8+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_LIFESPAN & endian_swap(ref.littleEndian, int(8,PARAMETER_LENGTH_WIDTH)); @@ -1575,9 +1590,9 @@ package body rtps_test_package is end if; end if; -- DESTINATION ORDER - if (ref.destination_order /= DEFAULT_DESTINATION_ORDER_QOS) then + if (ref.destination_order /= DEFAULT_DESTINATION_ORDER_QOS or pid = PID_DESTINATION_ORDER) then if (pid = PID_DESTINATION_ORDER) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DESTINATION_ORDER & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DESTINATION_ORDER & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1594,7 +1609,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.unicastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_UNICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_UNICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1622,7 +1637,7 @@ package body rtps_test_package is tmp := to_integer(unsigned(ref.multicastLocatorList.numLocators)); for i in 0 to tmp-1 loop if (pid = PID_MULTICAST_LOCATOR) then - assert (24+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (24+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_MULTICAST_LOCATOR & endian_swap(ref.littleEndian, int(24,PARAMETER_LENGTH_WIDTH)); @@ -1646,7 +1661,7 @@ package body rtps_test_package is end loop; end if; -- USER DATA - tmp := string_len(ref.user_data); + tmp := string_len(ref.user_data); if (tmp > 1) then output.data(output.length) := PID_USER_DATA & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4,PARAMETER_LENGTH_WIDTH)); output.length := output.length + 1; @@ -1658,7 +1673,7 @@ package body rtps_test_package is end loop; end if; -- TOPIC DATA - tmp := string_len(ref.topic_data); + tmp := string_len(ref.topic_data); if (tmp > 1) then output.data(output.length) := PID_TOPIC_DATA & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4,PARAMETER_LENGTH_WIDTH)); output.length := output.length + 1; @@ -1670,7 +1685,7 @@ package body rtps_test_package is end loop; end if; -- GROUP DATA - tmp := string_len(ref.group_data); + tmp := string_len(ref.group_data); if (tmp > 1) then output.data(output.length) := PID_GROUP_DATA & endian_swap(ref.littleEndian, int((round_div(tmp,4)+1)*4,PARAMETER_LENGTH_WIDTH)); output.length := output.length + 1; @@ -1682,9 +1697,10 @@ package body rtps_test_package is end loop; end if; -- MAX SIZE SERIALIZED + -- NOTE: PID_DATA_MAX_SIZE_SERIALIZED has no default value, but we use the value zero as default for not sending the parameter if (unsigned(ref.max_size_serialized) /= 0) then if (pid = PID_DATA_MAX_SIZE_SERIALIZED) then - assert (4+(offset*4) > 0) report "Parameter Length < 0" severity FAILURE; + assert (4+(offset*4) >= 0) report "Parameter Length < 0" severity FAILURE; output.data(output.length) := PID_DATA_MAX_SIZE_SERIALIZED & endian_swap(ref.littleEndian, int(4+(offset*4),PARAMETER_LENGTH_WIDTH)); else output.data(output.length) := PID_DATA_MAX_SIZE_SERIALIZED & endian_swap(ref.littleEndian, int(4,PARAMETER_LENGTH_WIDTH)); @@ -1751,13 +1767,13 @@ package body rtps_test_package is output.length := output.length + 1; end procedure; - procedure gen_parameter(pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); length : in natural; data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE) is + procedure gen_parameter(pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); data : in TEST_PACKET_TYPE; output : inout TEST_PACKET_TYPE) is begin -- PARAMETER HEADER - output.data(output.length) := pid & int(length*4,PARAMETER_LENGTH_WIDTH); + output.data(output.length) := pid & int(data.length*4,PARAMETER_LENGTH_WIDTH); output.length := output.length + 1; -- DATA - for i in 0 to length-1 loop + for i in 0 to data.length-1 loop output.data(output.length) := data.data(i); output.length := output.length + 1; end loop;