Jump to content

Segmentation fault: Method sensitive to an event which is notified(immediately)


Recommended Posts

Posted

Hello,

 

With the following example, I have a method which is sensitive to an event which is notified(immediately) from end_of_elaboration() function.

This gives Segmentation fault (core dumped).

However if I do func_event.notify(SC_ZERO_TIME); or func_event.notify(1,SC_NS), there is no Segmentation fault

 

#include "systemc.h"

 

class TOP : public sc_module

{

  public:

  sc_event func_event;

  SC_HAS_PROCESS(TOP);

  TOP(sc_module_name name) {

    SC_METHOD(method_function);

    sensitive<<func_event;

    dont_initialize();

  }

  void end_of_elaboration(){

      func_event.notify();

  }

  void method_function() {

      std::cout<<"inside f() before wait"<<std::endl;

  }

};

 

int sc_main(int argc, char* argv[])

{

  TOP top("top");

  sc_start();

  return 0;

}

 

Please have a look, thanks in advance.

  • 5 months later...
Posted

It can be found in LRM 4.4

 

The following constructs shall not be used directly or indirectly within callback end_of_elaboration:
a) The instantiation of objects of class sc_module, sc_port, sc_export, sc_prim_channel
B) Port binding
c) Export binding
d) The macros SC_CTOR, SC_CTHREAD
e) The member functions reset_signal_is and async_reset_signal_is of the class sc_module
f) Calls to event finder functions
g) Calls to member function notify of class sc_event with an empty argument list to create immediate
notifications
h) Calls to the process control member functions kill, reset, or throw_it of class sc_process_handle

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...