From ed214bd35a1560e8c43f01139bfe91d68605486b Mon Sep 17 00:00:00 2001 From: Greek Date: Sun, 29 Nov 2020 10:28:30 +0100 Subject: [PATCH] * Added rtps_builtin_test4 - Memory Handling - Compiling and Passing --- sim/modelsim.ini | 1 + sim/rtps_builtin_endpoint_test4.do | 72 ++ src/TODO.txt | 2 + .../Level_0/rtps_builtin_endpoint_test3.vhd | 2 - .../Level_0/rtps_builtin_endpoint_test4.vhd | 991 ++++++++++++++++++ src/Tests/mem_test_config.vhd | 126 +++ src/Tests/test_config.vhd | 2 + src/Tests/testbench.pro | 18 +- 8 files changed, 1211 insertions(+), 3 deletions(-) create mode 100644 sim/rtps_builtin_endpoint_test4.do create mode 100644 src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd create mode 100644 src/Tests/mem_test_config.vhd diff --git a/sim/modelsim.ini b/sim/modelsim.ini index 7660e38..1132f43 100644 --- a/sim/modelsim.ini +++ b/sim/modelsim.ini @@ -20,6 +20,7 @@ others = $MODEL_TECH/../modelsim.ini default = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/default.lib osvvm = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/osvvm.lib Level0-rtps_handler = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/Level0-rtps_handler.lib +Level0-rtps_builtin_endpoint = W:/HDL-SIM/OSVVM-Scripts/../sim/VHDL_LIBS/ModelSim-2020.02/Level0-rtps_builtin_endpoint.lib [vcom] ; VHDL93 variable selects language version as the default. ; Default is VHDL-2002. diff --git a/sim/rtps_builtin_endpoint_test4.do b/sim/rtps_builtin_endpoint_test4.do new file mode 100644 index 0000000..9814fd1 --- /dev/null +++ b/sim/rtps_builtin_endpoint_test4.do @@ -0,0 +1,72 @@ +onerror {resume} +quietly WaveActivateNextPane {} 0 +add wave -noupdate -divider SYSTEM +add wave -noupdate /rtps_builtin_endpoint_test4/uut/clk +add wave -noupdate /rtps_builtin_endpoint_test4/uut/reset +add wave -noupdate -divider INPUT +add wave -noupdate /rtps_builtin_endpoint_test4/uut/empty +add wave -noupdate /rtps_builtin_endpoint_test4/uut/rd +add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test4/uut/data_in +add wave -noupdate /rtps_builtin_endpoint_test4/uut/last_word_in +add wave -noupdate /rtps_builtin_endpoint_test4/uut/last_word_in_latch +add wave -noupdate -divider OUTPUT +add wave -noupdate -radix hexadecimal /rtps_builtin_endpoint_test4/uut/data_out +add wave -noupdate /rtps_builtin_endpoint_test4/uut/endpoint_wr +add wave -noupdate /rtps_builtin_endpoint_test4/uut/last_word_out +add wave -noupdate -divider TESTBENCH +add wave -noupdate /rtps_builtin_endpoint_test4/start +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 +add wave -noupdate /rtps_builtin_endpoint_test4/uut/cnt +add wave -noupdate /rtps_builtin_endpoint_test4/uut/endpoint_mask +add wave -noupdate /rtps_builtin_endpoint_test4/uut/participant_match +add wave -noupdate -divider {MEM FSM} +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_opcode +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_op_start +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_op_done +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_stage +add wave -noupdate -group MEM_FSM /rtps_builtin_endpoint_test4/uut/mem_stage_next +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 +add wave -noupdate /rtps_builtin_endpoint_test4/uut/parse_prc/rd_guard +add wave -noupdate -divider MEMORY +add wave -noupdate -group MEMORY -radix unsigned /rtps_builtin_endpoint_test4/uut/ram_inst/addr +add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test4/uut/ram_inst/wen +add wave -noupdate -group MEMORY /rtps_builtin_endpoint_test4/uut/ram_inst/ren +add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test4/uut/ram_inst/wr_data +add wave -noupdate -group MEMORY -radix hexadecimal /rtps_builtin_endpoint_test4/uut/ram_inst/rd_data +add wave -noupdate -divider MISC +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 +configure wave -namecolwidth 149 +configure wave -valuecolwidth 144 +configure wave -justifyvalue left +configure wave -signalnamewidth 1 +configure wave -snapdistance 10 +configure wave -datasetprefix 0 +configure wave -rowmargin 4 +configure wave -childrowmargin 2 +configure wave -gridoffset 0 +configure wave -gridperiod 1 +configure wave -griddelta 40 +configure wave -timeline 0 +configure wave -timelineunits ns +update +WaveRestoreZoom {33245026 ps} {34393368 ps} diff --git a/src/TODO.txt b/src/TODO.txt index d998a1b..cc21721 100644 --- a/src/TODO.txt +++ b/src/TODO.txt @@ -54,6 +54,8 @@ * Can we make an array of records of uncontrained strings? That we we could make an array of variable sized strings... * Should I also check for Minor_Version >= 4? * If a DATA Submessage is invalid in any way, the Sequence Number is never marked as received, and thus processing of remote Endpoints could stall on corrupt Messages. +* If we have a memory collision during an Endpoint insertion, the Sequence Number anouncing the Endpoint is marked as processed, + but the endpoint will never be inserted even when later on there is memory space (Except if the endpoint send a DATA message we a newer Sequence Number) * Fast-RTPS doen not follow DDSI-RTPS Specification - Open Github Issue diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd index b75944e..07abd8b 100644 --- a/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test3.vhd @@ -115,8 +115,6 @@ begin variable check_cnt : natural := 0; variable RV : RandomPType; variable p0, participant : PARTICIPANT_DATA_TYPE := DEFAULT_PARTICIPANT_DATA; - variable fixed_readers : ENDPOINT_DATA_ARRAY_TYPE(0 to NUM_READERS-1) := gen_endpoint_array(TRUE); - variable fixed_writers : ENDPOINT_DATA_ARRAY_TYPE(0 to NUM_WRITERS-1) := gen_endpoint_array(FALSE); variable e0, endpoint : ENDPOINT_DATA_TYPE := DEFAULT_ENDPOINT_DATA; variable p0_sn, p0_snp, p0_sns : SEQUENCENUMBER_TYPE := FIRST_SEQUENCENUMBER; variable wr_sig : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); diff --git a/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd b/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd new file mode 100644 index 0000000..0aa7695 --- /dev/null +++ b/src/Tests/Level_0/rtps_builtin_endpoint_test4.vhd @@ -0,0 +1,991 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library osvvm; -- Utility Library +context osvvm.OsvvmContext; + +use work.rtps_package.all; +use work.user_config.all; +use work.rtps_config_package.all; +use work.rtps_test_package.all; + + +entity rtps_builtin_endpoint_test4 is +end entity; + +architecture testbench of rtps_builtin_endpoint_test4 is + + -- *COMPONENT DECLARATION* + component rtps_builtin_endpoint is + port ( + clk : in std_logic; + reset : in std_logic; + empty : in std_logic; + rd : out std_logic; + data_in : in std_logic_vector(WORD_WIDTH-1 downto 0); + data_out : out std_logic_vector(WORD_WIDTH-1 downto 0); + last_word_in : in std_logic; + time : in TIME_TYPE; + endpoint_full : in std_logic_vector(0 to NUM_ENDPOINTS-1); + endpoint_wr : out std_logic_vector(0 to NUM_ENDPOINTS-1); + rtps_wr : out std_logic; + rtps_full : in std_logic; + last_word_out : out std_logic; + alive : in std_logic_vector(0 to NUM_ENDPOINTS-1) + ); + end component; + + -- *TYPE DECLARATION* + type TEST_STAGE_TYPE is (IDLE, BUSY); + type MATCH_MATRIX_TYPE is array (0 to NUM_WRITERS-1) of std_logic_vector(0 to NUM_READERS-1); + + -- *SIGNAL DECLARATION* + signal clk, in_empty, rd_sig, last_word_in, last_word_out: std_logic := '0'; + signal reset : std_logic := '1'; + signal endpoint_wr, endpoint_full : std_logic_vector(0 to NUM_ENDPOINTS-1) := (others => '0'); + signal data_in, data_out : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal stim_stage : TEST_STAGE_TYPE := IDLE; + shared variable stimulus, reference : TEST_PACKET_TYPE := EMPTY_TEST_PACKET; + signal packet_sent : std_logic := '0'; + signal cnt_stim : natural := 0; + signal start : std_logic := '0'; + shared variable SB_out : work.ScoreBoardPkg_builtin_endpoint.ScoreBoardPType; + shared variable SB_mem : work.ScoreBoardPkg_MemoryTest.ScoreBoardPType; + signal stim_done, check_done, mem_check : std_logic := '0'; + + -- *FUNCTION DECLARATION* + procedure wait_on_complete is + begin + wait until rising_edge(packet_sent); + end procedure; + +begin + + -- Unit Under Test + uut : rtps_builtin_endpoint + port map ( + clk => clk, + reset => reset, + empty => in_empty or packet_sent, + rd => rd_sig, + data_in => data_in, + data_out => data_out, + last_word_in => last_word_in, + time => TIME_ZERO, + endpoint_full => endpoint_full, + endpoint_wr => endpoint_wr, + rtps_wr => open, + rtps_full => '0', + last_word_out => last_word_out, + alive => (others => '0') + ); + + stimulus_prc : process + variable sub, sub_p : 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'); + + -- Wrapper to use procedure as function + impure function gen_rand_loc_2 return LOCATOR_TYPE is + variable ret : LOCATOR_TYPE := EMPTY_LOCATOR; + begin + gen_rand_loc(RV, ret); + return ret; + end function; + + impure function gen_rand_entityid_2(reader : boolean) return std_logic_vector is + variable ret : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0'); + begin + gen_rand_entityid(RV, reader, ret); + return ret; + end function; + + procedure push_reference is + begin + for i in 0 to reference.length-1 loop + SB_out.Push(wr_sig & reference.last(i) & reference.data(i)); + end loop; + end procedure; + + impure function gen_rand_guid_prefix return GUIDPREFIX_TYPE is + variable ret : GUIDPREFIX_TYPE; + begin + ret := (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), 2 => RV.RandSlv(WORD_WIDTH)); + return ret; + end function; + + procedure start_test is + begin + start <= '1'; + wait until rising_edge(clk); + start <= '0'; + mem_check <= '0'; + wait until rising_edge(clk); + end procedure; + begin + + assert (TEST_STRING = "TEST_CONFIG_2") report "user_config incompatible with testbench." severity FAILURE; + + SetAlertLogName("L0-rtps_builtin_endpoint-memory_handling"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + -- Participant RTPS Submessage + sub := DEFAULT_RTPS_SUBMESSAGE; + sub.submessageID := SID_DATA; + sub.writerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER; + sub.readerId := ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR; + sub.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + + -- Publisher Endpoint RTPS Submessage + sub_p := DEFAULT_RTPS_SUBMESSAGE; + sub_p.submessageID := SID_DATA; + sub_p.writerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_ANNOUNCER; + sub_p.readerId := ENTITYID_SEDP_BUILTIN_PUBLICATIONS_DETECTOR; + sub_p.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + + -- Participant 0 + p0.guidPrefix := gen_rand_guid_prefix; + p0.nr := 0; + p0.defaultUnicastLocatorList := (numLocators => int(1,CDR_LONG_WIDTH), locator => (0 => gen_rand_loc_2, others => EMPTY_LOCATOR)); + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR) := '1'; + p0.availableBuiltinEndpoints(DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER) := '1'; + + -- Participant 1 + p1.guidPrefix := gen_rand_guid_prefix; + p1.nr := 1; + 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_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); + + Log("Initiating Test", INFO); + mem_check <= '1'; + stim_done <= '0'; + start <= '0'; + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + Log("Match Participant 0 [Pos 0]", INFO); + sub.writerSN := p_sn; + participant := p0; + 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 [p0] + + Log("Match Participant 1 [Pos 1]", INFO); + sub.writerSN := p_sn; + participant := p1; + 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 [p0,p1] + + 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; + 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; + gen_endpoint_data(endpoint, sub_p.data); + gen_sentinel(sub_p.data); + gen_rtps_handler_out(sub_p, endpoint, stimulus); + start_test; + wait_on_complete; + stimulus := EMPTY_TEST_PACKET; + reference := EMPTY_TEST_PACKET; + sub_p.data := EMPTY_TEST_PACKET; + -- 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; + 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); + 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] + + TranscriptOpen(RESULTS_FILE, APPEND_MODE); + SetTranscriptMirror; + stim_done <= '1'; + wait until check_done = '1'; + AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + ReportAlerts; + TranscriptClose; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for 25 ns; + clk <= '1'; + wait for 25 ns; + end process; + + in_empty_prc : process + begin + in_empty <= '0'; + wait; --TODO: Remove + wait until rd_sig = '1'; + wait until rising_edge(clk); + in_empty <= '1'; + wait until rising_edge(clk); + end process; + + endpoint_full_prc : process + begin + endpoint_full <= (others => '0'); + wait; --TODO: Remove + wait until (or endpoint_wr) = '1'; + wait until rising_edge(clk); + endpoint_full <= (others => '1'); + wait until rising_edge(clk); + end process; + + alert_prc : process(all) + begin + if rising_edge(clk) then + alertif(in_empty = '1' and rd_sig = '1', "Input FIFO read signal high while empty signal high", ERROR); + alertif(endpoint_full /= (0 to NUM_ENDPOINTS-1 => '0') and (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')), "Endpoint FIFO write signal high while full signal high", ERROR); + end if; + end process; + + input_prc : process(all) + begin + data_in <= stimulus.data(cnt_stim); + last_word_in <= stimulus.last(cnt_stim); + case (stim_stage) is + when IDLE => + packet_sent <= '1'; + when BUSY => + packet_sent <= '0'; + end case; + + if rising_edge(clk) then + if (reset = '1') then + cnt_stim <= 0; + stim_stage <= IDLE; + else + case (stim_stage) is + when IDLE => + if (start = '1') then + stim_stage <= BUSY; + cnt_stim <= 0; + end if; + when BUSY => + if (cnt_stim = stimulus.length) then + stim_stage <= IDLE; + elsif (rd_sig = '1') then + cnt_stim <= cnt_stim + 1; + end if; + end case; + end if; + end if; + end process; + + output_check_prc : process(all) + begin + check_done <= '0'; + if rising_edge(clk) then + if (endpoint_wr /= (0 to NUM_ENDPOINTS-1 => '0')) then + SB_out.Check(endpoint_wr & last_word_out & data_out); + end if; + if (stim_done = '1' and SB_out.empty) then + check_done <= '1'; + end if; + end if; + end process; + + mem_check_prc : process + alias mem is <>; + alias mem_op_done is <>; + variable reference : TEST_PARTICIPANT_MEMORY_FRAME_TYPE; + begin + -- SAFEGUARD: (Prevent Fall-through Behavior) + if (reset /= '0') then + wait until reset = '0'; + end if; + -- NOTE: The first read after the packet is sent signifies that the State Machine has begun processing the next packet. + -- The memory operation that could still be in progress is the last one concerning the last sent packet. + wait on packet_sent until (packet_sent = '1' and mem_check = '1'); + if (rd_sig /= '1') then + wait until rd_sig = '1'; + end if; + if (mem_op_done /= '1') then + wait until mem_op_done = '1'; + end if; + if (not SB_mem.empty) then + SB_mem.Pop(reference); + for i in 0 to reference'length-1 loop + AffirmIf(?? (mem(reference(i).addr) ?= reference(i).data), "Address: " & integer'image(reference(i).addr) & " Received: " & to_hstring(mem(reference(i).addr)) & " Expected: " & to_hstring(reference(i).data)); + end loop; + end if; + end process; + + watchdog : process + begin + wait for 1 ms; + Alert("Test timeout", FAILURE); + std.env.stop; + end process; + +end architecture; \ No newline at end of file diff --git a/src/Tests/mem_test_config.vhd b/src/Tests/mem_test_config.vhd new file mode 100644 index 0000000..48a4671 --- /dev/null +++ b/src/Tests/mem_test_config.vhd @@ -0,0 +1,126 @@ +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 696385a..a664446 100644 --- a/src/Tests/test_config.vhd +++ b/src/Tests/test_config.vhd @@ -216,5 +216,7 @@ package user_config is -- Used to determine the size of the builtin endpoint buffer constant MAX_REMOTE_PARTICIPANTS : natural := 50; + -- TESTING PARAMETERS constant TEST_STRING : string := "TEST_CONFIG_1"; + end package; \ No newline at end of file diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index a0f7fa8..f79ef75 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -18,9 +18,25 @@ analyze Level_0/rtps_builtin_endpoint_test1.vhd analyze ScoreBoard_builtin_endpoint.vhd analyze Level_0/rtps_builtin_endpoint_test2.vhd analyze Level_0/rtps_builtin_endpoint_test3.vhd +analyze Level_0/rtps_builtin_endpoint_test4.vhd #simulate rtps_handler_test1 #simulate rtps_handler_test2 #simulate rtps_builtin_endpoint_test1 #simulate rtps_builtin_endpoint_test2 -simulate rtps_builtin_endpoint_test3 \ No newline at end of file +#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