Jump to content

help me about "function" in simple socket


Recommended Posts

I'm learning simple socket with 2 examples:

ex1: https://www.doulos.com/knowhow/systemc/tlm2/tutorial__3/tlm2_getting_started_3.cpp

ex2: in lib : systemc-2.3.3\examples\tlm\common\include\models\SimpleBusLT.h

I know that :

//Initiator
tlm_utils::simple_initiator_socket<Initiator>            initiator_socket;
...
tlmTrans.set_data_length(emdata_length);
tlmTrans.set_data_ptr(emdata_ptr);
initiator_socket->b_transport(tlmTrans, localTime);
...
//Target
tlm_utils::simple_target_socket<Target>            target_socket;
...
target_socket.register_b_transport(this, &Target::b_transport);
...
virtual void b_transport(tlm::tlm_generic_payload& trans, sc_time& delay)
{
	//receive data from tlmTrans Initiator
}

I only understand "register_b_transport" function.  But I see others function , Can you explain it? and how to use?

//Initiator
initiator_socket.register_invalidate_direct_mem_ptr(this, &Initiator::invalidateDMIPointers);

...
//Target
target_socket.register_b_transport(this, &Target::initiatorBTransport);
target_socket.register_transport_dbg(this, &Target::transportDebug);
target_socket.register_get_direct_mem_ptr(this, &Target::getDMIPointer);

 

Link to comment
Share on other sites

As you might know TLM2.0 defines forward and backward interfaces. Those have default implementations in the simple initiator/target sockets. They are fine for many case (e.g. get_direct_mem_ptr() denies DMI) but if you need to change/customize the behavior you can register appropriate functions here.

Best regards

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