Modified Type Size convention

The RTPS Payload size overhead was defined in the rtps_package, and is to be
used by all type packages to calculate the MAX_<TYPENAME>_SIZE.
The service overhead size was also renamed to ROS_SERVICE_OVERHEAD_BYTES to
make the connection with ROS clearer.
This commit is contained in:
John Ring 2023-07-21 17:06:52 +02:00
parent 5f7f2685c2
commit f0cc29fcd6
15 changed files with 65 additions and 63 deletions

View File

@ -89,7 +89,7 @@ package body user_config is
c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS; c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS;
c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE;
ret := (others => c); ret := (others => c);

View File

@ -89,7 +89,7 @@ package body user_config is
c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS; c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS;
c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE;
ret := (others => c); ret := (others => c);

View File

@ -90,7 +90,7 @@ package body user_config is
c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH));
c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE;
ret := (others => c); ret := (others => c);

View File

@ -90,7 +90,7 @@ package body user_config is
c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH));
c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH));
c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE;
ret := (others => c); ret := (others => c);

View File

@ -7,12 +7,9 @@ use work.rtps_package.all;
package Type1_package is package Type1_package is
constant MAX_ID_SIZE : natural := 4; constant MAX_ID_SIZE : natural := 4;
constant MAX_A_SIZE : natural := 4; -- 8 constant MAX_A_SIZE : natural := 4; -- 8
constant MAX_TYPE1_SIZE : natural := 8;
constant MAX_TYPE1_KEY_HOLDER_SIZE : natural := 4; constant MAX_TYPE1_SIZE : natural := 8 + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -45,8 +45,7 @@ package Type2_package is
constant MAX_TESTUNION_SIZE : natural := 7; -- 180 constant MAX_TESTUNION_SIZE : natural := 7; -- 180
constant MAX_TESTBITMASK_SIZE : natural := 4; -- 184 constant MAX_TESTBITMASK_SIZE : natural := 4; -- 184
constant MAX_TESTSTRING_SIZE : natural := 17; -- 201 constant MAX_TESTSTRING_SIZE : natural := 17; -- 201
constant MAX_TYPE2_SIZE : natural := 201;
constant MAX_TYPE2_KEY_HOLDER_SIZE : natural := 28; constant MAX_TYPE2_SIZE : natural := 201 + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -21,7 +21,7 @@ The Service VHDL generation closely follows the general RTPS IDL interface gener
For each Service (i.e. .srv File) two files are generated, a server (called <SERVICENAME>_ros_srv_server) For each Service (i.e. .srv File) two files are generated, a server (called <SERVICENAME>_ros_srv_server)
and a client (called <SERVICENAME>_ros_srv_client) file. and a client (called <SERVICENAME>_ros_srv_client) file.
Each file contains both encoding and decoding functionality (similar to the key_holder entities). Each file contains both encoding and decoding functionality (similar to the key_holder entities).
The files also contain extra logic that may be necessary to parse the SERVICE_OVERHEAD_BYTES that may be The files also contain extra logic that may be necessary to parse the ROS_SERVICE_OVERHEAD_BYTES that may be
present in the payload. present in the payload.
The code generation follows the normal code generation for encoding and decoding with following changes: The code generation follows the normal code generation for encoding and decoding with following changes:
@ -34,7 +34,7 @@ The code generation follows the normal code generation for encoding and decoding
* The <SERVICENAME>_package calculates both a maximum request and response message size, named * The <SERVICENAME>_package calculates both a maximum request and response message size, named
MAX_<SERVICENAME>_RQ_SIZE and MAX_<SERVICENAME>_RR_SIZE, respectively. MAX_<SERVICENAME>_RQ_SIZE and MAX_<SERVICENAME>_RR_SIZE, respectively.
The maximum includes the service overhead bytes that are contained in the DDS Payloads. The constant The maximum includes the service overhead bytes that are contained in the DDS Payloads. The constant
SERVICE_OVERHEAD_BYTES from ros_package gives this overhead bytes. ROS_SERVICE_OVERHEAD_BYTES from ros_package gives this overhead bytes.
ACTION ACTION

View File

