Jump to content

segmentation fault with async_reset_signal_is()


avihai.r

Recommended Posts

 

Hi,

I'm getting segmentation fault when I set async_reset signal for a thread, and initialize this signal to be true at the beginning of the TB. I'm getting this segmentation fault only when set the signal to reset when "true".

class main_module : sc_core::sc_module {
public:
	// Signals and event declaration
	sc_in<bool>		reset_in;
	sc_event		thread1_event;
	
	SC_HAS_PROCESS(main_module);

	// Constructor
	main_module(sc_core::sc_module_name mn) :
	  sc_core::sc_module(mn)
	 ,reset_in("reset_in")
	{
		cout << "this is main_module constructor" << endl;
		SC_THREAD(thread1);
		sensitive << thread1_event;
		async_reset_signal_is(reset_in,true);
	};

	// Thread
	void thread1() {
		while(1){
			wait();
		}
	}
};
int sc_main(int argc, char* argv[]) {

	main_module		*main_module_i = new main_module("main_module_i");
	
	sc_signal<bool>		reset_sig;
	reset_sig.write(true);

	// bind
	main_module_i->reset_in(reset_sig);

	cout << "before sc_start()" << endl;

	sc_start(100, SC_US);

	cout << "DONE!!! after sc_start()" << endl;
	return 0;
}

 

Is it forbidden to set async reset signal to be asserted at the beginning of simulation?

 

Thanks!
Avihai

Link to comment
Share on other sites

Hi Avihai,

I can confirm this behavior with the latest SystemC 2.3.2 pre-release and would classify this as a bug.

As a short-term workaround, you can mark affected threads with dont_initialize(), which happens not to trigger this misbehavior:

    SC_THREAD(thread1);
    sensitive << thread1_event;
    async_reset_signal_is(reset_in,true);
    dont_initialize(); // avoid crash when starting in reset state

I'll forward this issue to the Language Working Group for further analysis.

Greetings from Duisburg,
  Phiipp

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