diff --git a/src/PID_Ref.txt b/src/PID_Ref.txt new file mode 100644 index 0000000..b40cc9a --- /dev/null +++ b/src/PID_Ref.txt @@ -0,0 +1,146 @@ +struct PublicationBuiltinTopicData { + @id(0x005A) @key BuiltinTopicKey_t key; + octet value[16]; + @id(0x0050) BuiltinTopicKey_t participant_key; + octet value[16]; + @id(0x0005) ObjectName topic_name; + string<256> + @id(0x0007) ObjectName type_name; + string<256> + @id(0x0069) @optional TypeIdV1 type_id;// XTYPES 1.1 + @id(0x0072) @optional TypeObjectV1 type;// XTYPES 1.1 + @id(0x0075) @optional XTypes::TypeInformation type_information;// XTYPES 1.2 + @id(0x001D) DurabilityQosPolicy durability; + 32-bit enum {VOLATILE_DURABILITY_QOS,TRANSIENT_LOCAL_DURABILITY_QOS,TRANSIENT_DURABILITY_QOS,PERSISTENT_DURABILITY_QOS} + @id(0x001E) DurabilityServiceQosPolicy durability_service; + Duration (2xlong) service_cleanup_delay + 32-bit enum {KEEP_LAST_HISTORY_QOS,KEEP_ALL_HISTORY_QOS}; + long history_depth + long max_samples + long max_instances + long max_samples_per_instance + @id(0x0023) DeadlineQosPolicy deadline; + Duration (2xlong) period + @id(0x0027) LatencyBudgetQosPolicy latency_budget; + Duration (2xlong) duration + @id(0x001B) LivelinessQosPolicy liveliness; + 32-bit enum {AUTOMATIC_LIVELINESS_QOS,MANUAL_BY_PARTICIPANT_LIVELINESS_QOS,MANUAL_BY_TOPIC_LIVELINESS_QOS} + Duration (2xlong) lease_duration + @id(0x001A) ReliabilityQosPolicy reliability; + 32-bit enum {BEST_EFFORT_RELIABILITY_QOS=1,RELIABLE_RELIABILITY_QOS=2} + Duration (2xlong) max_blocking_time + @id(0x002B) LifespanQosPolicy lifespan; + Duration (2xlong) duration + @id(0x002C) UserDataQosPolicy user_data; + sequence + @id(0x001F) OwnershipQosPolicy ownership; + 32-bit enum {SHARED_OWNERSHIP_QOS,EXCLUSIVE_OWNERSHIP_QOS} + @id(0x0006) OwnershipStrengthQosPolicy ownership_strength; + long value + @id(0x0025) DestinationOrderQosPolicy destination_order; + 32-bit enum {BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS,BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS} + @id(0x0021) PresentationQosPolicy presentation; + 32-bit enum {INSTANCE_PRESENTATION_QOS,TOPIC_PRESENTATION_QOS,GROUP_PRESENTATION_QOS} + boolean (octet) coherent_access + boolean (octet) ordered_access + @id(0x0029) PartitionQosPolicy partition; + sequence + @id(0x002E) TopicDataQosPolicy topic_data; + sequence + @id(0x002D) GroupDataQosPolicy group_data; + sequence + @id(0x0073) DataRepresentationQosPolicy representation; + sequence +}; + +struct SubscriptionBuiltinTopicData { + - durability service + - ownership strength + - lifespan + @id(0x0004) TimeBasedFilterQosPolicy time_based_filter; + Duration (2xlong) minimum_separation + @id(0x0074) TypeConsistencyEnforcementQosPolicy type_consistency; + 16-bit enum {DISALLOW_TYPE_COERCION,ALLOW_TYPE_COERCION} + boolean (octet) ignore_sequence_bounds + boolean (octet) ignore_string_bounds + boolean (octet) ignore_member_names + boolean (octet) prevent_type_widening + boolean (octet) force_type_validation +} + + +PID_DOMAIN_ID DomainId_t + long +PID_DOMAIN_TAG string<256> + string<256> +PID_PROTOCOL_VERSION ProtocolVersion_t + octet[2] +PID_VENDORID VendorId_t + octet[2] +PID_UNICAST_LOCATOR Locator_t +PID_MULTICAST_LOCATOR Locator_t +PID_DEFAULT_UNICAST_LOCATOR Locator_t +PID_DEFAULT_MULTICAST_LOCATOR Locator_t +PID_METATRAFFIC_UNICAST_LOCATOR Locator_t +PID_METATRAFFIC_MULTICAST_LOCATOR Locator_t + long kind + long port + octet[16] address +PID_EXPECTS_INLINE_QOS boolean + boolean (octet) +PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT Count_t + long +PID_PARTICIPANT_LEASE_DURATION Duration_t + long seconds + long fraction +PID_CONTENT_FILTER_PROPERTY ContentFilterProperty_t + string<256> contentFilteredTopicName + string<256> relatedTopicName + string<256> filterClassName + string filterExpression + sequence expressionParameters +PID_PARTICIPANT_GUID GUID_t +PID_GROUP_GUID GUID_t +PID_ENDPOINT_GUID GUID_t + octet[12] guidPrefix + octet[3] entityKey + octet entityKind +PID_BUILTIN_ENDPOINT_SET BuiltinEndpointSet_t + bitmask { + @position(0) DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER, + @position(1) DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR, + @position(2) DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER, + @position(3) DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR, + @position(4) DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER, + @position(5) DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR, + @position(10) BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER, + @position(11) BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER, + @position(28) DISC_BUILTIN_ENDPOINT_TOPICS_ANNOUNCER, + @position(29) DISC_BUILTIN_ENDPOINT_TOPICS_DETECTOR + } +PID_BUILTIN_ENDPOINT_QOS BuiltinEndpointQos_t + bitmask { + @position(0) BEST_EFFORT_PARTICIPANT_MESSAGE_DATA_READER + } +PID_PROPERTY_LIST sequence + sequence{ + string name + string value + } +PID_TYPE_MAX_SIZE_SERIALIZED long + long +PID_ENTITY_NAME EntityName_t + string + +PID_CONTENT_FILTER_INFO DDSI-RTPS 9.6.3.1 +PID_COHERENT_SET DDSI-RTPS 9.6.3.2 +PID_GROUP_COHERENT_SET DDSI-RTPS 9.6.3.3 +PID_GROUP_SEQ_NUM DDSI-RTPS 9.6.3.4 +PID_WRITER_GROUP_INFO DDSI-RTPS 9.6.3.5 +PID_SECURE_WRITER_GROUP_INFO DDSI-RTPS 9.6.3.6 +PID_ORIGINAL_WRITER_INFO DDSI-RTPS 9.6.3.7 +PID_KEY_HASH DDSI-RTPS 9.6.3.8 +PID_STATUS_INFO DDSI-RTPS 9.6.3.9 + + + diff --git a/src/TODO.txt b/src/TODO.txt index d1f4f2a..96be5bf 100644 --- a/src/TODO.txt +++ b/src/TODO.txt @@ -52,6 +52,8 @@ Optional features may not be supported by all RTPS implementations. ENTITYID_UKNOWN also for Built-In? Ignore Participant/Topic/Publication/Subscription (handle argument of Sampleinfo) + + ENDIANNESS ========== You have to see what datatypes PSM maps to each element. @@ -61,15 +63,17 @@ The elements of an array are in order (but the elements themselves may need to b ENDPOINT FIFO PACKET FORMAT =========================== -0...2...........8...............16..............24..............32 +32..............24..............16..............8...............0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LENTGH | +---------------+---------------+---------------+---------------+ -| OPCODE | FLAGS | UDP_PORT | +| OPCODE | FLAGS | SRC_UDP_PORT | +---------------+---------------+---------------+---------------+ -| IPv4_ADDR | +| SRC_IPv4_ADDR | +---------------------------------------------------------------+ -| ENTITYID | +| SRC_ENTITYID | ++---------------------------------------------------------------+ +| DEST_ENTITYID [only for Builtin Destinations] | +---------------------------------------------------------------+ | | + Sequence Number [only for DATA Submessage] + @@ -84,4 +88,116 @@ ENDPOINT_ID =========== MSB...........LSB -READERS...WRITERS \ No newline at end of file +READERS...WRITERS + +BUILT-IN ENDPOINTS +================== + +2.2.5 Built-In Topics +The QoS of the built-in Subscriber and DataReader objects is given by the following table: +HISTORY: kind = KEEP_LAST, depth = 1 + +Since the Built-In Endpoints have a history depth of 1, we can safely reduce the processing complexity of ACKNACK and +HEARTBEAT messages (and even ignore GAP messages). + +PARTICICPANT DATA +================= +32..............24..............16..............8...............0 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++---------------------------------------------------------------+ +| | ++ + +| GUIDPREFIX | ++ + +| | ++---------------------------------------------------------------+ +| META_IPv4_ADDRESS | ++---------------------------------------------------------------+ +| DEFAULT_IPv4_ADDRESS | ++---------------------------------------------------------------+ +| META_UDP_PORT | DEFAULT_UDP_PORT | ++---------------------------------------------------------------+ +| LEASE_DURATION | ++ + +| | ++---------------------------------------------------------------+ +| LEASE_DEADLINE | ++ + +| | ++---------------------------------------------------------------+ +| EXTRA_FLAGS | ++---------------------------------------------------------------+ + + +32..............24..............16..............8...............0 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++---------------------------------------------------------------+ +| ENTITYID | ++---------------------------------------------------------------+ +| PARTICICPANT_INDEX | ++---------------------------------------------------------------+ +| | +~ ENDPOINT_BITMASK ~ +| | ++---------------------------------------------------------------+ + + +32..............24..............16..............8...............0 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ++---------------------------------------------------------------+ +| PARTICICPANT_INDEX | ++---------------------------------------------------------------+ +| ENTITYID | ++---------------------------------------------------------------+ +| IPv4_ADDRESS | ++---------------------------------------------------------------+ +| UDP_PORT | EXTRA_FLAGS | ++---------------------------------------------------------------+ +| LIFESPAN | ++ + +| (READER_ONLY) | ++---------------------------------------------------------------+ + +TOPIC KEYS +========== +Nominally the key is part of the serialized data of a data submessage. +Using the key hash benefits implementations by providing a faster alternative than deserializing the full key from the received data-object. + +MISC +==== + +8.2.9 Relation to DDS Entities +How exactly a DDS Entity interacts with the HistoryCache however, is implementation specific and not +formally modeled by the RTPS protocol. Instead, the Behavior Module of the RTPS protocol only specifies how +CacheChange changes are transferred from the HistoryCache of the RTPS Writer to the HistoryCache of +each matching RTPS Reader. + +8.2.9.1 +When using strict reliable communication, a change can +only be removed when it has been acknowledged by all readers the change was sent to and which are still +active and alive. + +8.2.9.2 +Each matching Writer will attempt to transfer all relevant samples from its HistoryCache to the HistoryCache of the Reader. + +8.4.3 +It is also not able to drop out-of-order samples on the Reader side as this +requires keeping track of the largest sequence number received from each remote Writer. +--> Suggests there is multiple writers + +8.5.4.2 +For the purpose of interoperability, it is sufficient that an +implementation provides the required built-in Endpoints and reliable communication that satisfies the general +requirements listed in 8.4.2. + +8.5.4.4 +An implementation of the protocol need not necessarily send all information contained in the DataTypes. If any +information is not present, the implementation can assume the default values, as defined by the PSM. + +8.7.2.2.6 +In order to implement the DDS_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS policy, +implementations must include an InfoTimestamp Submessage with every update from a Writer. + + + +DDS_Advanced_Tutorial_2006_00-T1-2_Pardo.pdf (P.16) diff --git a/src/test.vhd b/src/test.vhd index aa0bcd8..207971e 100644 --- a/src/test.vhd +++ b/src/test.vhd @@ -2,45 +2,21 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; -package rtps_package is - - -- Number of Domains - constant NUM_DOMAIN : integer := 1; - ----------------------------------------------------------------------------------------------------- - -- *DO NOT MODIFY BEGIN* - type USER_DOMAIN_ID_TYPE is array (NUM_DOMAIN-1 downto 0) of integer; - -- *DO NOT MODIFY END* - ----------------------------------------------------------------------------------------------------- - -- Array of Domain IDs - constant USER_DOMAIN_ID : USER_DOMAIN_ID_TYPE := (0 => 1); - - constant DOMAIN_ID_WIDTH : integer := 32; - - - - type DOMAIN_ID_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(DOMAIN_ID_WIDTH-1 downto 0); - - function gen_domain_ids (user_id : USER_DOMAIN_ID_TYPE) return DOMAIN_ID_TYPE; - - - -end package; +use work.math_pkg.all; +use work.test_package.all; -package body rtps_package is +-- TODO: Remove alignment logic for RTPS Submessages, since all Submessages are 32-bit aligned +-- Checksum has to be checked before - function gen_domain_ids (user_id : USER_DOMAIN_ID_TYPE) return DOMAIN_ID_TYPE is - variable ret : DOMAIN_ID_TYPE; - begin - ret := (others => (others => '0')); - for i in 0 to user_id'length-1 loop - -- Check if User provided Domain ID fits - -- NOTE: Cannot assert due to vhdl integer overflow. - --assert (user_id(i) < (2**DOMAIN_ID_WIDTH-1 - PORT_CONFIG_PB) / PORT_CONFIG_DG) report "Domain ID range exceeded" severity failure; - ret(i) := std_logic_vector(to_unsigned(user_id(i), ret(i)'length)); - end loop; - return ret; - end function; - - constant DOMAIN_ID : DOMAIN_ID_TYPE := gen_domain_ids(USER_DOMAIN_ID); - -end package body; +entity test is + port ( + clk : in std_logic; -- Input Clock + reset : in std_logic; -- Synchronous Reset + output : out std_logic + ); +end entity; + +architecture arch of test is +begin + +end architecture; diff --git a/src/test_package.vhd b/src/test_package.vhd new file mode 100644 index 0000000..8e239ce --- /dev/null +++ b/src/test_package.vhd @@ -0,0 +1,49 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package test_package is + + -- Number of Domains + constant NUM_DOMAIN : integer := 1; + ----------------------------------------------------------------------------------------------------- + -- *DO NOT MODIFY BEGIN* + type USER_DOMAIN_ID_TYPE is array (NUM_DOMAIN-1 downto 0) of integer; + -- *DO NOT MODIFY END* + ----------------------------------------------------------------------------------------------------- + -- Array of Domain IDs + constant USER_DOMAIN_ID : USER_DOMAIN_ID_TYPE := (0 => 1); + + constant DOMAIN_ID_WIDTH : integer := 32; + + type TEST_ARRAY_TYPE is array (1 downto 0) of string(1 to 10); + constant TEST1 : string(1 to 10) := "Blah" & (1 to 6 => NUL); + constant TEST2 : TEST_ARRAY_TYPE := (0 => "Blah" & (1 to 6 => NUL), + 1 => "Baba" & (1 to 6 => NUL)); + + type DOMAIN_ID_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(DOMAIN_ID_WIDTH-1 downto 0); + + function gen_domain_ids (user_id : USER_DOMAIN_ID_TYPE) return DOMAIN_ID_TYPE; + + + +end package; + +package body test_package is + + function gen_domain_ids (user_id : USER_DOMAIN_ID_TYPE) return DOMAIN_ID_TYPE is + variable ret : DOMAIN_ID_TYPE; + begin + ret := (others => (others => '0')); + for i in 0 to user_id'length-1 loop + -- Check if User provided Domain ID fits + -- NOTE: Cannot assert due to vhdl integer overflow. + --assert (user_id(i) < (2**DOMAIN_ID_WIDTH-1 - PORT_CONFIG_PB) / PORT_CONFIG_DG) report "Domain ID range exceeded" severity failure; + ret(i) := std_logic_vector(to_unsigned(user_id(i), ret(i)'length)); + end loop; + return ret; + end function; + + constant DOMAIN_ID : DOMAIN_ID_TYPE := gen_domain_ids(USER_DOMAIN_ID); + +end package body; diff --git a/syn/DE10-Nano/top.qsf b/syn/DE10-Nano/top.qsf index 4f53fb5..cdc732e 100644 --- a/syn/DE10-Nano/top.qsf +++ b/syn/DE10-Nano/top.qsf @@ -38,18 +38,20 @@ set_global_assignment -name FAMILY "Cyclone V" set_global_assignment -name DEVICE 5CSEBA6U23I7 -set_global_assignment -name TOP_LEVEL_ENTITY rtps_handler +set_global_assignment -name TOP_LEVEL_ENTITY test set_global_assignment -name ORIGINAL_QUARTUS_VERSION 18.1.0 set_global_assignment -name PROJECT_CREATION_TIME_DATE "12:05:11 MAY 29, 2020" -set_global_assignment -name LAST_QUARTUS_VERSION "18.1.0 Lite Edition" -set_global_assignment -name VHDL_FILE ../../src/rtps_package.vhd -hdl_version VHDL_2008 -set_global_assignment -name VHDL_FILE ../../src/rtps_handler.vhd -hdl_version VHDL_2008 -set_global_assignment -name VHDL_FILE ../../src/math_pkg.vhd -hdl_version VHDL_2008 +set_global_assignment -name LAST_QUARTUS_VERSION "19.1.0 Lite Edition" set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files set_global_assignment -name MIN_CORE_JUNCTION_TEMP "-40" set_global_assignment -name MAX_CORE_JUNCTION_TEMP 100 set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 256 -set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top +set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW" +set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)" set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top -set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top \ No newline at end of file +set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top +set_global_assignment -name VHDL_FILE ../../src/test_package.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../../src/test.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../../src/math_pkg.vhd -hdl_version VHDL_2008 +set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file