@ -3,6 +3,7 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
use work.math_pkg.all; use work.math_pkg.all;
use work.rtps_package.all;
use work.ros_package.all; use work.ros_package.all;
package AddTwoInts_package is package AddTwoInts_package is
@ -10,10 +11,10 @@ package AddTwoInts_package is
-- REQUEST -- REQUEST
constant MAX_RQ_A_SIZE : natural := 8; constant MAX_RQ_A_SIZE : natural := 8;
constant MAX_RQ_B_SIZE : natural := 8; -- 16 constant MAX_RQ_B_SIZE : natural := 8; -- 16
constant MAX_ADDTWOINTS_RQ_SIZE : natural := 16 + SERVICE_OVERHEAD_BYTES; constant MAX_ADDTWOINTS_RQ_SIZE : natural := 16 + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
-- RESPONSE -- RESPONSE
constant MAX_RR_SUM_SIZE : natural := 8; constant MAX_RR_SUM_SIZE : natural := 8;
constant MAX_ADDTWOINTS_RR_SIZE : natural := 8 + SERVICE_OVERHEAD_BYTES; constant MAX_ADDTWOINTS_RR_SIZE : natural := 8 + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -3,6 +3,7 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
use work.math_pkg.all; use work.math_pkg.all;
use work.rtps_package.all;
use work.ros_package.all; use work.ros_package.all;
use work.GoalInfo_package; use work.GoalInfo_package;
@ -20,7 +21,7 @@ package Fibonacci_package is
constant G_RR_MAX_STAMP_SEC_SIZE : natural := GoalInfo_package.MAX_STAMP_SEC_SIZE; constant G_RR_MAX_STAMP_SEC_SIZE : natural := GoalInfo_package.MAX_STAMP_SEC_SIZE;
constant G_RR_MAX_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant G_RR_MAX_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE;
constant G_RR_MAX_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; constant G_RR_MAX_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE;
constant G_RR_MAX_FIBONACCI_SIZE : natural := G_RR_MAX_ACCEPTED + G_RR_MAX_STAMP_SIZE; constant G_RR_MAX_FIBONACCI_SIZE : natural := G_RR_MAX_ACCEPTED + G_RR_MAX_STAMP_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
-- RESULT -- RESULT
constant R_RQ_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH; constant R_RQ_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH;
@ -34,7 +35,7 @@ package Fibonacci_package is
constant R_RR_MAX_STATUS_SIZE : natural := 1; constant R_RR_MAX_STATUS_SIZE : natural := 1;
constant R_RR_MAX_SEQ_SIZE : natural := R_RR_SEQ_MAX_DEPTH * 4; constant R_RR_MAX_SEQ_SIZE : natural := R_RR_SEQ_MAX_DEPTH * 4;
constant R_RR_MAX_FIBONACCI_SIZE : natural := R_RR_MAX_STATUS_SIZE + R_RR_MAX_SEQ_SIZE; constant R_RR_MAX_FIBONACCI_SIZE : natural := R_RR_MAX_STATUS_SIZE + R_RR_MAX_SEQ_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
-- FEEDBACK -- FEEDBACK
constant F_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH; constant F_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH;
@ -44,6 +45,6 @@ package Fibonacci_package is
constant F_MAX_GOAL_ID_SIZE : natural := GoalInfo_package.MAX_GOAL_ID_SIZE; constant F_MAX_GOAL_ID_SIZE : natural := GoalInfo_package.MAX_GOAL_ID_SIZE;
constant F_MAX_SEQ_SIZE : natural := F_SEQ_MAX_DEPTH * 4; constant F_MAX_SEQ_SIZE : natural := F_SEQ_MAX_DEPTH * 4;
constant F_MAX_FIBONACCI_SIZE : natural := F_MAX_GOAL_ID_SIZE + F_MAX_SEQ_SIZE; constant F_MAX_FIBONACCI_SIZE : natural := F_MAX_GOAL_ID_SIZE + F_MAX_SEQ_SIZE + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -17,7 +17,7 @@ package CancelGoal_package is
constant RQ_MAX_GOAL_INFO_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant RQ_MAX_GOAL_INFO_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE;
constant RQ_MAX_GOAL_INFO_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; constant RQ_MAX_GOAL_INFO_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE;
constant RQ_MAX_GOAL_INFO_SIZE : natural := RQ_MAX_GOAL_INFO_GOAL_ID_SIZE + RQ_MAX_GOAL_INFO_STAMP_SIZE; constant RQ_MAX_GOAL_INFO_SIZE : natural := RQ_MAX_GOAL_INFO_GOAL_ID_SIZE + RQ_MAX_GOAL_INFO_STAMP_SIZE;
constant RQ_MAX_CANCELGOAL_SIZE : natural := RQ_MAX_GOAL_INFO_SIZE; constant RQ_MAX_CANCELGOAL_SIZE : natural := RQ_MAX_GOAL_INFO_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
-- RESPONSE -- RESPONSE
constant RR_ERROR_NONE : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_INT8_WIDTH)); constant RR_ERROR_NONE : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_INT8_WIDTH));
@ -36,5 +36,5 @@ package CancelGoal_package is
constant RR_MAX_GOALS_CANCELING_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant RR_MAX_GOALS_CANCELING_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE;
constant RR_MAX_GOALS_CANCELING_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; constant RR_MAX_GOALS_CANCELING_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE;
constant RR_MAX_GOALS_CANCELING_SIZE : natural := RR_GOALS_CANCELING_MAX_DEPTH * GoalInfo_package.MAX_GOALINFO_SIZE; constant RR_MAX_GOALS_CANCELING_SIZE : natural := RR_GOALS_CANCELING_MAX_DEPTH * GoalInfo_package.MAX_GOALINFO_SIZE;
constant RR_MAX_CANCELGOAL_SIZE : natural := RR_MAX_RETURN_CODE_SIZE + RR_MAX_GOALS_CANCELING_SIZE; constant RR_MAX_CANCELGOAL_SIZE : natural := RR_MAX_RETURN_CODE_SIZE + RR_MAX_GOALS_CANCELING_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -21,5 +21,5 @@ package GoalInfo_package is
constant MAX_STAMP_NANOSEC_SIZE : natural := 4; constant MAX_STAMP_NANOSEC_SIZE : natural := 4;
constant MAX_STAMP_SIZE : natural := MAX_STAMP_SEC_SIZE + MAX_STAMP_NANOSEC_SIZE; constant MAX_STAMP_SIZE : natural := MAX_STAMP_SEC_SIZE + MAX_STAMP_NANOSEC_SIZE;
constant MAX_GOALINFO_SIZE : natural := MAX_GOAL_ID_SIZE + MAX_STAMP_SIZE; constant MAX_GOALINFO_SIZE : natural := MAX_GOAL_ID_SIZE + MAX_STAMP_SIZE + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -3,6 +3,7 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
use work.math_pkg.all; use work.math_pkg.all;
use work.rtps_package.all;
use work.ros_package.all; use work.ros_package.all;
use work.GoalInfo_package; use work.GoalInfo_package;
use work.GoalStatus_package; use work.GoalStatus_package;
@ -22,6 +23,6 @@ package GoalStatusArray_package is
constant MAX_STATUS_LIST_STATUS_SIZE : natural := GoalStatus_package.MAX_STATUS_SIZE; constant MAX_STATUS_LIST_STATUS_SIZE : natural := GoalStatus_package.MAX_STATUS_SIZE;
constant MAX_STATUS_LIST_SIZE : natural := STATUS_LIST_MAX_DEPTH * (GoalStatus_package.MAX_GOALSTATUS_SIZE); constant MAX_STATUS_LIST_SIZE : natural := STATUS_LIST_MAX_DEPTH * (GoalStatus_package.MAX_GOALSTATUS_SIZE);
constant MAX_GOALSTATUSARRAY_SIZE : natural := MAX_STATUS_LIST_SIZE; constant MAX_GOALSTATUSARRAY_SIZE : natural := MAX_STATUS_LIST_SIZE + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -25,6 +25,6 @@ package GoalStatus_package is
constant MAX_GOAL_INFO_SIZE : natural := Goalinfo_package.MAX_GOALINFO_SIZE; constant MAX_GOAL_INFO_SIZE : natural := Goalinfo_package.MAX_GOALINFO_SIZE;
constant MAX_STATUS_SIZE : natural := 1; constant MAX_STATUS_SIZE : natural := 1;
constant MAX_GOALSTATUS_SIZE : natural := MAX_GOAL_INFO_SIZE + MAX_STATUS_SIZE; constant MAX_GOALSTATUS_SIZE : natural := MAX_GOAL_INFO_SIZE + MAX_STATUS_SIZE + RTPS_PAYLOAD_HEADER_SIZE;
end package; end package;

