Amol Nikade Posted August 18, 2021 Report Posted August 18, 2021 Can I get Example of How can we use - simple_target_socket_tagged. I have one component, that can be requested by N peripherals, so that I wanted to use tagged socket in my component to serve N peripherals with only one b_transport API call. Also How can I Identify which socket has called b_transport function ? Quote
Eyck Posted August 18, 2021 Report Posted August 18, 2021 the simple_target_socket_tagged does tell the callback which socket called the callback not which initiator. So you need to have a target socket for each of your peripherals. A use example of tagged sockets can be found at https://www.doulos.com/httpswwwdouloscomknowhow/systemc/tlm-20/tutorial-3-routing-methods-through-interconnect-components/ where simple_initiator_socket_:tagged is used for the router. The use of simple_target_socket_tagged is similar. Quote
Amol Nikade Posted August 19, 2021 Author Report Posted August 19, 2021 Thanks Eyck, will check in given link. Quote
Amol Nikade Posted August 20, 2021 Author Report Posted August 20, 2021 Hi Eyck, I am facing some below issue while binding initiator and target socket. --------------------------------------------------------------------------------------------- Simple Module: class ABC : public sc_module { public: SC_HAS_PROCESS(ABC ); ABC (sc_module_name nm, bool log_enable); ~ABC (); tlm_utils::simple_target_socket_tagged<ABC , 32>* t_socket [11]; }; ABC ::ABC (sc_module_name ABC) : sc_module(nm) { for(unsigned int id=0;id<11;id++) { char txt[20]; sprintf(txt, "socket_%d", id); t_socket [id] = new tlm_utils::simple_target_socket_tagged<ABC,32>(txt); } } ----------------------------------------------------------------------------------------------------------------- TestBench: class testbench: public sc_module { public: sc_in<bool> i_clk; SC_HAS_PROCESS(testbench); testbench(sc_module_name nm) : sc_module(nm) { m_abc = new ABC("ABC"); for(unsigned int i=0;i<11;i++) { char txt[20]; sprintf(txt, "socket_%d", i); o_tb[i]= new tlm_utils::simple_initiator_socket<testbench, 32>(txt); o_tb[i]->bind(m_abc->t_socket [i]); // Facing issue while binding } tlm_utils::simple_initiator_socket<testbench, 32>* o_tb [11]; protected: ABC *m_abc; } ----------------------------------------------------------------------------------- error: no matching function for call to ‘tlm_utils::simple_initiator_socket<testbench, 32u>::bind(tlm_utils::simple_target_socket_tagged<ABC, 32u>*&)’ o_tb[i]->bind(m_abc->t_socket [i]); can you please comment, why I am getting binding issue. Quote
Eyck Posted August 21, 2021 Report Posted August 21, 2021 Well, t_socket[i] is a pointer. So with o_tb[i]->bind(m_abc->t_socket[i]); you are calling bind with a pointer. There is no such function defined. I would suggest to refrain from using raw pointers and C-style arrays as they harm more than helping you. I coded up an example at https://www.edaplayground.com/x/MTTy If you are going to build up a really big design then you should use a std::unique_ptr with std::make_unique in your sc_main function only. This way all design elements will be instantiated using a single new call... Quote
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.