From ec4d44c59a152fae5d83722b1e43297140127074 Mon Sep 17 00:00:00 2001 From: Greek Date: Sun, 29 Nov 2020 23:34:28 +0100 Subject: [PATCH] * Re-design rtps_builtin_endpoint - Remove endpoint data from memory. Store only participant data - Write PARTICIPANT_UNMATCH_FRAME to all endpoints on remote participant removal - Write ENDPOINT_MATCH and ENDPOINT_UNMATCH frames for all remote endpoints * Update testbenches to accomodate re-design * Streamline scorboard reference pushing and testbench completion detection --- .gitignore | 2 +- sim/rtps_builtin_endpoint_test1.do | 8 +- sim/rtps_builtin_endpoint_test2.do | 9 +- sim/rtps_builtin_endpoint_test3.do | 10 +- sim/rtps_builtin_endpoint_test4.do | 10 +- src/REF.txt | 27 +- .../Level_0/rtps_builtin_endpoint_test1.vhd | 110 ++- .../Level_0/rtps_builtin_endpoint_test2.vhd | 268 +++---- .../Level_0/rtps_builtin_endpoint_test3.vhd | 272 ++++--- .../Level_0/rtps_builtin_endpoint_test4.vhd | 733 ++---------------- src/Tests/mem_test_config.vhd | 126 --- src/Tests/test_config.vhd | 2 +- src/Tests/testbench.pro | 16 +- src/rtps_builtin_endpoint.vhd | 689 +++++----------- src/rtps_config_package.vhd | 9 +- src/rtps_test_package.vhd | 35 +- 16 files changed, 667 insertions(+), 1659 deletions(-) delete mode 100644 src/Tests/mem_test_config.vhd diff --git a/.gitignore b/.gitignore index 5ce30df..bfe2a43 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ /syn/** /sim/** /download/** - +*.NPPSESS #Unignore Directories (Needed to unignore files in Subdirectories) !*/ diff --git a/sim/rtps_builtin_endpoint_test1.do b/sim/rtps_builtin_endpoint_test1.do index 2cdeda8..b34bf4a 100644 --- a/sim/rtps_builtin_endpoint_test1.do +++ b/sim/rtps_builtin_endpoint_test1.do @@ -15,7 +15,6 @@ add wave -noupdate /rtps_builtin_endpoint_test1/stim_stage add wave -noupdate /rtps_builtin_endpoint_test1/stimulus.length add wave -noupdate /rtps_builtin_endpoint_test1/cnt_stim add wave -noupdate /rtps_builtin_endpoint_test1/packet_sent -add wave -noupdate /rtps_builtin_endpoint_test1/SB.ItemNumberVar add wave -noupdate -divider {MAIN FSM} add wave -noupdate /rtps_builtin_endpoint_test1/uut/stage add wave -noupdate /rtps_builtin_endpoint_test1/uut/stage_next @@ -31,9 +30,6 @@ add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_stage_next add wave -noupdate /rtps_builtin_endpoint_test1/uut/mem_cnt add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/mem_addr_base add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/addr_res -add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/last_addr -add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/max_participant_addr -add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/max_endpoint_addr add wave -noupdate -divider GUARD add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/read_cnt add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/parameter_end @@ -49,7 +45,7 @@ add wave -noupdate /rtps_builtin_endpoint_test1/uut/update_participant_flags add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/mem_seq_nr add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test1/uut/seq_nr TreeUpdate [SetDefaultTree] -WaveRestoreCursors {{Cursor 1} {15299092 ps} 0} +WaveRestoreCursors {{Cursor 1} {10125000 ps} 1} quietly wave cursor active 1 configure wave -namecolwidth 149 configure wave -valuecolwidth 144 @@ -65,4 +61,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ps update -WaveRestoreZoom {14808192 ps} {15956534 ps} +WaveRestoreZoom {9084076 ps} {10232418 ps} diff --git a/sim/rtps_builtin_endpoint_test2.do b/sim/rtps_builtin_endpoint_test2.do index 8c1a515..a61a88f 100644 --- a/sim/rtps_builtin_endpoint_test2.do +++ b/sim/rtps_builtin_endpoint_test2.do @@ -35,9 +35,6 @@ add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test2/uut/mem_stage_nex add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test2/uut/mem_cnt add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test2/uut/mem_addr_base add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test2/uut/addr_res -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test2/uut/last_addr -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test2/uut/max_participant_addr -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test2/uut/max_endpoint_addr add wave -noupdate -divider GUARD add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test2/uut/read_cnt add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test2/uut/parameter_end @@ -53,8 +50,8 @@ add wave -noupdate /rtps_builtin_endpoint_test2/uut/update_participant_flags add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test2/uut/mem_seq_nr add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test2/uut/seq_nr TreeUpdate [SetDefaultTree] -WaveRestoreCursors {Begin {32125000 ps} 1} {Error {35025000 ps} 1} {Cursor {33675000 ps} 0} -quietly wave cursor active 3 +WaveRestoreCursors {Begin {63775000 ps} 1} {Error {66975000 ps} 1} {Cursor {33675000 ps} 0} +quietly wave cursor active 1 configure wave -namecolwidth 149 configure wave -valuecolwidth 144 configure wave -justifyvalue left @@ -69,4 +66,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ns update -WaveRestoreZoom {33245026 ps} {34393368 ps} +WaveRestoreZoom {63200829 ps} {64349171 ps} diff --git a/sim/rtps_builtin_endpoint_test3.do b/sim/rtps_builtin_endpoint_test3.do index c590df2..90a67a2 100644 --- a/sim/rtps_builtin_endpoint_test3.do +++ b/sim/rtps_builtin_endpoint_test3.do @@ -19,7 +19,6 @@ 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 @@ -35,9 +34,6 @@ add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test3/uut/mem_stage_nex 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 @@ -53,8 +49,8 @@ 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 +WaveRestoreCursors {Begin {847825000 ps} 1} {Error {851525000 ps} 1} {Cursor {33675000 ps} 0} +quietly wave cursor active 1 configure wave -namecolwidth 149 configure wave -valuecolwidth 144 configure wave -justifyvalue left @@ -69,4 +65,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ns update -WaveRestoreZoom {33245026 ps} {34393368 ps} +WaveRestoreZoom {848883724 ps} {850032066 ps} diff --git a/sim/rtps_builtin_endpoint_test4.do b/sim/rtps_builtin_endpoint_test4.do index 9814fd1..d34b13a 100644 --- a/sim/rtps_builtin_endpoint_test4.do +++ b/sim/rtps_builtin_endpoint_test4.do @@ -19,7 +19,6 @@ add wave -noupdate /rtps_builtin_endpoint_test4/stim_stage add wave -noupdate /rtps_builtin_endpoint_test4/stimulus.length add wave -noupdate /rtps_builtin_endpoint_test4/cnt_stim add wave -noupdate /rtps_builtin_endpoint_test4/packet_sent -add wave -noupdate /rtps_builtin_endpoint_test4/SB.ItemNumberVar add wave -noupdate -divider {MAIN FSM} add wave -noupdate /rtps_builtin_endpoint_test4/uut/stage add wave -noupdate /rtps_builtin_endpoint_test4/uut/stage_next @@ -35,9 +34,6 @@ add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_stage_nex add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_cnt add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test4/uut/mem_addr_base add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test4/uut/addr_res -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test4/uut/last_addr -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test4/uut/max_participant_addr -add wave -noupdate -group MEM_FSM -radix unsigned /rtps_builtin_endpoint_test4/uut/max_endpoint_addr add wave -noupdate -divider GUARD add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test4/uut/read_cnt add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test4/uut/parameter_end @@ -53,8 +49,8 @@ add wave -noupdate /rtps_builtin_endpoint_test4/uut/update_participant_flags add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test4/uut/mem_seq_nr add wave -noupdate -radix unsigned /rtps_builtin_endpoint_test4/uut/seq_nr TreeUpdate [SetDefaultTree] -WaveRestoreCursors {Begin {32125000 ps} 1} {Error {35025000 ps} 1} {Cursor {33675000 ps} 0} -quietly wave cursor active 3 +WaveRestoreCursors {Begin {847825000 ps} 1} {Error {851525000 ps} 1} {Cursor {33675000 ps} 0} +quietly wave cursor active 1 configure wave -namecolwidth 149 configure wave -valuecolwidth 144 configure wave -justifyvalue left @@ -69,4 +65,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ns update -WaveRestoreZoom {33245026 ps} {34393368 ps} +WaveRestoreZoom {848883724 ps} {850032066 ps} diff --git a/src/REF.txt b/src/REF.txt index d7d7628..559ab7e 100644 --- a/src/REF.txt +++ b/src/REF.txt @@ -222,19 +222,6 @@ PARTICICPANT DATA 22| | +-------------------------------------------------------------+ -ENDPOINT DATA -============= - 31............24..............16..............8...............0 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-------------------------------------------------------------+ -00| ENTITYID | - +-------------------------------------------------------------+ -01| | - + + -02| GUIDPREFIX | - + + -03| | - +-------------------------------------------------------------+ ENDPOINT MATCH FRAME ==================== @@ -272,6 +259,20 @@ ENDPOINT UNMATCH FRAME 04| ENTITYID | +-------------------------------------------------------------+ +PARTICIPANT UNMATCH FRAME +========================= + 31............24..............16..............8...............0 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-------------------------------------------------------------+ +00| OPCODE | + +-------------------------------------------------------------+ +01| | + + + +02| GUIDPREFIX | + + + +03| | + +-------------------------------------------------------------+ + ENDPOINT LIVELINESS UPDATE ========================== 31............24..............16..............8...............0 diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test1.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test1.vhd index 65f555e..610efe5 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test1.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test1.vhd @@ -51,13 +51,16 @@ architecture testbench of rtps_builtin_endpoint_test1 is -- *SIGNAL DECLARATION* signal clk, in_empty, rd_sig, last_word_in, last_word_out: std_logic := '0'; signal reset : std_logic := '1'; --TODO: Do that in all testbenches + 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 : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + 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 : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + shared variable SB_out : work.ScoreBoardPkg_builtin_endpoint.ScoreBoardPType; + shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + signal stim_done, check_done : std_logic := '0'; -- *FUNCTION DECLARATION* procedure wait_on_complete is begin @@ -77,8 +80,8 @@ begin data_out => data_out, last_word_in => last_word_in, time => TIME_ZERO, - endpoint_full => (others => '0'), - endpoint_wr => open, + endpoint_full => endpoint_full, + endpoint_wr => endpoint_wr, rtps_wr => open, rtps_full => '0', last_word_out => last_word_out, @@ -87,7 +90,6 @@ begin stimulus_prc : process variable rtps_sub : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; - variable check_cnt : natural := 0; variable RV : RandomPType; variable participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; variable p0, p1, p2 : GUIDPREFIX_TYPE; @@ -100,6 +102,16 @@ begin return ret; end function; + procedure push_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 @@ -139,8 +151,8 @@ begin Log("Initiating Test", INFO); - start <= '0'; - reset <= '1'; + start <= '0'; + reset <= '1'; wait until rising_edge(clk); wait until rising_edge(clk); reset <= '0'; @@ -158,10 +170,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -181,10 +192,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -204,10 +214,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -227,10 +236,10 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); + push_reference; start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -250,10 +259,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -273,10 +281,10 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); + push_reference; start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -296,10 +304,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -326,10 +333,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -349,10 +355,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -372,10 +377,10 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); + push_reference; start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -392,10 +397,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -412,10 +416,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -447,10 +450,9 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -465,10 +467,10 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); + push_reference; start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; @@ -485,16 +487,16 @@ begin gen_participant_data(participant, rtps_sub.data); gen_sentinel(rtps_sub.data); gen_rtps_handler_out(rtps_sub, participant, stimulus); - SB.Push(gen_participant_mem_frame(participant)); + SB_mem.Push(gen_participant_mem_frame(participant)); + push_reference; start_test; wait_on_complete; - check_cnt := check_cnt + TEST_PARTICIPANT_MEMORY_FRAME_TYPE'length; stimulus := EMPTY_TEST_PACKET; rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.writerSN := rtps_sub.writerSN + 1; -- MEMORY STATE [0,p1,0] - -- LAST PACKET + -- DUMMY PACKET (Trigger last mem check) -- Mark Packet as non-standard Payload, in order to trigger the packet to be skipped (as early as possible) rtps_sub.data := EMPTY_TEST_PACKET; rtps_sub.flags(SUBMESSAGE_NON_STANDARD_PAYLOAD_FLAG_POS):= '1'; @@ -504,7 +506,9 @@ begin TranscriptOpen(RESULTS_FILE, APPEND_MODE); SetTranscriptMirror; - AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + stim_done <= '1'; + wait until check_done = '1'; + AlertIf((not SB_out.empty) or (not SB_mem.empty), "Incomplete test run"); ReportAlerts; TranscriptClose; std.env.stop; @@ -528,10 +532,20 @@ begin 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; @@ -568,8 +582,20 @@ begin 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; - output_prc : process + mem_check_prc : process alias mem is <>; alias mem_op_done is <>; variable reference : TEST_PARTICIPANT_MEMORY_FRAME_TYPE; @@ -587,8 +613,8 @@ begin if (mem_op_done /= '1') then wait until mem_op_done = '1'; end if; - if (not SB.empty) then - SB.Pop(reference); + 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; diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd index a1be380..05fc4a2 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test2.vhd @@ -185,13 +185,13 @@ begin variable sub, sub_p, sub_s : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; variable check_cnt : natural := 0; variable RV : RandomPType; - variable p0, p1, p2 : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; + variable p0, p1, p2, 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 endpoint, e1, e2 : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; - variable p0_sn, p0_snp, p0_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; - variable p1_sn, p1_snp, p1_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; - variable p2_sn, p2_snp, p2_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; + variable p0_snp, p1_snp, p2_snp : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; + variable p0_sns, p1_sns, p2_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; + variable p_sn : 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; @@ -211,11 +211,36 @@ begin return ret; end function; - procedure push_reference is + 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.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.Push((not wr_sig) & reference.last(i) & reference.data(i)); + end loop; + reference := EMPTY_TEST_PACKET; + end if; + 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.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 @@ -344,44 +369,44 @@ begin -- *Insert Participant 0* -- Contains the same Endpoints as our Participant, as defined above Log("Match Participant 0 [Compatible]", INFO); - sub.writerSN := p0_sn; - gen_participant_data(p0, sub.data); + sub.writerSN := p_sn; + participant := p0; + gen_participant_data(participant, sub.data); gen_sentinel(sub.data); - gen_rtps_handler_out(sub, p0, stimulus); + gen_rtps_handler_out(sub, participant, stimulus); start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; -- *Insert Participant 1* -- Contains the same Endpoints as Participant 0, but in little Endian Log("Match Participant 1 [Compatible, Little Endian]", INFO); - sub.writerSN := p1_sn; - gen_participant_data(p1, sub.data); + sub.writerSN := p_sn; + participant := p1; + gen_participant_data(participant, sub.data); gen_sentinel(sub.data); - gen_rtps_handler_out(sub, p1, stimulus); + gen_rtps_handler_out(sub, participant, stimulus); start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p1_sn := p1_sn + 1; + p_sn := p_sn + 1; -- *Insert Participant 2* -- Used for extra Endpoint testing (e.g. unsupported QoS) Log("Match Participant 2 [Compatible]", INFO); - sub.writerSN := p2_sn; - gen_participant_data(p2, sub.data); + sub.writerSN := p_sn; + participant := p2; + gen_participant_data(participant, sub.data); gen_sentinel(sub.data); - gen_rtps_handler_out(sub, p2, stimulus); + gen_rtps_handler_out(sub, participant, stimulus); start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; + p_sn := p_sn + 1; -- *Fixed Writers (Participant 0)* for i in 0 to NUM_WRITERS-1 loop @@ -392,15 +417,11 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := gen_wr(i, FALSE); - if (or wr_sig = '1') then - push_reference; - end if; + push_endpoint_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; end loop; @@ -415,15 +436,11 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := gen_wr(i, FALSE); - if (or wr_sig = '1') then - push_reference; - end if; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub_p.data := EMPTY_TEST_PACKET; p1_snp := p1_snp + 1; end loop; @@ -437,15 +454,11 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := gen_wr(i, TRUE); - if (or wr_sig = '1') then - push_reference; - end if; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub_s.data := EMPTY_TEST_PACKET; p0_sns := p0_sns + 1; end loop; @@ -460,63 +473,31 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := gen_wr(i, TRUE); - if (or wr_sig = '1') then - push_reference; - end if; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; sub_s.data := EMPTY_TEST_PACKET; p1_sns := p1_sns + 1; end loop; -- *Remove Participant 1* Log("Unmatch Participant 1", INFO); - sub.writerSN := p1_sn; - p1.domainId := int(2, DOMAIN_ID_WIDTH); - p1.match := UNMATCH; - gen_participant_data(p1, sub.data); + sub.writerSN := p_sn; + participant := p1; + participant.domainId := int(2, DOMAIN_ID_WIDTH); + participant.match := UNMATCH; + gen_participant_data(participant, sub.data); gen_sentinel(sub.data); - gen_rtps_handler_out(sub, p1, stimulus); + gen_rtps_handler_out(sub, participant, stimulus); + push_participant_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p1_sn := p1_sn + 1; - -- Unmatch Participant 1 Endpoints - for i in 0 to NUM_WRITERS-1 loop - endpoint := fixed_writers(i); - endpoint.participant := p1; - endpoint.littleEndian := '1'; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := gen_wr(i, FALSE); - -- If Endpoint was previously matched, unmatch - if (or wr_sig = '1') then - wr_sig := (others => '1'); - push_reference; - end if; - reference := EMPTY_TEST_PACKET; - end loop; - for i in 0 to NUM_READERS-1 loop - endpoint := fixed_readers(i); - endpoint.participant := p1; - endpoint.littleEndian := '1'; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := gen_wr(i, TRUE); - -- If Endpoint was previously matched, unmatch - if (or wr_sig = '1') then - wr_sig := (others => '1'); - push_reference; - end if; - reference := EMPTY_TEST_PACKET; - end loop; - + p_sn := p_sn + 1; -- *Participant 2 Endpoints* @@ -533,9 +514,8 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := (0 => '1', 3 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -554,9 +534,8 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := (0 => '1', 4 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -575,6 +554,8 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -596,9 +577,8 @@ begin gen_endpoint_data(endpoint, sub_p.data); 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; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -617,6 +597,8 @@ begin gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -635,6 +617,8 @@ begin gen_parameter(PID_PARTITION, partition, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -655,6 +639,8 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -673,6 +659,8 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -692,6 +680,8 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -713,9 +703,8 @@ begin gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); - gen_match_frame(endpoint, reference); wr_sig := (NUM_READERS => '1', NUM_READERS+4 => '1', NUM_READERS+5 => '1', NUM_READERS+7 => '1', others => '0'); - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -734,6 +723,8 @@ begin gen_parameter(PID_PARTITION, partition, sub_s.data); gen_sentinel(sub_s.data); gen_rtps_handler_out(sub_s, endpoint, stimulus); + wr_sig := (others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -745,12 +736,12 @@ begin Log("Match Participant 2 Writer [Default]", INFO); sub_p.writerSN := p2_snp; - gen_endpoint_data(e1, sub_p.data); + endpoint := e1; + gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, e1, stimulus); - gen_match_frame(e1, reference); + gen_rtps_handler_out(sub_p, endpoint, stimulus); wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -760,12 +751,12 @@ begin Log("Match Participant 2 Reader [Default]", INFO); sub_s.writerSN := p2_sns; - gen_endpoint_data(e2, sub_s.data); + endpoint := e2; + gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); - gen_rtps_handler_out(sub_s, e2, stimulus); - gen_match_frame(e2, reference); + gen_rtps_handler_out(sub_s, endpoint, stimulus); wr_sig := (NUM_READERS => '1', NUM_READERS+4 => '1', NUM_READERS+5 => '1', NUM_READERS+7 => '1', others => '0'); - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -775,25 +766,16 @@ begin Log("Update Participant 2 Writer [Unicast Locators (1 valid, 2 invalid)]", INFO); sub_p.writerSN := p2_snp; - e1.unicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR)); - e1.unicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6; - e1.unicastLocatorList.locator(2).addr := (others => '0'); - e1.unicastLocatorList.locator(3).portn := (others => '0'); - gen_endpoint_data(e1, sub_p.data); + endpoint := e1; + endpoint.unicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + endpoint.unicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6; + endpoint.unicastLocatorList.locator(2).addr := (others => '0'); + endpoint.unicastLocatorList.locator(3).portn := (others => '0'); + gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, e1, stimulus); - -- UNMATCH - e1.match := UNMATCH; - gen_match_frame(e1, reference); + gen_rtps_handler_out(sub_p, endpoint, stimulus); wr_sig := (0 => '1', 9 => '1', 10 => '1', 15 => '1', others => '0'); - wr_sig := not wr_sig; - push_reference; - reference := EMPTY_TEST_PACKET; - -- MATCH - e1.match := MATCH; - gen_match_frame(e1, reference); - wr_sig := not wr_sig; - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -803,25 +785,16 @@ begin Log("Update Participant 2 Reader [Multicast Locator (1 valid, 2 invalid)]", INFO); sub_s.writerSN := p2_sns; - e2.multicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR)); - e2.multicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6; - e2.multicastLocatorList.locator(2).addr := (others => '0'); - e2.multicastLocatorList.locator(3).portn := (others => '0'); - gen_endpoint_data(e2, sub_s.data); + endpoint := e2; + endpoint.multicastLocatorList := (numLocators => int(4,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, 1 => gen_rand_loc_2, 2 => gen_rand_loc_2, 3 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + endpoint.multicastLocatorList.locator(1).kind := LOCATOR_KIND_UDPv6; + endpoint.multicastLocatorList.locator(2).addr := (others => '0'); + endpoint.multicastLocatorList.locator(3).portn := (others => '0'); + gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); - gen_rtps_handler_out(sub_s, e2, stimulus); - -- UNMATCH - e2.match := UNMATCH; - gen_match_frame(e2, reference); + gen_rtps_handler_out(sub_s, endpoint, stimulus); wr_sig := (NUM_READERS => '1', NUM_READERS+4 => '1', NUM_READERS+5 => '1', NUM_READERS+7 => '1', others => '0'); - wr_sig := not wr_sig; - push_reference; - reference := EMPTY_TEST_PACKET; - -- MATCH - e2.match := MATCH; - gen_match_frame(e2, reference); - wr_sig := not wr_sig; - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -831,22 +804,13 @@ begin Log("Change Match Participant 2 Writer [Reliability Best Effort]", INFO); sub_p.writerSN := p2_snp; - e1.reliability := BEST_EFFORT_RELIABILITY_QOS; - gen_endpoint_data(e1, sub_p.data); + endpoint := e1; + endpoint.reliability := BEST_EFFORT_RELIABILITY_QOS; + gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, e1, stimulus); - -- UNMATCH - e1.match := UNMATCH; - gen_match_frame(e1, reference); + gen_rtps_handler_out(sub_p, endpoint, stimulus); wr_sig := (15 => '1', others => '0'); - wr_sig := not wr_sig; - push_reference; - reference := EMPTY_TEST_PACKET; - -- MATCH - e1.match := MATCH; - gen_match_frame(e1, reference); - wr_sig := not wr_sig; - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -856,23 +820,14 @@ begin Log("Change Match Participant 2 Reader [Topic & Type Change]", INFO); sub_s.writerSN := p2_sns; - e2.topic_name := ENDPOINT_TOPIC(2); - e2.type_name := ENDPOINT_TYPE(2); - gen_endpoint_data(e2, sub_s.data); + endpoint := e2; + endpoint.topic_name := ENDPOINT_TOPIC(2); + endpoint.type_name := ENDPOINT_TYPE(2); + gen_endpoint_data(endpoint, sub_s.data); gen_sentinel(sub_s.data); - gen_rtps_handler_out(sub_s, e2, stimulus); - -- UNMATCH - e2.match := UNMATCH; - gen_match_frame(e2, reference); + gen_rtps_handler_out(sub_s, endpoint, stimulus); wr_sig := (NUM_READERS+2 => '1', others => '0'); - wr_sig := not wr_sig; - push_reference; - reference := EMPTY_TEST_PACKET; - -- MATCH - e2.match := MATCH; - gen_match_frame(e2, reference); - wr_sig := not wr_sig; - push_reference; + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; @@ -884,6 +839,7 @@ begin SetTranscriptMirror; stim_done <= '1'; wait until check_done = '1'; + AlertIf(not SB.empty, "Incomplete test run"); ReportAlerts; TranscriptClose; std.env.stop; @@ -972,7 +928,7 @@ begin watchdog : process begin - wait for 1 ms; + wait for 2 ms; Alert("Test timeout", FAILURE); std.env.stop; end process; diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd index 07abd8b..2aefb1c 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd @@ -67,7 +67,6 @@ architecture testbench of rtps_builtin_endpoint_test3 is -- *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'; @@ -112,11 +111,10 @@ begin 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 e0, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; - variable p0_sn, p0_snp, p0_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; + variable p_sn, p_snp, p_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); -- Wrapper to use procedure as function @@ -134,11 +132,36 @@ begin return ret; end function; - procedure push_reference is + 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_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 @@ -216,23 +239,23 @@ begin reset <= '0'; Log("Match Participant 0 (Used for Endpoint Matching)", INFO); - sub.writerSN := p0_sn; - gen_participant_data(p0, sub.data); + sub.writerSN := p_sn; + participant := p0; + gen_participant_data(participant, sub.data); gen_sentinel(sub.data); - gen_rtps_handler_out(sub, p0, stimulus); - SB_mem.Push(gen_participant_mem_frame(p0)); + 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; + p_sn := p_sn + 1; -- *PID_PARTICIPANT_GUID* Log("Ignore Participant 1 [Invalid PID_PARTICIPANT_GUID]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 1; @@ -247,10 +270,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 1 [Extra Bytes in PID_PARTICIPANT_GUID]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 1; @@ -262,15 +285,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_DOMAIN_ID* Log("Ignore Participant 2 [Invalid PID_DOMAIN_ID]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 2; @@ -285,10 +307,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 2 [Extra Bytes in PID_DOMAIN_ID]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 2; @@ -300,15 +322,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_DOMAIN_TAG* Log("Ignore Participant 3 [Invalid PID_DOMAIN_TAG]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 3; @@ -323,10 +344,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 3 [Extra Bytes in PID_DOMAIN_TAG]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 3; @@ -338,15 +359,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_PROTOCOL_VERSION* Log("Ignore Participant 4 [Invalid PID_PROTOCOL_VERSION]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 4; @@ -361,10 +381,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 4 [Extra Bytes in PID_PROTOCOL_VERSION]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 4; @@ -376,15 +396,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_PARTICIPANT_LEASE_DURATION* Log("Ignore Participant 5 [Invalid PID_PARTICIPANT_LEASE_DURATION]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 5; @@ -399,10 +418,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 5 [Extra Bytes in PID_PARTICIPANT_LEASE_DURATION]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 5; @@ -414,15 +433,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_BUILTIN_ENDPOINT_SET* Log("Ignore Participant 6 [Invalid PID_BUILTIN_ENDPOINT_SET]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 6; @@ -437,10 +455,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 6 [Extra Bytes in PID_BUILTIN_ENDPOINT_SET]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_sn; participant := p0; participant.guidPrefix := gen_rand_guid_prefix; participant.nr := 6; @@ -452,15 +470,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_DEFAULT_UNICAST_LOCATOR* Log("Ignore Participant 7 [Invalid PID_DEFAULT_UNICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -476,10 +493,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 7 [Extra Bytes in PID_DEFAULT_UNICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -492,15 +509,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_DEFAULT_MULTICAST_LOCATOR* Log("Ignore Participant 8 [Invalid PID_DEFAULT_MULTICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -516,10 +532,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 8 [Extra Bytes in PID_DEFAULT_MULTICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -532,15 +548,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_METATRAFFIC_UNICAST_LOCATOR* Log("Ignore Participant 9 [Invalid PID_METATRAFFIC_UNICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -556,10 +571,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 9 [Extra Bytes in PID_METATRAFFIC_UNICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -572,15 +587,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_METATRAFFIC_MULTICAST_LOCATOR* Log("Ignore Participant 10 [Invalid PID_METATRAFFIC_MULTICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -596,10 +610,10 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; + p_sn := p_sn + 1; Log("Match Participant 10 [Extra Bytes in PID_METATRAFFIC_MULTICAST_LOCATOR]", INFO); - sub.writerSN := p0_sn; + sub.writerSN := p_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; @@ -612,15 +626,14 @@ begin 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; + p_sn := p_sn + 1; -- *PID_SENTINEL* Log("Ignore Endpoint [No PID_SENTINEL]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data); @@ -633,7 +646,7 @@ begin -- *PID_TOPIC_NAME* Log("Ignore Endpoint [Invalid PID_TOPIC_NAME]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_TOPIC_NAME, -1); @@ -646,25 +659,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_TOPIC_NAME]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_TYPE_NAME* Log("Ignore Endpoint [Invalid PID_TYPE_NAME]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_TYPE_NAME, -1); @@ -677,25 +689,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_TYPE_NAME]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_DURABILITY* Log("Ignore Endpoint [Invalid PID_DURABILITY]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_DURABILITY, -1); @@ -708,25 +719,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_DURABILITY]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_DEADLINE* Log("Ignore Endpoint [Invalid PID_DEADLINE]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_DEADLINE, -1); @@ -739,25 +749,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_DEADLINE]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_LIVELINESS* Log("Ignore Endpoint [Invalid PID_LIVELINESS]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_LIVELINESS, -1); @@ -770,25 +779,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_LIVELINESS]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_RELIABILITY* Log("Ignore Endpoint [Invalid PID_RELIABILITY]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_RELIABILITY, -1); @@ -801,25 +809,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_RELIABILITY]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_DESTINATION_ORDER* Log("Ignore Endpoint [Invalid PID_DESTINATION_ORDER]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_DESTINATION_ORDER, -1); @@ -832,25 +839,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_DESTINATION_ORDER]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_OWNERSHIP* Log("Ignore Endpoint [Invalid PID_OWNERSHIP]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_OWNERSHIP, -1); @@ -863,25 +869,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_OWNERSHIP]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_PRESENTATION* Log("Ignore Endpoint [Invalid PID_PRESENTATION]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_PRESENTATION, -1); @@ -894,25 +899,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_PRESENTATION]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_LATENCY_BUDGET* Log("Ignore Endpoint [Invalid PID_LATENCY_BUDGET]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_LATENCY_BUDGET, -1); @@ -925,25 +929,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_LATENCY_BUDGET]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_ENDPOINT_GUID* Log("Ignore Endpoint [Invalid PID_ENDPOINT_GUID]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_ENDPOINT_GUID, -1); @@ -956,25 +959,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_ENDPOINT_GUID]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_EXPECTS_INLINE_QOS* Log("Ignore Endpoint [Invalid PID_EXPECTS_INLINE_QOS]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data, PID_EXPECTS_INLINE_QOS, -1); @@ -987,25 +989,24 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_EXPECTS_INLINE_QOS]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_DATA_MAX_SIZE_SERIALIZED* Log("Ignore Endpoint [Invalid PID_DATA_MAX_SIZE_SERIALIZED]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_snp; endpoint := e0; endpoint.entityId := gen_rand_entityid_2(FALSE); endpoint.max_size_serialized:= int(65000, CDR_LONG_WIDTH); @@ -1019,26 +1020,25 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_DATA_MAX_SIZE_SERIALIZED]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_UNICAST_LOCATOR* Log("Ignore Endpoint [Invalid PID_UNICAST_LOCATOR]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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)); @@ -1052,26 +1052,25 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_UNICAST_LOCATOR]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; -- *PID_MULTICAST_LOCATOR* Log("Ignore Endpoint [Invalid PID_MULTICAST_LOCATOR]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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)); @@ -1085,28 +1084,27 @@ begin sub_p.data := EMPTY_TEST_PACKET; Log("Match Endpoint [Extra Bytes in PID_MULTICAST_LOCATOR]", INFO); - sub_p.writerSN := p0_snp; + sub_p.writerSN := p_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; + push_endpoint_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; + p_snp := p_snp + 1; TranscriptOpen(RESULTS_FILE, APPEND_MODE); SetTranscriptMirror; stim_done <= '1'; wait until check_done = '1'; - AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + AlertIf((not SB_out.empty) or (not SB_mem.empty), "Incomplete test run"); ReportAlerts; TranscriptClose; std.env.stop; diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd index 0aa7695..1214613 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd @@ -10,6 +10,7 @@ use work.user_config.all; use work.rtps_config_package.all; use work.rtps_test_package.all; +-- This testbench tests the internal memory handling of the rtps_builtin_endpoint. (Full Capacity behaviour) entity rtps_builtin_endpoint_test4 is end entity; @@ -38,7 +39,6 @@ architecture testbench of rtps_builtin_endpoint_test4 is -- *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'; @@ -82,13 +82,12 @@ begin ); stimulus_prc : process - variable sub, sub_p : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; - variable check_cnt : natural := 0; - variable RV : RandomPType; - variable p0, p1, p2, participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; - variable e0, e1, e2, e3, e4, e5, e6, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; - variable p_sn, p0_sn, p1_sn, p2_sn : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; - variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); + variable sub, sub_p : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; + variable RV : RandomPType; + variable p0, p1, participant: PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; + variable e0, 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 @@ -105,11 +104,36 @@ begin return ret; end function; - procedure push_reference is + 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_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 @@ -129,7 +153,7 @@ begin end procedure; begin - assert (TEST_STRING = "TEST_CONFIG_2") report "user_config incompatible with testbench." severity FAILURE; + assert (TEST_STRING = "TEST_CONFIG_1") report "user_config incompatible with testbench." severity FAILURE; SetAlertLogName("L0-rtps_builtin_endpoint-memory_handling"); SetAlertEnable(FAILURE, TRUE); @@ -159,63 +183,21 @@ begin 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'; - -- Participant 1 p1.guidPrefix := gen_rand_guid_prefix; - p1.nr := 1; + p1.nr := MAX_REMOTE_PARTICIPANTS; p1.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1'; + p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER):= '1'; + p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR) := '1'; p1.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1'; - -- Participant 2 - p2.guidPrefix := gen_rand_guid_prefix; - p2.nr := 2; - p2.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); - p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1'; - p2.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1'; - - -- Endpoint 0 e0.participant := p0; - e0.topic_name := ENDPOINT_TOPIC(0); - e0.type_name := ENDPOINT_TYPE(0); - e0.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 1 - e1.participant := p0; - e1.topic_name := ENDPOINT_TOPIC(0); - e1.type_name := ENDPOINT_TYPE(0); - e1.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 2 - e2.participant := p0; - e2.topic_name := ENDPOINT_TOPIC(0); - e2.type_name := ENDPOINT_TYPE(0); - e2.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 3 - e3.participant := p0; - e3.topic_name := ENDPOINT_TOPIC(0); - e3.type_name := ENDPOINT_TYPE(0); - e3.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 4 - e4.participant := p0; - e4.topic_name := ENDPOINT_TOPIC(0); - e4.type_name := ENDPOINT_TYPE(0); - e4.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 5 - e5.participant := p0; - e5.topic_name := ENDPOINT_TOPIC(0); - e5.type_name := ENDPOINT_TYPE(0); - e5.entityId := gen_rand_entityid_2(FALSE); - - -- Endpoint 6 - e6.participant := p0; - e6.topic_name := ENDPOINT_TOPIC(0); - e6.type_name := ENDPOINT_TYPE(0); - e6.entityId := gen_rand_entityid_2(FALSE); + e0.topic_name := ENDPOINT_TOPIC(2); + e0.type_name := ENDPOINT_TYPE(2); Log("Initiating Test", INFO); mem_check <= '1'; @@ -226,11 +208,9 @@ begin wait until rising_edge(clk); reset <= '0'; - Log("Match Participant 0 [Pos 0]", INFO); - sub.writerSN := p_sn; - participant := p0; - participant.nr := 0; - participant.match := MATCH; + Log("Match Participant 0", INFO); + sub.writerSN := p_sn; + participant := p0; gen_participant_data(participant, sub.data); gen_sentinel(sub.data); gen_rtps_handler_out(sub, participant, stimulus); @@ -238,163 +218,49 @@ begin 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p0] + p_sn := p_sn + 1; - Log("Match Participant 1 [Pos 1]", INFO); - sub.writerSN := p_sn; - participant := p1; - participant.nr := 1; - participant.match := MATCH; + for i in 1 to MAX_REMOTE_PARTICIPANTS-1 loop + Log("Match Participant " & to_string(i), INFO); + sub.writerSN := p_sn; + participant := p0; + participant.guidPrefix := gen_rand_guid_prefix; + participant.nr := i; + 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; + mem_check <= '1'; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub.data := EMPTY_TEST_PACKET; + p_sn := p_sn + 1; + end loop; + + Log("Ignore Participant" & to_string(MAX_REMOTE_PARTICIPANTS) & " [No memory available]", INFO); + sub.writerSN := p_sn; + participant := p1; 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p0,p1] + p_sn := p_sn + 1; - Log("Match Endpoint 0 Participant 0 [Pos 0]", INFO); - sub_p.writerSN := p0_sn; - endpoint := e0; - endpoint.participant:= p0; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; - -- MEMORY STATE [p0,p1/e0p0] - Log("Match Endpoint 1 Participant 0 [Pos 1]", INFO); - sub_p.writerSN := p0_sn; - endpoint := e1; - endpoint.participant:= p0; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; - -- MEMORY STATE [p0,p1/e1p0,e0p0] - - Log("Match Endpoint 2 Participant 0 [Pos 2]", INFO); - sub_p.writerSN := p0_sn; - endpoint := e2; - endpoint.participant:= p0; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; - -- MEMORY STATE [p0,p1/e2p0,e1p0,e0p0] - - Log("Match Endpoint 3 Participant 0 [Pos 3]", INFO); - sub_p.writerSN := p0_sn; - endpoint := e3; - endpoint.participant:= p0; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; - -- MEMORY STATE [p0,p1/e3p0,e2p0,e1p0,e0p0] - - Log("Match Endpoint 4 Participant 0 [Pos 4]", INFO); - sub_p.writerSN := p0_sn; - endpoint := e4; - endpoint.participant:= p0; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p0_sn := p0_sn + 1; - -- MEMORY STATE [p0,p1/e4p0,e3p0,e2p0,e1p0,e0p0] - - Log("Match Endpoint 0 Participant 1 [Pos 5]", INFO); - sub_p.writerSN := p1_sn; + Log("Ignore Endpoint 0 Participant 1 [No matching Participant]", INFO); + sub_p.writerSN := p_snp; endpoint := e0; endpoint.participant:= p1; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p1_sn := p1_sn + 1; - -- MEMORY STATE [p0,p1/e0p1,e4p0,e3p0,e2p0,e1p0,e0p0] - - Log("Ignore Participant 2 [Memory Collision]", INFO); - sub.writerSN := p_sn; - participant := p2; - participant.nr := 2; - participant.match := UNMATCH; - 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p0,p1/e0p1,e4p0,e3p0,e2p0,e1p0,e0p0] - - Log("Ignore Endpoint 0 Participant 2 [No matching participant]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e0; - endpoint.participant:= p2; + endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); @@ -403,470 +269,29 @@ begin stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub_p.data := EMPTY_TEST_PACKET; - -- MEMORY STATE [p0,p1/e0p1,e4p0,e3p0,e2p0,e1p0,e0p0] - Log("Match Endpoint 1 Participant 1 [Pos 6]", INFO); - sub_p.writerSN := p1_sn; - endpoint := e1; - endpoint.participant:= p1; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p1_sn := p1_sn + 1; - -- MEMORY STATE [p0,p1/e1p1,e0p1,e4p0,e3p0,e2p0,e1p0,e0p0] - - Log("Unmatch Participant 0 and its Endpoints", INFO); - sub.writerSN := p_sn; - participant := p0; - participant.protocolVersion := PROTOCOLVERSION_1_0; - participant.nr := 0; - participant.match := UNMATCH; - 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)); - -- Endpoint UNMATCH - endpoint := e0; - endpoint.participant:= p0; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e1; - endpoint.participant:= p0; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e2; - endpoint.participant:= p0; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e3; - endpoint.participant:= p0; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e4; - endpoint.participant:= p0; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - 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; - p_sn := p_sn + 1; - p0_sn := FIRST_SEQUENCENUMBER; - -- MEMORY STATE [0,p1/e1p1,e0p1,0,0,0,0] - - Log("Match Participant 2 [Pos 0]", INFO); - sub.writerSN := p_sn; - participant := p2; - participant.nr := 0; - participant.match := MATCH; - 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p2,p1/e1p1,e0p1,0,0,0,0] - - Log("Ignore Participant 0 [Memory Collision]", INFO); - sub.writerSN := p_sn; - participant := p0; - participant.nr := 2; - participant.match := UNMATCH; - 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p2,p1/e1p1,e0p1,0,0,0,0] - - Log("Ignore Endpoint 0 Participant 0 [No matching participant]", INFO); - sub_p.writerSN := p0_sn; + Log("Match Endpoint 0 Participant 0", INFO); + sub_p.writerSN := p_snp; endpoint := e0; endpoint.participant:= p0; + endpoint.entityId := gen_rand_entityid_2(FALSE); gen_endpoint_data(endpoint, sub_p.data); gen_sentinel(sub_p.data); gen_rtps_handler_out(sub_p, endpoint, stimulus); + wr_sig := (2 => '1', others => '0'); + push_endpoint_reference; start_test; wait_on_complete; stimulus := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; sub_p.data := EMPTY_TEST_PACKET; - -- MEMORY STATE [p2,p1/e1p1,e0p1,0,0,0,0] - - Log("Match Endpoint 2 Participant 1 [Pos 0]", INFO); - sub_p.writerSN := p1_sn; - endpoint := e2; - endpoint.participant:= p1; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p1_sn := p1_sn + 1; - -- MEMORY STATE [p2,p1/e1p1,e0p1,0,0,0,e2p1] - - Log("Match Endpoint 0 Participant 2 [Pos 1]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e0; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2,p1/e1p1,e0p1,0,0,e0p2,e2p1] - - Log("Unmatch Participant 1 and its Endpoints", INFO); - sub.writerSN := p_sn; - participant := p1; - participant.protocolVersion := PROTOCOLVERSION_1_0; - participant.nr := 1; - participant.match := UNMATCH; - 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)); - -- Endpoint UNMATCH - endpoint := e2; - endpoint.participant:= p1; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e0; - endpoint.participant:= p1; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e1; - endpoint.participant:= p1; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - 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; - p_sn := p_sn + 1; - p1_sn := FIRST_SEQUENCENUMBER; - -- MEMORY STATE [p2/e0p2,0] - - Log("Match Participant 0 [Pos 1]", INFO); - sub.writerSN := p_sn; - participant := p0; - participant.nr := 1; - participant.match := MATCH; - 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p2,p0/e0p2,0] - - Log("Match Participant 1 [Pos 2]", INFO); - sub.writerSN := p_sn; - participant := p1; - participant.nr := 2; - participant.match := MATCH; - 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; - 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; - p_sn := p_sn + 1; - -- MEMORY STATE [p2,p0,p1/e0p2,0] - - Log("Match Endpoint 1 Participant 2 [Pos 0]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e1; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2,p0,p1/e0p2,e1p2] - - Log("Match Endpoint 2 Participant 2 [Pos 2]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e2; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2,p0,p1/e2p2,e0p2,e1p2] - - Log("Match Endpoint 3 Participant 2 [Pos 3]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e3; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2,p0,p1/e3p2,e2p2,e0p2,e1p2] - - Log("Match Endpoint 4 Participant 2 [Pos 4]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e4; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2,p0,p1/e4p2,e3p2,e2p2,e0p2,e1p2] - - Log("Ignore Endpoint 5 Participant 2 [Memory Collision]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e5; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); -- Match Frame is generated, even if the Endpoint is not stored - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; -- Sequence Number is processed even with memory collision - -- MEMORY STATE [p2,p0,p1/e4p2,e3p2,e2p2,e0p2,e1p2] - - Log("Unmatch Participant 0", INFO); - sub.writerSN := p_sn; - participant := p0; - participant.protocolVersion := PROTOCOLVERSION_1_0; - participant.nr := 1; - participant.match := UNMATCH; - 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; - 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; - p_sn := p_sn + 1; - p0_sn := FIRST_SEQUENCENUMBER; - -- MEMORY STATE [p2,0,p1/e4p2,e3p2,e2p2,e0p2,e1p2] - - Log("Unmatch Participant 1", INFO); - sub.writerSN := p_sn; - participant := p1; - participant.protocolVersion := PROTOCOLVERSION_1_0; - participant.nr := 2; - participant.match := UNMATCH; - 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; - 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; - p_sn := p_sn + 1; - p1_sn := FIRST_SEQUENCENUMBER; - -- MEMORY STATE [p2/e4p2,e3p2,e2p2,e0p2,e1p2] - - Log("Match Endpoint 5 Participant 2 [Pos 5]", INFO); - sub_p.writerSN := p2_sn; - endpoint := e5; - endpoint.participant:= p2; - gen_endpoint_data(endpoint, sub_p.data); - gen_sentinel(sub_p.data); - gen_rtps_handler_out(sub_p, endpoint, stimulus); - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - start_test; - wait_on_complete; - stimulus := EMPTY_TEST_PACKET; - reference := EMPTY_TEST_PACKET; - sub_p.data := EMPTY_TEST_PACKET; - p2_sn := p2_sn + 1; - -- MEMORY STATE [p2/e5p2,e4p2,e3p2,e2p2,e0p2,e1p2] - - Log("Unmatch Participant 2 and its Endpoints", INFO); - sub.writerSN := p_sn; - participant := p2; - participant.protocolVersion := PROTOCOLVERSION_1_0; - participant.nr := 0; - participant.match := UNMATCH; - 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)); - -- Endpoint UNMATCH - endpoint := e1; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e0; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e2; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e3; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e4; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - endpoint := e5; - endpoint.participant:= p2; - endpoint.match := UNMATCH; - gen_match_frame(endpoint, reference); - wr_sig := (others => '1'); - push_reference; - reference := EMPTY_TEST_PACKET; - 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; - p_sn := p_sn + 1; - p1_sn := FIRST_SEQUENCENUMBER; - -- MEMORY STATE [0] + p_snp := p_snp + 1; TranscriptOpen(RESULTS_FILE, APPEND_MODE); SetTranscriptMirror; stim_done <= '1'; wait until check_done = '1'; - AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + AlertIf((not SB_out.empty) or (not SB_mem.empty), "Incomplete test run"); ReportAlerts; TranscriptClose; std.env.stop; @@ -884,7 +309,6 @@ begin in_empty_prc : process begin in_empty <= '0'; - wait; --TODO: Remove wait until rd_sig = '1'; wait until rising_edge(clk); in_empty <= '1'; @@ -894,7 +318,6 @@ begin endpoint_full_prc : process begin endpoint_full <= (others => '0'); - wait; --TODO: Remove wait until (or endpoint_wr) = '1'; wait until rising_edge(clk); endpoint_full <= (others => '1'); diff --git a/src/Tests/mem_test_config.vhd b/src/Tests/mem_test_config.vhd deleted file mode 100644 index 48a4671..0000000 --- a/src/Tests/mem_test_config.vhd +++ /dev/null @@ -1,126 +0,0 @@ -library ieee; -use ieee.std_logic_1164.all; -use ieee.numeric_std.all; - -use work.rtps_package.all; - -package user_config is - - --*****USER CONFIG***** - - -- NOTE: All strings have to be padded to 256 characters - - -- Unicast IPv4 Address used by all RTPS Entities [Default 192.168.0.80] - constant DEFAULT_IPv4_ADDRESS : std_logic_vector(IPv4_ADDRESS_WIDTH-1 downto 0) := x"C0A80080"; - -- Number of RTPS Writer Endpoints - constant NUM_WRITERS : natural := 0; - -- Number of RTPS Reader Endpoints - constant NUM_READERS : natural := 1; - -- Number of RTPS Endpoints (Do not modify) - constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; - -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PB : natural := 7400; - -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_DG : natural := 250; - -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PG : natural := 2; - -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D0 : natural := 0; - -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D1 : natural := 10; - -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D2 : natural := 1; - -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D3 : natural := 11; - -- MAC Address of underlying network stack (Used to generate GUIDs) - constant MAC_ADDRESS : std_logic_vector(47 downto 0) := x"97917E0BA8CF"; - -- Domain ID - constant USER_DOMAIN_ID : natural := 1; - -- Domain TAG - constant USER_DOMAIN_TAG : string(1 to 256) := (others => NUL); --"" - - --***RTPS ENDPOINTS*** - -- Array denoting if Endpoints use Keyed Topics - constant ENDPOINT_WITH_KEY : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => FALSE); - -- Array mapping Topic Names to Endpoints - constant ENDPOINT_TOPIC_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => "Placeholder" & (12 to 256 => NUL)); - -- Array mapping Type Names to Endpoints - constant ENDPOINT_TYPE_STRING : USER_STRING_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => "Placeholder" & (12 to 256 => NUL)); - -- *TIMING CHARACTERISTICS* - -- Timing Characteristics for Participant - constant PARTICIPANT_ANNOUNCEMENT_PERIOD : DURATION_TYPE := gen_duration(30,0); -- 30 s - constant PARTICIPANT_LEASE_DURATION : DURATION_TYPE := DEFAULT_PARTICIPANT_LEASE_DURATION; - -- Denotes how much faster then the deadline/period we schedule in order to account for transport delay. - constant DURATION_DELTA : DURATION_TYPE := gen_duration(0, 100*(10**6)); -- 100 ms - -- Timing Characteristics for built-in Endpoints - constant PARTICIPANT_HEARTBEAT_PERIOD : DURATION_TYPE := gen_duration(1,0); -- 1 s - constant PARTICIPANT_HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := gen_duration(0,500*(10**6)); -- 500 ms - constant PARTICIPANT_HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,0); - constant PARTICIPANT_ACKNACK_RESPONSE_DELAY : DURATION_TYPE := gen_duration(3,200*(10**6)); -- 200 ms - constant PARTICIPANT_ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE := gen_duration(0,0); - -- Array mapping Timing Characteristics to Endpoints - constant ENDPOINT_HEARTBEAT_PERIOD : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(1,0)); -- 1 s - constant ENDPOINT_HEARTBEAT_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,500*(10**6))); -- 500 ms - constant ENDPOINT_HEARTBEAT_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,0)); - constant ENDPOINT_ACKNACK_RESPONSE_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(3,200*(10**6))); -- 200 ms - constant ENDPOINT_ACKNACK_SUPPRESSION_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => gen_duration(0,0)); - - - --***ENDPOINT DDS QOS*** - -- Array mapping DURABILITY QoS to Endpoints - constant ENDPOINT_DURABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_QOS); - constant ENDPOINT_DURABILITY_SERVICE_CLEANUP_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_CLEANUP_DELAY); - constant ENDPOINT_DURABILITY_SERVICE_HISTORY : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY); - constant ENDPOINT_DURABILITY_SERVICE_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_HISTORY_DEPTH); - constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES); - constant ENDPOINT_DURABILITY_SERVICE_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_INSTANCES); - constant ENDPOINT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DURABILITY_SERVICE_MAX_SAMPLES_PER_INSTANCE); - -- Array mapping PRESENTATION QoS to Endpoints - constant ENDPOINT_PRESENTATION_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_PRESENTATION_QOS); - constant ENDPOINT_COHERENT_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_COHERENT_ACCESS); - constant ENDPOINT_ORDERED_ACCESS : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_ORDERED_ACCESS); - -- Array mapping DEADLINE QoS to Endpoints - constant ENDPOINT_DEADLINE_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DEADLINE_QOS); - -- Array mapping LATENCY_BUDGET QoS to Endpoints - constant ENDPOINT_LATENCY_BUDGET_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LATENCY_BUDGET_QOS); - -- Array mapping OWNERSHIP QoS to Endpoints - constant ENDPOINT_OWNERSHIP_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_QOS); - -- Array mapping OWNERSHIP_STRENGTH QoS to Endpoints (Only relevant to Writers) - constant ENDPOINT_OWNERSHIP_STRENGTH_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_OWNERSHIP_STRENGTH_QOS); - -- Array mapping LIVELINESS QoS to Endpoints - constant ENDPOINT_LIVELINESS_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIVELINESS_QOS); - constant ENDPOINT_LEASE_DURATION : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LEASE_DURATION); - -- Array mapping TIME_BASED_FILTER QoS to Endpoints (Only relevant to Readers) - constant ENDPOINT_TIME_BASED_FILTER_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TIME_BASED_FILTER_QOS); - -- XXX: PARTITION QoS Ignored - -- Array mapping RELIABILITY QoS to Endpoints - constant ENDPOINT_RELIABILITY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_RELIABILTY_QOS); - -- (Only relevant to Writers) - constant ENDPOINT_MAX_BLOCKING_TIME : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_BLOCKING_TIME); - -- Array mapping TRANSPORT_PRIORITY QoS to Endpoints (Only relevant to Writers) - constant ENDPOINT_TRANSPORT_PRIORITY_QOS : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_TRANSPORT_PRIORITY_QOS); - -- Array mapping LIFESPAN QoS to Endpoints (Only relevant to Writers) - constant ENDPOINT_LIFESPAN_QOS : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_LIFESPAN_QOS); - -- Array mapping DESTINATION_ORDER QoS to Endpoints - constant ENDPOINT_DESTINATION_ORDER_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_DESTINATION_ORDER_QOS); - -- Array mapping HISTORY QoS to Endpoints - constant ENDPOINT_HISTORY_QOS : USER_ENUMERATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_QOS); - constant ENDPOINT_HISTORY_DEPTH : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_HISTORY_DEPTH); - -- Array mapping RESOURCE_LIMITS QoS to Endpoints - constant ENDPOINT_MAX_SAMPLES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES); - constant ENDPOINT_MAX_INSTANCES : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_INSTANCES); - constant ENDPOINT_MAX_SAMPLES_PER_INSTANCE : USER_LONG_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_MAX_SAMPLES_PER_INSTANCE); - -- XXX: ENTITY_FACTORY QoS Ignored - -- Array mapping WRITER_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Writers) - constant ENDPOINT_AUTODISPOSE_UNREGISTERED_INSTANCES : USER_BOOLEAN_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTODISPOSE_UNREGISTERED_INSTANCES); - -- Array mapping Reader_DATA_LIFECYCLE QoS to Endpoints (Only relevant to Readers) - constant ENDPOINT_AUTOPURGE_NOWRITER_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_NOWRITER_SAMPLES_DELAY); - constant ENDPOINT_AUTOPURGE_DISPOSED_SAMPLES_DELAY : USER_DURATION_ARRAY_TYPE(0 to NUM_ENDPOINTS-1) := (others => DEFAULT_AUTOPURGE_DISPOSED_SAMPLES_DELAY); - - -- NOTE: The buffer will not only store participants, but also endpoint data - -- Used to determine the size of the builtin endpoint buffer - constant MAX_REMOTE_PARTICIPANTS : natural := 4; - - -- TESTING PARAMETERS - constant TEST_STRING : string := "TEST_CONFIG_2"; -end package; \ No newline at end of file diff --git a/src/Tests/test_config.vhd b/src/Tests/test_config.vhd index a664446..b8a3482 100644 --- a/src/Tests/test_config.vhd +++ b/src/Tests/test_config.vhd @@ -214,7 +214,7 @@ package user_config is -- NOTE: The buffer will not only store participants, but also endpoint data -- Used to determine the size of the builtin endpoint buffer - constant MAX_REMOTE_PARTICIPANTS : natural := 50; + constant MAX_REMOTE_PARTICIPANTS : natural := 11; -- TESTING PARAMETERS constant TEST_STRING : string := "TEST_CONFIG_1"; diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index f79ef75..a81c502 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -14,8 +14,8 @@ analyze Level_0/rtps_handler_test1.vhd analyze Level_0/rtps_handler_test2.vhd analyze test_ram.vhd analyze ScoreBoard_test_memory.vhd -analyze Level_0/rtps_builtin_endpoint_test1.vhd analyze ScoreBoard_builtin_endpoint.vhd +analyze Level_0/rtps_builtin_endpoint_test1.vhd analyze Level_0/rtps_builtin_endpoint_test2.vhd analyze Level_0/rtps_builtin_endpoint_test3.vhd analyze Level_0/rtps_builtin_endpoint_test4.vhd @@ -25,18 +25,4 @@ analyze Level_0/rtps_builtin_endpoint_test4.vhd #simulate rtps_builtin_endpoint_test1 #simulate rtps_builtin_endpoint_test2 #simulate rtps_builtin_endpoint_test3 - -library Level0-rtps_builtin_endpoint -analyze ../math_pkg.vhd -analyze ../rtps_package.vhd -analyze mem_test_config.vhd -analyze ../rtps_config_package.vhd -analyze ../rtps_test_package.vhd -analyze ../rtps_handler.vhd -analyze ../rtps_builtin_endpoint.vhd -analyze test_ram.vhd -analyze ScoreBoard_test_memory.vhd -analyze ScoreBoard_builtin_endpoint.vhd -analyze Level_0/rtps_builtin_endpoint_test4.vhd - simulate rtps_builtin_endpoint_test4 \ No newline at end of file diff --git a/src/rtps_builtin_endpoint.vhd b/src/rtps_builtin_endpoint.vhd index e5e6532..f9e447e 100644 --- a/src/rtps_builtin_endpoint.vhd +++ b/src/rtps_builtin_endpoint.vhd @@ -63,33 +63,23 @@ architecture arch of rtps_builtin_endpoint is type STAGE_TYPE is (IDLE, PACKET_HEADER, PACKET_SRC_ADDR, PACKET_SRC_ENTITYID, PACKET_SRC_GUIDPREFIX, PACKET_DEST_ENTITYID, CHECK_SRC_ENTITYID, LATCH_SEQ_NR, PROCESS_DATA, PROCESS_MESSAGE, PROCESS_GAP, PROCESS_GAP_SEQUENCE_NUMBERS, PROCESS_PL, CHECK_DEFAULT, LATCH_STRING_LENGTH, COMPARE_STRING, RXO_DURABILITY, RXO_DEADLINE, RXO_LIVELINESS, RXO_LEASE_DURATION, LATCH_LEASE_DURATION, - RXO_RELIABILITY, RXO_DESTINATION_ORDER, RXO_OWNERSHIP, RXO_PRESENTATION, RXO_PARTITION, RXO_LATENCY_BUDGET, CHECK_MAX_SIZE_SERIALIZED, MATCH_DOMAIN_ID, MATCH_PROTOCOL_VERSION, - LATCH_LOCATOR, LATCH_EXPECTS_INLINE_QOS, MATCH_GUID, CHECK_REMOTE_BUILTIN_ENDPOINTS, PARTICIPANT_MATCH_STAGE, - INITIATE_ENDPOINT_SEARCH, ENDPOINT_MATCH_STAGE, FIND_ORPHAN_ENDPOINT, PURGE_ORPHAN_ENDPOINT, INFORM_ENDPOINTS_MATCH, - INFORM_ENDPOINTS_UNMATCH, PARTICIPANT_STALE_CHECK, LATCH_REMOVED_GUIDPREFIX, PROCESS_HEARTBEAT, PROCESS_HEARTBEAT_SEQUENCE_NUMBERS, - SEND_ACKNACK, SEND_HEARTBEAT, PROCESS_ACKNACK, PROCESS_ACKNACK_SEQUENCE_NUMBERS, FIND_PARTICIPANT_DEST, SEND_HEADER, - SEND_PARTICIPANT_ANNOUNCEMENT, SEND_PUB_DATA, SEND_SUB_DATA, SEND_MES_MAN_LIVE, SEND_MES_GAP, SEND_MES_AUTO_LIVE, - LIVELINESS_UPDATE, SKIP_PARAMETER, SKIP_PACKET); + RXO_RELIABILITY, RXO_DESTINATION_ORDER, RXO_OWNERSHIP, RXO_PRESENTATION, RXO_PARTITION, RXO_LATENCY_BUDGET, CHECK_MAX_SIZE_SERIALIZED, + MATCH_DOMAIN_ID, MATCH_PROTOCOL_VERSION, LATCH_LOCATOR, LATCH_EXPECTS_INLINE_QOS, MATCH_GUID, CHECK_REMOTE_BUILTIN_ENDPOINTS, + PARTICIPANT_MATCH_STAGE, INFORM_ENDPOINTS_MATCH, INFORM_ENDPOINTS_UNMATCH, INFORM_ENDPOINTS_PARTICIPANT_UNMATCH, PARTICIPANT_STALE_CHECK, + LATCH_REMOVED_GUIDPREFIX, PROCESS_HEARTBEAT, PROCESS_HEARTBEAT_SEQUENCE_NUMBERS, SEND_ACKNACK, SEND_HEARTBEAT, PROCESS_ACKNACK, + PROCESS_ACKNACK_SEQUENCE_NUMBERS, FIND_PARTICIPANT_DEST, SEND_HEADER, SEND_PARTICIPANT_ANNOUNCEMENT, SEND_PUB_DATA, SEND_SUB_DATA, + SEND_MES_MAN_LIVE, SEND_MES_GAP, SEND_MES_AUTO_LIVE, LIVELINESS_UPDATE, SKIP_PARAMETER, SKIP_PACKET); -- Memory FSM states. Explained below in detail - type MEM_STAGE_TYPE is (IDLE, SEARCH_PARTICIPANT, GET_PARTICIPANT_DATA, SEARCH_ENDPOINT, REMOVE_PARTICIPANT, - REMOVE_ENDPOINT, FIND_PARTICIPANT_SLOT, INSERT_PARTICIPANT, FIND_ENDPOINT_SLOT, INSERT_ENDPOINT, - FIND_NEXT_PARTICIPANT, FIND_STALE_PARTICIPANT, UPDATE_PARTICIPANT); + type MEM_STAGE_TYPE is (IDLE, SEARCH_PARTICIPANT, GET_PARTICIPANT_DATA, REMOVE_PARTICIPANT, FIND_PARTICIPANT_SLOT, + INSERT_PARTICIPANT, FIND_NEXT_PARTICIPANT, FIND_STALE_PARTICIPANT, UPDATE_PARTICIPANT); -- Memory FSM Opcodes -- OPCODE DESCRIPTION -- SEARCH_PARTICIPANT Search memory for Participant Entry with GUID Prefix equal to "guid" signal. -- Set "addr_res" signal to Base Address of found Participant Entry or MAX Address if nothing found. -- "mem_participant_data" contains memory Participant Data. - -- SEARCH_ENDPOINT Search memory for Endpoint Entry with GUID equal to "guid" signal. - -- Set "add_res" signal to Base Address of found Endpoint Entry or MAX Address if nothing found. - -- "endpoint_mask_array" contains memory Endpoint Data. -- INSERT_PARTICIPANT Write Participant Data (contained in latches) to first empty Participant Slot. - -- MAX Participant Pointer follows the highest Address Participant Entry. On collision with Endpoint memory area, insert is ignored. - -- INSERT_ENDPOINT Write Endpoint Data (contained in latches) to the first empty Endpoint Entry. - -- MAX Endpoint Pointer follows the lowest Address Endpoint Entry. On collision with Participant memory area, insert is ignored. -- UPDATE_PARTICIPANT Update the Participant Data of the Participant Entry pointed in "addr_res" according to the "update_participant_flags" flags. - -- UPDATE_ENDPOINT Update the Endpoint Data of the Endpoint Entry pointed in "addr_res". - -- REMOVE_PARTICIPANT Remove the Participant Entry pointed in "addr_res". (MAX Participant Pointer is adjusted) - -- REMOVE_ENDPOINT Remove the Endpoint Entry pointed in "addr_res". (MAX Endpoint Pointer is adjusted) + -- REMOVE_PARTICIPANT Remove the Participant Entry pointed in "addr_res". -- FIND_STALE_PARTICIPANT Find first Participant Entry with expired times (Lease Deadline, HEARTBEAT/ACKNACK Response/Suppression Timeout). -- Set "addr_res" signal to Base Address of found Participant Entry or MAX Address if nothing found. -- FIND_FIRST_PATICIPANT Find first occupied Participant Entry in memory. @@ -131,10 +121,10 @@ architecture arch of rtps_builtin_endpoint is constant BUILTIN_BUFFER_ADDR_WIDTH : natural := log2c(BUILTIN_BUFFER_SIZE); -- Highest Memory Address constant MAX_ADDRESS : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := to_unsigned(BUILTIN_BUFFER_SIZE-1, BUILTIN_BUFFER_ADDR_WIDTH); + -- Highest participant Frame Address + constant MAX_PARTICIPANT_ADDRESS : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := MAX_ADDRESS - PARTICIPANT_FRAME_SIZE + 1; -- Address pointing to the beginning of the first Participant Data Frame constant FIRST_PARTICIPANT_ADDRESS : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); - -- Address pointing to the beginning of the first Endpoint Data Frame - constant FIRST_ENDPOINT_ADDRESS : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := to_unsigned(BUILTIN_BUFFER_SIZE - ENDPOINT_FRAME_SIZE-1, BUILTIN_BUFFER_ADDR_WIDTH); -- *UPDATE PARTICIPANT FLAG POSITIONS* -- Signifies that the main Participant Data are updated constant PARTICIPANT_DATA_FLAG : natural := 0; @@ -274,12 +264,6 @@ architecture arch of rtps_builtin_endpoint is signal mem_addr_base, mem_addr_base_next : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); -- Result Base Memory Address of Memory Operation signal addr_res, addr_res_next : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); - -- Help signal used to reset the MAX Participant/Endpoint Memory Pointers - signal last_addr, last_addr_next : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); - -- Highest Participant Memory Address (Points to first Word after last occupied Participant Frame) - signal max_participant_addr, max_participant_addr_next : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); - -- Lowest Endpoint Memory Address (Points to first Word of last occupied Endpoint Frame) - signal max_endpoint_addr, max_endpoint_addr_next : unsigned(BUILTIN_BUFFER_ADDR_WIDTH-1 downto 0) := (others => '0'); -- Memory Data Read and Write Signals signal mem_read_data, mem_write_data : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); -- Memory Read and Write Enable Signals @@ -294,16 +278,12 @@ architecture arch of rtps_builtin_endpoint is signal first_seq_nr, first_seq_nr_next : SEQUENCENUMBER_TYPE := (others => (others => '0')); -- Latch used to store the last Sequence Number in HEARTBEAT/GAP Messages signal last_seq_nr, last_seq_nr_next : SEQUENCENUMBER_TYPE := (others => (others => '0')); - -- Signifies if we currently do a Orphan Endpoint Search (Endpoint whose parent Participant was removed) - signal is_orphan_search, is_orphan_search_next : std_logic := '0'; -- Intermediate write enable signal. signal wr_sig : std_logic := '0'; - -- Signifies if we currently are resetting the MAX Participant/Endpoint Pointer - signal reset_max_pointer, reset_max_pointer_next : std_logic := '0'; -- Signifies if we currently are doing a Participant Stale Entry Check (Used to start Stale Checks between packet handling) signal stale_check, stale_check_next : std_logic := '0'; -- Latch containing the GUID Prefix of the removed Participant from the memory, and the Enity ID of the last Orphan Endpoint found - signal mem_guid, mem_guid_next : GUID_TYPE := (others => (others => '0')); + signal mem_guidprefix, mem_guidprefix_next : GUIDPREFIX_TYPE := (others => (others => '0')); -- Toggle latching the "last_word_in" signal until reset signal last_word_in_latch, last_word_in_latch_next : std_logic := '0'; -- Flags signifying which parts of the participant Data stored in memory to update @@ -480,6 +460,10 @@ begin if (wr_sig = '1') then endpoint_wr <= not endpoint_mask; end if; + when INFORM_ENDPOINTS_PARTICIPANT_UNMATCH => + if (wr_sig = '1') then + endpoint_wr <= (others => '1'); + end if; when LIVELINESS_UPDATE => if (wr_sig = '1') then endpoint_wr <= endpoint_mask; @@ -512,8 +496,6 @@ begin -- FIND_PARTICIPANT_DEST Find next stored Participant to send Participant Announcement and Liveliness Assertion to. -- PARTICIPANT_STALE_CHECK Check memory for remote stale Participant Entries (Lease Duration Exceeded, HEARTBEAT/ACKNACK timeout passed) -- LATCH_REMOVED_GUIDPREFIX Store Participant GUID Prefix of removed Participant for Orphan Endpoint Search - -- FIND_ORPHAN_ENDPOINT Search for Orphan (whose parent Participant was removed) Endpoints in memory - -- PURGE_ORPHAN_ENDPOINT Remove Orphan Endpoint from memory -- PROCESS_PL Parse RTPS Parameter List -- CHECK_DEFAULT Match local endpoints against non-received QoS (default values) of remote -- LATCH_STRING_LENGTH Store String Length @@ -536,11 +518,10 @@ begin -- RXO_PARTITION Check Compatibility of Partition QoS -- RXO_LATENCY_BUDGET Check Compatibility of Latency Budget QoS -- CHECK_MAX_SIZE_SERIALIZED Check if Publishers Max sent Payload Size is Compatible - -- PARTICIPANT_MATCH_STAGE Add compatible remote and remove incompatible remote Participants to and from memory. Update stored Sequence Numbers respectively - -- INITIATE_ENDPOINT_SEARCH Search for remote Endpoint in memory - -- ENDPOINT_MATCH_STAGE Add compatible remote and remove incompatible remote Participants to and from memory. Mark compatibility changes to local Endpoints. - -- INFORM_ENDPOINTS_MATCH Propagate new local Endpoint matches + -- PARTICIPANT_MATCH_STAGE Add compatible remote and remove incompatible remote Participants to and from memory. Update stored Sequence Numbers respectively (also for EDP) + -- INFORM_ENDPOINTS_MATCH Propagate local Endpoint matches -- INFORM_ENDPOINTS_UNMATCH Propagate local Endpoint unmatches + -- INFORM_ENDPOINTS_PARTICIPANT_UNMATCH Propagate remote Participant unmatch -- SEND_HEADER Send Output Data Header and RTPS Message Header -- SEND_PARTICIPANT_ANNOUNCEMENT Send Participant Announcement Data Submessage -- SEND_ACKNACK Send ACKNACK Submessages @@ -582,7 +563,6 @@ begin is_meta_addr_next <= is_meta_addr; cnt_next <= cnt; expects_inline_qos_rcv_next <= expects_inline_qos_rcv; - is_orphan_search_next <= is_orphan_search; extra_flags_next <= extra_flags; stale_check_next <= stale_check; first_seq_nr_next <= first_seq_nr; @@ -1493,43 +1473,11 @@ begin end if; when LATCH_REMOVED_GUIDPREFIX => if (mem_op_done = '1') then - -- Help Stage needed to latch the GUID Prefix of the removed staled participant (Needed for the orphan search) - guid_next(0) <= mem_guid(0); - guid_next(1) <= mem_guid(1); - guid_next(2) <= mem_guid(2); - stage_next <= FIND_ORPHAN_ENDPOINT; - end if; - when FIND_ORPHAN_ENDPOINT => - -- Memory Operation Guard - if (mem_op_done = '1') then - -- Initiate Endpoint Search - is_orphan_search_next <= '1'; - mem_opcode <= SEARCH_ENDPOINT; - mem_op_start <= '1'; - stage_next <= PURGE_ORPHAN_ENDPOINT; - end if; - when PURGE_ORPHAN_ENDPOINT => - -- Wait for Endpoint Search to finish - if (mem_op_done = '1') then - -- Found Orphan Endpoint - if (addr_res /= MAX_ADDRESS) then - -- Remove Orphaned Endpoint from Buffer - mem_opcode <= REMOVE_ENDPOINT; - mem_op_start <= '1'; - -- Latch Orphan Entity ID - guid_next(3) <= mem_guid(3); - -- Mark All UNMATCHES - endpoint_mask_next <= (others => '0'); - -- Propagate Unmatches to local Endpoints - stage_next <= INFORM_ENDPOINTS_UNMATCH; - cnt_next <= 0; - -- Buffer has no more Orphans - else - -- Reset Orphan Search Flag - is_orphan_search_next <= '0'; - -- DONE - stage_next <= SKIP_PACKET; - end if; + -- Help Stage needed to latch the GUID Prefix of the removed staled participant + guid_next(0) <= mem_guidprefix(0); + guid_next(1) <= mem_guidprefix(1); + guid_next(2) <= mem_guidprefix(2); + stage_next <= INFORM_ENDPOINTS_PARTICIPANT_UNMATCH; end if; when PROCESS_PL => -- Input FIFO Guard @@ -2379,8 +2327,9 @@ begin -- Remove participant from buffer mem_opcode <= REMOVE_PARTICIPANT; mem_op_start <= '1'; - -- Find and delete all orphaned endpoints in Buffer - stage_next <= FIND_ORPHAN_ENDPOINT; + -- Inform ENDPOINTS + stage_next <= INFORM_ENDPOINTS_PARTICIPANT_UNMATCH; + cnt_next <= 0; -- Participant remains matched else -- Update Participant Data and Lease @@ -2410,102 +2359,24 @@ begin mem_opcode <= UPDATE_PARTICIPANT; update_participant_flags_next <= (EDP_SEQ_NR_FLAG => '1', others => '0'); mem_op_start <= '1'; - -- Search for Endpoint in Buffer - stage_next <= INITIATE_ENDPOINT_SEARCH; + + -- At least one local Endpoint match + if (endpoint_mask /= (endpoint_mask'range => '0')) then + -- Propagate Matches to local Endpoints + stage_next <= INFORM_ENDPOINTS_MATCH; + cnt_next <= 0; + -- No local Endpoint matches + else + -- Propagate Matches to local Endpoints + stage_next <= INFORM_ENDPOINTS_UNMATCH; + cnt_next <= 0; + end if; else -- Ignore (Messages are handled in a dedicated stage) stage_next <= SKIP_PACKET; end if; end if; end if; - -- Help stage, because we need to do two consecutive memory operations - when INITIATE_ENDPOINT_SEARCH => - -- Memory Operation Guard - if (mem_op_done = '1') then - -- Search Endpoint in Buffer - mem_opcode <= SEARCH_ENDPOINT; - mem_op_start <= '1'; - - stage_next <= ENDPOINT_MATCH_STAGE; - end if; - when ENDPOINT_MATCH_STAGE => - -- Wait for Endpoint Search to finish - if (mem_op_done = '1') then - -- No Match in Buffer (New remote Endpoint) - if (addr_res = MAX_ADDRESS) then - -- At least one local Endpoint match - if (endpoint_mask /= (endpoint_mask'range => '0')) then - -- Add Endpoint in buffer - mem_opcode <= INSERT_ENDPOINT; - mem_op_start <= '1'; - -- Propagate Matches to local Endpoints - stage_next <= INFORM_ENDPOINTS_MATCH; - cnt_next <= 0; - -- No local Endpoint matches - else - -- Ignore - stage_next <= SKIP_PACKET; - end if; - -- Match in buffer (Existing Endpoint) - else - -- At least one local Endpoint match - if (endpoint_mask /= (endpoint_mask'range => '0')) then - -- Propagate Match Changes to local Endpoints - stage_next <= INFORM_ENDPOINTS_UNMATCH; - cnt_next <= 0; - -- No local Endpoint match - else - -- Remove endpoint from buffer - mem_opcode <= REMOVE_ENDPOINT; - mem_op_start <= '1'; - -- Mark All UNMATCHES - endpoint_mask_next <= (others => '0'); - -- Propagate Unmatches to local Endpoints - stage_next <= INFORM_ENDPOINTS_UNMATCH; - cnt_next <= 0; - end if; - end if; - end if; - when INFORM_ENDPOINTS_UNMATCH => - -- Output FIFO Guard - if (((not endpoint_mask) and endpoint_full) = (endpoint_full'range => '0')) then - wr_sig <= '1'; - cnt_next <= cnt + 1; - - case (cnt) is - -- Match Opcode - when 0 => - data_out <= OPCODE_UNMATCH; - -- GUID Prefix 1/3 - when 1 => - data_out <= guid(0); - -- GUID Prefix 2/3 - when 2 => - data_out <= guid(1); - -- GUID Prefix 3/3 - when 3 => - data_out <= guid(2); - -- Entity ID - when 4 => - data_out <= guid(3); - last_word_out <= '1'; - -- If we are in the middle of an Orphan Purge Process, return to the search stage - if (is_orphan_search = '1') then - stage_next <= FIND_ORPHAN_ENDPOINT; - else - -- If there are Endpoints to match, inform them - if (endpoint_mask /= (endpoint_mask'range => '0')) then - stage_next <= INFORM_ENDPOINTS_MATCH; - cnt_next <= 0; - else - -- DONE - stage_next <= SKIP_PACKET; - end if; - end if; - when others => - null; - end case; - end if; when INFORM_ENDPOINTS_MATCH => -- Output FIFO Guard if ((endpoint_mask and endpoint_full) = (endpoint_full'range => '0')) then @@ -2515,7 +2386,7 @@ begin case (cnt) is -- Match Opcode when 0 => - data_out <= OPCODE_MATCH; + data_out <= OPCODE_ENDPOINT_MATCH; -- GUID Prefix 1/3 when 1 => data_out <= guid(0); @@ -2558,6 +2429,64 @@ begin data_out(0) <= DEFAULT_EXPECTS_INLINE_QOS; end if; + -- DONE + stage_next <= INFORM_ENDPOINTS_UNMATCH; + cnt_next <= 0; + when others => + null; + end case; + end if; + when INFORM_ENDPOINTS_UNMATCH => + -- Output FIFO Guard + if (((not endpoint_mask) and endpoint_full) = (endpoint_full'range => '0')) then + wr_sig <= '1'; + cnt_next <= cnt + 1; + + case (cnt) is + -- Match Opcode + when 0 => + data_out <= OPCODE_ENDPOINT_UNMATCH; + -- GUID Prefix 1/3 + when 1 => + data_out <= guid(0); + -- GUID Prefix 2/3 + when 2 => + data_out <= guid(1); + -- GUID Prefix 3/3 + when 3 => + data_out <= guid(2); + -- Entity ID + when 4 => + data_out <= guid(3); + last_word_out <= '1'; + + -- DONE + stage_next <= SKIP_PACKET; + when others => + null; + end case; + end if; + when INFORM_ENDPOINTS_PARTICIPANT_UNMATCH => + -- Output FIFO Guard + if (endpoint_full = (endpoint_full'range => '0')) then + wr_sig <= '1'; + cnt_next <= cnt + 1; + + case (cnt) is + -- Match Opcode + when 0 => + data_out <= OPCODE_PARTICIPANT_UNMATCH; + -- GUID Prefix 1/3 + when 1 => + data_out <= guid(0); + -- GUID Prefix 2/3 + when 2 => + data_out <= guid(1); + -- GUID Prefix 3/3 + when 3 => + data_out <= guid(2); + last_word_out <= '1'; + -- DONE stage_next <= SKIP_PACKET; when others => @@ -3091,17 +3020,11 @@ begin -- STATE DESCRIPTION -- IDLE Idle state. Done Signal is pulled high and Memory FSM accepts new memory operations -- SEARCH_PARTICIPANT See Memory OPCODE Description - -- SEARCH_ENDPOINT See Memory OPCODE Description -- GET_PARTICIPANT_DATA Latch the contents of the Participant Entry for use in the main FSM - -- GET_ENDPOINT_MASK Latch the contents of the Endpoint Entry for use in the main FSM -- INSERT_PARTICIPANT See Memory OPCODE Description - -- INSERT_ENDPOINT See Memory OPCODE Description -- UPDATE_PARTICIPANT See Memory OPCODE Description - -- UPDATE_ENDPOINT See Memory OPCODE Description -- REMOVE_PARTICIPANT See Memory OPCODE Description - -- REMOVE_ENDPOINT See Memory OPCODE Description -- FIND_PARTICIPANT_SLOT Find first empty Participant Slot in memory - -- FIND_ENDPOINT_SLOT Find first empty Endpoint Slot in memory -- FIND_NEXT_PARTICIPANT See Memory OPCODE Description -- FIND_STALE_PARTICIPANT See Memory OPCODE Description mem_ctrl_prc : process(all) @@ -3115,13 +3038,9 @@ begin mem_addr_next <= mem_addr; addr_res_next <= addr_res; mem_cnt_next <= mem_cnt; - last_addr_next <= last_addr; mem_participant_data_next <= mem_participant_data; is_heartbeat_res_next <= is_heartbeat_res; - max_participant_addr_next <= max_participant_addr; - max_endpoint_addr_next <= max_endpoint_addr; - reset_max_pointer_next <= reset_max_pointer; - mem_guid_next <= mem_guid; + mem_guidprefix_next <= mem_guidprefix; -- DEFAULT Unregistered mem_write_data <= (others => '0'); mem_op_done <= '0'; @@ -3132,7 +3051,6 @@ begin case (mem_stage) is when IDLE => mem_op_done <= '1'; - reset_max_pointer_next <= '0'; if (mem_op_start = '1') then case(mem_opcode) is @@ -3141,21 +3059,11 @@ begin mem_addr_next <= FIRST_PARTICIPANT_ADDRESS; mem_stage_next <= SEARCH_PARTICIPANT; mem_cnt_next <= 0; - when SEARCH_ENDPOINT => - mem_addr_base_next <= FIRST_ENDPOINT_ADDRESS; - mem_addr_next <= FIRST_ENDPOINT_ADDRESS; - mem_stage_next <= SEARCH_ENDPOINT; - mem_cnt_next <= 0; when INSERT_PARTICIPANT => mem_addr_base_next <= FIRST_PARTICIPANT_ADDRESS; mem_addr_next <= FIRST_PARTICIPANT_ADDRESS; mem_stage_next <= FIND_PARTICIPANT_SLOT; mem_cnt_next <= 0; - when INSERT_ENDPOINT => - mem_addr_base_next <= FIRST_ENDPOINT_ADDRESS; - mem_addr_next <= FIRST_ENDPOINT_ADDRESS; - mem_stage_next <= FIND_ENDPOINT_SLOT; - mem_cnt_next <= 0; when UPDATE_PARTICIPANT => -- NOTE: We use the "_next" flag here, because it is not yet latched. if (update_participant_flags_next(PARTICIPANT_DATA_FLAG) = '1') then @@ -3187,10 +3095,6 @@ begin mem_addr_next <= addr_res; mem_stage_next <= REMOVE_PARTICIPANT; mem_cnt_next <= 0; - when REMOVE_ENDPOINT => - mem_addr_next <= addr_res; - mem_stage_next <= REMOVE_ENDPOINT; - mem_cnt_next <= 0; when FIND_STALE_PARTICIPANT => mem_addr_base_next <= FIRST_PARTICIPANT_ADDRESS; mem_addr_next <= FIRST_PARTICIPANT_ADDRESS; @@ -3221,37 +3125,56 @@ begin tmp := mem_addr_base + PARTICIPANT_FRAME_SIZE; case (mem_cnt) is + -- Preload when 0 => - -- Preload - -- Reached End of Participant Memory Area, No Match Found - if (mem_addr_base = max_participant_addr) then - addr_res_next <= MAX_ADDRESS; --No match - -- DONE - mem_stage_next <= IDLE; - end if; + null; + -- GUID Prefix 1/3 when 1 => -- No Match if (mem_read_data /= guid(0)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; + -- GUID Prefix 2/3 when 2 => -- No Match if (mem_read_data /= guid(1)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; + -- GUID Prefix 3/3 when 3 => -- No Match if (mem_read_data /= guid(2)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; -- Match else -- Fetch Participant Data @@ -3263,71 +3186,6 @@ begin when others => null; end case; - when SEARCH_ENDPOINT => - mem_rd <= '1'; - mem_cnt_next <= mem_cnt + 1; - mem_addr_next <= mem_addr + 1; - - -- Next Endpoint Frame Address - tmp := mem_addr_base - ENDPOINT_FRAME_SIZE; - - case (mem_cnt) is - -- Preload - when 0 => - -- Reache End of Endpoint Memory Area, No Match Found - if (mem_addr_base < max_endpoint_addr) then - addr_res_next <= MAX_ADDRESS; -- No match - -- DONE - mem_stage_next <= IDLE; - end if; - -- NOTE: Endpoint GUID is stored with Entity ID first, and then the GUID Prefix - -- Entity ID - when 1 => - -- No Match - -- Ignore Entity ID Match if Orphan Search (But make sure to ignore empty Slots) - if ((is_orphan_search = '0' and mem_read_data /= guid(3)) or mem_read_data = ENTITYID_UNKNOWN) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Latch Entity ID if Orphan Search - elsif (is_orphan_search = '1') then - mem_guid_next(3) <= mem_read_data; - end if; - -- GUID Prefix 1/3 - when 2 => - -- No Match - if (mem_read_data /= guid(0)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - end if; - -- GUID Prefix 2/3 - when 3 => - -- No Match - if (mem_read_data /= guid(1)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - end if; - -- GUID Prefix 3/3 - when 4 => - -- No Match - if (mem_read_data /= guid(2)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Match Found - else - addr_res_next <= mem_addr_base; - mem_stage_next <= IDLE; - end if; - when others => - null; - end case; when GET_PARTICIPANT_DATA => mem_rd <= '1'; mem_cnt_next <= mem_cnt + 1; @@ -3484,29 +3342,6 @@ begin when others => null; end case; - when INSERT_ENDPOINT => - mem_wr <= '1'; - mem_addr_next <= mem_addr + 1; - mem_cnt_next <= mem_cnt + 1; - - case (mem_cnt) is - -- Entity ID - when 0 => - mem_write_data <= guid(3); - -- GUIDPrefix 1/3 - when 1 => - mem_write_data <= guid(0); - -- GUIDPrefix 2/3 - when 2 => - mem_write_data <= guid(1); - -- GUIDPrefix 3/3 - when 3 => - mem_write_data <= guid(2); - -- DONE - mem_stage_next <= IDLE; - when others => - null; - end case; when UPDATE_PARTICIPANT => mem_cnt_next <= mem_cnt + 1; mem_addr_next <= mem_addr + 1; @@ -3675,15 +3510,15 @@ begin -- GUID Prefix 1/3 when 1 => mem_rd <= '1'; - mem_guid_next(0) <= mem_read_data; + mem_guidprefix_next(0) <= mem_read_data; -- GUID Prefix 2/3 when 2 => mem_rd <= '1'; - mem_guid_next(1) <= mem_read_data; + mem_guidprefix_next(1) <= mem_read_data; -- GUID Prefix 3/3 when 3 => mem_rd <= '1'; - mem_guid_next(2) <= mem_read_data; + mem_guidprefix_next(2) <= mem_read_data; mem_addr_next <= addr_res; -- GUID Prefix 1/3 when 4 => @@ -3697,28 +3532,12 @@ begin when 6 => mem_wr <= '1'; mem_write_data <= GUIDPREFIX_UNKNOWN(2); - -- Reset MAX Participant Pointer - mem_addr_base_next <= FIRST_PARTICIPANT_ADDRESS; - mem_addr_next <= FIRST_PARTICIPANT_ADDRESS; - reset_max_pointer_next <= '1'; - last_addr_next <= (others => '0'); - mem_stage_next <= FIND_PARTICIPANT_SLOT; - mem_cnt_next <= 0; + + -- DONE + mem_stage_next <= IDLE; when others => null; end case; - when REMOVE_ENDPOINT => - mem_wr <= '1'; - - -- Overtwrite EntityID with ENTITYID_UNKNOWN to mark slot as empty - mem_write_data <= ENTITYID_UNKNOWN; - -- Reset MAX Participant Pointer - mem_addr_base_next <= FIRST_ENDPOINT_ADDRESS; - mem_addr_next <= FIRST_ENDPOINT_ADDRESS; - reset_max_pointer_next <= '1'; - last_addr_next <= MAX_ADDRESS; - mem_stage_next <= FIND_ENDPOINT_SLOT; - mem_cnt_next <= 0; when FIND_PARTICIPANT_SLOT => mem_rd <= '1'; mem_addr_next <= mem_addr + 1; @@ -3730,145 +3549,60 @@ begin case (mem_cnt) is -- Preload when 0 => - -- Reached MAX Addr - if (mem_addr_base = max_participant_addr) then - -- We are in the middle of resetting the MAX Participant Pointer - if (reset_max_pointer = '1') then - -- Reset MAX Participant Pointer to first free slot after last occupied slot - if (last_addr /= 0) then - max_participant_addr_next <= last_addr; - end if; - -- DONE - mem_stage_next <= IDLE; - -- MEMORY COLLISION - -- XXX: Posible worst case path (addition and comparison on same clock) - elsif (tmp > max_endpoint_addr) then - report "Memory Full, Ignoring Participant Data" severity NOTE; - -- Ignore Insertion - mem_stage_next <= IDLE; - else - -- Extend Participant Memory Area - -- NOTE: "max_participant_addr" points to the first address after the last participant frame - max_participant_addr_next <= tmp; - -- Populate Participant Slot - mem_stage_next <= INSERT_PARTICIPANT; - mem_addr_next <= mem_addr_base; - mem_cnt_next <= 0; - end if; - end if; + null; -- GUID Prefix 1/3 when 1 => -- Slot Occupied if (mem_read_data /= GUIDPREFIX_UNKNOWN(0)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Reset Last Free Address - last_addr_next <= (others => '0'); + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + report "Memory Full, ignoring Participant Data" severity WARNING; + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; -- GUID Prefix 2/3 when 2 => -- Slot Occupied if (mem_read_data /= GUIDPREFIX_UNKNOWN(1)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Reset Last Free Address - last_addr_next <= (others => '0'); + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + report "Memory Full, ignoring Participant Data" severity WARNING; + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; -- GUID Prefix 3/3 when 3 => -- Slot Occupied if (mem_read_data /= GUIDPREFIX_UNKNOWN(2)) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Reset Last Free Address - last_addr_next <= (others => '0'); - -- Slot Empty - else - -- If we are in the middle of resetting the MAX Participant Pointer, go through all the Participant memory area to reset the pointer - if (reset_max_pointer = '1') then - -- Store first Free Slot Address after occupied slot - if (last_addr = 0) then - last_addr_next <= mem_addr_base; - end if; - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - else - -- Populate Participant Slot - mem_stage_next <= INSERT_PARTICIPANT; - mem_addr_next <= mem_addr_base; - mem_cnt_next <= 0; - end if; - end if; - when others => - null; - end case; - when FIND_ENDPOINT_SLOT => - mem_rd <= '1'; - mem_cnt_next <= mem_cnt + 1; - - -- Next Endpoint Frame Address - tmp := mem_addr_base - ENDPOINT_FRAME_SIZE; - - case (mem_cnt) is - -- Preload - when 0 => - -- Exceeded MAX Addr - if (mem_addr_base < max_endpoint_addr) then - -- If we are in the middle of resetting the MAX Participant Pointer - if (reset_max_pointer = '1') then - -- Reset MAX Endpoint Pointer to last occupied slot - if (last_addr /= MAX_ADDRESS) then - max_endpoint_addr_next <= last_addr; - end if; + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + report "Memory Full, ignoring Participant Data" severity WARNING; + addr_res_next <= MAX_ADDRESS; --No match -- DONE mem_stage_next <= IDLE; - -- MEMORY COLLISION - elsif (mem_addr_base < max_participant_addr) then - report "Memory Full, Ignoring Endpoint Data" severity NOTE; - -- Ignore Insertion - mem_stage_next <= IDLE; else - -- Extend Participant Memory Area - -- NOTE: "max_endpoint_addr" points to the beginning of the last endpoint frame - max_endpoint_addr_next <= mem_addr_base; - -- Populate Endpoint Slot - mem_stage_next <= INSERT_ENDPOINT; - mem_addr_next <= mem_addr_base; - mem_cnt_next <= 0; - end if; - end if; - -- Entity ID - when 1 => - -- Slot Occupied - if (mem_read_data /= ENTITYID_UNKNOWN) then - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; - -- Store last occupied endpoint slot - last_addr_next <= mem_addr_base; - -- Slot Empty - else - -- If we are in the middle of resetting the MAX Participant Pointer, go through all the Endpoint memory area to reset the pointer - if (reset_max_pointer = '1') then -- Continue Search mem_addr_next <= tmp; mem_addr_base_next <= tmp; mem_cnt_next <= 0; - else - -- Populate Endpoint - mem_stage_next <= INSERT_ENDPOINT; - mem_addr_next <= mem_addr_base; - mem_cnt_next <= 0; end if; + -- Slot Empty + else + -- Populate Participant Slot + mem_stage_next <= INSERT_PARTICIPANT; + mem_addr_next <= mem_addr_base; + mem_cnt_next <= 0; end if; when others => null; @@ -3886,12 +3620,7 @@ begin case (mem_cnt) is -- Preload when 0 => - -- Reached MAX Addr, No Match Found - if (mem_addr_base = max_participant_addr) then - addr_res_next <= MAX_ADDRESS; --No match - -- DONE - mem_stage_next <= IDLE; - end if; + null; -- GUID Prefix 1/3 when 1 => -- Slot Occupied @@ -3921,10 +3650,17 @@ begin mem_cnt_next <= 0; -- Slot Empty else - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; when others => null; @@ -3944,12 +3680,7 @@ begin case (mem_cnt) is -- Preload when 0 => - -- Reached MAX Addr, No Match Found - if (mem_addr_base = max_participant_addr) then - addr_res_next <= MAX_ADDRESS; --No match - -- DONE - mem_stage_next <= IDLE; - end if; + null; -- GUID Prefix 1/3 when 1 => -- Slot Occupied @@ -3975,10 +3706,17 @@ begin mem_cnt_next <= 4; -- Slot Empty else - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; -- Preload when 4 => @@ -4055,10 +3793,17 @@ begin mem_cnt_next <= 0; -- Participant not Stale else - -- Continue Search - mem_addr_next <= tmp; - mem_addr_base_next <= tmp; - mem_cnt_next <= 0; + -- Reached End of Memory, No Match + if (mem_addr_base = MAX_PARTICIPANT_ADDRESS) then + addr_res_next <= MAX_ADDRESS; --No match + -- DONE + mem_stage_next <= IDLE; + else + -- Continue Search + mem_addr_next <= tmp; + mem_addr_base_next <= tmp; + mem_cnt_next <= 0; + end if; end if; when others => null; @@ -4112,13 +3857,10 @@ begin mem_addr_base <= (others => '0'); mem_addr <= (others => '0'); addr_res <= (others => '0'); - last_addr <= (others => '0'); long_latch <= (others => '0'); rcvd <= (others => '0'); - max_participant_addr <= FIRST_PARTICIPANT_ADDRESS; - max_endpoint_addr <= FIRST_ENDPOINT_ADDRESS; guid <= (others => (others => '0')); - mem_guid <= (others => (others => '0')); + mem_guidprefix <= (others => (others => '0')); lease_duration <= (others => (others => '0')); deadline <= (others => (others => '0')); announcement_time <= (others => (others => '0')); @@ -4143,11 +3885,9 @@ begin is_subscriber <= '0'; is_meta_addr <= '0'; expects_inline_qos_rcv <= '0'; - is_orphan_search <= '0'; stale_check <= '0'; is_live_assert <= '0'; is_heartbeat_res <= '0'; - reset_max_pointer <= '0'; last_word_in_latch <= '0'; else stage <= stage_next; @@ -4175,13 +3915,10 @@ begin mem_addr_base <= mem_addr_base_next; mem_addr <= mem_addr_next; addr_res <= addr_res_next; - last_addr <= last_addr_next; long_latch <= long_latch_next; rcvd <= rcvd_next; - max_participant_addr <= max_participant_addr_next; - max_endpoint_addr <= max_endpoint_addr_next; guid <= guid_next; - mem_guid <= mem_guid_next; + mem_guidprefix <= mem_guidprefix_next; lease_duration <= lease_duration_next; deadline <= deadline_next; announcement_time <= announcement_time_next; @@ -4206,11 +3943,9 @@ begin is_subscriber <= is_subscriber_next; is_meta_addr <= is_meta_addr_next; expects_inline_qos_rcv <= expects_inline_qos_rcv_next; - is_orphan_search <= is_orphan_search_next; stale_check <= stale_check_next; is_live_assert <= is_live_assert_next; is_heartbeat_res <= is_heartbeat_res_next; - reset_max_pointer <= reset_max_pointer_next; last_word_in_latch <= last_word_in_latch_next; end if; end if; diff --git a/src/rtps_config_package.vhd b/src/rtps_config_package.vhd index 6142956..29a8d77 100644 --- a/src/rtps_config_package.vhd +++ b/src/rtps_config_package.vhd @@ -39,16 +39,15 @@ package rtps_config_package is -- 4-Byte Word Size of a Participant Entry in Memory constant PARTICIPANT_FRAME_SIZE : natural := 23; - -- 4-Byte Word Size of a Endpoint Entry in Memory - constant ENDPOINT_FRAME_SIZE : natural := 4; -- Built-in Endpoint Memory Buffer 4-Byte Word Size constant BUILTIN_BUFFER_SIZE : natural := MAX_REMOTE_PARTICIPANTS*PARTICIPANT_FRAME_SIZE; -- ENDPOINT FRAME OPCODES constant ENDPOINT_MATCH_OPCODE_WIDTH: natural := 32; - constant OPCODE_MATCH : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000000"; - constant OPCODE_UNMATCH : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000001"; - constant OPCODE_LIVELINESS_UPDATE : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000002"; + constant OPCODE_ENDPOINT_MATCH : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000000"; + constant OPCODE_ENDPOINT_UNMATCH : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000001"; + constant OPCODE_PARTICIPANT_UNMATCH : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000002"; + constant OPCODE_LIVELINESS_UPDATE : std_logic_vector(ENDPOINT_MATCH_OPCODE_WIDTH-1 downto 0) := x"55000003"; -- Marks the Reader Endpoint in the Endpoint Array diff --git a/src/rtps_test_package.vhd b/src/rtps_test_package.vhd index 9096f7b..399004c 100644 --- a/src/rtps_test_package.vhd +++ b/src/rtps_test_package.vhd @@ -38,7 +38,6 @@ package rtps_test_package is type TEST_MEMORY_TYPE is array (natural range <>) of TEST_MEMORY_ELEMENT_TYPE; subtype TEST_PARTICIPANT_MEMORY_FRAME_TYPE is TEST_MEMORY_TYPE(0 to PARTICIPANT_FRAME_SIZE-1); - subtype TEST_ENDPOINT_MEMORY_FRAME_TYPE is TEST_MEMORY_TYPE(0 to ENDPOINT_FRAME_SIZE-1); constant LOCATOR_PORT_WIDTH : natural := CDR_LONG_WIDTH; constant LOCATOR_ADDR_WIDTH : natural := 4*CDR_LONG_WIDTH; @@ -223,7 +222,8 @@ package rtps_test_package is procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer); - procedure gen_match_frame( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + procedure gen_endpoint_match_frame( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE); + procedure gen_participant_match_frame( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE); function gen_endpoint_array(readers : boolean) return ENDPOINT_DATA_ARRAY_TYPE; procedure gen_sentinel(output : inout TEST_PACKET_TYPE); @@ -1294,6 +1294,31 @@ package body rtps_test_package is return ret; end function; + procedure gen_participant_match_frame( ref : in PARTICIPANT_DATA_TYPE; output : inout TEST_PACKET_TYPE) is + begin + -- OPCODE + case (ref.match) is + when MATCH => + report "No Endpoint Frame generated on Participant match" severity WARNING; + return; + when UNMATCH => + output.data(output.length) := OPCODE_PARTICIPANT_UNMATCH; + output.length := output.length + 1; + when others => + null; + end case; + -- GUID Prefix + output.data(output.length) := ref.guidPrefix(0); + output.length := output.length + 1; + output.data(output.length) := ref.guidPrefix(1); + output.length := output.length + 1; + output.data(output.length) := ref.guidPrefix(2); + output.length := output.length + 1; + + -- Mark Last Word + output.last(output.length-1) := '1'; + end procedure; + -- The Arguments "pid" and "offset" can be used to modify the parameter generation. More specifically, the length of the parameter denoted by "pid" is modified by "offset" 4-Byte words. -- Also setting "pid" forces the respective parameter to be writen out even if it is equal to the default value. procedure gen_endpoint_data( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE; pid : in std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0); offset : in integer) is @@ -1719,7 +1744,7 @@ package body rtps_test_package is gen_endpoint_data(ref, output, PID_PAD, 0); end procedure; - procedure gen_match_frame( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE) is + procedure gen_endpoint_match_frame( ref : in ENDPOINT_DATA_TYPE; output : inout TEST_PACKET_TYPE) is variable loc : LOCATOR_TYPE; begin -- Fetch relevant Locator @@ -1728,10 +1753,10 @@ package body rtps_test_package is -- OPCODE case (ref.match) is when MATCH => - output.data(output.length) := OPCODE_MATCH; + output.data(output.length) := OPCODE_ENDPOINT_MATCH; output.length := output.length + 1; when UNMATCH => - output.data(output.length) := OPCODE_UNMATCH; + output.data(output.length) := OPCODE_ENDPOINT_UNMATCH; output.length := output.length + 1; when others => null;