View File

@ -306,7 +306,7 @@ package ros_package is
type ENDPOINT_ROS_NODE_MAPPING_ARRAY_TYPE is array (natural range <>) of natural; type ENDPOINT_ROS_NODE_MAPPING_ARRAY_TYPE is array (natural range <>) of natural;
constant SERVICE_OVERHEAD_BYTES : natural := 16; constant ROS_SERVICE_OVERHEAD_BYTES : natural := 16;
constant GOAL_HANDLE_WIDTH : natural := WORD_WIDTH; constant GOAL_HANDLE_WIDTH : natural := WORD_WIDTH;
constant GOAL_HANDLE_UNKNOWN : std_logic_vector(GOAL_HANDLE_WIDTH-1 downto 0) := (others => '1'); constant GOAL_HANDLE_UNKNOWN : std_logic_vector(GOAL_HANDLE_WIDTH-1 downto 0) := (others => '1');

View File

@ -342,6 +342,9 @@ package rtps_package is
constant D_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0014"; constant D_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0014";
constant D_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0015"; constant D_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0015";
-- Size of RTPS Payload Header in Bytes
constant RTPS_PAYLOAD_HEADER_SIZE : natural := 4;
-- *ENTITY ID* -- *ENTITY ID*
constant ENTITYID_UNKNOWN : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0'); constant ENTITYID_UNKNOWN : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');
constant ENTITYID_PARTICIPANT : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000001c1"); constant ENTITYID_PARTICIPANT : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (x"000001c1");