diff --git a/src/rtps_package.vhd b/src/rtps_package.vhd index 1c12934..f9c80e8 100644 --- a/src/rtps_package.vhd +++ b/src/rtps_package.vhd @@ -39,16 +39,16 @@ package rtps_package is -- Domain ID constant USER_DOMAIN_ID : natural := 1; -- Domain TAG - constant USER_DOMAIN_TAG : string := ""; + constant USER_DOMAIN_TAG : string(1 to 256) := (others => NUL); --"" ----------------------------------------------------------------------------------------------------- -- *DO NOT MODIFY BEGIN* type ENDPOINT_WITH_KEY_TYPE is array (0 to MAX_ENDPOINTS-1) of boolean; type ENDPOINT_STRING_TYPE is array (0 to MAX_ENDPOINTS-1) of string(1 to 256); - type STRING_SLV_WORD_TYPE is array (0 to (256*8)/32) of std_logic_vector(31 downto 0); + type STRING_SLV_WORD_TYPE is array (0 to ((256*8)/32)-1) of std_logic_vector(31 downto 0); type ENDPOINT_STRING_SLV_TYPE is array (0 to MAX_ENDPOINTS-1) of STRING_SLV_WORD_TYPE; - subtype QOS_TYPE is array (0 to MAX_ENDPOINTS-1) of std_logic_vector(31 downto 0); - subtype QOS_SLV_TYPE is array (0 to MAX_ENDPOINTS-1) of std_logic_vector(31 downto 0); + type QOS_TYPE is array (0 to MAX_ENDPOINTS-1) of std_logic_vector(31 downto 0); + type QOS_SLV_TYPE is array (0 to MAX_ENDPOINTS-1) of std_logic_vector(31 downto 0); type DOUBLE_WORD_ARRAY is array (0 to 1) of unsigned(31 downto 0); type ENDPOINT_DURATION_TYPE is array (0 to MAX_ENDPOINTS-1) of DOUBLE_WORD_ARRAY; @@ -80,8 +80,8 @@ package rtps_package is constant KEEP_LAST_HISTORY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32)); constant KEEP_ALL_HISTORY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32)); -- TYPE CONSISTENCY KIND - constant DISALLOW_TYPE_COERCION : std_logic_vector(15 downto 0) := std_logic_vector(to_unsigned(0,32)); - constant ALLOW_TYPE_COERCION : std_logic_vector(15 downto 0) := std_logic_vector(to_unsigned(1,32)); + constant DISALLOW_TYPE_COERCION : std_logic_vector(15 downto 0) := std_logic_vector(to_unsigned(0,16)); + constant ALLOW_TYPE_COERCION : std_logic_vector(15 downto 0) := std_logic_vector(to_unsigned(1,16)); -- *DO NOT MODIFY END* ----------------------------------------------------------------------------------------------------- @@ -121,15 +121,15 @@ package rtps_package is constant ENDPOINT_ACKNACK_RESPONSE_DELAY : ENDPOINT_DURATION_TYPE := (0 => (to_unsigned(0,32),to_unsigned(858993459,32))); -- 200 ms constant ENDPOINT_ACKNACK_SUPPRESSION_DELAY : ENDPOINT_DURATION_TYPE := (0 => (to_unsigned(0,32),to_unsigned(0,32))); - constant PARTICIPANT_HEARTBEAT_PERIOD : DURATION_TYPE := (to_unsigned(3,32),to_unsigned(0,32)); -- 3s - constant PARTICIPANT_HEARTBEAT_RESPONSE_DELAY : DURATION_TYPE := (to_unsigned(0,32),to_unsigned(2147483648,32)); -- 500 ms - constant PARTICIPANT_HEARTBEAT_SUPPRESSION_DELAY : DURATION_TYPE := (to_unsigned(0,32),to_unsigned(0,32)); - constant PARTICIPANT_ACKNACK_RESPONSE_DELAY : DURATION_TYPE := (to_unsigned(0,32),to_unsigned(858993459,32)); -- 200 ms - constant PARTICIPANT_ACKNACK_SUPPRESSION_DELAY : DURATION_TYPE := (to_unsigned(0,32),to_unsigned(0,32)); + constant PARTICIPANT_HEARTBEAT_PERIOD : DOUBLE_WORD_ARRAY := (to_unsigned(3,32),to_unsigned(0,32)); -- 3s + constant PARTICIPANT_HEARTBEAT_RESPONSE_DELAY : DOUBLE_WORD_ARRAY := (to_unsigned(0,32),to_unsigned(2147483648,32)); -- 500 ms + constant PARTICIPANT_HEARTBEAT_SUPPRESSION_DELAY : DOUBLE_WORD_ARRAY := (to_unsigned(0,32),to_unsigned(0,32)); + constant PARTICIPANT_ACKNACK_RESPONSE_DELAY : DOUBLE_WORD_ARRAY := (to_unsigned(0,32),to_unsigned(858993459,32)); -- 200 ms + constant PARTICIPANT_ACKNACK_SUPPRESSION_DELAY : DOUBLE_WORD_ARRAY := (to_unsigned(0,32),to_unsigned(0,32)); - constant DURATION_DELTA : DURATION_TYPE := (to_unsigned(0,32),to_unsigned(429496730,32)); --100 ms + constant DURATION_DELTA : DOUBLE_WORD_ARRAY := (to_unsigned(0,32),to_unsigned(429496730,32)); --100 ms - constant DEFAULT_PARTICIPANT_LEASE_DURATION : DOUBLE_WORD_ARRAY := (to_unsigned(100,32),to_unsigned(0,32); + constant DEFAULT_PARTICIPANT_LEASE_DURATION : DOUBLE_WORD_ARRAY := (to_unsigned(100,32),to_unsigned(0,32)); constant PARTICIPANT_LEASE_DURATION : DOUBLE_WORD_ARRAY := DEFAULT_PARTICIPANT_LEASE_DURATION; -- NOTE: The buffer will not only store participants, but also endpoint data @@ -254,7 +254,7 @@ package rtps_package is - constant DOMAIN_ID : std_logic_vector(DOMAIN_ID_WIDTH-1 downto 0) := to_unsigned(USER_DOMAIN_ID, DOMAIN_ID'length); + constant DOMAIN_ID : std_logic_vector(DOMAIN_ID_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(USER_DOMAIN_ID, DOMAIN_ID_WIDTH)); constant DOMAIN_TAG : STRING_SLV_WORD_TYPE; -- Deferred to package body -- Since this implementation runs on the same network stack and the RTPS Endpoints (Readers & Writers) @@ -347,7 +347,7 @@ package rtps_package is constant ENDPOINT_BITMASK_SIZE : natural := round_div(MAX_ENDPOINTS, 32); constant ENDPOINT_FRAME_SIZE : natural := 4 + ENDPOINT_BITMASK_SIZE; -- Limit Buffer to 32 bit Addresses - constant BUILTIN_BUFFER_SIZE : natural := min(MAX_ENDPOINTS*PARTICIPANT_FRAME_SIZE, 2**32); + constant BUILTIN_BUFFER_SIZE : natural := work.math_pkg.min(MAX_ENDPOINTS*PARTICIPANT_FRAME_SIZE, natural'high); --**************** constant ENDPOINT_MATCH_OPCODE_WIDTH: natural := 32; @@ -359,9 +359,10 @@ package rtps_package is type USER_ENDPOINT_OUTPUT is array (0 to MAX_ENDPOINTS-1) of std_logic_vector(31 downto 0); type ENDPOINT_BITMASK_ARRAY_TYPE is array (0 to ENDPOINT_BITMASK_SIZE-1) of std_logic_vector(31 downto 0); - type WORD_ARRAY_TYPE is array (range <>) of std_logic_vector(31 downto 0); + type WORD_ARRAY_TYPE is array (natural range <>) of std_logic_vector(31 downto 0); type OUTPUT_DATA_TYPE is record - data : WORD_ARRAY_TYPE; + -- Limit DATA to MAX UDPv4 Payload Size - RTPS Header (65487 Bytes) + data : WORD_ARRAY_TYPE(0 to 16371); length : natural; end record; @@ -373,29 +374,29 @@ package rtps_package is function convert_from_double_word (seq: DOUBLE_WORD_ARRAY) return unsigned; function convert_to_double_word (seq: unsigned(63 downto 0)) return DOUBLE_WORD_ARRAY; function ">" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function ">" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function ">" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function ">" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function ">" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function "<" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function "<" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function "<" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function "<" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function "<" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function ">=" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function ">=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function ">=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function ">=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function ">=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function "<=" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function "<=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function "<=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function "<=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function "<=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function "=" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function "=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function "=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function "=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function "=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function "/=" (L,R: DOUBLE_WORD_ARRAY) return boolean; - function "/=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean; - function "/=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean; + function "/=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean; + function "/=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean; function "+" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; - function "+" (L: DOUBLE_WORD_ARRAY, R: natural) return DOUBLE_WORD_ARRAY; - function "+" (L: natural, R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; + function "+" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY; + function "+" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; function "-" (L,R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; - function "-" (L: DOUBLE_WORD_ARRAY, R: natural) return DOUBLE_WORD_ARRAY; - function "-" (L: natural, R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; + function "-" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY; + function "-" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY; end package; @@ -438,27 +439,29 @@ package body rtps_package is tmp := (others => '0'); ret := (others => (others => '0')); -- First two bytes have to be Vendor ID (see DDSI-RTPS 2.3 Section 9.3.1.5) - tmp(GUIDPREFIX_WIDTH-1 downto GUIDPREFIX_WIDTH-VENDORID_WIDTH) <= VENDORID; + tmp(GUIDPREFIX_WIDTH-1 downto GUIDPREFIX_WIDTH-VENDORID_WIDTH) := VENDORID; -- Next we insert the MAC address for uniqueness - tmp(GUIDPREFIX_WIDTH-VENDORID_WIDTH-1 downto GUIDPREFIX_WIDTH-VENDORID_WIDTH-48) <= MAC_ADDRESS; + tmp(GUIDPREFIX_WIDTH-VENDORID_WIDTH-1 downto GUIDPREFIX_WIDTH-VENDORID_WIDTH-48) := MAC_ADDRESS; -- Next we insert the Domain ID - tmp(DOMAIN_ID_WIDTH-1 downto 0) <= DOMAIN_ID; + tmp(DOMAIN_ID_WIDTH-1 downto 0) := DOMAIN_ID; -- Convert to return type for i in 0 to ret'length-1 loop - ret(i) := tmp(GUIDPREFIX_WIDTH-(i*ret'length(1))-1 downto GUIDPREFIX_WIDTH-(i*ret'length(1))-ret'length(1)); + ret(i) := tmp(GUIDPREFIX_WIDTH-(i*ret(i)'length)-1 downto GUIDPREFIX_WIDTH-(i*ret(i)'length)-ret(i)'length); end loop; return ret; end function; constant GUIDPREFIX : GUIDPREFIX_TYPE := gen_guidprefix; - function convert_string (str : string) return STRING_SLV_WORD_TYPE is + -- TODO: Use unconstraint string as input + function convert_string (str : string(1 to 256)) return STRING_SLV_WORD_TYPE is variable ret : STRING_SLV_WORD_TYPE := (others => (others => '0')); begin - ret := (others => others => '0')); + ret := (others => (others => '0')); for i in 0 to ret'length-1 loop - ret(i) := std_logic_vector(to_unsigned(character'POS(str(i*4)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+1)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+2)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+3)), 8)); + ret(i) := std_logic_vector(to_unsigned(character'POS(str(1)), 8)) & std_logic_vector(to_unsigned(character'POS(str(2)), 8)) & std_logic_vector(to_unsigned(character'POS(str(3)), 8)) & std_logic_vector(to_unsigned(character'POS(str(4)), 8)); + --ret(i) := std_logic_vector(to_unsigned(character'POS(str((i*4)+1)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+2)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+3)), 8)) & std_logic_vector(to_unsigned(character'POS(str((i*4)+4)), 8)); end loop; return ret; end function; @@ -478,15 +481,15 @@ package body rtps_package is constant DOMAIN_TAG : STRING_SLV_WORD_TYPE := convert_string(USER_DOMAIN_TAG); function string_len (str : STRING_SLV_WORD_TYPE) return natural is - ret : natural := 0; + variable ret : natural := 0; begin ret := 0; - for i in 0 to str'length loop - for j in 0 to str'length(1)-1 loop + for i in 0 to str'length-1 loop + for j in 0 to (str(i)'length/8)-1 loop -- Count Bytes ret := ret + 1; -- Exit on first NULL byte (NULL Byte included in count) - if (str(i)(str'length(1)-j*8-1 downto str'length(1)-j*8-8) = (8 downto 0 => '0')) then + if (str(i)(str(i)'length-j*8-1 downto str(i)'length-j*8-8) = (7 downto 0 => '0')) then exit; end if; end loop; @@ -495,8 +498,7 @@ package body rtps_package is end function; function gen_reader_endpoint_data return OUTPUT_DATA_TYPE is - -- Limit DATA to MAX UDPv4 Payload Size - RTPS Header (65487 Bytes) - variable ret : OUTPUT_DATA_TYPE(data(0 to 16371)) := (data => (others => (others => '0')), length => 0); + variable ret : OUTPUT_DATA_TYPE := (data => (others => (others => '0')), length => 0); variable ind : natural := 0; variable len : natural := 0; variable tmp : natural := 0; @@ -509,7 +511,6 @@ package body rtps_package is end if; len := 0; ind := 0; - ind2 := 0; -- RTPS Submessages -- One DATA Submessage for each Reader @@ -530,7 +531,7 @@ package body rtps_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+1, ret.data'length(1))); + ret.data(ind+len) := std_logic_vector(to_unsigned(i+1, ret.data(0)'length)); -- Serialized Payload Header len := len + 1; ret.data(ind+len) := PL_CDR_BE & x"0000"; @@ -557,7 +558,7 @@ package body rtps_package is ret.data(ind+len) := PID_TOPIC_NAME & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16)); len := len + 1; ret.data(ind+len) := std_logic_vector(to_unsigned(tmp, 32)); - for j in 0 to tmp-1 loop + for j in 0 to round_div(tmp,4)-1 loop len := len + 1; ret.data(ind+len) := ENDPOINT_TOPIC(i)(j); end loop; @@ -567,7 +568,7 @@ package body rtps_package is ret.data(ind+len) := PID_TYPE_NAME & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16)); len := len + 1; ret.data(ind+len) := std_logic_vector(to_unsigned(tmp, 32)); - for j in 0 to tmp-1 loop + for j in 0 to round_div(tmp,4)-1 loop len := len + 1; ret.data(ind+len) := ENDPOINT_TYPE(i)(j); end loop; @@ -583,9 +584,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := PID_DEADLINE & std_logic_vector(to_unsigned(8, 16)); len := len + 1; - ret.data(ind+len) := ENDPOINT_DEADLINE(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_DEADLINE(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_DEADLINE(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_DEADLINE(i)(1)); end if; -- LIVELINESS if (ENDPOINT_LIVELINESS(i) /= AUTOMATIC_LIVELINESS_QOS or ENDPOINT_LEASE_DURATION(i) /= DURATION_INFINITE) then @@ -594,9 +595,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := ENDPOINT_LIVELINESS(i); len := len + 1; - ret.data(ind+len) := ENDPOINT_LEASE_DURATION(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LEASE_DURATION(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_LEASE_DURATION(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LEASE_DURATION(i)(1)); end if; -- RELIABILITY -- TODO: Check also max_blocking_time for change (Currently ignored) @@ -606,9 +607,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := ENDPOINT_RELIABILITY(i); len := len + 1; - ret.data(ind+len) := ENDPOINT_MAX_BLOCKING_TIME(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_MAX_BLOCKING_TIME(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_MAX_BLOCKING_TIME(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_MAX_BLOCKING_TIME(i)(1)); end if; -- DESTINATION ORDER if (ENDPOINT_DESTINATION_ORDER(i) /= BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS) then @@ -643,8 +644,7 @@ package body rtps_package is constant READER_ENDPOINT_DATA : OUTPUT_DATA_TYPE := gen_reader_endpoint_data; function gen_writer_endpoint_data return OUTPUT_DATA_TYPE is - -- Limit DATA to MAX UDPv4 Payload Size - RTPS Header (65487 Bytes) - variable ret : OUTPUT_DATA_TYPE(data(0 to 16371)) := (data => (others => (others => '0')), length => 0); + variable ret : OUTPUT_DATA_TYPE := (data => (others => (others => '0')), length => 0); variable ind : natural := 0; variable len : natural := 0; variable tmp : natural := 0; @@ -657,7 +657,6 @@ package body rtps_package is end if; len := 0; ind := 0; - ind2 := 0; -- RTPS Submessages -- One DATA Submessage for each Writer Endpoint @@ -700,7 +699,7 @@ package body rtps_package is ret.data(ind+len) := PID_TOPIC_NAME & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16)); len := len + 1; ret.data(ind+len) := std_logic_vector(to_unsigned(tmp, 32)); - for j in 0 to tmp-1 loop + for j in 0 to round_div(tmp,4)-1 loop len := len + 1; ret.data(ind+len) := ENDPOINT_TOPIC(i)(j); end loop; @@ -710,7 +709,7 @@ package body rtps_package is ret.data(ind+len) := PID_TYPE_NAME & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16)); len := len + 1; ret.data(ind+len) := std_logic_vector(to_unsigned(tmp, 32)); - for j in 0 to tmp-1 loop + for j in 0 to round_div(tmp,4)-1 loop len := len + 1; ret.data(ind+len) := ENDPOINT_TYPE(i)(j); end loop; @@ -726,9 +725,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := PID_DEADLINE & std_logic_vector(to_unsigned(8, 16)); len := len + 1; - ret.data(ind+len) := ENDPOINT_DEADLINE(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_DEADLINE(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_DEADLINE(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_DEADLINE(i)(1)); end if; -- LIVELINESS if (ENDPOINT_LIVELINESS(i) /= AUTOMATIC_LIVELINESS_QOS or ENDPOINT_LEASE_DURATION(i) /= DURATION_INFINITE) then @@ -737,9 +736,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := ENDPOINT_LIVELINESS(i); len := len + 1; - ret.data(ind+len) := ENDPOINT_LEASE_DURATION(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LEASE_DURATION(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_LEASE_DURATION(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LEASE_DURATION(i)(1)); end if; -- RELIABILITY -- TODO: Check also max_blocking_time for change (Currently ignored) @@ -749,18 +748,18 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := ENDPOINT_RELIABILITY(i); len := len + 1; - ret.data(ind+len) := ENDPOINT_MAX_BLOCKING_TIME(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_MAX_BLOCKING_TIME(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_MAX_BLOCKING_TIME(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_MAX_BLOCKING_TIME(i)(1)); end if; -- LIFESPAN if (ENDPOINT_LIFESPAN(i) /= DURATION_INFINITE) then len := len + 1; ret.data(ind+len) := PID_LIFESPAN & std_logic_vector(to_unsigned(8, 16)); len := len + 1; - ret.data(ind+len) := ENDPOINT_LIFESPAN(i)(0); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LIFESPAN(i)(0)); len := len + 1; - ret.data(ind+len) := ENDPOINT_LIFESPAN(i)(1); + ret.data(ind+len) := std_logic_vector(ENDPOINT_LIFESPAN(i)(1)); end if; -- DESTINATION ORDER if (ENDPOINT_DESTINATION_ORDER(i) /= BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS) then @@ -792,11 +791,10 @@ package body rtps_package is return ret; end function; - constant ENDPOINT_DATA : OUTPUT_DATA_TYPE := gen_writer_endpoint_data; + constant WRITER_ENDPOINT_DATA : OUTPUT_DATA_TYPE := gen_writer_endpoint_data; function gen_participant_data return OUTPUT_DATA_TYPE is - -- Limit DATA to MAX UDPv4 Payload Size - RTPS Header (65487 Bytes) - variable ret : OUTPUT_DATA_TYPE(data(0 to 16371)) := (data => (others => (others => '0')), length => 0); + variable ret : OUTPUT_DATA_TYPE := (data => (others => (others => '0')), length => 0); variable ind : natural := 0; variable len : natural := 0; variable tmp : natural := 0; @@ -805,7 +803,6 @@ package body rtps_package is ret.length := 0; len := 0; ind := 0; - ind2 := 0; -- RTPS DATA SUBMESSAGE -- RTPS Submessage Header @@ -824,7 +821,7 @@ package body rtps_package is ret.data(ind+len) := (others => '0'); -- DATA Header (Sequence Number) len := len + 1; - ret.data(ind+len) := std_logic_vector(to_unsigned(1, ret.data'length(1))); + ret.data(ind+len) := std_logic_vector(to_unsigned(1, ret.data(ind+len)'length)); -- Serialized Payload Header len := len + 1; ret.data(ind+len) := PL_CDR_BE & x"0000"; @@ -852,7 +849,7 @@ package body rtps_package is ret.data(ind+len) := PID_DOMAIN_TAG & std_logic_vector(to_unsigned((round_div(tmp,4)+1)*4, 16)); len := len + 1; ret.data(ind+len) := std_logic_vector(to_unsigned(tmp, 32)); - for j in 0 to tmp-1 loop + for j in 0 to round_div(tmp,4)-1 loop len := len + 1; ret.data(ind+len) := DOMAIN_TAG(j); end loop; @@ -861,12 +858,14 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := PID_PROTOCOL_VERSION & std_logic_vector(to_unsigned(4, 16)); len := len + 1; - ret.data(ind+len) := (31 downto 16 => PROTOCOLVERSION_2_4, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(31 downto 16) := PROTOCOLVERSION_2_4; -- VENDORID len := len + 1; ret.data(ind+len) := PID_VENDORID & std_logic_vector(to_unsigned(4, 16)); len := len + 1; - ret.data(ind+len) := (31 downto 16 => VENDORID, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(31 downto 16) := VENDORID; -- TODO: Expects inline QoS of Participant -- METATRAFFIC UNICAST LOCATOR len := len + 1; @@ -874,7 +873,8 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := LOCATOR_KIND_UDPv4; len := len + 1; - ret.data(ind+len) := (16 downto 0 => META_IPv4_UNICAST_PORT, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(15 downto 0) := META_IPv4_UNICAST_PORT; len := len + 1; ret.data(ind+len) := (others => '0'); len := len + 1; @@ -889,7 +889,8 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := LOCATOR_KIND_UDPv4; len := len + 1; - ret.data(ind+len) := (16 downto 0 => META_IPv4_MULTICAST_PORT, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(15 downto 0) := META_IPv4_MULTICAST_PORT; len := len + 1; ret.data(ind+len) := (others => '0'); len := len + 1; @@ -904,7 +905,8 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := LOCATOR_KIND_UDPv4; len := len + 1; - ret.data(ind+len) := (16 downto 0 => USER_IPv4_UNICAST_PORT, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(15 downto 0) := USER_IPv4_UNICAST_PORT; len := len + 1; ret.data(ind+len) := (others => '0'); len := len + 1; @@ -919,7 +921,8 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := LOCATOR_KIND_UDPv4; len := len + 1; - ret.data(ind+len) := (16 downto 0 => USER_IPv4_MULTICAST_PORT, others => '0'); + ret.data(ind+len) := (others => '0'); + ret.data(ind+len)(15 downto 0) := USER_IPv4_MULTICAST_PORT; len := len + 1; ret.data(ind+len) := (others => '0'); len := len + 1; @@ -933,9 +936,9 @@ package body rtps_package is len := len + 1; ret.data(ind+len) := PID_PARTICIPANT_LEASE_DURATION & std_logic_vector(to_unsigned(8, 16)); len := len + 1; - ret.data(ind+len) := PARTICIPANT_LEASE_DURATION(0); + ret.data(ind+len) := std_logic_vector(PARTICIPANT_LEASE_DURATION(0)); len := len + 1; - ret.data(ind+len) := PARTICIPANT_LEASE_DURATION(1); + ret.data(ind+len) := std_logic_vector(PARTICIPANT_LEASE_DURATION(1)); end if; -- AVAILABLE ENDPOINTS len := len + 1; @@ -978,7 +981,7 @@ package body rtps_package is variable ret : DOUBLE_WORD_ARRAY := (others => (others => '0')); begin ret(0) := seq(63 downto 32); - ret1) := seq(31 downto 0); + ret(1) := seq(31 downto 0); return ret; end function; @@ -987,12 +990,12 @@ package body rtps_package is return convert_from_double_word(L) > convert_from_double_word(R); end function; - function ">" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function ">" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) > R; end function; - function ">" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function ">" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L > convert_from_double_word(R); end function; @@ -1002,12 +1005,12 @@ package body rtps_package is return convert_from_double_word(L) < convert_from_double_word(R); end function; - function "<" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function "<" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) < R; end function; - function "<" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function "<" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L < convert_from_double_word(R); end function; @@ -1017,12 +1020,12 @@ package body rtps_package is return convert_from_double_word(L) >= convert_from_double_word(R); end function; - function ">=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function ">=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) >= R; end function; - function ">=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function ">=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L >= convert_from_double_word(R); end function; @@ -1032,27 +1035,27 @@ package body rtps_package is return convert_from_double_word(L) <= convert_from_double_word(R); end function; - function "<=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function "<=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) <= R; end function; - function "<=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function "<=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L <= convert_from_double_word(R); end function; - function "=" (L,R: DOUBLE_WORD_ARRAY) return boolean; + function "=" (L,R: DOUBLE_WORD_ARRAY) return boolean is begin return convert_from_double_word(L) = convert_from_double_word(R); end function; - function "=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function "=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) = R; end function; - function "=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function "=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L = convert_from_double_word(R); end function; @@ -1062,12 +1065,12 @@ package body rtps_package is return convert_from_double_word(L) /= convert_from_double_word(R); end function; - function "/=" (L: DOUBLE_WORD_ARRAY, R: natural) return boolean is + function "/=" (L: DOUBLE_WORD_ARRAY; R: natural) return boolean is begin return convert_from_double_word(L) /= R; end function; - function "/=" (L: natural, R: DOUBLE_WORD_ARRAY) return boolean is + function "/=" (L: natural; R: DOUBLE_WORD_ARRAY) return boolean is begin return L /= convert_from_double_word(R); end function; @@ -1077,12 +1080,12 @@ package body rtps_package is return convert_to_double_word(convert_from_double_word(L) + convert_from_double_word(R)); end function; - function "+" (L: DOUBLE_WORD_ARRAY, R: natural) return DOUBLE_WORD_ARRAY is + function "+" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY is begin return convert_to_double_word(convert_from_double_word(L) + R); end function; - function "+" (L: natural, R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is + function "+" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is begin return convert_to_double_word(L + convert_from_double_word(R)); end function; @@ -1092,12 +1095,12 @@ package body rtps_package is return convert_to_double_word(convert_from_double_word(L) - convert_from_double_word(R)); end function; - function "-" (L: DOUBLE_WORD_ARRAY, R: natural) return DOUBLE_WORD_ARRAY is + function "-" (L: DOUBLE_WORD_ARRAY; R: natural) return DOUBLE_WORD_ARRAY is begin return convert_to_double_word(convert_from_double_word(L) - R); end function; - function "-" (L: natural, R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is + function "-" (L: natural; R: DOUBLE_WORD_ARRAY) return DOUBLE_WORD_ARRAY is begin return convert_to_double_word(L - convert_from_double_word(R)); end function;