commit b118482e63e6996fed9b49e52bb9a51b1289ebd5 Author: Greek Date: Sun May 10 19:31:49 2020 +0200 * Added DDS/RTPS Documentation * Added initial constant package diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7ca8cb2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +doc/*.pdf filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/doc/DDS-XRCE_1-0.pdf b/doc/DDS-XRCE_1-0.pdf new file mode 100644 index 0000000..6744424 --- /dev/null +++ b/doc/DDS-XRCE_1-0.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e6c67b138eb53577e84db345e869cf9a62755730532af73804b16d0a63cf308 +size 1865518 diff --git a/doc/DDSI-RTPS_2-3.pdf b/doc/DDSI-RTPS_2-3.pdf new file mode 100644 index 0000000..96b59da --- /dev/null +++ b/doc/DDSI-RTPS_2-3.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef03fbc58f6ea741ad15da1dfd17d7c5a15a2eba0f3e00965bc89c9854cef244 +size 10942563 diff --git a/doc/DDS_1-4.pdf b/doc/DDS_1-4.pdf new file mode 100644 index 0000000..0316ff8 --- /dev/null +++ b/doc/DDS_1-4.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e7873b5df8dbded895a05c9a6393a4897c93f116ccd835e33a996ac5df1a5a3 +size 1783330 diff --git a/doc/IDL_4-2.pdf b/doc/IDL_4-2.pdf new file mode 100644 index 0000000..f6cd449 --- /dev/null +++ b/doc/IDL_4-2.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed0837151a7672b4fa9dae9057dc94c70082ccfae8aa2ba04c612fe134f16a96 +size 1023704 diff --git a/src/rtps_package.vhd b/src/rtps_package.vhd new file mode 100644 index 0000000..ad25526 --- /dev/null +++ b/src/rtps_package.vhd @@ -0,0 +1,147 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package rtps_package is + + +subtype BYTE is std_logic_vector(7 downto 0); + +type GUIDPREFIX_TYPE is array (11 downto 0) of BYTE; +constant GUIDPREFIX_UNKNOWN : GUIDPREFIX_TYPE := (others => (others => '0')); + +type ENTITYID_TYPE is array (3 downto 0) of BYTE; +constant ENTITYID_UNKNOWN : ENTITYID_TYPE := (others => (others => '0')); +--alias ENTITYKIND : BYTE is ENTITYID(0); +--alias ENTITYKIND_UPPER : std_logic_vector(1 downto 0) is ENTITYKIND(7 downto 6); +--FOLLOWING MAP TO ENTITYKIND_UPPER +constant USER_DEFINED_ENTITY_KIND : std_logic_vector(1 downto 0) := "00"; +constant BUILT_IN_ENTITY_KIND : std_logic_vector(1 downto 0) := "11"; +constant VENDOR_SPECIFIC_ENTITY_KIND: std_logic_vector(1 downto 0) := "01"; +--alias ENTITYKIND_LOWER : std_logic_vector(1 downto 0) is ENTITYKIND(5 downto 0); +--FOLLOWING MAP TO ENTITYKIND_LOWER +constant WRITER_WITH_KEY : std_logic_vector(5 downto 0) := "000010"; +constant WRITER_NO_KEY : std_logic_vector(5 downto 0) := "000011"; +constant READER_NO_KEY : std_logic_vector(5 downto 0) := "000100"; +constant READER_WITH_KEY : std_logic_vector(5 downto 0) := "000111"; +constant WRITER_GROUP : std_logic_vector(5 downto 0) := "001000"; +constant READER_GROUP : std_logic_vector(5 downto 0) := "001001"; +-- +constant ENTITYID_PARTICIPANT : ENTITYID_TYPE := (x"00", x"00", x"01", x"c1"); +constant ENTITYID_SEDP_BUILTIN_TOPICS_ANNOUNCER : ENTITYID_TYPE := (x"00", x"00", x"02", x"c2"); +constant ENTITYID_SEDP_BUILTIN_TOPICS_DETECTOR : ENTITYID_TYPE := (x"00", x"00", x"02", x"c7"); +constant ENTITYID_SEDP_BUILTIN_PUBLICATIONS_ANNOUNCER : ENTITYID_TYPE := (x"00", x"00", x"03", x"c2"); +constant ENTITYID_SEDP_BUILTIN_PUBLICATIONS_DETECTOR : ENTITYID_TYPE := (x"00", x"00", x"03", x"c7"); +constant ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_ANNOUNCER : ENTITYID_TYPE := (x"00", x"00", x"04", x"c2"); +constant ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_DETECTOR : ENTITYID_TYPE := (x"00", x"00", x"04", x"c7"); +constant ENTITYID_SPDP_BUILTIN_PARTICIPANT_ANNOUNCER : ENTITYID_TYPE := (x"00", x"01", x"00", x"c2"); +constant ENTITYID_SPDP_BUILTIN_PARTICIPANT_DETECTOR : ENTITYID_TYPE := (x"00", x"01", x"00", x"c7"); +constant ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER: ENTITYID_TYPE := (x"00", x"02", x"00", x"c2"); +constant ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER: ENTITYID_TYPE := (x"00", x"02", x"00", x"c7"); + +type VENDORID_TYPE is array (1 downto 0) of BYTE; +--GUIDPREFIX(1 downto 0) <= VENDORID; +constant VENDORID_UNKNOWN : VENDORID_TYPE := (others => (others => '0')); + +type PROTOCOLVERSION_TYPE is array (1 downto 0) of BYTE; +constant PROTOCOLVERSION_2_4 : PROTOCOLVERSION_TYPE := (x"02", x"04"); + +--General BITMAP SET Constants +constant NUMBITS_WIDTH : integer := 32; +constant BITMAP_WIDTH : integer := 32; + +constant SEQUENCENUMBER_WIDTH : integer := 64; +type SEQUENCENUMBERSET_HEADER_TYPE is record { + bitmapBase : std_logic_vector(SEQUENCENUMBER_WIDTH-1 downto 0); + numBits : std_logic_vector(NUMBITS_WIDTH-1 downto 0); +}; + +subtype FRAGMENTNUMBER_WIDTH : integer := 32;; +type FRAGMENTNUMBERSET_HEADER_TYPE is record{ + bitmapBase : std_logic_vector(FRAGMENTNUMBER_WIDTH-1 downto 0); + numBits : std_logic_vector(NUMBITS_WIDTH-1 downto 0); +}; + +--Fixed Point Q32.32 +constant TIMESTAMP_WIDTH : integer := 64; + +constant LOCATOR_KIND : integer := 32; +constant LOCATOR_PORT : integer := 32; +constant LOCATOR_ADDR : integer := 128; +type LOCATOR_TYPE is record{ + kind : std_logic_vector(LOCATOR_KIND-1 downto 0); + port : std_logic_vector(LOCATOR_PORT-1 downto 0); + addr : std_logic_vector(LOCATOR_ADDR-1 downto 0); +}; +constant NUMLOCATOR_WIDTH : integer := 32; + +constant LOCATORUDPv4_PORT : integer := 32; +constant LOCATORUDPv4_ADDR : integer := 32; +type LOCATORUDPv4_TYPE is record{ + addr : std_logic_vector(LOCATORUDPv4_ADDR-1 downto 0); + port : std_logic_vector(LOCATORUDPv4_PORT-1 downto 0); +}; + + +constant PARAMETERID_WIDTH : integer := 16; +constant PARAMETERLENGTH_WIDTH : integer := 16; +type PARAMETER_HEADER_TYPE is record{ + pid : std_logic_vector(PARAMETERID_WIDTH-1 downto 0); + length : std_logic_vector(PARAMETERLENGTH_WIDTH-1 downto 0); +}; + +constant PID_PAD : std_logic_vector(PARAMETERID_WIDTH-1 downto 0) := (others => '0'); +constant PID_SENTINEL : std_logic_vector(PARAMETERID_WIDTH-1 downto 0) := std_logic_vector(unsigned(1,PARAMETERID_WIDTH)); + +constant COUNT_WIDTH : integer := 32; + +--TODO: GroupDigest? + +constant PROTOCOLLD_WIDTH : integer := 32; +type RTPS_HEADER_TYPE is record{ + protocol : std_logic_vector(PROTOCOLLD_WIDTH-1 downto 0); + version : PROTOCOLVERSION_TYPE; + vendorid : VENDORID_TYPE; + guidprefix : GUIDPREFIX_TYPE; +}; +constant PROTOCOLLD_RTPS : std_logic_vector(PROTOCOLLD_WIDTH-1 downto 0) := x"52545053"; + +constant SUBMESSAGE_ID_WIDTH : integer := 8; +constant SUBMESSAGE_FLAGS_WIDTH : integer := 8; +constant SUBMESSAGE_LENGTH_WIDTH : integer := 16; +type RTPS_SUBMESSAGE_HEADER_TYPE is record{ + id : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0); + flags : std_logic_vector(SUBMESSAGE_FLAGS_WIDTH-1 downto 0); + length : std_logic_vector(SUBMESSAGE_LENGTH_WIDTH-1 downto 0); +}; + +constant SID_PAD : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"01"; +constant SID_ACKNACK : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"06"; +constant SID_HEARTBEAT : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"07"; +constant SID_GAP : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"08"; +constant SID_INFO_TS : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"09"; +constant SID_INFO_SRC : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0c"; +constant SID_INFO_REPLY_IP4 : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0d"; +constant SID_INFO_DST : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0e"; +constant SID_INFO_REPLY : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"0f"; +constant SID_NACK_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"12"; +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_FRAG : std_logic_vector(SUBMESSAGE_ID_WIDTH-1 downto 0) := x"16"; +--TODO: Enum it? + +constant ENDIANNESS_FLAG_POS : integer := 0; +--ACKNACK +constant FINAL_FLAG_POS : integer := 1; +--DATA +constant INLINEQOS_FLAG_POS : integer := 1; +constant DATA_FLAG_POS : integer := 2; +constant KEY_FLAG_POS : integer := 3; +constant NONSTANDARDPAYLOAD_FLAG_POS: integer := 4; + + + +end package; + +package body rtps_package is +end package body;