112027Sjungma@eit.uni-kl.de/*****************************************************************************
212027Sjungma@eit.uni-kl.de
312027Sjungma@eit.uni-kl.de  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412027Sjungma@eit.uni-kl.de  more contributor license agreements.  See the NOTICE file distributed
512027Sjungma@eit.uni-kl.de  with this work for additional information regarding copyright ownership.
612027Sjungma@eit.uni-kl.de  Accellera licenses this file to you under the Apache License, Version 2.0
712027Sjungma@eit.uni-kl.de  (the "License"); you may not use this file except in compliance with the
812027Sjungma@eit.uni-kl.de  License.  You may obtain a copy of the License at
912027Sjungma@eit.uni-kl.de
1012027Sjungma@eit.uni-kl.de    http://www.apache.org/licenses/LICENSE-2.0
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de  Unless required by applicable law or agreed to in writing, software
1312027Sjungma@eit.uni-kl.de  distributed under the License is distributed on an "AS IS" BASIS,
1412027Sjungma@eit.uni-kl.de  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512027Sjungma@eit.uni-kl.de  implied.  See the License for the specific language governing
1612027Sjungma@eit.uni-kl.de  permissions and limitations under the License.
1712027Sjungma@eit.uni-kl.de
1812027Sjungma@eit.uni-kl.de *****************************************************************************/
1912027Sjungma@eit.uni-kl.de#ifndef __MULTI_PASSTHROUGH_TARGET_SOCKET_H__
2012027Sjungma@eit.uni-kl.de#define __MULTI_PASSTHROUGH_TARGET_SOCKET_H__
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de#include "tlm_utils/multi_socket_bases.h"
2312027Sjungma@eit.uni-kl.de#include <sstream>
2412027Sjungma@eit.uni-kl.de
2512027Sjungma@eit.uni-kl.denamespace tlm_utils {
2612027Sjungma@eit.uni-kl.de
2712027Sjungma@eit.uni-kl.de/*
2812027Sjungma@eit.uni-kl.deThis class implements a trivial multi target socket.
2912027Sjungma@eit.uni-kl.deThe triviality refers to the fact that the socket does not
3012027Sjungma@eit.uni-kl.dedo blocking to non-blocking or non-blocking to blocking conversions.
3112027Sjungma@eit.uni-kl.de
3212027Sjungma@eit.uni-kl.deIt allows to connect multiple initiators to this socket.
3312027Sjungma@eit.uni-kl.deThe user has to register callbacks for the fw interface methods
3412027Sjungma@eit.uni-kl.dehe likes to use. The callbacks are basically equal to the fw interface
3512027Sjungma@eit.uni-kl.demethods but carry an additional integer that indicates to which
3612027Sjungma@eit.uni-kl.deindex of this socket the calling initiator is connected.
3712027Sjungma@eit.uni-kl.de*/
3812027Sjungma@eit.uni-kl.detemplate <typename MODULE,
3912027Sjungma@eit.uni-kl.de          unsigned int BUSWIDTH = 32,
4012027Sjungma@eit.uni-kl.de          typename TYPES = tlm::tlm_base_protocol_types,
4112027Sjungma@eit.uni-kl.de          unsigned int N=0
4212027Sjungma@eit.uni-kl.de#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
4312027Sjungma@eit.uni-kl.de          ,sc_core::sc_port_policy POL = sc_core::SC_ONE_OR_MORE_BOUND
4412027Sjungma@eit.uni-kl.de#endif
4512027Sjungma@eit.uni-kl.de          >
4612027Sjungma@eit.uni-kl.declass multi_passthrough_target_socket: public multi_target_base< BUSWIDTH,
4712027Sjungma@eit.uni-kl.de                                                        TYPES,
4812027Sjungma@eit.uni-kl.de                                                        N
4912027Sjungma@eit.uni-kl.de#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
5012027Sjungma@eit.uni-kl.de                                                        ,POL
5112027Sjungma@eit.uni-kl.de#endif
5212027Sjungma@eit.uni-kl.de                                                        >
5312027Sjungma@eit.uni-kl.de                              , public multi_to_multi_bind_base<TYPES>
5412027Sjungma@eit.uni-kl.de{
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.depublic:
5712027Sjungma@eit.uni-kl.de
5812027Sjungma@eit.uni-kl.de  //typedefs
5912027Sjungma@eit.uni-kl.de  //  tlm 2.0 types for nb_transport
6012027Sjungma@eit.uni-kl.de  typedef typename TYPES::tlm_payload_type              transaction_type;
6112027Sjungma@eit.uni-kl.de  typedef typename TYPES::tlm_phase_type                phase_type;
6212027Sjungma@eit.uni-kl.de  typedef tlm::tlm_sync_enum                            sync_enum_type;
6312027Sjungma@eit.uni-kl.de
6412027Sjungma@eit.uni-kl.de  //  typedefs to keep the fn ptr notations short
6512027Sjungma@eit.uni-kl.de  typedef sync_enum_type (MODULE::*nb_cb)(int, transaction_type&, phase_type&, sc_core::sc_time&);
6612027Sjungma@eit.uni-kl.de  typedef void (MODULE::*b_cb)(int, transaction_type&, sc_core::sc_time&);
6712027Sjungma@eit.uni-kl.de  typedef unsigned int (MODULE::*dbg_cb)(int, transaction_type& txn);
6812027Sjungma@eit.uni-kl.de  typedef bool (MODULE::*dmi_cb)(int, transaction_type& txn, tlm::tlm_dmi& dmi);
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.de  typedef multi_target_base<BUSWIDTH,
7112027Sjungma@eit.uni-kl.de                        TYPES,
7212027Sjungma@eit.uni-kl.de                        N
7312027Sjungma@eit.uni-kl.de#if !(defined SYSTEMC_VERSION & SYSTEMC_VERSION <= 20050714)
7412027Sjungma@eit.uni-kl.de                        ,POL
7512027Sjungma@eit.uni-kl.de#endif
7612027Sjungma@eit.uni-kl.de                        > base_type;
7712027Sjungma@eit.uni-kl.de
7812027Sjungma@eit.uni-kl.de  typedef typename base_type::base_initiator_socket_type base_initiator_socket_type;
7912027Sjungma@eit.uni-kl.de
8012027Sjungma@eit.uni-kl.de  //CTOR
8112027Sjungma@eit.uni-kl.de  multi_passthrough_target_socket()
8212027Sjungma@eit.uni-kl.de      : base_type(sc_core::sc_gen_unique_name("multi_passthrough_target_socket"))
8312027Sjungma@eit.uni-kl.de      , m_hierarch_bind(0)
8412027Sjungma@eit.uni-kl.de      , m_eoe_disabled(false)
8512027Sjungma@eit.uni-kl.de      , m_export_callback_created(false)
8612027Sjungma@eit.uni-kl.de  {
8712027Sjungma@eit.uni-kl.de  }
8812027Sjungma@eit.uni-kl.de
8912027Sjungma@eit.uni-kl.de  //CTOR
9012027Sjungma@eit.uni-kl.de  multi_passthrough_target_socket(const char* name)
9112027Sjungma@eit.uni-kl.de      : base_type(name)
9212027Sjungma@eit.uni-kl.de      , m_hierarch_bind(0)
9312027Sjungma@eit.uni-kl.de      , m_eoe_disabled(false)
9412027Sjungma@eit.uni-kl.de      , m_export_callback_created(false)
9512027Sjungma@eit.uni-kl.de  {
9612027Sjungma@eit.uni-kl.de  }
9712027Sjungma@eit.uni-kl.de
9812027Sjungma@eit.uni-kl.de  ~multi_passthrough_target_socket(){
9912027Sjungma@eit.uni-kl.de    //clean up everything allocated by 'new'
10012027Sjungma@eit.uni-kl.de    for (unsigned int i=0; i<m_binders.size(); i++) delete m_binders[i];
10112027Sjungma@eit.uni-kl.de  }
10212027Sjungma@eit.uni-kl.de
10312027Sjungma@eit.uni-kl.de  //simple helpers for warnings an errors to shorten in code notation
10412027Sjungma@eit.uni-kl.de  void display_warning(const std::string& text) const {
10512027Sjungma@eit.uni-kl.de    std::stringstream s;
10612027Sjungma@eit.uni-kl.de    s<<"WARNING in instance "<<base_type::name()<<": "<<text;
10712027Sjungma@eit.uni-kl.de    SC_REPORT_WARNING("/OSCI_TLM-2/multi_socket", s.str().c_str());
10812027Sjungma@eit.uni-kl.de  }
10912027Sjungma@eit.uni-kl.de
11012027Sjungma@eit.uni-kl.de  void display_error(const std::string& text) const {
11112027Sjungma@eit.uni-kl.de    std::stringstream s;
11212027Sjungma@eit.uni-kl.de    s<<"ERROR in instance "<<base_type::name()<<": "<<text;
11312027Sjungma@eit.uni-kl.de    SC_REPORT_ERROR("/OSCI_TLM-2/multi_socket", s.str().c_str());
11412027Sjungma@eit.uni-kl.de  }
11512027Sjungma@eit.uni-kl.de
11612027Sjungma@eit.uni-kl.de  void check_export_binding()
11712027Sjungma@eit.uni-kl.de  {
11812027Sjungma@eit.uni-kl.de    //if our export hasn't been bound yet (due to a hierarch binding)
11912027Sjungma@eit.uni-kl.de    //  we bind it now.
12012027Sjungma@eit.uni-kl.de    //We do that here as the user of the target port HAS to bind at least on callback,
12112027Sjungma@eit.uni-kl.de    //otherwise the socket was useless. Nevertheless, the target socket may still
12212027Sjungma@eit.uni-kl.de    // stay unbound afterwards.
12312027Sjungma@eit.uni-kl.de    if (!sc_core::sc_export<tlm::tlm_fw_transport_if<TYPES> >::get_interface())
12412027Sjungma@eit.uni-kl.de    {
12512027Sjungma@eit.uni-kl.de      // We bind to a callback_binder that will be used as the first interface
12612027Sjungma@eit.uni-kl.de      // i.e. calls to the sc_export will have the same ID as calls from the first initator
12712027Sjungma@eit.uni-kl.de      // socket bound
12812027Sjungma@eit.uni-kl.de      callback_binder_fw<TYPES> * binder;
12912027Sjungma@eit.uni-kl.de
13012027Sjungma@eit.uni-kl.de      if (m_binders.size() == 0)
13112027Sjungma@eit.uni-kl.de      {
13212027Sjungma@eit.uni-kl.de        binder = new callback_binder_fw<TYPES>(m_binders.size());
13312027Sjungma@eit.uni-kl.de        m_binders.push_back(binder);
13412027Sjungma@eit.uni-kl.de        m_export_callback_created = true;
13512027Sjungma@eit.uni-kl.de      }
13612027Sjungma@eit.uni-kl.de      else
13712027Sjungma@eit.uni-kl.de      {
13812027Sjungma@eit.uni-kl.de        binder = m_binders[0];
13912027Sjungma@eit.uni-kl.de      }
14012027Sjungma@eit.uni-kl.de
14112027Sjungma@eit.uni-kl.de      sc_core::sc_export<tlm::tlm_fw_transport_if<TYPES> >::bind(*binder);
14212027Sjungma@eit.uni-kl.de    }
14312027Sjungma@eit.uni-kl.de  }
14412027Sjungma@eit.uni-kl.de
14512027Sjungma@eit.uni-kl.de  //register callback for nb transport of fw interface
14612027Sjungma@eit.uni-kl.de  void register_nb_transport_fw(MODULE* mod,
14712027Sjungma@eit.uni-kl.de                              nb_cb cb)
14812027Sjungma@eit.uni-kl.de  {
14912027Sjungma@eit.uni-kl.de    check_export_binding();
15012027Sjungma@eit.uni-kl.de
15112027Sjungma@eit.uni-kl.de    //warn if there already is a callback
15212027Sjungma@eit.uni-kl.de    if (!m_nb_f.empty()){
15312027Sjungma@eit.uni-kl.de      display_warning("NBTransport_bw callback already registered.");
15412027Sjungma@eit.uni-kl.de      return;
15512027Sjungma@eit.uni-kl.de    }
15612027Sjungma@eit.uni-kl.de
15712027Sjungma@eit.uni-kl.de    //set the functor
15812027Sjungma@eit.uni-kl.de    m_nb_f.set_function(mod, cb);
15912027Sjungma@eit.uni-kl.de  }
16012027Sjungma@eit.uni-kl.de
16112027Sjungma@eit.uni-kl.de  //register callback for b transport of fw interface
16212027Sjungma@eit.uni-kl.de  void register_b_transport(MODULE* mod,
16312027Sjungma@eit.uni-kl.de                              b_cb cb)
16412027Sjungma@eit.uni-kl.de  {
16512027Sjungma@eit.uni-kl.de    check_export_binding();
16612027Sjungma@eit.uni-kl.de
16712027Sjungma@eit.uni-kl.de    //warn if there already is a callback
16812027Sjungma@eit.uni-kl.de    if (!m_b_f.empty()){
16912027Sjungma@eit.uni-kl.de      display_warning("BTransport callback already registered.");
17012027Sjungma@eit.uni-kl.de      return;
17112027Sjungma@eit.uni-kl.de    }
17212027Sjungma@eit.uni-kl.de
17312027Sjungma@eit.uni-kl.de    //set the functor
17412027Sjungma@eit.uni-kl.de    m_b_f.set_function(mod, cb);
17512027Sjungma@eit.uni-kl.de  }
17612027Sjungma@eit.uni-kl.de
17712027Sjungma@eit.uni-kl.de  //register callback for debug transport of fw interface
17812027Sjungma@eit.uni-kl.de  void register_transport_dbg(MODULE* mod,
17912027Sjungma@eit.uni-kl.de                              dbg_cb cb)
18012027Sjungma@eit.uni-kl.de  {
18112027Sjungma@eit.uni-kl.de    check_export_binding();
18212027Sjungma@eit.uni-kl.de
18312027Sjungma@eit.uni-kl.de    //warn if there already is a callback
18412027Sjungma@eit.uni-kl.de    if (!m_dbg_f.empty()){
18512027Sjungma@eit.uni-kl.de      display_warning("DebugTransport callback already registered.");
18612027Sjungma@eit.uni-kl.de      return;
18712027Sjungma@eit.uni-kl.de    }
18812027Sjungma@eit.uni-kl.de
18912027Sjungma@eit.uni-kl.de    //set the functor
19012027Sjungma@eit.uni-kl.de    m_dbg_f.set_function(mod, cb);
19112027Sjungma@eit.uni-kl.de  }
19212027Sjungma@eit.uni-kl.de
19312027Sjungma@eit.uni-kl.de  //register callback for DMI of fw interface
19412027Sjungma@eit.uni-kl.de  void register_get_direct_mem_ptr(MODULE* mod,
19512027Sjungma@eit.uni-kl.de                                   dmi_cb cb)
19612027Sjungma@eit.uni-kl.de  {
19712027Sjungma@eit.uni-kl.de    check_export_binding();
19812027Sjungma@eit.uni-kl.de
19912027Sjungma@eit.uni-kl.de    //warn if there already is a callback
20012027Sjungma@eit.uni-kl.de    if (!m_dmi_f.empty()){
20112027Sjungma@eit.uni-kl.de      display_warning("DMI callback already registered.");
20212027Sjungma@eit.uni-kl.de      return;
20312027Sjungma@eit.uni-kl.de    }
20412027Sjungma@eit.uni-kl.de
20512027Sjungma@eit.uni-kl.de    //set the functor
20612027Sjungma@eit.uni-kl.de    m_dmi_f.set_function(mod, cb);
20712027Sjungma@eit.uni-kl.de  }
20812027Sjungma@eit.uni-kl.de
20912027Sjungma@eit.uni-kl.de
21012027Sjungma@eit.uni-kl.de  //Override virtual functions of the tlm_target_socket:
21112027Sjungma@eit.uni-kl.de  // this function is called whenever an sc_port (as part of a init socket)
21212027Sjungma@eit.uni-kl.de  //  wants to bind to the export of the underlying tlm_target_socket
21312027Sjungma@eit.uni-kl.de  //At this time a callback binder is created an returned to the sc_port
21412027Sjungma@eit.uni-kl.de  // of the init socket, so that it binds to the callback binder
21512027Sjungma@eit.uni-kl.de  virtual tlm::tlm_fw_transport_if<TYPES>& get_base_interface()
21612027Sjungma@eit.uni-kl.de  {
21712027Sjungma@eit.uni-kl.de    //error if this socket is already bound hierarchically
21812027Sjungma@eit.uni-kl.de    if (m_hierarch_bind) display_error("Socket already bound hierarchically.");
21912027Sjungma@eit.uni-kl.de
22012027Sjungma@eit.uni-kl.de    if (!m_export_callback_created)
22112027Sjungma@eit.uni-kl.de      m_binders.push_back(new callback_binder_fw<TYPES>(m_binders.size()));
22212027Sjungma@eit.uni-kl.de    else
22312027Sjungma@eit.uni-kl.de      m_export_callback_created = false;
22412027Sjungma@eit.uni-kl.de
22512027Sjungma@eit.uni-kl.de    return *m_binders[m_binders.size()-1];
22612027Sjungma@eit.uni-kl.de  }
22712027Sjungma@eit.uni-kl.de
22812027Sjungma@eit.uni-kl.de  // const overload not allowed for multi-sockets
22912027Sjungma@eit.uni-kl.de  virtual const tlm::tlm_fw_transport_if<TYPES>& get_base_interface() const
23012027Sjungma@eit.uni-kl.de  {
23112027Sjungma@eit.uni-kl.de    display_error("'get_base_interface()' const not allowed for multi-sockets.");
23212027Sjungma@eit.uni-kl.de    return base_type::get_base_interface();
23312027Sjungma@eit.uni-kl.de  }
23412027Sjungma@eit.uni-kl.de
23512027Sjungma@eit.uni-kl.de  //just return the export of the underlying tlm_target_socket in case of a hierarchical bind
23612027Sjungma@eit.uni-kl.de  virtual sc_core::sc_export<tlm::tlm_fw_transport_if<TYPES> >& get_base_export()
23712027Sjungma@eit.uni-kl.de  {
23812027Sjungma@eit.uni-kl.de    return *this;
23912027Sjungma@eit.uni-kl.de  }
24012027Sjungma@eit.uni-kl.de
24112027Sjungma@eit.uni-kl.de  //just return the export of the underlying tlm_target_socket in case of a hierarchical bind
24212027Sjungma@eit.uni-kl.de  virtual const sc_core::sc_export<tlm::tlm_fw_transport_if<TYPES> >& get_base_export() const
24312027Sjungma@eit.uni-kl.de  {
24412027Sjungma@eit.uni-kl.de    return base_type::get_base_export();
24512027Sjungma@eit.uni-kl.de  }
24612027Sjungma@eit.uni-kl.de
24712027Sjungma@eit.uni-kl.de  //the standard end of elaboration callback
24812027Sjungma@eit.uni-kl.de  void end_of_elaboration(){
24912027Sjungma@eit.uni-kl.de    //'break' here if the socket was told not to do callback binding
25012027Sjungma@eit.uni-kl.de    if (m_eoe_disabled) return;
25112027Sjungma@eit.uni-kl.de
25212027Sjungma@eit.uni-kl.de    //get the callback binders and the multi binds of the top of the hierachical bind chain
25312027Sjungma@eit.uni-kl.de    // NOTE: this could be the same socket if there is no hierachical bind
25412027Sjungma@eit.uni-kl.de    std::vector<callback_binder_fw<TYPES>* >& binders=get_hierarch_bind()->get_binders();
25512027Sjungma@eit.uni-kl.de    std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*>&  multi_binds=get_hierarch_bind()->get_multi_binds();
25612027Sjungma@eit.uni-kl.de
25712027Sjungma@eit.uni-kl.de    //iterate over all binders
25812027Sjungma@eit.uni-kl.de    for (unsigned int i=0; i<binders.size(); i++) {
25912027Sjungma@eit.uni-kl.de      binders[i]->set_callbacks(m_nb_f, m_b_f, m_dmi_f, m_dbg_f); //set the callbacks for the binder
26012027Sjungma@eit.uni-kl.de      if (multi_binds.find(i)!=multi_binds.end()) //check if this connection is multi-multi
26112027Sjungma@eit.uni-kl.de        //if so remember the interface
26212027Sjungma@eit.uni-kl.de        m_sockets.push_back(multi_binds[i]);
26312027Sjungma@eit.uni-kl.de      else{ //if we are bound to a normal socket
26412027Sjungma@eit.uni-kl.de        //get the calling port and try to cast it into a tlm socket base
26512027Sjungma@eit.uni-kl.de        base_initiator_socket_type* test=dynamic_cast<base_initiator_socket_type*>(binders[i]->get_other_side());
26612027Sjungma@eit.uni-kl.de        if (!test){display_error("Not bound to tlm_socket.");}
26712027Sjungma@eit.uni-kl.de        m_sockets.push_back(&test->get_base_interface()); //remember the interface
26812027Sjungma@eit.uni-kl.de      }
26912027Sjungma@eit.uni-kl.de    }
27012027Sjungma@eit.uni-kl.de  }
27112027Sjungma@eit.uni-kl.de
27212027Sjungma@eit.uni-kl.de  //
27312027Sjungma@eit.uni-kl.de  // Bind multi target socket to multi target socket (hierarchical bind)
27412027Sjungma@eit.uni-kl.de  //
27512027Sjungma@eit.uni-kl.de  virtual void bind(base_type& s)
27612027Sjungma@eit.uni-kl.de  {
27712027Sjungma@eit.uni-kl.de    //warn if already bound hierarchically
27812027Sjungma@eit.uni-kl.de    if (m_eoe_disabled){
27912027Sjungma@eit.uni-kl.de      display_warning("Socket already bound hierarchically. Bind attempt ignored.");
28012027Sjungma@eit.uni-kl.de      return;
28112027Sjungma@eit.uni-kl.de    }
28212027Sjungma@eit.uni-kl.de
28312027Sjungma@eit.uni-kl.de    //disable our own end of elaboration call
28412027Sjungma@eit.uni-kl.de    disable_cb_bind();
28512027Sjungma@eit.uni-kl.de
28612027Sjungma@eit.uni-kl.de    //inform the bound target socket that it is bound hierarchically now
28712027Sjungma@eit.uni-kl.de    s.set_hierarch_bind((base_type*)this);
28812027Sjungma@eit.uni-kl.de    base_type::bind(s); //satisfy SystemC
28912027Sjungma@eit.uni-kl.de  }
29012027Sjungma@eit.uni-kl.de
29112027Sjungma@eit.uni-kl.de  //operator notation for hierarchical bind
29212027Sjungma@eit.uni-kl.de  void operator() (base_type& s)
29312027Sjungma@eit.uni-kl.de  {
29412027Sjungma@eit.uni-kl.de    bind(s);
29512027Sjungma@eit.uni-kl.de  }
29612027Sjungma@eit.uni-kl.de
29712027Sjungma@eit.uni-kl.de  //get access to sub port
29812027Sjungma@eit.uni-kl.de  tlm::tlm_bw_transport_if<TYPES>* operator[](int i){return m_sockets[i];}
29912027Sjungma@eit.uni-kl.de
30012027Sjungma@eit.uni-kl.de  //get number of bound initiators
30112027Sjungma@eit.uni-kl.de  // NOTE: this is only valid at end of elaboration!
30212027Sjungma@eit.uni-kl.de  unsigned int size(){return get_hierarch_bind()->get_binders().size();}
30312027Sjungma@eit.uni-kl.de
30412027Sjungma@eit.uni-kl.deprotected:
30512027Sjungma@eit.uni-kl.de  //implementation of base class interface
30612027Sjungma@eit.uni-kl.de  base_type* get_hierarch_bind(){if (m_hierarch_bind) return m_hierarch_bind->get_hierarch_bind(); else return this;}
30712027Sjungma@eit.uni-kl.de  std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*>&  get_multi_binds(){return m_multi_binds;}
30812027Sjungma@eit.uni-kl.de  void set_hierarch_bind(base_type* h){m_hierarch_bind=h;}
30912027Sjungma@eit.uni-kl.de  tlm::tlm_fw_transport_if<TYPES>* get_last_binder(tlm::tlm_bw_transport_if<TYPES>* other){
31012027Sjungma@eit.uni-kl.de    m_multi_binds[m_binders.size()-1]=other;
31112027Sjungma@eit.uni-kl.de    return m_binders[m_binders.size()-1];
31212027Sjungma@eit.uni-kl.de  }
31312027Sjungma@eit.uni-kl.de
31412027Sjungma@eit.uni-kl.de  //map that stores to which index a multi init socket is connected
31512027Sjungma@eit.uni-kl.de  // and the interface of the multi init socket
31612027Sjungma@eit.uni-kl.de  std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*> m_multi_binds;
31712027Sjungma@eit.uni-kl.de
31812027Sjungma@eit.uni-kl.de  void disable_cb_bind(){ m_eoe_disabled=true;}
31912027Sjungma@eit.uni-kl.de  std::vector<callback_binder_fw<TYPES>* >& get_binders(){return m_binders;}
32012027Sjungma@eit.uni-kl.de  //vector of connected sockets
32112027Sjungma@eit.uni-kl.de  std::vector<tlm::tlm_bw_transport_if<TYPES>*> m_sockets;
32212027Sjungma@eit.uni-kl.de  //vector of binders that convert untagged interface into tagged interface
32312027Sjungma@eit.uni-kl.de  std::vector<callback_binder_fw<TYPES>*> m_binders;
32412027Sjungma@eit.uni-kl.de
32512027Sjungma@eit.uni-kl.de  base_type*  m_hierarch_bind; //pointer to hierarchical bound multi port
32612027Sjungma@eit.uni-kl.de  bool m_eoe_disabled; //bool that diables callback bindings at end of elaboration
32712027Sjungma@eit.uni-kl.de  bool m_export_callback_created; // bool to indicate that a callback has already been created for export binding
32812027Sjungma@eit.uni-kl.de
32912027Sjungma@eit.uni-kl.de  //callbacks as functors
33012027Sjungma@eit.uni-kl.de  // (allows to pass the callback to another socket that does not know the type of the module that owns
33112027Sjungma@eit.uni-kl.de  //  the callbacks)
33212027Sjungma@eit.uni-kl.de  typename callback_binder_fw<TYPES>::nb_func_type    m_nb_f;
33312027Sjungma@eit.uni-kl.de  typename callback_binder_fw<TYPES>::b_func_type     m_b_f;
33412027Sjungma@eit.uni-kl.de  typename callback_binder_fw<TYPES>::debug_func_type m_dbg_f;
33512027Sjungma@eit.uni-kl.de  typename callback_binder_fw<TYPES>::dmi_func_type   m_dmi_f;
33612027Sjungma@eit.uni-kl.de};
33712027Sjungma@eit.uni-kl.de
33812027Sjungma@eit.uni-kl.de}
33912027Sjungma@eit.uni-kl.de
34012027Sjungma@eit.uni-kl.de#endif
341