taog Posted March 6, 2019 Report Share Posted March 6, 2019 I want to create a SystemC class as a derivative of another SystemC class like below: struct A : public sc_module { ... tlm_utils::multi_passthrough_target_socket<A, 32, tlm::tlm_base_protocol_types, 0, sc_core::SC_ZERO_OR_MORE_BOUND> tsocket; ... }; struct B : public A { ... }; struct C : public sc_module { ... tlm_utils::multi_passthrough_initiator_socket<C, 32, tlm::tlm_base_protocol_types, 0, sc_core::SC_ZERO_OR_MORE_BOUND> isocket; ... }; Then I need to bind B to C B b; C c; C->isocket.bind(b->tsocket); But, I will get some runtime error like below: Error: (E120) sc_export instance has no interface: B.tsocket In file: /home/tools/vcs/mx-2017.12-1/include/systemc231/sysc/communication/sc_export.h:162 Does SystemC do not support such a use case? Or I only need to do some “cast” to bind this socket? I'm not sure if it will bring some side-effect. Quote Link to comment Share on other sites More sharing options...
Eyck Posted March 6, 2019 Report Share Posted March 6, 2019 You need to register callbacks to them so that they are bound to an interface. See Unbound multi_passthrough_initiator_socket/multi_passthrough_target_socket In general I would discourage the use of them (or at least suggest to carefully think about their use) as they have several drawbacks: you cannot bind a target socket to a multi_passthrough_target_socket and you cannot bind in before_end_of_elaboration (see also Is there any order requirement for binding multi_passthrough_initiator_sockets?). BR Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted March 8, 2019 Report Share Posted March 8, 2019 From my understanding, the "before_end_of_elaboration" limitation got fixed in SystemC 2.3.1 (and a regression introduced by this was fixed in 2.3.2/2.3.3). /Philipp Quote Link to comment Share on other sites More sharing options...
Khushi Posted April 25, 2019 Report Share Posted April 25, 2019 On 3/8/2019 at 3:22 AM, Philipp A Hartmann said: From my understanding, the "before_end_of_elaboration" limitation got fixed in SystemC 2.3.1 (and a regression introduced by this was fixed in 2.3.2/2.3.3). /Philipp Hi Philipp I don't think it is fixed in either 2.3.2 or 2.3.3. The example below is still gives the error "Error: (E126) sc_export instance already bound: top_inst.middle_export_0" with both 2.3.2 and 2.3.3 #include "systemc.h" #include "tlm_utils/multi_passthrough_initiator_socket.h" #include "tlm_utils/simple_target_socket.h" struct top : sc_module { tlm_utils::multi_passthrough_initiator_socket<top> leaf{"leaf"}; tlm_utils::multi_passthrough_initiator_socket<top> middle{"middle"}; tlm_utils::simple_target_socket<top> target{"target"}; top(sc_module_name){ //leaf.bind(target); //middle.bind(leaf); } protected: void before_end_of_elaboration(){ middle.bind(leaf); leaf.bind(target); } }; int sc_main(int argc, char** argv){ top top_inst("top_inst"); sc_start(); return 0; } Thanks Khushi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.