matteodc Posted May 20, 2015 Report Share Posted May 20, 2015 Hi, when I try to do this: typedef tlm::tlm_blocking_put_if<DATA_TYPE> TLM_BUS_IF_TYPE; template < class M > class chan : public TLM_BUS_IF_TYPE, public sc_core::sc_channel { public: SC_HAS_PROCESS(chan); chan(sc_core::sc_module_name nm) : sc_core::sc_channel(nm) { SC_THREAD(put); }; virtual void put(const DATA_TYPE &t) { wait(m_delay); <- it stops here }; }; I get: error C2440: 'static_cast' : cannot convert from 'void (__thiscall E::chan<M>::* )(const E::DATA_TYPE &)' to 'sc_core::SC_ENTRY_FUNC' Any idea? Thanks Quote Link to comment Share on other sites More sharing options...
David Black Posted May 20, 2015 Report Share Posted May 20, 2015 Methods registered as processes via SC_THREAD are not allowed to have arguments and must have the signature: void METHODNAME(void); Think of it this way: When you register a method to be used as a SystemC process, you are telling the simulator kernel to invoke the method for you, and you are also implicitly stating you will not be invoking it yourself. I suspect you simply need to remove the SC_THREAD registration. put(data) will be called from another thread process, and hence does not need a process locally. If your channel requires a local process, it will need to be something that is not part of the interface class. Quote Link to comment Share on other sites More sharing options...
matteodc Posted May 20, 2015 Author Report Share Posted May 20, 2015 Thanks David. Quote Link to comment Share on other sites More sharing options...
matteodc Posted May 20, 2015 Author Report Share Posted May 20, 2015 I have removed SC_THREAD and added a wait() in the put method: virtual void put(const DATA_TYPE &t) { wait(); <- it stops here }; But I get, SC_REPORT_ERROR( SC_ID_WAIT_NOT_ALLOWED_, "\n " "in SC_METHODs use next_trigger() instead" ); break; } It is quite clear. If I add next_trigger(), I get: SC_REPORT_ERROR( SC_ID_NEXT_TRIGGER_NOT_ALLOWED_, "\n " "in SC_THREADs and SC_CTHREADs use wait() instead" ); } And this is the reason I put SC_THREAD.. How to solve it? Thanks Quote Link to comment Share on other sites More sharing options...
apfitch Posted May 21, 2015 Report Share Posted May 21, 2015 If you put wait() in your put() method, you must call it from the context of an SC_THREAD. Can you show the code where you're calling put()? Alan 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.