Jump to content

simple sockets and TLM sockets


Recommended Posts

Hi Cam,

   you can use the simple sockets if they do something useful for you. If you can't work out why you want to use them, then you probably don't want to use them.

 

The key features of the simple sockets are described in the LRM section 16.1.2.1

 

The comparison of the socket types is in tables 59 and 60 in section 16.1.1.1.

 

If the LRM description is unclear, you probably need to ask a more specific question. For instance if you asked me "what is the advantage of using callbacks in the simple socket" I could answer that question.

 

regards

Alan

Link to comment
Share on other sites

Thanks Alan,

 

I read the specified sections in LRM which u told. I understand now the difference between sockets.

 

But there is my doubts about register of callbacks.

 

I had used b_transport on transmission side and register_b_transport on reception side. But if i change to b_transport from register_b_transport in reception side and vice versa in reception side, then it does not work?

 

in below code(from LRM) 

 

two callbacks are registered on tx side and four on rx side.

 

I want to know that there is not something like if there 2 method calls on tx side then there should be 2 corresponding calls on receiver side too, which actually pick the same data sent by respective 2 calls in tx?  

 

SC_CTOR(Initiator)
: socket("socket") // Construct and name simple socket
{ // Register callbacks with simple socket
socket.register_nb_transport_bw( this, &Initiator::nb_transport_bw );
socket.register_invalidate_direct_mem_ptr( this, &Initiator::invalidate_direct_mem_ptr );
}
 
};
struct Target: sc_module // Target component
{
 
SC_CTOR(Target)
: socket("socket") // Construct and name simple socket
{ // Register callbacks with simple socket
socket.register_nb_transport_fw( this, &Target::nb_transport_fw );
socket.register_b_transport( this, &Target::b_transport );
socket.register_get_direct_mem_ptr( this, &Target::get_direct_mem_ptr );
socket.register_transport_dbg( this, &Target::transport_dbg );
}
 
Regards
cam
Link to comment
Share on other sites

Hi Cam,

  the simple_sockets behave in the same was as the standard sockets, in the sense that an initiator may *call* the four functions (b_transport, nb_transport_fw, get_direct_me_ptr, transport_dbg) and the target *must* implement those functions.

 

On the reverse path the target may *call* nb_transport_bw and invalidate_direct_mem_ptr, and the initiator implements them.

 

The only difference with the simple sockets is that they have the bodies of the functions for you. In other words the simple_target_socket implements the tlm_fw_transport_if, it contains function bodies for b_transport, nb_transport_fw, get_direct_mem_ptr, and transport_dbg. However to tell those functions exactly what to do, you register your *own* function with the required behaviour. To do this, you call register_b_transport etc.

 

So if the initiator calls b_transport in the target with a simple socket, the b_transport function *in the simple socket* is called. That then in turn calls the function you registered with b_transport.

 

That compares to the standard sockets, where the implementation of b_transport is *in the target* not *in the simple target socket*.

 

I hope that's a bit clearer,

 

regards

Alan

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.

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