Jump to content
Santhosh_Michael

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.

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

×