Jump to content
Hadrian2002

Names of bound TLM-Simple-Sockets

Recommended Posts

Hello,

 

I have a question regarding the reflection possibilities of SystemC in combination with TLM-Sockets. For logging I want to know the name of a simple-initiator-socket, which is bound to a given simple-target-socket.

 

The Idea is, to log something like " 'CPU_1_initiator_socket' starts request to 'Bus_Port_4_target_socket' ", but this message needs to be created at the submodule, which only knows the target-socket.

 

I know, since the sockets are sc_objects, they will get a unique name, but is also saved the binding relation to the socket?

Share this post


Link to post
Share on other sites

As far as my researches shows, only the Interfaces to the sockets are bound and they not include references to the bounded object. Of course this is the intended behavior.

Regarding an interface (derived from sc_interface) should not derive from sc_object, so also no chance to do bad casting stuff. I tried this with simple_target_socket.get_base_port()->get_interface(0) and so on.

 

Seems to be that I need an additional TLM-Extension carrying the name of Initiator. I think I could also implement a target-socket, which saves the name, when the socket is bound, but then I forbid to bound against exports and so on ...

 

Really annoying is, that with a Debugger I could extract the, but there is no API for that.

 

Any other suggestions ?

Share this post


Link to post
Share on other sites

I tried exactly this, but as the IEEE Standard §5.14.3 says, it should not be derived from sc_object. For the convenience sockets simple_*_socket, this is also the case. I think I need to modify the binding operation to save the name of the binded Object.

Share this post


Link to post
Share on other sites

I tried exactly this, but as the IEEE Standard §5.14.3 says, it should not be derived from sc_object.

 

Yes, sc_interface itself is not derived from sc_object. But the channel that is bound to the port/socket is frequently derived from sc_object.  I didn't look up the details in the standard, but to me it may be a reasonable assumption that the bound object is indeed a proper part of the SystemC object hierarchy.

 

For the convenience sockets simple_*_socket, this is also the case. I think I need to modify the binding operation to save the name of the binded Object.

 

Indeed, the current implementation of the simple sockets use internal classes not derived from sc_object to provide the interface implementations.  To me, this is at least an inconvenience for use cases like yours.  I'll take this to the LWG/TLMWG for discussion.

 

You may still be able to "lookup" the correct socket by traversing the object hierarchy (5.16.7) looking for candidate sockets and comparing the original result of 'get_interface()' with the interfaces of the candidates.  Or derive your own socket and override the bind() function to store the name.  Make sure to call the base-class bind() to actually perform the binding.

 

/Philipp

Share this post


Link to post
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.

Guest
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...