Jump to content
TRANG

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);

 

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×