rtps-fpga/src/Tests/Level_0/L0_rtps_discovery_module_test4.vhd

1888 lines
70 KiB
VHDL

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;
-- This testbench tests the SequenceNumber, HEARTBEAT, and GAP handling of the Participant, Subscriber, Publisher, and ParticipantMessage DATA Submessages.
entity L0_rtps_discovery_module_test4 is
end entity;
architecture testbench of L0_rtps_discovery_module_test4 is
-- *CONSTANT DECLARATION*
constant MAX_REMOTE_PARTICIPANTS : natural := 1;
-- *TYPE DECLARATION*
type TEST_STAGE_TYPE is (IDLE, BUSY);
type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_PARTICIPANTS*PARTICIPANT_FRAME_SIZE)-1) of std_logic_vector(WORD_WIDTH-1 downto 0);
-- *SIGNAL DECLARATION*
signal clk, in_empty, rd_sig, last_word_in, last_word_out_rtps: std_logic := '0';
signal reset : std_logic := '1';
signal wr_rtps, full_rtps : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0');
signal data_in, data_out_rtps : 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_discovery_module.ScoreBoardPType;
shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType;
signal stim_done, mem_check_done, check_done, test_done : std_logic := '0';
-- *FUNCTION DECLARATION*
procedure wait_on_complete is
begin
if (test_done /= '1') then
wait until test_done = '1';
end if;
end procedure;
procedure wait_on_mem_check is
begin
if (mem_check_done /= '1') then
wait until mem_check_done = '1';
end if;
end procedure;
procedure wait_on_sent is
begin
wait until rising_edge(packet_sent);
end procedure;
function gen_sn(input : natural) return SEQUENCENUMBER_TYPE is
variable ret : SEQUENCENUMBER_TYPE;
begin
ret(0) := (others => '0');
ret(1) := unsigned(int(input, WORD_WIDTH));
return ret;
end function;
begin
-- Unit Under Test
uut : entity work.rtps_discovery_module(arch)
generic map (
MAX_REMOTE_PARTICIPANTS => MAX_REMOTE_PARTICIPANTS
)
port map (
-- SYSTEM
clk => clk,
reset => reset,
time => TIME_ZERO,
-- FROM RTPS HANDLER
empty => in_empty or packet_sent,
rd => rd_sig,
data_in => data_in,
last_word_in => last_word_in,
-- FROM USER ENDPOINT
alive => (others => '0'),
-- TO USER ENDPOINT
full_rtps => full_rtps,
wr_rtps => wr_rtps,
data_out_rtps => data_out_rtps,
last_word_out_rtps => last_word_out_rtps,
-- RTPS OUTPUT
full_ro => '0',
wr_ro => open,
data_out_ro => open,
last_word_out_ro => open
);
stimulus_prc : process
variable sub, sub_d, sub_p, sub_s, sub_m : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE;
variable RV : RandomPType;
variable p0, participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA;
variable e0, e1, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA;
variable p_sn, p_snp : 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_loc_list return LOCATOR_LIST_TYPE is
variable ret : LOCATOR_LIST_TYPE := EMPTY_LOCATOR_LIST;
begin
ret := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR));
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_endpoint_reference is
begin
-- MATCH
if (wr_sig /= (wr_sig'range => '0')) then
endpoint.match := MATCH;
gen_endpoint_match_frame(endpoint, reference);
for i in 0 to reference.length-1 loop
SB_out.Push(wr_sig & reference.last(i) & reference.data(i));
end loop;
reference := EMPTY_TEST_PACKET;
end if;
-- UNMATCH
if ((not wr_sig) /= (wr_sig'range => '0')) then
endpoint.match := UNMATCH;
gen_endpoint_match_frame(endpoint, reference);
for i in 0 to reference.length-1 loop
SB_out.Push((not wr_sig) & reference.last(i) & reference.data(i));
end loop;
reference := EMPTY_TEST_PACKET;
end if;
end procedure;
procedure push_liveliness_update is
begin
gen_liveliness_update_frame(participant, reference);
for i in 0 to reference.length-1 loop
SB_out.Push(wr_sig & reference.last(i) & reference.data(i));
end loop;
reference := EMPTY_TEST_PACKET;
end procedure;
procedure push_participant_reference is
variable wr_sig : std_logic_vector(NUM_ENDPOINTS-1 downto 0) := (others => '1');
begin
gen_participant_match_frame(participant, reference);
for i in 0 to reference.length-1 loop
SB_out.Push(wr_sig & reference.last(i) & reference.data(i));
end loop;
reference := EMPTY_TEST_PACKET;
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';
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_discovery_module_test4 - Sequence Number 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_d := DEFAULT_RTPS_SUBMESSAGE;
sub_d.writerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER;
sub_d.readerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR;
-- Publisher Endpoint RTPS Submessage
sub_p := DEFAULT_RTPS_SUBMESSAGE;
sub_p.writerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_ANNOUNCER;
sub_p.readerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_DETECTOR;
-- Subscriber Endpoint RTPS Submessage
sub_s := DEFAULT_RTPS_SUBMESSAGE;
sub_s.writerId := ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_ANNOUNCER;
sub_s.readerId := ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_DETECTOR;
-- Participant Message RTPS Submessage
sub_m := DEFAULT_RTPS_SUBMESSAGE;
sub_m.writerId := ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER;
sub_m.readerId := ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER;
-- Participant 0
p0.guidPrefix := gen_rand_guid_prefix;
p0.nr := 0;
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';
e0.participant := p0;
e0.topic_name := ENDPOINT_TOPIC(2);
e0.type_name := ENDPOINT_TYPE(2);
e0.reader := FALSE;
e0.reliability := DEFAULT_RELIABILITY_QOS_W;
e0.entityId := gen_rand_entityid_2(FALSE);
e1.participant := p0;
e1.topic_name := ENDPOINT_TOPIC(2);
e1.type_name := ENDPOINT_TYPE(2);
e1.reader := TRUE;
e1.reliability := DEFAULT_RELIABILITY_QOS_R;
e1.entityId := gen_rand_entityid_2(TRUE);
Log("Initiating Test", INFO);
stim_done <= '0';
start <= '0';
reset <= '1';
wait until rising_edge(clk);
wait until rising_edge(clk);
reset <= '0';
-- *PARTICIPANT*
Log("Test General SequenceNumber Handling of Participant Data", INFO);
Log("Match Participant [SN 1]", INFO);
sub := sub_d;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := gen_rand_loc_list;
gen_participant_data(participant, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
SB_mem.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
p0.defaultUnicastLocatorList := participant.defaultUnicastLocatorList;
Log("Update Participant [SN 2]", INFO);
sub := sub_d;
sub.writerSN := gen_sn(2);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := gen_rand_loc_list;
gen_participant_data(participant, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
SB_mem.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
p0.defaultUnicastLocatorList := participant.defaultUnicastLocatorList;
Log("Update Participant [SN 5]", INFO);
sub := sub_d;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := gen_rand_loc_list;
gen_participant_data(participant, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
SB_mem.Push(gen_participant_mem_frame(participant));
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
p0.defaultUnicastLocatorList := participant.defaultUnicastLocatorList;
Log("Ignore Participant Update [SN 3]", INFO);
sub := sub_d;
sub.writerSN := gen_sn(3);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
participant.defaultUnicastLocatorList := gen_rand_loc_list;
gen_participant_data(participant, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
SB_mem.Push(gen_participant_mem_frame(p0));
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- *PUBLISHER*
Log("Test General SequenceNumber Handling of Publisher Data", INFO);
Log("Match Publisher [SN 1]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Update Publisher [SN 2]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(2);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Ignore Publisher Update [SN 5]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 1]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Test HEARTBEAT Handling of Publisher Data", INFO);
Log("Publisher Heartbeat [First 11, Last 18]", INFO);
sub := sub_p;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(11);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 18]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(18);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 11]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher Heartbeat [First 5, Last 15]", INFO);
sub := sub_p;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(5);
sub.lastSN := gen_sn(15);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 5]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 15]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 12]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(12);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher Heartbeat [First 15, Last 18]", INFO);
sub := sub_p;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(15);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 18]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(18);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 16]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(16);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 15]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(15);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher Heartbeat [First 19, Last 18]", INFO);
sub := sub_p;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(19);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 19]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(19);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Test GAP Handling of Publisher Data", INFO);
Log("Publisher GAP [1-10]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(1);
sub.gapList := (base => gen_sn(11), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 11]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Publisher GAP [2-10,12]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(2);
sub.gapList := (base => gen_sn(10), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 13]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(13);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Publisher GAP [21-22]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(23), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 20]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(20);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher GAP [21-22, 24]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 21]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(21);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- TEST: GAP WITH NEXT_EXPECTED NOT MARKED IN BITMAP
Log("Publisher GAP [21-22, 24]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 23]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(23);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher GAP [21-22, 24]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 24]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(24);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 25]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(25);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
Log("Publisher GAP [20-30]", INFO);
sub := sub_p;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(20);
sub.gapList := (base => gen_sn(31), numBits => int(1, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Publisher Update [SN 26]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(26);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Publisher [SN 31]", INFO);
sub := sub_p;
sub.writerSN := gen_sn(31);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e0;
endpoint.participant:= p0;
endpoint.unicastLocatorList := gen_rand_loc_list;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e0.unicastLocatorList := endpoint.unicastLocatorList;
-- *SUBSCRIBER*
Log("Test General SequenceNumber Handling of Subscriber Data", INFO);
Log("Match Subscriber [SN 1]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Update Subscriber [SN 2]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(2);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Ignore Subscriber Update [SN 5]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 1]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Test HEARTBEAT Handling of Subscriber Data", INFO);
Log("Subscriber Heartbeat [First 11, Last 18]", INFO);
sub := sub_s;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(11);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 18]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(18);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 11]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber Heartbeat [First 5, Last 15]", INFO);
sub := sub_s;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(5);
sub.lastSN := gen_sn(15);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 5]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 15]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(15);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 12]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(12);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber Heartbeat [First 15, Last 18]", INFO);
sub := sub_s;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(15);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 18]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(18);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 16]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(16);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 15]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(15);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber Heartbeat [First 19, Last 18]", INFO);
sub := sub_s;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(19);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 19]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(19);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Test GAP Handling of Subscriber Data", INFO);
Log("Subscriber GAP [1-10]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(1);
sub.gapList := (base => gen_sn(11), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 11]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Subscriber GAP [2-10,12]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(2);
sub.gapList := (base => gen_sn(10), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 13]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(13);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Subscriber GAP [21-22]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(23), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 20]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(20);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber GAP [21-22, 24]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 21]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(21);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Subscriber GAP [21-22, 24]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 23]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(23);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber GAP [21-22, 24]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(22), numBits => int(3, CDR_LONG_WIDTH), bitmap => (0 => '1', 2 => '1', others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 24]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(24);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 25]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(25);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
Log("Subscriber GAP [20-30]", INFO);
sub := sub_s;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(20);
sub.gapList := (base => gen_sn(31), numBits => int(1, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Subscriber Update [SN 26]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(26);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Update Subscriber [SN 31]", INFO);
sub := sub_s;
sub.writerSN := gen_sn(31);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
endpoint := e1;
endpoint.participant:= p0;
gen_endpoint_data(endpoint, sub.data);
gen_sentinel(sub.data);
gen_rtps_handler_out(sub, endpoint, stimulus);
wr_sig := (NUM_READERS+2 => '1', others => '0');
push_endpoint_reference;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
-- Update
e1.unicastLocatorList := endpoint.unicastLocatorList;
-- *MESSAGE*
Log("Test General SequenceNumber Handling of ParticipantMessage Data", INFO);
Log("Accept Liveliness Update [SN 1]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := AUTOMATIC_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 2]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(2);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := MANUAL_BY_PARTICIPANT_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 5]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := AUTOMATIC_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 1]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(1);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Test HEARTBEAT Handling of ParticipantMessage Data", INFO);
Log("ParticipantMessage Heartbeat [First 11, Last 11]", INFO);
sub := sub_m;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(11);
sub.lastSN := gen_sn(11);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 5]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 11]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := MANUAL_BY_PARTICIPANT_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("ParticipantMessage Heartbeat [First 5, Last 15]", INFO);
sub := sub_m;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(5);
sub.lastSN := gen_sn(5);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 5]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(5);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("ParticipantMessage Heartbeat [First 19, Last 18]", INFO);
sub := sub_m;
sub.submessageID := SID_HEARTBEAT;
sub.firstSN := gen_sn(19);
sub.lastSN := gen_sn(18);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 18]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(18);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 19]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(19);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := AUTOMATIC_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Test GAP Handling of ParticipantMessage Data", INFO);
Log("ParticipantMessage GAP [1-10]", INFO);
sub := sub_m;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(1);
sub.gapList := (base => gen_sn(11), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 11]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(11);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("ParticipantMessage GAP [21-22]", INFO);
sub := sub_m;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(21);
sub.gapList := (base => gen_sn(23), numBits => int(0, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 20]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(20);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := MANUAL_BY_PARTICIPANT_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("ParticipantMessage GAP [20-30]", INFO);
sub := sub_m;
sub.submessageID := SID_GAP;
sub.gapStart := gen_sn(20);
sub.gapList := (base => gen_sn(31), numBits => int(1, CDR_LONG_WIDTH), bitmap => (others => '0'));
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Ignore Liveliness Update [SN 21]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(21);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, FALSE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
Log("Accept Liveliness Update [SN 31]", INFO);
sub := sub_m;
sub.writerSN := gen_sn(31);
sub.submessageID := SID_DATA;
sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1';
participant := p0;
participant.nr := 0;
participant.match := MATCH;
gen_liveliness_assertion(participant, TRUE, sub.data);
gen_rtps_handler_out(sub, participant, stimulus);
wr_sig := MANUAL_BY_PARTICIPANT_LIVELINESS_READERS;
push_liveliness_update;
start_test;
wait_on_sent;
wait_on_mem_check;
stimulus := EMPTY_TEST_PACKET;
reference := EMPTY_TEST_PACKET;
stim_done <= '1';
wait_on_complete;
TranscriptOpen(RESULTS_FILE, APPEND_MODE);
SetTranscriptMirror;
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
full_rtps <= (others => '0');
wait until (or wr_rtps) = '1';
wait until rising_edge(clk);
full_rtps <= (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(full_rtps /= (0 to NUM_ENDPOINTS-1 => '0') and (wr_rtps /= (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);
if rising_edge(clk) then
if (reset = '1') then
cnt_stim <= 0;
stim_stage <= IDLE;
packet_sent <= '1';
else
case (stim_stage) is
when IDLE =>
if (start = '1' and stimulus.length /= 0) then
stim_stage <= BUSY;
packet_sent <= '0';
end if;
when BUSY =>
if (rd_sig = '1') then
if (cnt_stim = stimulus.length-1) then
stim_stage <= IDLE;
packet_sent <= '1';
cnt_stim <= 0;
else
cnt_stim <= cnt_stim + 1;
end if;
end if;
end case;
end if;
end if;
end process;
output_check_prc : process(all)
begin
if rising_edge(clk) then
if (wr_rtps /= (0 to NUM_ENDPOINTS-1 => '0')) then
SB_out.Check(wr_rtps & last_word_out_rtps & data_out_rtps);
end if;
if (stim_done = '1' and SB_out.empty) then
check_done <= '1';
else
check_done <= '0';
end if;
end if;
end process;
done_proc : process(clk)
begin
if rising_edge(clk) then
if (stim_done = '1' and SB_mem.empty and check_done = '1') then
test_done <= '1';
else
test_done <= '0';
end if;
end if;
end process;
mem_check_prc : process
alias mem is <<signal uut.mem_ctrl_inst.ram_inst.mem : TEST_RAM_TYPE>>;
alias mem_op_done is <<signal uut.mem_op_done : std_logic>>;
alias idle_sig is <<signal uut.idle_sig : std_logic>>;
variable reference : TEST_PARTICIPANT_MEMORY_FRAME_TYPE;
begin
mem_check_done <= '0';
-- SAFEGUARD: (Prevent Fall-through Behavior)
if (reset /= '0') then
wait until reset = '0';
end if;
-- Wait for Packet to be sent
wait until rising_edge(packet_sent);
-- Wait for UUT IDLE state
if (idle_sig /= '1') then
wait until idle_sig = '1';
end if;
-- Wait for ongoing memory operation
if (mem_op_done /= '1') then
wait until mem_op_done = '1';
end if;
while (not SB_mem.empty) loop
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 loop;
-- Toggle High for one clock cycle
mem_check_done <= '1';
wait until rising_edge(clk);
end process;
watchdog : process
begin
wait for 1 ms;
Alert("Test timeout", FAILURE);
std.env.stop;
end process;
end architecture;