Jump to content

Samuel Benjamin

  • Posts

  • Joined

  • Last visited

Everything posted by Samuel Benjamin

  1. Hello Everyone, I came to an issue which is only occuring with gcc-7.4.0 and linux 32 bit. The issue is with this static cast statement in the following scenario. # define SC_MAKE_FUNC_PTR(callback_tag, func) \ static_cast<sc_core::SC_ENTRY_FUNC>(&callback_tag::func) I Create a SystemC shared library (systemc.so) It has a memory Module Memory Module has TWO SC_METHODS p_memory and p_foo p_foo has no implementation --> this should give linking error. In order to provide some utlity to detect the undefined methods I create a stub.c file as shown below. This stub basically creates a function with the decorated name and has an implementation which issues a specific message instead of blocking the design. I generate (systemc_stub.so) to deal with the stub independent of systemc.so Then i Create a main where I load systemc_stub.so and then system.so Then i get the sc_main sybmol and launch the simulation. Design attached The Issue i see with gcc-7.4.0 , 32 bit is that the static cast fails as below. You will find in the code i inserted the code of SC_METHOD rather than the macro in order to see where the issue is coming from. Good case where the function is implemented inside systemc.so vs bad case. It looks to me the there is something happens with the static_cast to dispatch this function and cast it. Can anyone help me with this ? (gdb) p tmp2 $1 = (void (sc_core::sc_process_host::*)(sc_core::sc_process_host * const)) 0xf7fc140c <memory::p_memory()>, this adjustment -64 SC_ENTRY_FUNC tmp = static_cast<SC_ENTRY_FUNC>(&memory::p_foo); (gdb) n 46 ::sc_core::sc_process_handle p_foo_handle = sc_core::sc_get_curr_simcontext()->create_method_process( "p_foo", false, tmp, this, 0); (gdb) p tmp $1 = &virtual table offset -134397620, this adjustment -64 stub.c #ifdef __cplusplus #define DPI_LINK_DECL extern "C" #else #define DPI_LINK_DECL #endif #define FOUND_UNDEFINED_SYMBOL(nm) \ DPI_LINK_DECL void nm () {} FOUND_UNDEFINED_SYMBOL(_ZN6memory5p_fooEv) Thanks, Samuel gcc-7.4.0-issue.7z
  2. Hello , I am having a closed design which is running using SystemC 2.3.1 , When i updagraded to version 2.3.2 i found an error resulting from multi_socket_bases.h in the b_transport method "Call to b_transport without a registered callback for b_transport" as shown below. multi_socket_bases.h void b_transport(transaction_type& trans,sc_core::sc_time& t){ //check if a callback is registered if (m_b_f && m_b_f->is_valid()) { (*m_b_f)(m_id, trans,t); //do the callback return; } display_error("Call to b_transport without a registered callback for b_transport."); } Although , customer is supposed to be registering callbacks correctly as the register_b_transport function is called , but it looks like the callback pointers are not set due to an extra check as mention below in the end_of_elaboration function in multi_passthrough_socket.h // complete binding only if there has been a real bind bool unbound = (binders.size() == 1 && m_export_callback_created); // no call to get_base_interface has consumed the export - ignore if (unbound) return; void end_of_elaboration(){ //'break' here if the socket was told not to do callback binding if (m_eoe_disabled) return; //get the callback binders and the multi binds of the top of the hierachical bind chain // NOTE: this could be the same socket if there is no hierachical bind std::vector<callback_binder_fw<TYPES>* >& binders=get_hierarch_bind()->get_binders(); std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*>& multi_binds=get_hierarch_bind()->get_multi_binds(); // complete binding only if there has been a real bind // THIS IS A NEW CHECK WHICH WAS NOT IN 2.3.1 bool unbound = (binders.size() == 1 && m_export_callback_created); // no call to get_base_interface has consumed the export - ignore if (unbound) return; //// // iterate over all binders for (unsigned int i=0; i<binders.size(); i++) { binders[i]->set_callbacks(m_nb_f, m_b_f, m_dmi_f, m_dbg_f); //set the callbacks for the binder if (multi_binds.find(i)!=multi_binds.end()) //check if this connection is multi-multi //if so remember the interface m_sockets.push_back(multi_binds[i]); else{ //if we are bound to a normal socket //get the calling port and try to cast it into a tlm socket base base_initiator_socket_type* test=dynamic_cast<base_initiator_socket_type*>(binders[i]->get_other_side()); if (!test){display_error("Not bound to tlm_socket.");} m_sockets.push_back(&test->get_base_interface()); //remember the interface } } } When I commented out this extra check , the design worked fine. I would appreciate if you can tell me what could be the reason for this check and what to check ? and if there are any known issues with this extra check ? i can see that there are some fixe 2.3.3 to check the hierarchial binding but it did not work too. Thanks, Samuel
  • Create New...