Jump to content

Generic Payload Extensions

Recommended Posts

Section 14.2 of the IEEE STD 1666-2011 states


It should be emphasized that although deriving a new class from the generic payload is possible, it is not the
recommended approach for interoperability

I am wondering why the extension mechanism is preferred since you could simple ignore the additional fields provided in a derived class.

Link to comment
Share on other sites

If a third party model is designed to take a tlm_generic_payload, and you derive from tlm_generic_payload, then it should handle your transaction object correctly, ignoring any additional fields that may be defined on the object.  If a target wants to make use of those additional fields, then it could dynamic_cast the tlm_generic_payload* to your derived type* (using C++ RTTI to ensure that it actually has a derived_type object) .   I understand that the standard was instead developed around extensions, but I'm wondering what was the motivation for going in this direction.

Link to comment
Share on other sites

You cannot bind sockets with different payload classes, as the interfaces are templated over the protocol traits, which include the payload and phase types.  So integrating this third-party model would require an adapter in your case.

Many use cases can be implemented with (ignorable) extensions, which will avoid this incompatibility and integration burden.   As a result, you don't have to write/use a custom adapters, interconnect models, tool integrations, etc. For maximum interoperability with models and tools, you want to follow the (base-protocol) conventions as closely as possible, even for custom protocols.

See the different TLM-2.0 compliance categories (IEEE 1666-2011, 9.1).

Hope that helps,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...