Jump to content

how to connect a single initiator socket to a multiple target socket


Recommended Posts

Use a multi_pass_thru_socket and a simple loop (incomplete - extend as needed):

#include <systemc>
#include <tlm>
#include <tlm_utils/simple_initiator_socket.h>
#include <tlm_utils/multi_passthrough_initiator_socket.h>
  
struct Broadcast : sc_core::sc_module
  tlm_utils::simple_target_socket target_socket<>;
  tlm_utils::multi_pass_through_initiator_socket initiator_socket<Broadcast>;
  SC_CTOR(Broadcast)
    : target_socket("target_socket")
    , initiator_socket("initiator_socket")
  {
    target_socket.register_b_transport( this, &Broadcast::b_transport );
  }
  void b_transport(tlm::tlm_generic_payload& payload, sc_time& delay);
};

void Broadcast::b_transport(tlm::tlm_generic_payload& payload, sc_time& delay)
{
      for (size_t i=0; i<initiator_socket.size(); ++i) {
		initiator_socket[i]->b_transport(payload, delay);
      }
}

 

Of course you need to be careful with this because technically you probably need to copy the payload (i.e. create an individual transaction per target). If it is a an IGNORE_COMMAND and you use appropriately designed extensions, then it might work.

Link to comment
Share on other sites

  • 10 months later...

Hi David, bumping an old thread. How will you do the binding in your above example?

I have a top level block which has A, B and C bounded as A -> B -> C. The module B has multiple sub-modules B1, B2 and B3. Can I have a multi_passthrough_initiator_socket within B and bind it (in the constructor of B) to the simple_target sockets of B1, B2 and B3? If so, how do I do it?

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