Jump to content

sc_bind undefined


bk4u_1980

Recommended Posts

Hi,

I am getting below error when compiling systemc code.

"$TESTDIR/../../src/common/test_uvm/cxx//reg_interceptor_wrapper.h", line 85: error:

identifier "sc_bind" is undefined

sc_spawn( sc_bind(&sc_sim_reg_if::write, this->wrappedObject, payload.GetAddress(), payload.GetValue()) );

^

"$TESTDIR/../../src/common/test_uvm/cxx//reg_interceptor_wrapper.h", line 85: error:

identifier "sc_spawn" is undefined

sc_spawn( sc_bind(&sc_sim_reg_if::write, this->wrappedObject, payload.GetAddress(), payload.GetValue()) );

Am I missing any file to include from systemC library?

I have already included systemc.h file in my csim wrapper.

Thanks,

Bharat,

Link to comment
Share on other sites

Hello,

Are you sure that at this point in your code in reg_interceptor_wrapper.h the <systemc.h> header is already included? sc_bind should be found always, as it is defined in the standard to be a #define to boost::bind, which as a side note is not very proper. So it should be found once <systemc> or <systemc.h> is included in the header. However, sc_spawn() is a function, which is defined in the namespace sc_core. In your error message, sc_spawn isn't prefixed with sc_core::. In that case there should be somewhere a

using namespace sc_core;

or

using sc_core::sc_spawn;

somewhere in the header to make it work or <systemc.h> has to be included. All three solutions are not very proper, as you should not use using statements in headers to avoid public namespace pollution. Therefore, als #include <systemc> is preferrerd over #include <systemc.h>.

No further diagnosis of your problem is possible without any further context.

Best regards,

Torsten

Link to comment
Share on other sites

To use the dynamic process features (like sc_bind and sc_spawn), you need to define the preprocessor symbol SC_INCLUDE_DYNAMIC_PROCESSES before including SystemC:

#define SC_INCLUDE_DYNAMIC_PROCESSES
#include <systemc>

In SystemC 2.3.0, this should work reliably, even if SystemC has been already included before. To make sure that this define is in place at all times, you might want to add the define to your compiler options.

Greetings from Oldenburg,

Philipp

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...