* Partly implemented rtps_builtin_endpoint

* Modify rtps_handler
* Modify rtps_package
This commit is contained in:
John Ring 2020-09-22 21:04:29 +02:00
parent 4a6b19ef25
commit aaae545c8b
3 changed files with 1311 additions and 55 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,21 +5,22 @@ use ieee.numeric_std.all;
use work.math_pkg.all; use work.math_pkg.all;
use work.rtps_package.all; use work.rtps_package.all;
-- TODO: Remove alignment logic for RTPS Submessages, since all Submessages are 32-bit aligned
-- Checksum has to be checked before -- Checksum has to be checked before
entity rtps_handler is entity rtps_handler is
port ( port (
clk : in std_logic; -- Input Clock clk : in std_logic; -- Input Clock
reset : in std_logic; -- Synchronous Reset reset : in std_logic; -- Synchronous Reset
empty : in std_logic; -- Input FIFO empty flag empty : in std_logic; -- Input FIFO empty flag
rd : out std_logic; -- Input FIFO read signal rd : out std_logic; -- Input FIFO read signal
data_in : in std_logic_vector(31 downto 0); -- Input FIFO data signal data_in : in std_logic_vector(31 downto 0); -- Input FIFO data signal
builtin_output : out BUILTIN_ENDPOINT_TYPE; -- Output FIFO (Built-In Endpoints) data signal builtin_output : out BUILTIN_ENDPOINT_TYPE; -- Output FIFO (Built-In Endpoints) data signal
builtin_full : in std_logic_vector(NUM_DOMAIN-1 downto 0); -- Output FIFO (Built-In Endpoints) full signal builtin_full : in std_logic_vector(NUM_DOMAIN-1 downto 0); -- Output FIFO (Built-In Endpoints) full signal
builtin_wr : out std_logic_vector(NUM_DOMAIN-1 downto 0); -- Output FIFO (Built-In Endpoints) write signal builtin_wr : out std_logic_vector(NUM_DOMAIN-1 downto 0); -- Output FIFO (Built-In Endpoints) write signal
user_output : out USER_ENDPOINT_OUTPUT; -- Output FIFO (User Endpoints) data signal user_output : out USER_ENDPOINT_OUTPUT; -- Output FIFO (User Endpoints) data signal
user_full : in std_logic_vector(MAX_ENDPOINTS-1 downto 0); -- Output FIFO (User Endpoints) full signal user_full : in std_logic_vector(MAX_ENDPOINTS-1 downto 0); -- Output FIFO (User Endpoints) full signal
user_wr : out std_logic_vector(MAX_ENDPOINTS-1 downto 0) -- Output FIFO (User Endpoints) write signal user_wr : out std_logic_vector(MAX_ENDPOINTS-1 downto 0) -- Output FIFO (User Endpoints) write signal
); );
end entity; end entity;
@ -60,8 +61,8 @@ architecture arch of rtps_handler is
-- FSM states. Explained below in detail -- FSM states. Explained below in detail
type STAGE_TYPE is (SRC_ADDR_HEADER, DEST_ADDR_HEADER, LEN_HEADER, UDP_HEADER_1, UDP_HEADER_2, RTPS_HEADER_1, RTPS_HEADER_2, type STAGE_TYPE is (SRC_ADDR_HEADER, DEST_ADDR_HEADER, LEN_HEADER, UDP_HEADER_1, UDP_HEADER_2, RTPS_HEADER_1, RTPS_HEADER_2,
RTPS_HEADER_3, RTPS_SUB_HEADER, EXTRACT_LOCATOR_UDPv4_1, EXTRACT_LOCATOR_UDPv4_2, RTPS_HEADER_3, RTPS_SUB_HEADER, EXTRACT_LOCATOR_UDPv4_1, EXTRACT_LOCATOR_UDPv4_2,
EXTRACT_LOCATOR_LIST, EXTRACT_LOCATOR, INFO_SRC_HEADER, EXTRACT_DOMAIN_ID, SRC_ENTPOINT, DATA_HEADER, EXTRACT_LOCATOR_LIST, EXTRACT_LOCATOR, INFO_SRC_HEADER, EXTRACT_DOMAIN_ID, SRC_ENDPOINT, DATA_HEADER,
MATCH_DST_ENDPOINT, PUSH_PAYLOAD_HEADER, DATA_SKIP_HEADER, PUSH_PAYLOAD, CHECK_SUB_END, SKIP_PACKET, MATCH_DST_ENDPOINT, PUSH_PAYLOAD_HEADER, PUSH_DEST, DATA_SKIP_HEADER, PUSH_PAYLOAD, CHECK_SUB_END, SKIP_PACKET,
SKIP_SUB); SKIP_SUB);
@ -108,6 +109,8 @@ architecture arch of rtps_handler is
signal flags, flags_next : std_logic_vector(7 downto 0) := (others => '0'); signal flags, flags_next : std_logic_vector(7 downto 0) := (others => '0');
-- Source Endpoint Entity ID latch -- Source Endpoint Entity ID latch
signal src_entityid, src_entityid_next : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0'); signal src_entityid, src_entityid_next : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');
-- Destination Endpoint Entity ID latch
signal dest_entityid, dest_entityid_next : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');
-- Vector denoting the Destination User Endpoints of the Message -- Vector denoting the Destination User Endpoints of the Message
signal user_endpoint, user_endpoint_next : std_logic_vector(MAX_ENDPOINTS-1 downto 0) := (others => '0'); signal user_endpoint, user_endpoint_next : std_logic_vector(MAX_ENDPOINTS-1 downto 0) := (others => '0');
-- Denoting if the Message is destined for the Built-in Endpoints -- Denoting if the Message is destined for the Built-in Endpoints
@ -187,7 +190,7 @@ architecture arch of rtps_handler is
return ret; return ret;
end function; end function;
-- Compares argument 'ref' with every elemant of 'ar', and returns the index of the last match. -- Compares argument 'ref' with every element of 'ar', and returns the index of the last match.
-- If no match is found, array length is returned. -- If no match is found, array length is returned.
function match_id_port ( ref : std_logic_vector(UDP_PORT_WIDTH-1 downto 0); function match_id_port ( ref : std_logic_vector(UDP_PORT_WIDTH-1 downto 0);
ar : IPv4_PORT_TYPE) return integer is ar : IPv4_PORT_TYPE) return integer is
@ -318,10 +321,11 @@ begin
-- EXTRACT_LOCATOR Parse Locator -- EXTRACT_LOCATOR Parse Locator
-- INFO_SRC_HEADER Parse INFO_SRC content -- INFO_SRC_HEADER Parse INFO_SRC content
-- EXTRACT_DOMAIN_ID Extract Domain ID from GUID Prefix (Works only for GUID Prefixes generated by rtps_package) -- EXTRACT_DOMAIN_ID Extract Domain ID from GUID Prefix (Works only for GUID Prefixes generated by rtps_package)
-- SRC_ENTPOINT Read EntityID -- SRC_ENDPOINT Read EntityID
-- DATA_HEADER Parse Submessage DATA Subheader -- DATA_HEADER Parse Submessage DATA Subheader
-- MATCH_DST_ENDPOINT Determine destination of Submessage -- MATCH_DST_ENDPOINT Determine destination of Submessage
-- PUSH_PAYLOAD_HEADER Write Payload Header into relevant output FIFOs -- PUSH_PAYLOAD_HEADER Write Payload Header into relevant output FIFOs
-- PUSH_DEST Write Destination Entity ID (Only for Built-In Endpoints)
-- DATA_SKIP_HEADER Read known DATA Submessage Subheader Elements, and skip the rest -- DATA_SKIP_HEADER Read known DATA Submessage Subheader Elements, and skip the rest
-- PUSH_PAYLOAD Read from input FIFO into relevant output FIFOs -- PUSH_PAYLOAD Read from input FIFO into relevant output FIFOs
-- CHECK_SUB_END Check if end of Submessage is reached, and handle accordingly -- CHECK_SUB_END Check if end of Submessage is reached, and handle accordingly
@ -344,6 +348,7 @@ begin
domain_id_next <= domain_id; domain_id_next <= domain_id;
flags_next <= flags; flags_next <= flags;
src_entityid_next <= src_entityid; src_entityid_next <= src_entityid;
dest_entityid_next <= dest_entityid;
user_endpoint_next <= user_endpoint; user_endpoint_next <= user_endpoint;
builtin_endpoint_next <= builtin_endpoint; builtin_endpoint_next <= builtin_endpoint;
return_stage_next <= return_stage; return_stage_next <= return_stage;
@ -497,9 +502,7 @@ begin
if (empty = '0') then if (empty = '0') then
rd_sig <= '1'; rd_sig <= '1';
-- Sender GUID_Prefix -- Sender GUID_Prefix
-- Since we already have the Src Addr and Port, we do not need the --TODO <= data_in;
-- Guid_prefix of the source.
--TODO <= data_in;
if (cnt = GUIDPREFIX_WIDTH/32) then if (cnt = GUIDPREFIX_WIDTH/32) then
-- Next Stage -- Next Stage
stage_next <= RTPS_SUB_HEADER; stage_next <= RTPS_SUB_HEADER;
@ -519,10 +522,10 @@ begin
if (empty = '0') then if (empty = '0') then
rd_sig <= '1'; rd_sig <= '1';
-- TODO: Still valid?
-- The case that a submessage is the last one (Length=0) is silently handled -- The case that a submessage is the last one (Length=0) is silently handled
-- by the 'SKIP_SUB' stage, which is taken after every Submessage (in order to skip -- by the 'SKIP_SUB' stage, which is taken after every Submessage (in order to skip
-- unknown parts of the Submessage and keep backwards Compatibility [see DDSI-RTPS 2.3 Section 8.3.4.1]). -- unknown parts of the Submessage and keep backwards Compatibility [see DDSI-RTPS 2.3 Section 8.3.4.1]).
-- TODO: Still valid?
--DEFAULT --DEFAULT
src_is_reader_next <= '0'; src_is_reader_next <= '0';
@ -584,7 +587,7 @@ begin
stage_next <= EXTRACT_LOCATOR_UDPv4_1; stage_next <= EXTRACT_LOCATOR_UDPv4_1;
end if; end if;
-- Heartbeat (Writer -> Reader, Available SeqNum) -- Heartbeat (Writer -> Reader, Available SeqNum)
-- STAGE ORDER: MATCH_DST_ENDPOINT -> SRC_ENTPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER -- STAGE ORDER: MATCH_DST_ENDPOINT -> SRC_ENDPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER
when SID_HEARTBEAT => when SID_HEARTBEAT =>
-- Check Length -- Check Length
if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_HEARTBEAT_SIZE)) then if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_HEARTBEAT_SIZE)) then
@ -593,10 +596,10 @@ begin
else else
-- Next Stage -- Next Stage
stage_next <= MATCH_DST_ENDPOINT; stage_next <= MATCH_DST_ENDPOINT;
return_stage_next <= SRC_ENTPOINT; return_stage_next <= SRC_ENDPOINT;
end if; end if;
-- AckNack (Reader -> Writer, Request SeqNum) -- AckNack (Reader -> Writer, Request SeqNum)
-- STAGE ORDER: SRC_ENTPOINT -> MATCH_DST_ENDPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER -- STAGE ORDER: SRC_ENDPOINT -> MATCH_DST_ENDPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER
when SID_ACKNACK => when SID_ACKNACK =>
-- Check Length -- Check Length
if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_ACKNACK_SIZE)) then if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_ACKNACK_SIZE)) then
@ -606,10 +609,10 @@ begin
-- Mark if destination is for writers -- Mark if destination is for writers
src_is_reader_next <= '1'; src_is_reader_next <= '1';
-- Next Stage -- Next Stage
stage_next <= SRC_ENTPOINT; stage_next <= SRC_ENDPOINT;
end if; end if;
-- GAP (Writer -> Reader, Invalidate SeqNum) -- GAP (Writer -> Reader, Invalidate SeqNum)
-- STAGE ORDER: MATCH_DST_ENDPOINT -> SRC_ENTPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER -- STAGE ORDER: MATCH_DST_ENDPOINT -> SRC_ENDPOINT -> PUSH_PAYLOAD_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER
when SID_GAP => when SID_GAP =>
-- Check Length -- Check Length
if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_GAP_SIZE)) then if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_GAP_SIZE)) then
@ -618,10 +621,10 @@ begin
else else
-- Next Stage -- Next Stage
stage_next <= MATCH_DST_ENDPOINT; stage_next <= MATCH_DST_ENDPOINT;
return_stage_next <= SRC_ENTPOINT; return_stage_next <= SRC_ENDPOINT;
end if; end if;
-- DATA (Writer -> Reader, SeqNum+Data) -- DATA (Writer -> Reader, SeqNum+Data)
-- STAGE ORDER: DATA_HEADER -> MATCH_DST_ENDPOINT -> SRC_ENTPOINT -> PUSH_PAYLOAD_HEADER -> DATA_SKIP_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER -- STAGE ORDER: DATA_HEADER -> MATCH_DST_ENDPOINT -> SRC_ENDPOINT -> PUSH_PAYLOAD_HEADER -> DATA_SKIP_HEADER -> PUSH_PAYLOAD -> RTPS_SUB_HEADER
when SID_DATA => when SID_DATA =>
-- Check Length -- Check Length
if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_DATA_SIZE)) then if ( (rtps_sub_length /= (rtps_sub_length'reverse_range => '0')) and (to_integer(unsigned(rtps_sub_length)) < MIN_DATA_SIZE)) then
@ -781,19 +784,20 @@ begin
if (empty = '0') then if (empty = '0') then
rd_sig <= '1'; rd_sig <= '1';
-- Second Word of INFO_SRC Submessage -- Second Word of INFO_SRC Submessage
if (cnt = 2) then case (cnt) is
-- Check Major Protocol Version when 2 =>
if (aligned_data_in(31 downto 24) /= PROTOCOLVERSION_2_4(15 downto 8)) then -- Default Next Stage
-- Protocol Supported, skip rest of Submessage
stage_next <= SKIP_SUB; stage_next <= SKIP_SUB;
else -- Check Major Protocol Version
-- Protocol not supported, skip Packet if (aligned_data_in(31 downto 24) /= PROTOCOLVERSION_2_4(15 downto 8)) then
stage_next <= SKIP_PACKET; -- Protocol not supported, skip rest of Packet
end if; stage_next <= SKIP_PACKET;
else end if;
-- TODO: Check how many addres are synthesized for cnt/cnt_next when others =>
cnt_next <= cnt + 1; null;
end if; end case;
-- TODO: Check how many addres are synthesized for cnt/cnt_next
cnt_next <= cnt + 1;
-- Latch Input for alignment purposes -- Latch Input for alignment purposes
align_sig_next <= data_in(23 downto 0); align_sig_next <= data_in(23 downto 0);
end if; end if;
@ -815,7 +819,7 @@ begin
-- Latch Input for alignment purposes -- Latch Input for alignment purposes
align_sig_next <= data_in(23 downto 0); align_sig_next <= data_in(23 downto 0);
end if; end if;
when SRC_ENTPOINT => when SRC_ENDPOINT =>
if (empty = '0') then if (empty = '0') then
rd_sig <= '1'; rd_sig <= '1';
-- Latch src Entity ID -- Latch src Entity ID
@ -843,7 +847,7 @@ begin
payload_length_next <= std_logic_vector(unsigned(payload_length) - unsigned(normalize_length(endian_swap(rtps_sub_endianness, rtps_sub_data_length)))); payload_length_next <= std_logic_vector(unsigned(payload_length) - unsigned(normalize_length(endian_swap(rtps_sub_endianness, rtps_sub_data_length))));
-- Next Stage -- Next Stage
stage_next <= MATCH_DST_ENDPOINT; stage_next <= MATCH_DST_ENDPOINT;
return_stage_next <= SRC_ENTPOINT; return_stage_next <= SRC_ENDPOINT;
-- Latch Input for alignment purposes -- Latch Input for alignment purposes
align_sig_next <= data_in(23 downto 0); align_sig_next <= data_in(23 downto 0);
end if; end if;
@ -895,8 +899,10 @@ begin
else else
stage_next <= SKIP_SUB; stage_next <= SKIP_SUB;
end if; end if;
-- Latch Destination Entity ID
dest_entityid_next <= aligned_data_in;
-- Latch Input for alignment purposes -- Latch Input for alignment purposes
align_sig_next <= data_in(23 downto 0); align_sig_next <= data_in(23 downto 0);
end if; end if;
when PUSH_PAYLOAD_HEADER => when PUSH_PAYLOAD_HEADER =>
-- NOTE: This is a synchronised push on potentially multiple output FIFOs. -- NOTE: This is a synchronised push on potentially multiple output FIFOs.
@ -919,7 +925,12 @@ begin
output_sig <= src_entityid; output_sig <= src_entityid;
wr_sig <= '1'; wr_sig <= '1';
-- Next Stage -- Next Stage
if (is_data = '1') then if (builtin_endpoint = '1') then
-- If the destination is a built-in Endpoint, push also the destination ID,
-- so that the sub-entity knows the intended target.
-- For the User-Endpoints this is implicitly decoded by the domain ID and is not necessary.
stage_next <= PUSH_DEST;
else if (is_data = '1') then
stage_next <= DATA_SKIP_HEADER; stage_next <= DATA_SKIP_HEADER;
-- Reset Counter -- Reset Counter
cnt_next <= 1; cnt_next <= 1;
@ -930,6 +941,21 @@ begin
null; null;
end case; end case;
end if; end if;
-- Only Taken for built-in Endpoints
when PUSH_DEST =>
-- If Output FIFOs not full (Only consider Builtin output FIFOs)
if (builtin_endpoint = '1' and builtin_full(domain_id) = '0') then
output_sig <= dest_entityid;
wr_sig <= '1';
-- Next Stage
if (is_data = '1') then
stage_next <= DATA_SKIP_HEADER;
-- Reset Counter
cnt_next <= 1;
else
stage_next <= PUSH_PAYLOAD;
end if;
end if;
when DATA_SKIP_HEADER => when DATA_SKIP_HEADER =>
if (empty = '0') then if (empty = '0') then
-- Known DATA Header Data (Sequence Number Field) -- Known DATA Header Data (Sequence Number Field)
@ -1065,6 +1091,7 @@ begin
domain_id <= 0; domain_id <= 0;
flags <= (others => '0'); flags <= (others => '0');
src_entityid <= (others => '0'); src_entityid <= (others => '0');
dest_entityid <= (others => '0');
user_endpoint <= (others => '0'); user_endpoint <= (others => '0');
numlocators <= (others => '0'); numlocators <= (others => '0');
payload_length <= (others => '0'); payload_length <= (others => '0');
@ -1091,6 +1118,7 @@ begin
domain_id <= domain_id_next; domain_id <= domain_id_next;
flags <= flags_next; flags <= flags_next;
src_entityid <= src_entityid_next; src_entityid <= src_entityid_next;
dest_entityid <= dest_entityid_next;
user_endpoint <= user_endpoint_next; user_endpoint <= user_endpoint_next;
numlocators <= numlocators_next; numlocators <= numlocators_next;
payload_length <= payload_length_next; payload_length <= payload_length_next;

View File

@ -46,30 +46,92 @@ package rtps_package is
-- *DO NOT MODIFY BEGIN* -- *DO NOT MODIFY BEGIN*
type ENDPOINT_DOMAIN_MAP_TYPE is array (MAX_ENDPOINTS-1 downto 0) of integer; type ENDPOINT_DOMAIN_MAP_TYPE is array (MAX_ENDPOINTS-1 downto 0) of integer;
type ENDPOINT_WITH_KEY_TYPE is array (MAX_ENDPOINTS-1 downto 0) of boolean; type ENDPOINT_WITH_KEY_TYPE is array (MAX_ENDPOINTS-1 downto 0) of boolean;
type ENDPOINT_TOPIC_STRING_TYPE is array (MAX_ENDPOINTS-1 downto 0) of string(1 to 256);
type ENDPOINT_TOPIC_TYPE is array (MAX_ENDPOINTS-1 downto 0) of std_logic_vector(0 to (256*8)-1);
subtype QOS_TYPE is array (MAX_ENDPOINTS-1 downto 0) of std_logic_vector(31 downto 0);
subtype QOS_SLV_TYPE is array (MAX_ENDPOINTS-1 downto 0) of std_logic_vector(31 downto 0);
type DURATION_TYPE is array (1 downto 0) of unsigned(31 downto 0);
type ENDPOINT_DURATION_TYPE is array (MAX_ENDPOINTS-1 downto 0) of DURATION_TYPE;
constant DURATION_INFINITE : DURATION_TYPE := (x"7fffffff", x"ffffffff");
-- DURABILITY KIND
constant VOLATILE_DURABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32));
constant TRANSIENT_LOCAL_DURABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
constant TRANSIENT_DURABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(2,32));
constant PERSISTENT_DURABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(3,32));
-- LIVELINESS KIND
constant AUTOMATIC_LIVELINESS_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32));
constant MANUAL_BY_PARTICIPANT_LIVELINESS_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
constant MANUAL_BY_TOPIC_LIVELINESS_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(2,32));
-- RELIABILITY KIND
constant BEST_EFFORT_RELIABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
constant RELIABLE_RELIABILITY_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(2,32));
-- OWNERSHIP KIND
constant SHARED_OWNERSHIP_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32));
constant EXCLUSIVE_OWNERSHIP_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
-- DESTINATION ORDER KIND
constant BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32));
constant BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
-- PRESENTATION KIND
constant INSTANCE_PRESENTATION_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(0,32));
constant TOPIC_PRESENTATION_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(1,32));
constant GROUP_PRESENTATION_QOS : std_logic_vector(31 downto 0) := std_logic_vector(to_unsigned(2,32));
-- HISTORY KIND
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));
-- *DO NOT MODIFY END* -- *DO NOT MODIFY END*
----------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------
--***RTPS ENDPOINTS*** --***RTPS ENDPOINTS***
-- Array mapping the RTPS Endpoints to their respective Domain IDs -- Array mapping the RTPS Endpoints to their respective Domain IDs
-- The index of this array denotes the Endpoint, and the element value the index of the Domain in the 'USER_DOMAIN_ID'. -- The index of this array denotes the Endpoint, and the element value the index of the Domain in the 'USER_DOMAIN_ID'.
constant ENDPOINT_DOMAIN_MAP: ENDPOINT_DOMAIN_MAP_TYPE := (0 => 0); constant ENDPOINT_DOMAIN_MAP : ENDPOINT_DOMAIN_MAP_TYPE := (0 => 0);
-- Array denoting if Endpoints use Keyed Topics -- Array denoting if Endpoints use Keyed Topics
constant ENDPOINT_WITH_KEY : ENDPOINT_WITH_KEY_TYPE := (0 => FALSE); constant ENDPOINT_WITH_KEY : ENDPOINT_WITH_KEY_TYPE := (0 => FALSE);
-- Array mapping Topic Strings to Endpoints
-- NOTE: All strings have to be padded to 256 characters
constant ENDPOINT_TOPIC_STRING : ENDPOINT_TOPIC_STRING_TYPE := (0 => "Placeholder" & (12 to 256 => NUL));
constant ENDPOINT_TOPIC : ENDPOINT_TOPIC_TYPE; -- Deferred to Package Body
constant ENDPOINT_DURABILITY : QOS_TYPE := (0 => VOLATILE_DURABILITY_QOS);
constant ENDPOINT_PRESENTATION : QOS_TYPE := (0 => INSTANCE_PRESENTATION_QOS);
constant ENDPOINT_COHERENT_ACCESS : std_logic_vector(MAX_ENDPOINTS-1 downto 0) := (others => '0');
constant ENDPOINT_ORDERED_ACCESS : std_logic_vector(MAX_ENDPOINTS-1 downto 0) := (others => '0');
constant ENDPOINT_DEADLINE : ENDPOINT_DURATION_TYPE := (0 => DURATION_INFINITE); --TODO: Assert
constant ENDPOINT_LIVELINESS : QOS_TYPE := (0 => AUTOMATIC_LIVELINESS_QOS);
constant ENDPOINT_LEASE_DURATION : ENDPOINT_DURATION_TYPE := (0 => DURATION_INFINITE); --TODO: Assert
-- Only relevant for Readers
constant ENDPOINT_TIME_BASED_FILTER : ENDPOINT_DURATION_TYPE := (0 => (to_unsigned(0,32),to_unsigned(0,32))); --TODO: Assert
constant ENDPOINT_RELIABILITY : QOS_TYPE := (0 => RELIABLE_RELIABILITY_QOS);
constant ENDPOINT_MAX_BLOCKING_TIME : ENDPOINT_DURATION_TYPE := (0 => (to_unsigned(0,32),to_unsigned(1,32)));
-- Only relevant for Writers
constant ENDPOINT_LIFESPAN : ENDPOINT_DURATION_TYPE := (0 => DURATION_INFINITE);
constant ENDPOINT_DESTINATION_ORDER : QOS_TYPE := (0 => BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS);
constant ENDPOINT_HISTORY : QOS_TYPE := (0 => KEEP_LAST_HISTORY_QOS);
constant ENDPOINT_DEPTH : QOS_SLV_TYPE := (0 => std_logic_vector(to_unsigned(1,32))); --TODO: Assert
constant ENDPOINT_MAX_SAMPLES : QOS_SLV_TYPE := (0 => std_logic_vector(to_unsigned(0,32))); --TODO: Assert
constant ENDPOINT_MAX_INSTANCES : QOS_SLV_TYPE := (0 => std_logic_vector(to_unsigned(0,32))); --TODO: Assert
constant ENDPOINT_MAX_SAMP_PER_INST : QOS_SLV_TYPE := (0 => std_logic_vector(to_unsigned(0,32))); --TODO: Assert
--*****DDSI-RTPS 2.3***** --*****DDSI-RTPS 2.3*****
-- Default Multicast Ipv4 Address (239.255.0.1) -- Default Multicast Ipv4 Address (239.255.0.1)
constant DEFAULT_IPv4_MULTICAST_ADDRESS : std_logic_vector(31 downto 0) := x"EFFF0001"; constant DEFAULT_IPv4_MULTICAST_ADDRESS : std_logic_vector(31 downto 0) := x"EFFF0001";
constant GUIDPREFIX_WIDTH : integer := 96; constant GUIDPREFIX_WIDTH : integer := 96;
constant PROTOCOLVERSION_WIDTH : integer := 16; constant PROTOCOLVERSION_WIDTH : integer := 16;
constant VENDORID_WIDTH : integer := 16; constant VENDORID_WIDTH : integer := 16;
constant SUBMESSAGE_ID_WIDTH : integer := 8; constant SUBMESSAGE_ID_WIDTH : integer := 8;
constant DOMAIN_ID_WIDTH : integer := 32; constant DOMAIN_ID_WIDTH : integer := 32;
constant UDP_PORT_WIDTH : integer := 16; constant UDP_PORT_WIDTH : integer := 16;
constant ENTITYID_WIDTH : integer := 32; constant ENTITYID_WIDTH : integer := 32;
constant PROTOCOL_WIDTH : integer := 32; constant PROTOCOL_WIDTH : integer := 32;
constant PARAMETER_ID_WIDTH : integer := 16;
constant PAYLOAD_REPRESENTATION_ID : integer := 16;
constant PAYLOAD_REPRESENTATION_OPTIONS : integer := 16;
-- 'RTPS' in Ascii code -- 'RTPS' in Ascii code
constant PROTOCOL_RTPS : std_logic_vector(PROTOCOL_WIDTH-1 downto 0) := x"52545053"; constant PROTOCOL_RTPS : std_logic_vector(PROTOCOL_WIDTH-1 downto 0) := x"52545053";
@ -90,6 +152,83 @@ package rtps_package is
constant SID_HEARTBEAT_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"13"; constant SID_HEARTBEAT_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"13";
constant SID_DATA : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"15"; constant SID_DATA : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"15";
constant SID_DATA_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"16"; constant SID_DATA_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"16";
-- Parameter IDs
constant PID_PAD : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0000";
constant PID_SENTINEL : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0001";
constant PID_TOPIC_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0005";
constant PID_TYPE_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0007";
constant PID_USER_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002c";
constant PID_GROUP_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002d";
constant PID_TOPIC_DATA : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002e";
constant PID_DURABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001d";
constant PID_DURABILITY_SERVICE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001e";
constant PID_DEADLINE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0023";
constant PID_LATENCY_BUDGET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0027";
constant PID_LIVELINESS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001b";
constant PID_RELIABILITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001a";
constant PID_LIFESPAN : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002b";
constant PID_DESTINATION_ORDER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0025";
constant PID_HISTORY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0040";
constant PID_RESOURCE_LIMITS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0041";
constant PID_OWNERSHIP : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001f";
constant PID_OWNERSHIP_STRENGTH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"001e";
constant PID_PRESENTATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0021";
constant PID_PARTITION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0029";
constant PID_TIME_BASED_FILTER : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0004";
constant PID_TRANSPORT_PRIORITY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0049";
constant PID_DOMAIN_ID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"000f";
constant PID_DOMAIN_TAG : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"4014";
constant PID_PROTOCOL_VERSION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0015";
constant PID_VENDORID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0016";
constant PID_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"002f";
constant PID_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0030";
constant PID_DEFAULT_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0031";
constant PID_DEFAULT_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0048";
constant PID_METATRAFFIC_UNICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0032";
constant PID_METATRAFFIC_MULTICAST_LOCATOR : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0033";
constant PID_EXPECTS_INLINE_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0043";
constant PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0034";
constant PID_PARTICIPANT_LEASE_DURATION : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0002";
constant PID_CONTENT_FILTER_PROPERTY : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0035";
constant PID_PARTICIPANT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0050";
constant PID_GROUP_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0052";
constant PID_BUILTIN_ENDPOINT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0058";
constant PID_BUILTIN_ENDPOINT_QOS : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0077";
constant PID_PROPERTY_LIST : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0059";
constant PID_TYPE_MAX_SIZE_SERIALIZED : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0060";
constant PID_ENTITY_NAME : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0062";
constant PID_ENDPOINT_GUID : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"005a";
-- INLINE-QOS ONLY
constant PID_CONTENT_FILTER_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0055";
constant PID_COHERENT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0056";
constant PID_DIRECTED_WRITE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0057";
constant PID_ORIGINAL_WRITER_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0061";
constant PID_GROUP_COHERENT_SET : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0063";
constant PID_GROUP_SEQ_NUM : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0064";
constant PID_WRITER_GROUP_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0065";
constant PID_SECURE_WRITER_GROUP_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0066";
constant PID_KEY_HASH : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0070";
constant PID_STATUS_INFO : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"0071";
-- XTYPES 1.3
constant PID_EXTENDED : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"7F01";
constant PID_LIST_END : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"7F02";
constant PID_IGNORE : std_logic_vector(PARAMETER_ID_WIDTH-1 downto 0) := x"3F03";
-- PAYLOAD REPRESENTATION IDENTIFIERS
constant CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0000";
constant CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0001";
constant PL_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0002";
constant PL_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0003";
constant XML : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0004";
constant CDR2_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0010";
constant CDR2_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0011";
constant PL_CDR2_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0012";
constant PL_CDR2_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0013";
constant D_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0014";
constant D_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID-1 downto 0) := x"0015";
@ -102,7 +241,7 @@ package rtps_package is
-- Since this implementation runs on the same network stack and the RTPS Endpoints (Readers & Writers) -- Since this implementation runs on the same network stack and the RTPS Endpoints (Readers & Writers)
-- can be differentiated based on their Entity ID, it makes no sense to have multiple IP Addresses -- can be differentiated based on their Entity ID, it makes no sense to have multiple IP Addresses
-- (and hence multiple Participants). -- (and hence multiple Participants).
-- We generate just single participant for every Domain, and later match the Endpoints to their respective -- We generate just a single participant for every Domain, and later match the Endpoints to their respective
-- Domain (and thus also to their respective RTPS Participant). -- Domain (and thus also to their respective RTPS Participant).
type IPv4_PORT_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(UDP_PORT_WIDTH-1 downto 0); type IPv4_PORT_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(UDP_PORT_WIDTH-1 downto 0);
@ -112,6 +251,8 @@ package rtps_package is
constant USER_IPv4_UNICAST_PORT : IPv4_PORT_TYPE; -- Deferred to Package Body constant USER_IPv4_UNICAST_PORT : IPv4_PORT_TYPE; -- Deferred to Package Body
type GUIDPREFIX_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(GUIDPREFIX_WIDTH-1 downto 0); type GUIDPREFIX_TYPE is array (NUM_DOMAIN-1 downto 0) of std_logic_vector(GUIDPREFIX_WIDTH-1 downto 0);
type GUIDPREFIX_ARRAY_TYPE is array (GUIDPREFIX_WIDTH/32-1 downto 0) of std_logic_vector(31 downto 0);
type GUID_ARRAY_TYPE is array ((GUIDPREFIX_WIDTH+ENTITYID_WIDTH)/32-1 downto 0) of std_logic_vector(31 downto 0);
constant GUIDPREFIX : GUIDPREFIX_TYPE; -- Deferred to Package Body constant GUIDPREFIX : GUIDPREFIX_TYPE; -- Deferred to Package Body
constant GUIDPREFIX_UNKNOWN : std_logic_vector(GUIDPREFIX_WIDTH-1 downto 0) := (others => '0'); constant GUIDPREFIX_UNKNOWN : std_logic_vector(GUIDPREFIX_WIDTH-1 downto 0) := (others => '0');
@ -152,6 +293,21 @@ package rtps_package is
constant LOCATOR_KIND_UDPv4 : std_logic_vector := std_logic_vector(to_signed(1,LOCATOR_KIND_WIDTH)); constant LOCATOR_KIND_UDPv4 : std_logic_vector := std_logic_vector(to_signed(1,LOCATOR_KIND_WIDTH));
constant LOCATOR_KIND_UDPv6 : std_logic_vector := std_logic_vector(to_signed(2,LOCATOR_KIND_WIDTH)); constant LOCATOR_KIND_UDPv6 : std_logic_vector := std_logic_vector(to_signed(2,LOCATOR_KIND_WIDTH));
-- BUILTIN ENDPOINT SET POSITIONS
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER : integer := 0;
constant DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR : integer := 1;
constant DISC_BUILTIN_ENDPOINT_PUBLICATIONS_ANNOUNCER : integer := 2;
constant DISC_BUILTIN_ENDPOINT_PUBLICATIONS_DETECTOR : integer := 3;
constant DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_ANNOUNCER : integer := 4;
constant DISC_BUILTIN_ENDPOINT_SUBSCRIPTIONS_DETECTOR : integer := 5;
constant BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER : integer := 10;
constant BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER : integer := 11;
constant DISC_BUILTIN_ENDPOINT_TOPICS_ANNOUNCER : integer := 28;
constant DISC_BUILTIN_ENDPOINT_TOPICS_DETECTOR : integer := 29;
-- BUILTIN ENDPOINT QOS BITMASK
constant BEST_EFFORT_PARTICIPANT_MESSAGE_DATA_READER : integer := 0;
--*****CUSTOM***** --*****CUSTOM*****
--**************** --****************
@ -296,4 +452,18 @@ package body rtps_package is
constant ENTITYID : ENTITYID_TYPE := gen_entyid; constant ENTITYID : ENTITYID_TYPE := gen_entyid;
function convert_string (string_array : ENDPOINT_TOPIC_STRING_TYPE) return ENDPOINT_TOPIC_TYPE is
variable ret : ENDPOINT_TOPIC_TYPE
begin
ret := (others => (others => '0'));
for i in 0 to ret'length-1 loop
for j in 1 to ret'length(1) loop
ret(i)((256-j)*8 to ((257-j)*8)-1) := std_logic_vector(to_unsigned(character'POS(string_array(i)(j)), 8));
end loop;
end loop;
return ret;
end function;
constant ENDPOINT_TOPIC : ENDPOINT_TOPIC_TYPE := convert_string(ENDPOINT_TOPIC_STRING);
end package body; end package body;