Jump to content

block_interface between initiator and target

Recommended Posts



I assume its a basic question .

Can someone please help me understand the basic flow of initiator and target by using a blocking interface in a c++ way.

I had read the tutorial on doulous ,but i dint get the required explnation from my side.

I do know the concepts of c++,but implementation wise i am bit on the slower side.

It would be great if someone could explain it here through step wise.

Thanks in advance.


Ps: just for reference i am putting up the code.initiator.h,target.h,top.h,main.cpp





Link to comment
Share on other sites

At first glance, you can call b_transport from C++, but it must be C++ that is inside a SystemC process during simulation phase if the b_transport call invokes sc_core::wait(). You can read the details in the IEEE-1666-2011 specification. Or perhaps you should signup for the Doulos SystemC TLM-2.0 course and get expert hands-on training.

Fundamentally, b_transport is a simple function call; however, it may use SystemC semantics to accomplish its work. Hence you should also be knowledgable on SystemC SC_THREADs (may not be used in SC_METHODs).

Technically, you could write a b_transport method in the target that did not call sc_core::wait, which is desirable anyhow. If you did this, then you may call from pretty much anywhere; however, SystemC is not thread-safe without special precautions. In any event, there is a lot to learn about the subtleties of the generic payload and extensions too.


Link to comment
Share on other sites

Well, to me it is always helpful

to think about sockets as a proxy or sophisticated function forwarder (in some sense similar lto sc_port). So you call b_transport on the initiator side and the socket forwards the call to the target and invokes b_transport there.


Link to comment
Share on other sites


@David Black,yes i do have working knowledge on system c,tlm is bit new to me.b_transport is a simple function call .So acc. to my understanding  ,

This is how b_transport works -

  1. we create a payload with a certain space by using new operator.As we have created a new space it will be having a pointer to work out with.There are predefined fields for payload which will be filled up by us or may be by default.
  2. Now we send our payload and its defined fields by using b_transport interface through socket to target side.
  3. Target side will be having its own memory,it will be filling up its space according to requirement .In my example we are using int[255] array .
  4. If its a write command from initiator ,it will write in memory space of target.And if its a read command,it will read from the memory whatever its written in the array.

This is my understanding of b_interface.Please correct me, if i am wrong.


Thanks & regards,


Link to comment
Share on other sites

@shubham_v as a course top-level description, you have the correct general idea, but there are many subtleties:

  • b_transport() can block using a call to wait( args... ); although, models that do not block are desirable from a performance perspective.
  • b_transport() executes in the simulation context of the caller. Anything requiring the SystemC kernel management (e.g. wait) imposes the requirement that b_transport() was invoked in the context of a SystemC SC_THREAD.
  • Simulated time conceptually may be decoupled from the SystemC kernel's notion of time using a temporal offset (when 2nd argument of the b_transport call is non-zero).
  • Sockets are not required; however, they solve a number of problems.
  • TLM 2.0 Base Protocol compliant target models must support both blocking and non-blocking interfaces. This is one reason the convenience simple target sockets are so useful (automatic conversion provided may be suitable for some models).
  • Extensions and custom protocols may have important consequences that need to be considered.
Link to comment
Share on other sites

@David Black,Thanks for your time.

Yes i undersatnd,as i go through further tlm concepts,complexity will increase and at that time i should be having  the exact working knowledge of these ideas.

Hey david,its just a follow up question on blocking_interface.It is as follows-

As we will be having up a memory in target side and it will be executed on its own and assume all space of int[255] array will be filled.

Now ,if a write command is generated from the initiator side and the target realises that there is no space to write or better to say the space is already written,den what would be the response from the target side.Does it send a "FAILED TRANSACTION" error or will there be some sort of alternate way to execute the command ?  

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