Jump to content

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

Recommended Posts



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



  sc_event func_event;


  TOP(sc_module_name name) {





  void end_of_elaboration(){



  void method_function() {

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




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


  TOP top("top");


  return 0;



Please have a look, thanks in advance.

Share this post

Link to post
Share on other sites

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
h) Calls to the process control member functions kill, reset, or throw_it of class sc_process_handle

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now