diff --git a/sim/rtps_handler.do b/sim/rtps_handler_test1.do similarity index 100% rename from sim/rtps_handler.do rename to sim/rtps_handler_test1.do diff --git a/sim/rtps_handler_test2.do b/sim/rtps_handler_test2.do new file mode 100644 index 0000000..588a9e0 --- /dev/null +++ b/sim/rtps_handler_test2.do @@ -0,0 +1,53 @@ +onerror {resume} +quietly WaveActivateNextPane {} 0 +add wave -noupdate -divider SYSTEM +add wave -noupdate /rtps_handler_test2/uut/clk +add wave -noupdate /rtps_handler_test2/uut/reset +add wave -noupdate -divider INPUT +add wave -noupdate /rtps_handler_test2/uut/empty +add wave -noupdate /rtps_handler_test2/uut/rd +add wave -noupdate -radix hexadecimal /rtps_handler_test2/uut/data_in +add wave -noupdate -divider OUTPUT +add wave -noupdate -radix hexadecimal /rtps_handler_test2/uut/data_out +add wave -noupdate /rtps_handler_test2/uut/builtin_full +add wave -noupdate /rtps_handler_test2/uut/builtin_wr +add wave -noupdate /rtps_handler_test2/uut/user_full +add wave -noupdate /rtps_handler_test2/uut/user_wr +add wave -noupdate /rtps_handler_test2/uut/last_word_out +add wave -noupdate -divider TESTBENCH +add wave -noupdate /rtps_handler_test2/start +add wave -noupdate /rtps_handler_test2/stimulus.length +add wave -noupdate /rtps_handler_test2/stim_stage +add wave -noupdate /rtps_handler_test2/cnt_stim +add wave -noupdate /rtps_handler_test2/packet_sent +add wave -noupdate /rtps_handler_test2/dummy.length +add wave -noupdate /rtps_handler_test2/ref_stage +add wave -noupdate /rtps_handler_test2/cnt_ref +add wave -noupdate /rtps_handler_test2/packet_checked +add wave -noupdate -divider RTPS_HANDLER +add wave -noupdate /rtps_handler_test2/uut/stage +add wave -noupdate /rtps_handler_test2/uut/stage_next +add wave -noupdate /rtps_handler_test2/uut/cnt +add wave -noupdate -radix unsigned /rtps_handler_test2/uut/read_cnt +add wave -noupdate -radix unsigned /rtps_handler_test2/uut/packet_length +add wave -noupdate -radix unsigned /rtps_handler_test2/uut/data_header_end +add wave -noupdate -radix unsigned /rtps_handler_test2/uut/sub_end +add wave -noupdate -divider MISC +TreeUpdate [SetDefaultTree] +WaveRestoreCursors {Begin {80925000 ps} 1} {Error {84575000 ps} 1} {{Cursor 3} {12725000 ps} 0} +quietly wave cursor active 3 +configure wave -namecolwidth 132 +configure wave -valuecolwidth 91 +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 ps +update +WaveRestoreZoom {12125373 ps} {13324628 ps} diff --git a/src/Tests/Level_0/rtps_handler_test1.vhd b/src/Tests/Level_0/rtps_handler_test1.vhd index c69f429..371b6ef 100644 --- a/src/Tests/Level_0/rtps_handler_test1.vhd +++ b/src/Tests/Level_0/rtps_handler_test1.vhd @@ -10,6 +10,75 @@ use work.user_config.all; use work.rtps_config_package.all; use work.rtps_test_package.all; +-- This testbench tests the Input Handling of the rtps_handler. It generates stimulus and compares the output to an expected value. +-- This testbench covers following: +-- RTPS HEADER +-- * The Message has less than the required number of octets to contain a full Header +-- * Its protocol value does not match the value of PROTOCOL_RTPS +-- * The major protocol version is larger than the major protocol version supported by the implementation +-- DATA SUBEMSSAGE +-- * Empty DATA Submessage (No payload/inline-QoS) +-- * META/USER Traffic +-- * Little/Big Endian +-- * Extra Header Bytes (not aligned to 4-Byte boundary) +-- * Invalid Flag setting (KEY and DATA Flag set) +-- * PacketSize invalid (SubmessageLength > PacketSize) +-- * SubmessageLength invalid +-- * writerSN invalid +-- ACKNACK SUBMESSAGE +-- * META/USER Traffic +-- * Little/Big Endian +-- * PacketSize invalid (SubmessageLength > PacketSize) +-- * SubmessageLength invalid +-- * readerSNState invalid (Base invalid) +-- * readerSNState invalid (NumBits invalid) +-- GAP SUBMESSAGE +-- * META/USER Traffic +-- * Little/Big Endian +-- * PacketSize invalid (SubmessageLength > PacketSize) +-- * SubmessageLength invalid +-- * gapStart invalid +-- * gapList invalid (Base invalid) +-- * gapList invalid (NumBits invalid) +-- HEARTBEAT SUBMESSAGE +-- * META/USER Traffic +-- * Little/Big Endian +-- * PacketSize invalid (SubmessageLength > PacketSize) +-- * SubmessageLength invalid +-- * firstSN invalid +-- * lastSN invalid +-- * lastSN.value < firstSN.value - 1 +-- INFO_SOURCE SUBMESSAGE +-- * Little/Big Endian +-- * Protocol Version missmatch +-- * SubmessageLength invalid +-- INFO_DESTINATION SUBMESSAGE +-- * Little/Big Endian +-- * Destination GUID Prefix missmatch +-- * SubmessageLength invalid +-- INFO_REPLY SUBMESSAGE +-- * Little/Big Endian +-- * Empty Locator List +-- * Valid/Invalid Unicast/Multicast (Both invalid Ports and Addresses are tested) +-- * Invalid only +-- * SubmessageLength invalid +-- INFO_REPLY_IP4 SUBMESSAGE +-- * Little/Big Endian +-- * Valid/Invalid Unicast/Multicast (Both invalid Ports and Addresses are tested) +-- * Invalid only +-- * SubmessageLength invalid +-- INFO_TIMESTAMP SUBMESSAGE +-- * Little/Big Endian +-- * Invalidate Flag Set +-- * SubmessageLength invalid +-- PAD SUBMESSAGE +-- * 28 Padding Bytes +-- UKNOWN SUBMESSAGE +-- * DATA_FRAG Submessage +-- * HEARTBEAT_FRAG Submessage +-- * NACK_FRAG Submessage +-- * UKNOWN SID + entity rtps_handler_test1 is end entity; @@ -1343,4 +1412,11 @@ begin 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/Level_0/rtps_handler_test2.vhd b/src/Tests/Level_0/rtps_handler_test2.vhd new file mode 100644 index 0000000..a9f7417 --- /dev/null +++ b/src/Tests/Level_0/rtps_handler_test2.vhd @@ -0,0 +1,329 @@ +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 Output Routing of the rtps_handler. It generates stimulus for different destinations and compares the selected output to the expected. +-- This testbench covers following: +-- * METATRAFFIC/USERTRAFFIC/UKNOWN Destination Addresses (All Address/Port Combinations) +-- * UNKNOWN/BUILT-IN/USER/ENTITY_UNKNOWN Entity Destinations +-- * READER/WRITER Source + + +entity rtps_handler_test2 is +end entity; + +architecture testbench of rtps_handler_test2 is + + -- *COMPONENT DECLARATION* + component rtps_handler is + port ( + clk : in std_logic; -- Input Clock + reset : in std_logic; -- Synchronous Reset + empty : in std_logic; -- Input FIFO empty flag + rd : out std_logic; -- Input FIFO read signal + data_in : in std_logic_vector(WORD_WIDTH-1 downto 0); -- Input FIFO data signal + data_out : out std_logic_vector(WORD_WIDTH-1 downto 0); -- Output data signal + builtin_full : in std_logic; -- Output FIFO (Built-In Endpoint) full signal + builtin_wr : out std_logic; -- Output FIFO (Built-In Endpoint) write signal + user_full : in std_logic_vector(0 to NUM_ENDPOINTS-1); -- Output FIFO (User Endpoints) full signal + user_wr : out std_logic_vector(0 to NUM_ENDPOINTS-1); -- Output FIFO (User Endpoints) write signal + last_word_out : out std_logic -- Output FIFO Last Word signal + ); + end component; + + -- *TYPE DECLARATION* + type TEST_STAGE_TYPE is (IDLE, BUSY); + + -- *SIGNAL DECLARATION* + signal clk, reset, in_empty, rd_sig, builtin_full, builtin_wr, last_word_out : std_logic := '0'; + signal user_full, user_wr : std_logic_vector(NUM_ENDPOINTS-1 downto 0) := (others => '0'); + signal data_in, data_out : std_logic_vector(WORD_WIDTH-1 downto 0) := (others => '0'); + signal stim_stage, ref_stage : TEST_STAGE_TYPE := IDLE; + shared variable stimulus, dummy : TEST_PACKET_TYPE := ( + data => (others => (others => '0')), + length => 0 + ); + signal packet_sent, packet_checked : std_logic := '0'; + signal cnt_stim, cnt_ref : natural := 0; + signal start : std_logic := '0'; + signal reference : std_logic_vector(0 to NUM_ENDPOINTS) := (others => '0'); + + -- *FUNCTION DECLARATION* + procedure wait_on_complete is + begin + wait until rising_edge(packet_sent); + if (packet_checked /= '1') then + wait until (packet_checked = '1'); + end if; + end procedure; + +begin + + -- Unit Under Test + uut : rtps_handler + port map ( + clk => clk, + reset => reset, + empty => in_empty or packet_sent, + rd => rd_sig, + data_in => data_in, + data_out => data_out, + builtin_full => builtin_full, + builtin_wr => builtin_wr, + user_full => user_full, + user_wr => user_wr, + last_word_out => last_word_out + ); + + stimulus_prc : process + variable rtps_header : RTPS_HEADER_TYPE := DEFAULT_RTPS_HEADER; + variable rtps_data : RTPS_SUBMESSAGE_TYPE := DEFAULT_RTPS_SUBMESSAGE; + variable check_cnt : natural := 0; + variable RV : RandomPType; + variable UDP : UDP_HEADER_TYPE; + variable tmp_loc_list : LOCATOR_LIST_TYPE; + variable ref1, ref2, ref3 : std_logic_vector(0 to NUM_ENDPOINTS); + variable tmp_id : std_logic_vector(ENTITYID_WIDTH-1 downto 0); + variable is_meta : boolean; + + -- "Cheat" 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; + + procedure start_test is + begin + start <= '1'; + wait until rising_edge(clk); + start <= '0'; + wait until rising_edge(clk); + end procedure; + begin + + SetAlertLogName("L0-rtps_handler-output_routing"); + SetAlertEnable(FAILURE, TRUE); + SetAlertEnable(ERROR, TRUE); + SetAlertEnable(WARNING, TRUE); + SetLogEnable(DEBUG, FALSE); + SetLogEnable(PASSED, FALSE); + SetLogEnable(INFO, TRUE); + RV.InitSeed(RV'instance_name); + + + -- UDP Header + UDP := (src => gen_rand_loc_2, dest => EMPTY_LOCATOR); + + -- Default Valid Data Submessage + rtps_data := DEFAULT_RTPS_SUBMESSAGE; + rtps_data.flags(SUBMESSAGE_DATA_FLAG_POS) := '1'; + rtps_data.data := (length => 2, data => (0 => RV.RandSlv(WORD_WIDTH), 1 => RV.RandSlv(WORD_WIDTH), others => (others => '0'))); + + + + Log("Initiating Test", INFO); + in_empty <= '0'; + builtin_full <= '0'; + user_full <= (others => '0'); + start <= '0'; + reset <= '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + reset <= '0'; + + for i in 0 to 2 loop -- USER/META/UKNOWN Traffic + case (i) is + -- META TRAFFIC ADDRESSES + when 0 => + tmp_loc_list := DEST_LOC.meta; + ref1 := (NUM_ENDPOINTS => '1', others => '0'); + is_meta := TRUE; + -- USER TRAFFIC ADDRESSES + when 1 => + tmp_loc_list := DEST_LOC.user; + ref1 := (NUM_ENDPOINTS => '0', others => '1'); + is_meta := FALSE; + -- UKNOWN ADDRESSES + when others => + ref1 := (others => '0'); + tmp_loc_list := ( numLocators => int(2,CDR_LONG_WIDTH), + locator => ( + 0 => ( + kind => LOCATOR_KIND_UDPv4, + portn => (LOCATOR_PORT_WIDTH-1 downto UDP_PORT_WIDTH => '0') & META_IPv4_MULTICAST_PORT, + addr => RV.RandSlv(LOCATOR_ADDR_WIDTH) + ), + 1 => ( + kind => LOCATOR_KIND_UDPv4, + portn => RV.RandSlv(LOCATOR_PORT_WIDTH), + addr => (LOCATOR_ADDR_WIDTH-1 downto IPv4_ADDRESS_WIDTH => '0') & DEFAULT_IPv4_META_ADDRESS + ), + others => EMPTY_LOCATOR + ) + ); + is_meta := FALSE; + end case; + for j in 0 to to_integer(unsigned(tmp_loc_list.numLocators))-1 loop -- Destination Address + UDP.dest := tmp_loc_list.locator(j); + + for k in 0 to NUM_ENDPOINTS+2 loop -- Destination Entity ID + case (k) is + -- UKNOWN + when NUM_ENDPOINTS => + ref2 := (others => '0'); + tmp_id := RV.RandSlv(ENTITYID_WIDTH); + tmp_id(ENTITY_KIND_H_RANGE) := USER_DEFINED_ENTITY; + tmp_id(ENTITY_KIND_L_RANGE) := UNKNOWN_KIND; + -- ENTITYID_UKNOWN + when NUM_ENDPOINTS+1 => + tmp_id := ENTITYID_UNKNOWN; + ref2 := (others => '1'); + -- BUILT_IN + when NUM_ENDPOINTS+2 => + tmp_id := ENTITYID_PARTICIPANT; + ref2 := (NUM_ENDPOINTS => '1', others => '0'); + -- USER + when others => + tmp_id := ENTITYID(k); + ref2 := (k => '1', others => '0'); + end case; + + for l in 0 to 1 loop -- Reader/Writer Source + case (l) is + -- Writer Source + when 0 => + rtps_data.submessageID := SID_DATA; + rtps_data.readerId := tmp_id; + rtps_data.writerId := DEFAULT_ENTITYID; + ref3 := (NUM_ENDPOINTS => '1', NUM_READERS-1 downto 0 => '1', others => '0'); + -- Reader Source + when others => + rtps_data.submessageID := SID_ACKNACK; + rtps_data.readerId := DEFAULT_ENTITYID; + rtps_data.writerId := tmp_id; + ref3 := (NUM_ENDPOINTS => '1', NUM_ENDPOINTS-1 downto NUM_READERS => '1', others => '0'); + end case; + + -- *STIMULUS* + Log("Sending Packet. Config i=" & integer'image(i) & ", j=" & integer'image(j) & ", k=" & integer'image(k) & ", l=" & integer'image(l), INFO); + --report "ref1: " & to_string(ref1); + --report "ref2: " & to_string(ref2); + --report "ref3: " & to_string(ref3); + -- UDP Header + gen_udp_header(UDP, stimulus); + -- RTPS Header + gen_rtps_header(rtps_header, stimulus); + -- Valid Data + gen_rtps_submessage(rtps_data, stimulus); + if ((ref1 and ref2 and ref3) /= (ref1'range => '0')) then + gen_rtps_handler_out(rtps_data, UDP.src, is_meta, TIME_INVALID, rtps_header.guidPrefix, dummy); + end if; + -- Finalize Packet + fix_udp_packet(stimulus); + reference <= ref1 and ref2 and ref3; + start_test; + wait_on_complete; + check_cnt := check_cnt + dummy.length; + stimulus.length := 0; + dummy.length := 0; + end loop; + end loop; + end loop; + end loop; + + AlertIf(GetAffirmCount < check_cnt, "Incomplete test run"); + ReportAlerts; + std.env.stop; + wait; + end process; + + clock_prc : process + begin + clk <= '0'; + wait for 25 ns; + clk <= '1'; + wait for 25 ns; + end process; + + input_prc : process(all) + begin + data_in <= stimulus.data(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_prc : process(all) + begin + case (ref_stage) is + when IDLE => + packet_checked <= '1'; + when BUSY => + packet_checked <= '0'; + end case; + + if rising_edge(clk) then + if (reset = '1') then + cnt_ref <= 0; + ref_stage <= IDLE; + else + case (ref_stage) is + when IDLE => + if (start = '1') then + ref_stage <= BUSY; + cnt_ref <= 0; + end if; + when BUSY => + if (cnt_ref = dummy.length) then + ref_stage <= IDLE; + elsif (builtin_wr = '1' or user_wr /= (0 to NUM_ENDPOINTS-1 => '0')) then + AffirmIfEqual((user_wr & builtin_wr), reference); + cnt_ref <= cnt_ref + 1; + end if; + end case; + end if; + 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/test_config.vhd b/src/Tests/test_config.vhd new file mode 100644 index 0000000..7c3dd33 --- /dev/null +++ b/src/Tests/test_config.vhd @@ -0,0 +1,123 @@ +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 := 2; + -- Number of RTPS Reader Endpoints + constant NUM_READERS : natural := 2; + -- 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 := 50; +end package; \ No newline at end of file diff --git a/src/Tests/testbench.pro b/src/Tests/testbench.pro index 6456286..94e09f9 100644 --- a/src/Tests/testbench.pro +++ b/src/Tests/testbench.pro @@ -5,10 +5,12 @@ include ../OSVVM/osvvm.pro library Level0-rtps_handler analyze ../math_pkg.vhd analyze ../rtps_package.vhd -analyze ../user_config.vhd +analyze test_config.vhd analyze ../rtps_config_package.vhd analyze ../rtps_test_package.vhd analyze ../rtps_handler.vhd analyze Level_0/rtps_handler_test1.vhd +analyze Level_0/rtps_handler_test2.vhd -simulate rtps_handler_test1 \ No newline at end of file +simulate rtps_handler_test1 +simulate rtps_handler_test2 \ No newline at end of file diff --git a/src/rtps_config_package.vhd b/src/rtps_config_package.vhd index d35c270..b746c7e 100644 --- a/src/rtps_config_package.vhd +++ b/src/rtps_config_package.vhd @@ -448,7 +448,7 @@ package body rtps_config_package is ret.data(ind+len) := (others => '0'); -- DATA Header (Sequence Number) len := len + 1; - ret.data(ind+len) := std_logic_vector(to_unsigned(i-NUM_READERS+1, ret.data'length(1))); + ret.data(ind+len) := std_logic_vector(to_unsigned(i-NUM_READERS+1, ret.data(0)'length)); -- Serialized Payload Header len := len + 1; ret.data(ind+len) := PL_CDR_BE & x"0000"; diff --git a/src/user_config.vhd b/src/user_config.vhd index af761cf..644c032 100644 --- a/src/user_config.vhd +++ b/src/user_config.vhd @@ -43,9 +43,9 @@ package user_config is -- 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) := (0 => "Placeholder" & (12 to 256 => NUL)); + 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) := (0 => "Placeholder" & (12 to 256 => NUL)); + 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