diff --git a/sim/L0_rtps_reader_test3_a.do b/sim/L0_rtps_reader_test3_a.do new file mode 100644 index 0000000..9585749 --- /dev/null +++ b/sim/L0_rtps_reader_test3_a.do @@ -0,0 +1,79 @@ +onerror {resume} +quietly WaveActivateNextPane {} 0 +add wave -noupdate -divider SYSTEM +add wave -noupdate /l0_rtps_reader_test3_a/uut/clk +add wave -noupdate /l0_rtps_reader_test3_a/uut/reset +add wave -noupdate -radix unsigned /l0_rtps_reader_test3_a/uut/time +add wave -noupdate -radix unsigned /l0_rtps_reader_test3_a/uut/check_time +add wave -noupdate -divider INPUT +add wave -noupdate -group META /l0_rtps_reader_test3_a/uut/empty_meta +add wave -noupdate -group META /l0_rtps_reader_test3_a/uut/rd_meta +add wave -noupdate -group META /l0_rtps_reader_test3_a/uut/last_word_in_meta +add wave -noupdate -group META -radix hexadecimal /l0_rtps_reader_test3_a/uut/data_in_meta +add wave -noupdate -expand -group USER /l0_rtps_reader_test3_a/uut/empty_user +add wave -noupdate -expand -group USER /l0_rtps_reader_test3_a/uut/rd_user +add wave -noupdate -expand -group USER -radix hexadecimal /l0_rtps_reader_test3_a/uut/data_in_user +add wave -noupdate -expand -group USER /l0_rtps_reader_test3_a/uut/last_word_in_user +add wave -noupdate -divider HC +add wave -noupdate /l0_rtps_reader_test3_a/uut/start_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/opcode_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/ack_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/valid_out_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/ready_out_hc +add wave -noupdate -radix hexadecimal /l0_rtps_reader_test3_a/uut/data_out_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/last_word_out_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/done_hc +add wave -noupdate /l0_rtps_reader_test3_a/uut/ret_hc +add wave -noupdate -divider {MAIN FSM} +add wave -noupdate /l0_rtps_reader_test3_a/uut/stage +add wave -noupdate /l0_rtps_reader_test3_a/uut/stage_next +add wave -noupdate /l0_rtps_reader_test3_a/uut/cnt +add wave -noupdate -divider {MEMORY FSM} +add wave -noupdate /l0_rtps_reader_test3_a/uut/idle_sig +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_op_done +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_op_start +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_opcode +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_stage +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_stage_next +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_cnt +add wave -noupdate /l0_rtps_reader_test3_a/uut/mem_pos +add wave -noupdate -radix unsigned /l0_rtps_reader_test3_a/uut/mem_addr_base +add wave -noupdate -childformat {{/l0_rtps_reader_test3_a/uut/mem_endpoint_data.guid -radix hexadecimal} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.addr -radix hexadecimal} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.portn -radix hexadecimal} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr -radix unsigned -childformat {{/l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(0) -radix unsigned} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(1) -radix unsigned}}} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.lease_deadline -radix hexadecimal} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.res_time -radix hexadecimal}} -subitemconfig {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.guid {-height 15 -radix hexadecimal} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.addr {-height 15 -radix hexadecimal} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.portn {-height 15 -radix hexadecimal} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr {-height 15 -radix unsigned -childformat {{/l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(0) -radix unsigned} {/l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(1) -radix unsigned}}} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(0) {-height 15 -radix unsigned} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.next_seq_nr(1) {-height 15 -radix unsigned} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.lease_deadline {-height 15 -radix hexadecimal} /l0_rtps_reader_test3_a/uut/mem_endpoint_data.res_time {-height 15 -radix hexadecimal}} /l0_rtps_reader_test3_a/uut/mem_endpoint_data +add wave -noupdate -group MEM_CTRL -radix unsigned /l0_rtps_reader_test3_a/uut/mem_addr +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/mem_valid_in +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/mem_ready_in +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/mem_read +add wave -noupdate -group MEM_CTRL -radix hexadecimal /l0_rtps_reader_test3_a/uut/mem_write_data +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/abort_read +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/mem_valid_out +add wave -noupdate -group MEM_CTRL /l0_rtps_reader_test3_a/uut/mem_ready_out +add wave -noupdate -group MEM_CTRL -radix hexadecimal /l0_rtps_reader_test3_a/uut/mem_read_data +add wave -noupdate -divider TESTBENCH +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/mem_check +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/start_meta +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/packet_sent_meta +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/start_user +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/packet_sent_user +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/check_stage +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/out_check_done +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/mem_check_done +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/stim_done +add wave -noupdate -group TESTBENCH /l0_rtps_reader_test3_a/test_done +TreeUpdate [SetDefaultTree] +WaveRestoreCursors {Begin {49575000 ps} 1} {Error {53225000 ps} 1} {Cursor {5324494 ps} 0} +quietly wave cursor active 3 +configure wave -namecolwidth 150 +configure wave -valuecolwidth 100 +configure wave -justifyvalue left +configure wave -signalnamewidth 1 +configure wave -snapdistance 10 +configure wave -datasetprefix 0 +configure wave -rowmargin 4 +configure wave -childrowmargin 2 +configure wave -gridoffset 0 +configure wave -gridperiod 1 +configure wave -griddelta 40 +configure wave -timeline 0 +configure wave -timelineunits ns +update +WaveRestoreZoom {4863 ns} {5887 ns} diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd index 1957fc9..9186017 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_tbk.vhd @@ -26,14 +26,13 @@ end entity; architecture testbench of L0_rtps_reader_test2_tbk is -- *CONSTANT DECLARATION* - constant MAX_REMOTE_ENDPOINTS : natural := 4; + constant MAX_REMOTE_ENDPOINTS : natural := 3; constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); -- *TYPE DECLARATION* type SEND_STAGE_TYPE is (IDLE, BUSY); type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); - type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta, wr_rtps : std_logic := '0'; @@ -208,23 +207,26 @@ begin RV.InitSeed(RV'instance_name); -- Endpoint 1 - e0 := DEFAULT_ENDPOINT_DATA; - e0.nr := 0; - e0.match := MATCH; - e0.entityid := RV.RandSlv(ENTITYID_WIDTH); - e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e0 := DEFAULT_ENDPOINT_DATA; + e0.nr := 0; + e0.match := MATCH; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant.guidPrefix := gen_rand_guid_prefix; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 2 - e1 := DEFAULT_ENDPOINT_DATA; - e1.nr := 1; - e1.match := MATCH; - e1.entityid := RV.RandSlv(ENTITYID_WIDTH); - e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e1 := DEFAULT_ENDPOINT_DATA; + e1.nr := 1; + e1.match := MATCH; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant.guidPrefix := gen_rand_guid_prefix; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 3 - e2 := DEFAULT_ENDPOINT_DATA; - e2.nr := 2; - e2.match := MATCH; - e2.entityid := RV.RandSlv(ENTITYID_WIDTH); - e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e2 := DEFAULT_ENDPOINT_DATA; + e2.nr := 2; + e2.match := MATCH; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant.guidPrefix := gen_rand_guid_prefix; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); Log("Initiating Test", INFO); stim_done <= '0'; @@ -986,10 +988,38 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; + Log("Accept Endpoint 1 sent DATA [SN 15, Inline-QoS (Lifespan, Status Info, Key Hash), Little Endian]", INFO); + src_ts := gen_duration(1,700); + life_ts := gen_duration(2,700); + endpoint := e1; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(15); + sub.flags(SUBMESSAGE_ENDIAN_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; + sub.data := gen_payload; + cc := gen_cache_change(sub); + cc.kind := ALIVE_FILTERED; + cc.src_timestamp := src_ts; + cc.instance := gen_key_hash; + gen_inline_qos(cc, life_ts, sub.inlineQos); + gen_sentinel(sub.inlineQos); + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, src_ts, endpoint.participant.guidPrefix, stimulus_user); + gen_add_cache_change_dds(cc, life_ts, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + -- *NON_PAYLOAD TRAFFIC HANDLING* Log("Test Non-Payload Traffic Handling", INFO); - Log("Accept Endpoint 1 sent DATA [SN 15, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 16, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); src_ts := gen_duration(2,0); life_ts := gen_duration(3,0); endpoint := e1; @@ -997,7 +1027,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(15); + sub.writerSN := gen_sn(16); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; @@ -1014,7 +1044,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 16, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 17, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,500); life_ts := gen_duration(3,500); endpoint := e1; @@ -1022,7 +1052,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(16); + sub.writerSN := gen_sn(17); sub.flags(SUBMESSAGE_KEY_FLAG_POS) := '1'; sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; sub.data := gen_payload; @@ -1040,7 +1070,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Ignore Endpoint 1 sent DATA [SN 17, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Ignore Endpoint 1 sent DATA [SN 18, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,600); life_ts := gen_duration(3,600); endpoint := e1; @@ -1048,7 +1078,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(17); + sub.writerSN := gen_sn(18); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd index 4fc5ec2..66eea01 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_trk.vhd @@ -26,14 +26,13 @@ end entity; architecture testbench of L0_rtps_reader_test2_trk is -- *CONSTANT DECLARATION* - constant MAX_REMOTE_ENDPOINTS : natural := 4; + constant MAX_REMOTE_ENDPOINTS : natural := 3; constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); -- *TYPE DECLARATION* type SEND_STAGE_TYPE is (IDLE, BUSY); type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); - type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta : std_logic := '0'; @@ -208,23 +207,26 @@ begin RV.InitSeed(RV'instance_name); -- Endpoint 1 - e0 := DEFAULT_ENDPOINT_DATA; - e0.nr := 0; - e0.match := MATCH; - e0.entityid := RV.RandSlv(ENTITYID_WIDTH); - e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e0 := DEFAULT_ENDPOINT_DATA; + e0.nr := 0; + e0.match := MATCH; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant.guidPrefix := gen_rand_guid_prefix; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 2 - e1 := DEFAULT_ENDPOINT_DATA; - e1.nr := 1; - e1.match := MATCH; - e1.entityid := RV.RandSlv(ENTITYID_WIDTH); - e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e1 := DEFAULT_ENDPOINT_DATA; + e1.nr := 1; + e1.match := MATCH; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant.guidPrefix := gen_rand_guid_prefix; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 3 - e2 := DEFAULT_ENDPOINT_DATA; - e2.nr := 2; - e2.match := MATCH; - e2.entityid := RV.RandSlv(ENTITYID_WIDTH); - e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e2 := DEFAULT_ENDPOINT_DATA; + e2.nr := 2; + e2.match := MATCH; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant.guidPrefix := gen_rand_guid_prefix; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); Log("Initiating Test", INFO); stim_done <= '0'; @@ -996,10 +998,38 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; + Log("Accept Endpoint 1 sent DATA [SN 15, Inline-QoS (Lifespan, Status Info, Key Hash), Little Endian]", INFO); + src_ts := gen_duration(1,700); + life_ts := gen_duration(2,700); + endpoint := e1; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(15); + sub.flags(SUBMESSAGE_ENDIAN_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; + sub.data := gen_payload; + cc := gen_cache_change(sub); + cc.kind := ALIVE_FILTERED; + cc.src_timestamp := src_ts; + cc.instance := gen_key_hash; + gen_inline_qos(cc, life_ts, sub.inlineQos); + gen_sentinel(sub.inlineQos); + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, src_ts, endpoint.participant.guidPrefix, stimulus_user); + gen_add_cache_change_dds(cc, life_ts, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + -- *NON_PAYLOAD TRAFFIC HANDLING* Log("Test Non-Payload Traffic Handling", INFO); - Log("Accept Endpoint 1 sent DATA [SN 15, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 16, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); src_ts := gen_duration(2,0); life_ts := gen_duration(3,0); endpoint := e1; @@ -1007,7 +1037,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(15); + sub.writerSN := gen_sn(16); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; @@ -1024,7 +1054,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 16, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 17, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,500); life_ts := gen_duration(3,500); endpoint := e1; @@ -1032,7 +1062,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(16); + sub.writerSN := gen_sn(17); sub.flags(SUBMESSAGE_KEY_FLAG_POS) := '1'; sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; sub.data := gen_payload; @@ -1050,7 +1080,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Ignore Endpoint 1 sent DATA [SN 17, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Ignore Endpoint 1 sent DATA [SN 18, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,600); life_ts := gen_duration(3,600); endpoint := e1; @@ -1058,7 +1088,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(17); + sub.writerSN := gen_sn(18); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd index 04be180..4dd9a52 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vbk.vhd @@ -26,14 +26,13 @@ end entity; architecture testbench of L0_rtps_reader_test2_vbk is -- *CONSTANT DECLARATION* - constant MAX_REMOTE_ENDPOINTS : natural := 4; + constant MAX_REMOTE_ENDPOINTS : natural := 3; constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); -- *TYPE DECLARATION* type SEND_STAGE_TYPE is (IDLE, BUSY); type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); - type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta, wr_rtps : std_logic := '0'; @@ -208,23 +207,26 @@ begin RV.InitSeed(RV'instance_name); -- Endpoint 1 - e0 := DEFAULT_ENDPOINT_DATA; - e0.nr := 0; - e0.match := MATCH; - e0.entityid := RV.RandSlv(ENTITYID_WIDTH); - e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e0 := DEFAULT_ENDPOINT_DATA; + e0.nr := 0; + e0.match := MATCH; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant.guidPrefix := gen_rand_guid_prefix; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 2 - e1 := DEFAULT_ENDPOINT_DATA; - e1.nr := 1; - e1.match := MATCH; - e1.entityid := RV.RandSlv(ENTITYID_WIDTH); - e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e1 := DEFAULT_ENDPOINT_DATA; + e1.nr := 1; + e1.match := MATCH; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant.guidPrefix := gen_rand_guid_prefix; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 3 - e2 := DEFAULT_ENDPOINT_DATA; - e2.nr := 2; - e2.match := MATCH; - e2.entityid := RV.RandSlv(ENTITYID_WIDTH); - e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e2 := DEFAULT_ENDPOINT_DATA; + e2.nr := 2; + e2.match := MATCH; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant.guidPrefix := gen_rand_guid_prefix; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); Log("Initiating Test", INFO); stim_done <= '0'; @@ -967,10 +969,38 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; + Log("Accept Endpoint 1 sent DATA [SN 15, Inline-QoS (Lifespan, Status Info, Key Hash), Little Endian]", INFO); + src_ts := gen_duration(1,700); + life_ts := gen_duration(2,700); + endpoint := e1; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(15); + sub.flags(SUBMESSAGE_ENDIAN_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; + sub.data := gen_payload; + cc := gen_cache_change(sub); + cc.kind := ALIVE_FILTERED; + cc.src_timestamp := src_ts; + cc.instance := gen_key_hash; + gen_inline_qos(cc, life_ts, sub.inlineQos); + gen_sentinel(sub.inlineQos); + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, src_ts, endpoint.participant.guidPrefix, stimulus_user); + gen_add_cache_change_dds(cc, life_ts, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + -- *NON_PAYLOAD TRAFFIC HANDLING* Log("Test Non-Payload Traffic Handling", INFO); - Log("Accept Endpoint 1 sent DATA [SN 15, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 16, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); src_ts := gen_duration(2,0); life_ts := gen_duration(3,0); endpoint := e1; @@ -978,7 +1008,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(15); + sub.writerSN := gen_sn(16); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; @@ -995,7 +1025,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 16, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 17, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,500); life_ts := gen_duration(3,500); endpoint := e1; @@ -1003,7 +1033,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(16); + sub.writerSN := gen_sn(17); sub.flags(SUBMESSAGE_KEY_FLAG_POS) := '1'; sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; sub.data := gen_payload; @@ -1021,7 +1051,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Ignore Endpoint 1 sent DATA [SN 17, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Ignore Endpoint 1 sent DATA [SN 18, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,600); life_ts := gen_duration(3,600); endpoint := e1; @@ -1029,7 +1059,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(17); + sub.writerSN := gen_sn(18); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd index a31a876..a965eb4 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vrk.vhd @@ -26,14 +26,13 @@ end entity; architecture testbench of L0_rtps_reader_test2_vrk is -- *CONSTANT DECLARATION* - constant MAX_REMOTE_ENDPOINTS : natural := 4; + constant MAX_REMOTE_ENDPOINTS : natural := 3; constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); -- *TYPE DECLARATION* type SEND_STAGE_TYPE is (IDLE, BUSY); type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); - type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta : std_logic := '0'; @@ -208,23 +207,26 @@ begin RV.InitSeed(RV'instance_name); -- Endpoint 1 - e0 := DEFAULT_ENDPOINT_DATA; - e0.nr := 0; - e0.match := MATCH; - e0.entityid := RV.RandSlv(ENTITYID_WIDTH); - e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e0 := DEFAULT_ENDPOINT_DATA; + e0.nr := 0; + e0.match := MATCH; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant.guidPrefix := gen_rand_guid_prefix; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 2 - e1 := DEFAULT_ENDPOINT_DATA; - e1.nr := 1; - e1.match := MATCH; - e1.entityid := RV.RandSlv(ENTITYID_WIDTH); - e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e1 := DEFAULT_ENDPOINT_DATA; + e1.nr := 1; + e1.match := MATCH; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant.guidPrefix := gen_rand_guid_prefix; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 3 - e2 := DEFAULT_ENDPOINT_DATA; - e2.nr := 2; - e2.match := MATCH; - e2.entityid := RV.RandSlv(ENTITYID_WIDTH); - e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e2 := DEFAULT_ENDPOINT_DATA; + e2.nr := 2; + e2.match := MATCH; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant.guidPrefix := gen_rand_guid_prefix; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); Log("Initiating Test", INFO); stim_done <= '0'; @@ -982,10 +984,38 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; + Log("Accept Endpoint 1 sent DATA [SN 15, Inline-QoS (Lifespan, Status Info, Key Hash), Little Endian]", INFO); + src_ts := gen_duration(1,700); + life_ts := gen_duration(2,700); + endpoint := e1; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(15); + sub.flags(SUBMESSAGE_ENDIAN_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; + sub.data := gen_payload; + cc := gen_cache_change(sub); + cc.kind := ALIVE_FILTERED; + cc.src_timestamp := src_ts; + cc.instance := gen_key_hash; + gen_inline_qos(cc, life_ts, sub.inlineQos); + gen_sentinel(sub.inlineQos); + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, src_ts, endpoint.participant.guidPrefix, stimulus_user); + gen_add_cache_change_dds(cc, life_ts, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + -- *NON_PAYLOAD TRAFFIC HANDLING* Log("Test Non-Payload Traffic Handling", INFO); - Log("Accept Endpoint 1 sent DATA [SN 15, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 16, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); src_ts := gen_duration(2,0); life_ts := gen_duration(3,0); endpoint := e1; @@ -993,7 +1023,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(15); + sub.writerSN := gen_sn(16); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; @@ -1010,7 +1040,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 16, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 17, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,500); life_ts := gen_duration(3,500); endpoint := e1; @@ -1018,7 +1048,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(16); + sub.writerSN := gen_sn(17); sub.flags(SUBMESSAGE_KEY_FLAG_POS) := '1'; sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; sub.data := gen_payload; @@ -1036,7 +1066,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Ignore Endpoint 1 sent DATA [SN 17, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Ignore Endpoint 1 sent DATA [SN 18, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,600); life_ts := gen_duration(3,600); endpoint := e1; @@ -1044,7 +1074,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(17); + sub.writerSN := gen_sn(18); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; diff --git a/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd b/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd index d227c62..932378b 100644 --- a/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd +++ b/src/Tests/Level_0/L0_rtps_reader_test2_vrn.vhd @@ -26,14 +26,13 @@ end entity; architecture testbench of L0_rtps_reader_test2_vrn is -- *CONSTANT DECLARATION* - constant MAX_REMOTE_ENDPOINTS : natural := 4; + constant MAX_REMOTE_ENDPOINTS : natural := 3; constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); -- *TYPE DECLARATION* type SEND_STAGE_TYPE is (IDLE, BUSY); type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); - type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); -- *SIGNAL DECLARATION* signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta : std_logic := '0'; @@ -208,23 +207,26 @@ begin RV.InitSeed(RV'instance_name); -- Endpoint 1 - e0 := DEFAULT_ENDPOINT_DATA; - e0.nr := 0; - e0.match := MATCH; - e0.entityid := RV.RandSlv(ENTITYID_WIDTH); - e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e0 := DEFAULT_ENDPOINT_DATA; + e0.nr := 0; + e0.match := MATCH; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant.guidPrefix := gen_rand_guid_prefix; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 2 - e1 := DEFAULT_ENDPOINT_DATA; - e1.nr := 1; - e1.match := MATCH; - e1.entityid := RV.RandSlv(ENTITYID_WIDTH); - e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e1 := DEFAULT_ENDPOINT_DATA; + e1.nr := 1; + e1.match := MATCH; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant.guidPrefix := gen_rand_guid_prefix; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); -- Endpoint 3 - e2 := DEFAULT_ENDPOINT_DATA; - e2.nr := 2; - e2.match := MATCH; - e2.entityid := RV.RandSlv(ENTITYID_WIDTH); - e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + e2 := DEFAULT_ENDPOINT_DATA; + e2.nr := 2; + e2.match := MATCH; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant.guidPrefix := gen_rand_guid_prefix; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); Log("Initiating Test", INFO); stim_done <= '0'; @@ -986,10 +988,39 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; + Log("Accept Endpoint 1 sent DATA [SN 15, Inline-QoS (Lifespan, Status Info, Key Hash), Little Endian]", INFO); + src_ts := gen_duration(1,700); + life_ts := gen_duration(2,700); + endpoint := e1; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(15); + sub.flags(SUBMESSAGE_ENDIAN_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; + sub.data := gen_payload; + cc := gen_cache_change(sub); + cc.kind := ALIVE_FILTERED; + cc.src_timestamp := src_ts; + cc.instance := gen_key_hash; + gen_inline_qos(cc, life_ts, sub.inlineQos); + gen_sentinel(sub.inlineQos); + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, src_ts, endpoint.participant.guidPrefix, stimulus_user); + cc.instance := HANDLE_NIL; -- No key Hash due to WITH_KEY=FALSE + gen_add_cache_change_dds(cc, life_ts, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + -- *NON_PAYLOAD TRAFFIC HANDLING* Log("Test Non-Payload Traffic Handling", INFO); - Log("Accept Endpoint 1 sent DATA [SN 15, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 16, No Payload, Inline-QoS (Lifespan, Status Info, Key Hash)]", INFO); src_ts := gen_duration(2,0); life_ts := gen_duration(3,0); endpoint := e1; @@ -997,7 +1028,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(15); + sub.writerSN := gen_sn(16); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; @@ -1015,7 +1046,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 16, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 17, Serialized Key, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,500); life_ts := gen_duration(3,500); endpoint := e1; @@ -1023,7 +1054,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(16); + sub.writerSN := gen_sn(17); sub.flags(SUBMESSAGE_KEY_FLAG_POS) := '1'; sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; sub.data := gen_payload; @@ -1042,7 +1073,7 @@ begin stimulus_user := EMPTY_TEST_PACKET; reference := EMPTY_TEST_PACKET; - Log("Accept Endpoint 1 sent DATA [SN 17, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); + Log("Accept Endpoint 1 sent DATA [SN 18, No Payload, Inline-QoS (Lifespan, Status Info)]", INFO); src_ts := gen_duration(2,600); life_ts := gen_duration(3,600); endpoint := e1; @@ -1050,7 +1081,7 @@ begin sub.submessageID := SID_DATA; sub.writerId := endpoint.entityid; sub.readerId := DEFAULT_READER_ENTITYID; - sub.writerSN := gen_sn(17); + sub.writerSN := gen_sn(18); sub.flags(SUBMESSAGE_INLINE_QOS_FLAG_POS) := '1'; cc := gen_cache_change(sub); cc.kind := NOT_ALIVE_DISPOSED; diff --git a/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd b/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd new file mode 100644 index 0000000..f16b090 --- /dev/null +++ b/src/Tests/Level_0/L0_rtps_reader_test3_a.vhd @@ -0,0 +1,639 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library osvvm; -- Utility Library +context osvvm.OsvvmContext; + +use work.rtps_package.all; +use work.user_config.all; +use work.rtps_config_package.all; +use work.rtps_test_package.all; + +-- This testbench tests the Liveliness handling of the RTPS Reader. +-- The testbench checks the memory contents at specific times, and also checks if the removal is propagated to the History Cache. + +entity L0_rtps_reader_test3_a is +end entity; + +architecture testbench of L0_rtps_reader_test3_a is + + -- *CONSTANT DECLARATION* + constant MAX_REMOTE_ENDPOINTS : natural := 3; + constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); + constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); + + -- *TYPE DECLARATION* + type SEND_STAGE_TYPE is (IDLE, BUSY); + type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); + type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); + + -- *SIGNAL DECLARATION* + signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta : std_logic := '0'; + signal reset : std_logic := '1'; + signal data_in_user, data_in_meta, data_out_hc : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal start_hc, ack_hc, done_hc, done_hc_delay, ready_out_hc, valid_out_hc, last_word_out_hc : std_logic := '0'; + signal opcode_hc : HISTORY_CACHE_OPCODE_TYPE := NOP; + signal ret_hc : HISTORY_CACHE_RESPONSE_TYPE := OK; + signal test_time : TIME_TYPE := TIME_INVALID; + signal stim_stage_user, stim_stage_meta : SEND_STAGE_TYPE := IDLE; + signal check_stage : CHECK_STAGE_TYPE := IDLE; + shared variable stimulus_user, stimulus_meta, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + signal packet_sent_user, packet_sent_meta : std_logic := '0'; + signal cnt_stim_meta, cnt_stim_user : natural := 0; + signal start_meta, start_user : std_logic := '0'; + shared variable SB_out : osvvm.ScoreBoardPkg_slv.ScoreBoardPType; + shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + signal stim_done, mem_check_done, out_check_done, test_done, mem_check : std_logic := '0'; + + -- *FUNCTION DECLARATION* + function gen_sn(input : natural) return SEQUENCENUMBER_TYPE is + variable ret : SEQUENCENUMBER_TYPE; + begin + ret(0) := (others => '0'); + ret(1) := unsigned(int(input, WORD_WIDTH)); + return ret; + end function; +begin + + -- Unit Under Test + uut : entity work.rtps_reader(arch) + generic map ( + ENTITYID => DEFAULT_READER_ENTITYID, + RELIABILTY_QOS => RELIABLE_RELIABILITY_QOS, + LIVELINESS_QOS => AUTOMATIC_LIVELINESS_QOS, + DURABILITY_QOS => VOLATILE_DURABILITY_QOS, + HEARTBEAT_RESPONSE_DELAY => DURATION_ZERO, + HEARTBEAT_SUPPRESSION_DELAY => DURATION_ZERO, + LEASE_DURATION => gen_duration(5,0), + WITH_KEY => TRUE, + MAX_REMOTE_ENDPOINTS => MAX_REMOTE_ENDPOINTS + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => test_time, + empty_user => empty_user or packet_sent_user, + rd_user => rd_user, + data_in_user => data_in_user, + last_word_in_user => last_word_in_user, + empty_meta => empty_meta or packet_sent_meta, + rd_meta => rd_meta, + data_in_meta => data_in_meta, + last_word_in_meta => last_word_in_meta, + wr_rtps => open, + full_rtps => '0', + last_word_out_rtps => open, + data_out_rtps => open, + start_hc => start_hc, + opcode_hc => opcode_hc, + ack_hc => ack_hc, + done_hc => done_hc, + ret_hc => ret_hc, + data_out_hc => data_out_hc, + valid_out_hc => valid_out_hc, + ready_out_hc => ready_out_hc, + last_word_out_hc => last_word_out_hc + ); + + stimulus_prc : process + variable RV : RandomPType; + variable p0, p1, p2 : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; + variable e0, e1, e2, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; + variable payload : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + variable sub : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; + variable cc : CACHE_CHANGE_TYPE := DEFAULT_CACHE_CHANGE; + + alias mem_op_done is <>; + alias idle_sig is <>; + + -- Wrapper to use procedure as function + impure function gen_rand_loc_2 return LOCATOR_TYPE is + variable ret : LOCATOR_TYPE := EMPTY_LOCATOR; + begin + gen_rand_loc(RV, ret); + return ret; + end function; + + impure function gen_rand_guid_prefix return GUIDPREFIX_TYPE is + variable ret : GUIDPREFIX_TYPE; + begin + ret := (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), 2 => RV.RandSlv(WORD_WIDTH)); + return ret; + end function; + + procedure start_meta_test is + begin + start_meta <= '1'; + wait until rising_edge(clk); + start_meta <= '0'; + wait until rising_edge(clk); + end procedure; + + procedure start_user_test is + begin + start_user <= '1'; + wait until rising_edge(clk); + start_user <= '0'; + wait until rising_edge(clk); + end procedure; + + procedure push_reference(accept : in BOOLEAN) is + begin + -- NOTE: First Word represents the Response that we will return. + if (accept) then + SB_out.Push(ACCEPT_RES); + else + SB_out.Push(REJECT_RES); + end if; + for i in 0 to reference.length-1 loop + SB_out.Push(reference.last(i) & reference.data(i)); + end loop; + end procedure; + + impure function gen_payload return TEST_PACKET_TYPE is + variable ret : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + begin + for i in 0 to RV.RandInt(1,10) loop + ret.data(ret.length) := RV.RandSlv(WORD_WIDTH); + ret.length := ret.length + 1; + end loop; + return ret; + end function; + + impure function gen_key_hash return KEY_HASH_TYPE is + variable ret : KEY_HASH_TYPE := (others => (others => '0')); + begin + for i in 0 to KEY_HASH_TYPE'length-1 loop + ret(i) := RV.RandSlv(WORD_WIDTH); + end loop; + return ret; + end function; + + procedure wait_on_meta_sent is + begin + wait until rising_edge(packet_sent_meta); + end procedure; + + procedure wait_on_user_sent is + begin + wait until rising_edge(packet_sent_user); + end procedure; + + procedure wait_on_out_check is + begin + if (out_check_done /= '1') then + wait until out_check_done = '1'; + end if; + end procedure; + + procedure wait_on_mem_check is + begin + if (mem_check_done /= '1') then + wait until mem_check_done = '1'; + end if; + end procedure; + + procedure wait_on_completion is + begin + if (test_done /= '1') then + wait until test_done = '1'; + end if; + end procedure; + + procedure wait_on_idle is + begin + if (idle_sig /= '1' or mem_op_done /= '1') then + wait until idle_sig = '1' and mem_op_done = '1'; + end if; + end procedure; + + + begin + + SetAlertLogName("rtps_reader - (Automatic Liveliness) - Level 0 - Liveliness Handling"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + -- Participant 0 + p0 := DEFAULT_PARTICIPANT_DATA; + p0.guidPrefix := gen_rand_guid_prefix; + -- Participant 1 + p1 := DEFAULT_PARTICIPANT_DATA; + p1.guidPrefix := gen_rand_guid_prefix; + -- Participant 2 + p2 := DEFAULT_PARTICIPANT_DATA; + p2.guidPrefix := gen_rand_guid_prefix; + + -- Endpoint 1 + e0 := DEFAULT_ENDPOINT_DATA; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant := p0; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + -- Endpoint 2 + e1 := DEFAULT_ENDPOINT_DATA; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant := p1; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + -- Endpoint 3 + e2 := DEFAULT_ENDPOINT_DATA; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant := p2; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + + Log("Initiating Test", INFO); + test_time <= TIME_ZERO; + stim_done <= '0'; + start_meta <= '0'; + start_user <= '0'; + mem_check <= '0'; + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + Log("Current Time: 0 s", INFO); + wait until rising_edge(clk); + + Log("Insert Endpoint 0 Participant 0", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + Log("Insert Endpoint 1 Participant 1", INFO); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + Log("Insert Endpoint 2 Participant 2", INFO); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 1 s", INFO); + test_time <= gen_duration(1,0); + wait until rising_edge(clk); + + Log("Accept Endpoint 0 sent DATA [SN 1]", INFO); + endpoint := e0; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(1); + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.data := gen_payload; + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, TIME_INVALID, endpoint.participant.guidPrefix, stimulus_user); + cc := gen_cache_change(sub); + gen_add_cache_change_dds(cc, TIME_INVALID, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 2 s", INFO); + test_time <= gen_duration(2,0); + wait until rising_edge(clk); + + Log("Participant 1 Liveliness Update", INFO); + gen_liveliness_update_frame(p1, stimulus_meta); + start_meta_test; + wait_on_meta_sent; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 5 s", INFO); + test_time <= gen_duration(5,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 2", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(2, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 6 s", INFO); + test_time <= gen_duration(6,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 0", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(0, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 7 s", INFO); + test_time <= gen_duration(7,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 1", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(1, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + stim_done <= '1'; + wait_on_completion; + TranscriptOpen(RESULTS_FILE, APPEND_MODE); + SetTranscriptMirror; + ReportAlerts; + TranscriptClose; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for 25 ns; + clk <= '1'; + wait for 25 ns; + end process; + + empty_meta_prc : process + begin + empty_meta <= '0'; + wait until rd_meta = '1'; + wait until rising_edge(clk); + empty_meta <= '1'; + wait until rising_edge(clk); + end process; + + empty_user_prc : process + begin + empty_user <= '0'; + wait until rd_user = '1'; + wait until rising_edge(clk); + empty_user <= '1'; + wait until rising_edge(clk); + end process; + + alert_prc : process(all) + begin + if rising_edge(clk) then + alertif(empty_meta = '1' and rd_meta = '1', "Input FIFO read signal high while empty signal high (meta)", ERROR); + alertif(empty_user = '1' and rd_user = '1', "Input FIFO read signal high while empty signal high (user)", ERROR); + end if; + end process; + + input_meta_prc : process(all) + begin + data_in_meta <= stimulus_meta.data(cnt_stim_meta); + last_word_in_meta <= stimulus_meta.last(cnt_stim_meta); + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim_meta <= 0; + stim_stage_meta <= IDLE; + packet_sent_meta <= '1'; + else + case (stim_stage_meta) is + when IDLE => + if (start_meta = '1' and stimulus_meta.length /= 0) then + stim_stage_meta <= BUSY; + packet_sent_meta <= '0'; + end if; + when BUSY => + if (rd_meta = '1') then + if (cnt_stim_meta = stimulus_meta.length-1) then + stim_stage_meta <= IDLE; + packet_sent_meta <= '1'; + cnt_stim_meta <= 0; + else + cnt_stim_meta <= cnt_stim_meta + 1; + end if; + end if; + end case; + end if; + end if; + end process; + + input_user_prc : process(all) + begin + data_in_user <= stimulus_user.data(cnt_stim_user); + last_word_in_user <= stimulus_user.last(cnt_stim_user); + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim_user <= 0; + stim_stage_user <= IDLE; + packet_sent_user <= '1'; + else + case (stim_stage_user) is + when IDLE => + if (start_user = '1' and stimulus_user.length /= 0) then + stim_stage_user <= BUSY; + packet_sent_user <= '0'; + end if; + when BUSY => + if (rd_user = '1') then + if (cnt_stim_user = stimulus_user.length-1) then + stim_stage_user <= IDLE; + packet_sent_user <= '1'; + cnt_stim_user <= 0; + else + cnt_stim_user <= cnt_stim_user + 1; + end if; + end if; + end case; + end if; + end if; + end process; + + done_proc : process(clk) + begin + if rising_edge(clk) then + if (stim_done = '1' and SB_out.empty) then + test_done <= '1'; + else + test_done <= '0'; + end if; + end if; + end process; + + out_check_prc : process(all) + variable accept : std_logic_vector(WORD_WIDTH downto 0); + begin + if rising_edge(clk) then + case (check_stage) is + when IDLE => + ack_hc <= '0'; + done_hc <= '0'; + ready_out_hc <= '0'; + ret_hc <= ERROR; + out_check_done <= '0'; + if (start_hc = '1') then + ack_hc <= '1'; + check_stage <= CHECK; + case (opcode_hc) is + when REMOVE_WRITER => + SB_out.Check(last_word_out_hc & data_out_hc); + accept := ACCEPT_RES; + check_stage <= RESPONSE; + when ADD_CACHE_CHANGE => + -- Pop Response Value + SB_out.pop(accept); + when others => + Alert("Unexpected HC Opcode", ERROR); + end case; + end if; + when CHECK => + ack_hc <= '0'; + ready_out_hc <= '1'; + out_check_done <= '0'; + if (valid_out_hc = '1') then + SB_out.Check(last_word_out_hc & data_out_hc); + + if (last_word_out_hc = '1') then + ready_out_hc <= '0'; + check_stage <= RESPONSE; + end if; + end if; + when RESPONSE => + ack_hc <= '0'; + ready_out_hc <= '0'; + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + check_stage <= IDLE; + out_check_done <= '1'; + end case; + end if; + end process; + + mem_check_prc : process + alias mem is <>; + alias mem_op_done is <>; + alias idle_sig is <>; + variable reference : TEST_WRITER_ENDPOINT_MEMORY_FRAME_TYPE_A; + begin + mem_check_done <= '0'; + -- SAFEGUARD: (Prevent Fall-through Behavior) + if (reset /= '0') then + wait until reset = '0'; + end if; + -- Wait for Stimulus Process to give the go + wait until rising_edge(mem_check); + -- Wait for UUT IDLE state + if (idle_sig /= '1') then + wait until idle_sig = '1'; + end if; + -- Wait for ongoing memory operation + if (mem_op_done /= '1') then + wait until mem_op_done = '1'; + end if; + while (not SB_mem.empty) loop + SB_mem.Pop(reference); + for i in 0 to reference'length-1 loop + AffirmIf(?? (mem(reference(i).addr) ?= reference(i).data), "Address: " & integer'image(reference(i).addr) & " Received: " & to_hstring(mem(reference(i).addr)) & " Expected: " & to_hstring(reference(i).data)); + end loop; + end loop; + -- Toggle High for one clock cycle + mem_check_done <= '1'; + wait until rising_edge(clk); + end process; + + watchdog : process + begin + wait for 1 ms; + Alert("Test timeout", FAILURE); + std.env.stop; + end process; + +end architecture; \ No newline at end of file diff --git a/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd b/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd new file mode 100644 index 0000000..8b4b05e --- /dev/null +++ b/src/Tests/Level_0/L0_rtps_reader_test3_m.vhd @@ -0,0 +1,660 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library osvvm; -- Utility Library +context osvvm.OsvvmContext; + +use work.rtps_package.all; +use work.user_config.all; +use work.rtps_config_package.all; +use work.rtps_test_package.all; + +-- This testbench tests the Liveliness handling of the RTPS Reader. +-- The testbench checks the memory contents at specific times, and also checks if the removal is propagated to the History Cache. + +entity L0_rtps_reader_test3_m is +end entity; + +architecture testbench of L0_rtps_reader_test3_m is + + -- *CONSTANT DECLARATION* + constant MAX_REMOTE_ENDPOINTS : natural := 3; + constant ACCEPT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '0'); + constant REJECT_RES : std_logic_vector(WORD_WIDTH downto 0) := (others => '1'); + + -- *TYPE DECLARATION* + type SEND_STAGE_TYPE is (IDLE, BUSY); + type CHECK_STAGE_TYPE is (IDLE, CHECK, RESPONSE); + type TEST_RAM_TYPE is array (0 to (MAX_REMOTE_ENDPOINTS*WRITER_ENDPOINT_FRAME_SIZE_A)-1) of std_logic_vector(WORD_WIDTH-1 downto 0); + + -- *SIGNAL DECLARATION* + signal clk, empty_user, empty_meta, rd_user, rd_meta, last_word_in_user, last_word_in_meta : std_logic := '0'; + signal reset : std_logic := '1'; + signal data_in_user, data_in_meta, data_out_hc : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal start_hc, ack_hc, done_hc, done_hc_delay, ready_out_hc, valid_out_hc, last_word_out_hc : std_logic := '0'; + signal opcode_hc : HISTORY_CACHE_OPCODE_TYPE := NOP; + signal ret_hc : HISTORY_CACHE_RESPONSE_TYPE := OK; + signal test_time : TIME_TYPE := TIME_INVALID; + signal stim_stage_user, stim_stage_meta : SEND_STAGE_TYPE := IDLE; + signal check_stage : CHECK_STAGE_TYPE := IDLE; + shared variable stimulus_user, stimulus_meta, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + signal packet_sent_user, packet_sent_meta : std_logic := '0'; + signal cnt_stim_meta, cnt_stim_user : natural := 0; + signal start_meta, start_user : std_logic := '0'; + shared variable SB_out : osvvm.ScoreBoardPkg_slv.ScoreBoardPType; + shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + signal stim_done, mem_check_done, out_check_done, test_done, mem_check : std_logic := '0'; + + -- *FUNCTION DECLARATION* + function gen_sn(input : natural) return SEQUENCENUMBER_TYPE is + variable ret : SEQUENCENUMBER_TYPE; + begin + ret(0) := (others => '0'); + ret(1) := unsigned(int(input, WORD_WIDTH)); + return ret; + end function; +begin + + -- Unit Under Test + uut : entity work.rtps_reader(arch) + generic map ( + ENTITYID => DEFAULT_READER_ENTITYID, + RELIABILTY_QOS => RELIABLE_RELIABILITY_QOS, + LIVELINESS_QOS => MANUAL_BY_TOPIC_LIVELINESS_QOS, + DURABILITY_QOS => VOLATILE_DURABILITY_QOS, + HEARTBEAT_RESPONSE_DELAY => DURATION_ZERO, + HEARTBEAT_SUPPRESSION_DELAY => DURATION_ZERO, + LEASE_DURATION => gen_duration(5,0), + WITH_KEY => TRUE, + MAX_REMOTE_ENDPOINTS => MAX_REMOTE_ENDPOINTS + ) + port map ( + -- SYSTEM + clk => clk, + reset => reset, + time => test_time, + empty_user => empty_user or packet_sent_user, + rd_user => rd_user, + data_in_user => data_in_user, + last_word_in_user => last_word_in_user, + empty_meta => empty_meta or packet_sent_meta, + rd_meta => rd_meta, + data_in_meta => data_in_meta, + last_word_in_meta => last_word_in_meta, + wr_rtps => open, + full_rtps => '0', + last_word_out_rtps => open, + data_out_rtps => open, + start_hc => start_hc, + opcode_hc => opcode_hc, + ack_hc => ack_hc, + done_hc => done_hc, + ret_hc => ret_hc, + data_out_hc => data_out_hc, + valid_out_hc => valid_out_hc, + ready_out_hc => ready_out_hc, + last_word_out_hc => last_word_out_hc + ); + + stimulus_prc : process + variable RV : RandomPType; + variable p0, p1, p2 : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; + variable e0, e1, e2, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; + variable payload : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + variable sub : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; + variable cc : CACHE_CHANGE_TYPE := DEFAULT_CACHE_CHANGE; + + alias mem_op_done is <>; + alias idle_sig is <>; + + -- Wrapper to use procedure as function + impure function gen_rand_loc_2 return LOCATOR_TYPE is + variable ret : LOCATOR_TYPE := EMPTY_LOCATOR; + begin + gen_rand_loc(RV, ret); + return ret; + end function; + + impure function gen_rand_guid_prefix return GUIDPREFIX_TYPE is + variable ret : GUIDPREFIX_TYPE; + begin + ret := (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), 2 => RV.RandSlv(WORD_WIDTH)); + return ret; + end function; + + procedure start_meta_test is + begin + start_meta <= '1'; + wait until rising_edge(clk); + start_meta <= '0'; + wait until rising_edge(clk); + end procedure; + + procedure start_user_test is + begin + start_user <= '1'; + wait until rising_edge(clk); + start_user <= '0'; + wait until rising_edge(clk); + end procedure; + + procedure push_reference(accept : in BOOLEAN) is + begin + -- NOTE: First Word represents the Response that we will return. + if (accept) then + SB_out.Push(ACCEPT_RES); + else + SB_out.Push(REJECT_RES); + end if; + for i in 0 to reference.length-1 loop + SB_out.Push(reference.last(i) & reference.data(i)); + end loop; + end procedure; + + impure function gen_payload return TEST_PACKET_TYPE is + variable ret : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + begin + for i in 0 to RV.RandInt(1,10) loop + ret.data(ret.length) := RV.RandSlv(WORD_WIDTH); + ret.length := ret.length + 1; + end loop; + return ret; + end function; + + impure function gen_key_hash return KEY_HASH_TYPE is + variable ret : KEY_HASH_TYPE := (others => (others => '0')); + begin + for i in 0 to KEY_HASH_TYPE'length-1 loop + ret(i) := RV.RandSlv(WORD_WIDTH); + end loop; + return ret; + end function; + + procedure wait_on_meta_sent is + begin + wait until rising_edge(packet_sent_meta); + end procedure; + + procedure wait_on_user_sent is + begin + wait until rising_edge(packet_sent_user); + end procedure; + + procedure wait_on_out_check is + begin + if (out_check_done /= '1') then + wait until out_check_done = '1'; + end if; + end procedure; + + procedure wait_on_mem_check is + begin + if (mem_check_done /= '1') then + wait until mem_check_done = '1'; + end if; + end procedure; + + procedure wait_on_completion is + begin + if (test_done /= '1') then + wait until test_done = '1'; + end if; + end procedure; + + procedure wait_on_idle is + begin + if (idle_sig /= '1' or mem_op_done /= '1') then + wait until idle_sig = '1' and mem_op_done = '1'; + end if; + end procedure; + + + begin + + SetAlertLogName("rtps_reader - (Manual by Topic Liveliness) - Level 0 - Liveliness Handling"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + -- Participant 0 + p0 := DEFAULT_PARTICIPANT_DATA; + p0.guidPrefix := gen_rand_guid_prefix; + -- Participant 1 + p1 := DEFAULT_PARTICIPANT_DATA; + p1.guidPrefix := gen_rand_guid_prefix; + -- Participant 2 + p2 := DEFAULT_PARTICIPANT_DATA; + p2.guidPrefix := gen_rand_guid_prefix; + + -- Endpoint 1 + e0 := DEFAULT_ENDPOINT_DATA; + e0.entityid := RV.RandSlv(ENTITYID_WIDTH); + e0.participant := p0; + e0.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + -- Endpoint 2 + e1 := DEFAULT_ENDPOINT_DATA; + e1.entityid := RV.RandSlv(ENTITYID_WIDTH); + e1.participant := p1; + e1.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + -- Endpoint 3 + e2 := DEFAULT_ENDPOINT_DATA; + e2.entityid := RV.RandSlv(ENTITYID_WIDTH); + e2.participant := p2; + e2.unicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + + Log("Initiating Test", INFO); + test_time <= TIME_ZERO; + stim_done <= '0'; + start_meta <= '0'; + start_user <= '0'; + mem_check <= '0'; + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + Log("Current Time: 0 s", INFO); + wait until rising_edge(clk); + + Log("Insert Endpoint 0 Participant 0", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + Log("Insert Endpoint 1 Participant 1", INFO); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + Log("Insert Endpoint 2 Participant 2", INFO); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := MATCH; + gen_endpoint_match_frame(endpoint, stimulus_meta); + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + start_meta_test; + wait_on_meta_sent; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 1 s", INFO); + test_time <= gen_duration(1,0); + wait until rising_edge(clk); + + Log("Accept Endpoint 0 sent DATA [SN 1]", INFO); + endpoint := e0; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.writerSN := gen_sn(1); + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + sub.data := gen_payload; + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, TIME_INVALID, endpoint.participant.guidPrefix, stimulus_user); + cc := gen_cache_change(sub); + gen_add_cache_change_dds(cc, TIME_INVALID, endpoint.nr, reference); + push_reference(TRUE); + start_user_test; + wait_on_user_sent; + wait_on_out_check; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 2 s", INFO); + test_time <= gen_duration(2,0); + wait until rising_edge(clk); + + Log("Participant 1 Liveliness Update [Ignored]", INFO); + gen_liveliness_update_frame(p1, stimulus_meta); + start_meta_test; + wait_on_meta_sent; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 3 s", INFO); + test_time <= gen_duration(3,0); + wait until rising_edge(clk); + + Log("Endpoint 2 HEARTBEAT Liveliness Update", INFO); + endpoint := e2; + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_HEARTBEAT; + sub.writerId := endpoint.entityid; + sub.readerId := DEFAULT_READER_ENTITYID; + sub.firstSN := gen_sn(0); + sub.lastSN := gen_sn(1); + sub.flags(SUBMESSAGE_LIVELINESS_FLAG_POS) := '1'; + gen_rtps_handler_out(sub, get_loc(endpoint), FALSE, TIME_INVALID, endpoint.participant.guidPrefix, stimulus_user); + start_user_test; + wait_on_user_sent; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 5 s", INFO); + test_time <= gen_duration(5,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 1", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(1, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 6 s", INFO); + test_time <= gen_duration(6,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 0", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := MATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(0, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + wait_on_idle; + Log("Current Time: 8 s", INFO); + test_time <= gen_duration(8,0); + wait until rising_edge(clk); + + Log("Check removal of Endpoint 1", INFO); + endpoint := e0; + endpoint.nr := 0; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e1; + endpoint.nr := 1; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + endpoint := e2; + endpoint.nr := 2; + endpoint.match := UNMATCH; + SB_mem.Push(gen_writer_endpoint_mem_frame_a(endpoint)); + SB_out.Push("0" & std_logic_vector(to_unsigned(2, WORD_WIDTH))); + wait_on_out_check; + mem_check <= '1'; + wait_on_mem_check; + mem_check <= '0'; + stimulus_meta := EMPTY_TEST_PACKET; + stimulus_user := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + + stim_done <= '1'; + wait_on_completion; + TranscriptOpen(RESULTS_FILE, APPEND_MODE); + SetTranscriptMirror; + ReportAlerts; + TranscriptClose; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for 25 ns; + clk <= '1'; + wait for 25 ns; + end process; + + empty_meta_prc : process + begin + empty_meta <= '0'; + wait until rd_meta = '1'; + wait until rising_edge(clk); + empty_meta <= '1'; + wait until rising_edge(clk); + end process; + + empty_user_prc : process + begin + empty_user <= '0'; + wait until rd_user = '1'; + wait until rising_edge(clk); + empty_user <= '1'; + wait until rising_edge(clk); + end process; + + alert_prc : process(all) + begin + if rising_edge(clk) then + alertif(empty_meta = '1' and rd_meta = '1', "Input FIFO read signal high while empty signal high (meta)", ERROR); + alertif(empty_user = '1' and rd_user = '1', "Input FIFO read signal high while empty signal high (user)", ERROR); + end if; + end process; + + input_meta_prc : process(all) + begin + data_in_meta <= stimulus_meta.data(cnt_stim_meta); + last_word_in_meta <= stimulus_meta.last(cnt_stim_meta); + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim_meta <= 0; + stim_stage_meta <= IDLE; + packet_sent_meta <= '1'; + else + case (stim_stage_meta) is + when IDLE => + if (start_meta = '1' and stimulus_meta.length /= 0) then + stim_stage_meta <= BUSY; + packet_sent_meta <= '0'; + end if; + when BUSY => + if (rd_meta = '1') then + if (cnt_stim_meta = stimulus_meta.length-1) then + stim_stage_meta <= IDLE; + packet_sent_meta <= '1'; + cnt_stim_meta <= 0; + else + cnt_stim_meta <= cnt_stim_meta + 1; + end if; + end if; + end case; + end if; + end if; + end process; + + input_user_prc : process(all) + begin + data_in_user <= stimulus_user.data(cnt_stim_user); + last_word_in_user <= stimulus_user.last(cnt_stim_user); + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim_user <= 0; + stim_stage_user <= IDLE; + packet_sent_user <= '1'; + else + case (stim_stage_user) is + when IDLE => + if (start_user = '1' and stimulus_user.length /= 0) then + stim_stage_user <= BUSY; + packet_sent_user <= '0'; + end if; + when BUSY => + if (rd_user = '1') then + if (cnt_stim_user = stimulus_user.length-1) then + stim_stage_user <= IDLE; + packet_sent_user <= '1'; + cnt_stim_user <= 0; + else + cnt_stim_user <= cnt_stim_user + 1; + end if; + end if; + end case; + end if; + end if; + end process; + + done_proc : process(clk) + begin + if rising_edge(clk) then + if (stim_done = '1' and SB_out.empty) then + test_done <= '1'; + else + test_done <= '0'; + end if; + end if; + end process; + + out_check_prc : process(all) + variable accept : std_logic_vector(WORD_WIDTH downto 0); + begin + if rising_edge(clk) then + case (check_stage) is + when IDLE => + ack_hc <= '0'; + done_hc <= '0'; + ready_out_hc <= '0'; + ret_hc <= ERROR; + out_check_done <= '0'; + if (start_hc = '1') then + ack_hc <= '1'; + check_stage <= CHECK; + case (opcode_hc) is + when REMOVE_WRITER => + SB_out.Check(last_word_out_hc & data_out_hc); + accept := ACCEPT_RES; + check_stage <= RESPONSE; + when ADD_CACHE_CHANGE => + -- Pop Response Value + SB_out.pop(accept); + when others => + Alert("Unexpected HC Opcode", ERROR); + end case; + end if; + when CHECK => + ack_hc <= '0'; + ready_out_hc <= '1'; + out_check_done <= '0'; + if (valid_out_hc = '1') then + SB_out.Check(last_word_out_hc & data_out_hc); + + if (last_word_out_hc = '1') then + ready_out_hc <= '0'; + check_stage <= RESPONSE; + end if; + end if; + when RESPONSE => + ack_hc <= '0'; + ready_out_hc <= '0'; + done_hc <= '1'; + if (accept = ACCEPT_RES) then + ret_hc <= OK; + else + ret_hc <= REJECTED; + end if; + check_stage <= IDLE; + out_check_done <= '1'; + end case; + end if; + end process; + + mem_check_prc : process + alias mem is <>; + alias mem_op_done is <>; + alias idle_sig is <>; + variable reference : TEST_WRITER_ENDPOINT_MEMORY_FRAME_TYPE_A; + begin + mem_check_done <= '0'; + -- SAFEGUARD: (Prevent Fall-through Behavior) + if (reset /= '0') then + wait until reset = '0'; + end if; + -- Wait for Stimulus Process to give the go + wait until rising_edge(mem_check); + -- Wait for UUT IDLE state + if (idle_sig /= '1') then + wait until idle_sig = '1'; + end if; + -- Wait for ongoing memory operation + if (mem_op_done /= '1') then + wait until mem_op_done = '1'; + end if; + while (not SB_mem.empty) loop + SB_mem.Pop(reference); + for i in 0 to reference'length-1 loop + AffirmIf(?? (mem(reference(i).addr) ?= reference(i).data), "Address: " & integer'image(reference(i).addr) & " Received: " & to_hstring(mem(reference(i).addr)) & " Expected: " & to_hstring(reference(i).data)); + end loop; + end loop; + -- Toggle High for one clock cycle + mem_check_done <= '1'; + wait until rising_edge(clk); + end process; + + watchdog : process + begin + wait for 1 ms; + Alert("Test timeout", FAILURE); + std.env.stop; + end process; + +end architecture; \ No newline at end of file diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index e24f15b..aee981f 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -29,8 +29,15 @@ analyze Level_0/L0_rtps_builtin_endpoint_test7.vhd analyze Level_0/L0_rtps_out_test1.vhd analyze Level_1/L1_rtps_builtin_endpoint_test1.vhd analyze Level_0/L0_mem_ctrl_test1.vhd -analyze Level_0/L0_rtps_reader_test1.vhd -analyze Level_0/L0_rtps_reader_test2.vhd +analyze Level_0/L0_rtps_reader_test1_vrk.vhd +analyze Level_0/L0_rtps_reader_test1_vbk.vhd +analyze Level_0/L0_rtps_reader_test2_vrk.vhd +analyze Level_0/L0_rtps_reader_test2_trk.vhd +analyze Level_0/L0_rtps_reader_test2_vbk.vhd +analyze Level_0/L0_rtps_reader_test2_tbk.vhd +analyze Level_0/L0_rtps_reader_test2_vrn.vhd +analyze Level_0/L0_rtps_reader_test3_a.vhd +analyze Level_0/L0_rtps_reader_test3_m.vhd #simulate L0_rtps_handler_test1 #simulate L0_rtps_handler_test2 @@ -44,5 +51,12 @@ analyze Level_0/L0_rtps_reader_test2.vhd #simulate L0_rtps_out_test1 #simulate L1_rtps_builtin_endpoint_test1 #simulate L0_mem_ctrl_test1 -#simulate L0_rtps_reader_test1 -simulate L0_rtps_reader_test2 +#simulate L0_rtps_reader_test1_vrk +#simulate L0_rtps_reader_test1_vbk +#simulate L0_rtps_reader_test2_vrk +#simulate L0_rtps_reader_test2_trk +#simulate L0_rtps_reader_test2_vbk +#simulate L0_rtps_reader_test2_tbk +#simulate L0_rtps_reader_test2_vrn +#simulate L0_rtps_reader_test3_a +simulate L0_rtps_reader_test3_m \ No newline at end of file diff --git a/src/rtps_reader.vhd b/src/rtps_reader.vhd index a115f66..2cad9a4 100644 --- a/src/rtps_reader.vhd +++ b/src/rtps_reader.vhd @@ -606,7 +606,7 @@ begin if (LIVELINESS_QOS /= MANUAL_BY_TOPIC_LIVELINESS_QOS) then mem_op_start <= '1'; mem_opcode <= GET_FIRST_ENDPOINT; - mem_field_flags <= (others => '0'); + mem_field_flags <= EMF_GUIDPREFIX_FLAG; stage_next <= METATRAFFIC_OPERATION; cnt_next <= 0; end if; @@ -783,6 +783,7 @@ begin -- Continue Search mem_op_start <= '1'; mem_opcode <= GET_NEXT_ENDPOINT; + mem_field_flags <= EMF_GUIDPREFIX_FLAG; cnt_next <= 0; when others => null; @@ -1411,11 +1412,19 @@ begin else -- Endpoint Lease Expired if (mem_endpoint_data.lease_deadline /= TIME_INVALID and mem_endpoint_data.lease_deadline <= time) then - -- Remove Participant - mem_op_start <= '1'; - mem_opcode <= REMOVE_ENDPOINT; - -- Continue Search - cnt_next <= 0; + -- Propagate Removal + start_hc <= '1'; + opcode_hc <= REMOVE_WRITER; + data_out_hc <= std_logic_vector(to_unsigned(mem_pos, WORD_WIDTH)); + -- Wait for Operation Acknowledgement + if (ack_hc = '1') then + start_hc <= '0'; + -- Remove Endpoint + mem_op_start <= '1'; + mem_opcode <= REMOVE_ENDPOINT; + -- Continue Search + cnt_next <= 0; + end if; -- Synthesis Guard/Response Time Reached elsif (RELIABILTY_QOS = RELIABLE_RELIABILITY_QOS and mem_endpoint_data.res_time /= TIME_INVALID and mem_endpoint_data.res_time <= time) then -- If Suppression Delay passed, zero the time @@ -1745,14 +1754,14 @@ begin mem_cnt_next <= 0; when GET_NEXT_ENDPOINT => -- Memory Bound Guard - if (mem_addr_base /= max_endpoint_addr) then + if (mem_addr_base >= max_endpoint_addr) then + mem_addr_base_next <= ENDPOINT_MEMORY_MAX_ADDRESS; + else -- Reached End of Memory, No match mem_addr_base_next <= mem_addr_base + ENDPOINT_FRAME_SIZE; mem_pos_next <= mem_pos + 1; mem_stage_next <= GET_NEXT_ENDPOINT; mem_cnt_next <= 0; - else - mem_addr_base_next <= ENDPOINT_MEMORY_MAX_ADDRESS; end if; when GET_ENDPOINT => -- Fetch Endpoint Data diff --git a/src/rtps_test_package.vhd b/src/rtps_test_package.vhd index 2b89b28..5f3fc06 100644 --- a/src/rtps_test_package.vhd +++ b/src/rtps_test_package.vhd @@ -1015,7 +1015,7 @@ package body rtps_test_package is variable ret : CACHE_CHANGE_TYPE := DEFAULT_CACHE_CHANGE; begin assert(ref.submessageID = SID_DATA) report "Cache Change can only be derived from DATA Submessages." severity FAILURE; - + ret.littleEndian := ref.flags(SUBMESSAGE_ENDIAN_FLAG_POS); ret.seq_nr := ref.writerSN; ret.payload := ref.data; ret.serialized_key := TRUE when (ref.flags(SUBMESSAGE_KEY_FLAG_POS) = '1') else FALSE;