avihai.r

segmentation fault with async_reset_signal_is()

3 posts in this topic

 

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

Share this post


Link to post
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

avihai.r likes this

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