Jump to content

suspend/resume vs wait(e)


mohitnegi

Recommended Posts

hello all ,

i am just started to use sc_process_handler and the suspend/wait  usuage is somewhat similar to wait(e) (ignoring its implementation w.r.t schedular) ...

as i see that from the usuage point of view i can replace suspend/resume any where i have wait(e)  ...

can anyone tell me the difference here ...

Link to comment
Share on other sites

hello all ,

i am just started to use sc_process_handler and the suspend/wait  usuage is somewhat similar to wait(e) (ignoring its implementation w.r.t schedular) ...

as i see that from the usuage point of view i can replace suspend/resume any where i have wait(e)  ...

can anyone tell me the difference here ...

Hello Sir,

Could you please make your query a bit more concrete ? A simple example, would

be helpful in understanding what exactly the main issue is.

Link to comment
Share on other sites

Hello Sir,

Could you please make your query a bit more concrete ? A simple example, would

be helpful in understanding what exactly the main issue is.

#include "systemc.h"

class test : public sc_module {
	public :
	sc_process_handle t ;
	SC_HAS_PROCESS(test);
	test(sc_module_name){
		SC_THREAD(run);
		t = sc_get_current_process_handle();
		SC_THREAD(run2);
	} 
	void run(){
		wait(10,SC_NS);
		wait(5,SC_NS);
		cout<<"T :run2 "<<sc_time_stamp().value()<<endl;
	}

	void run2(){
	    wait(10,SC_NS);
	    t.suspend();
	    wait(20,SC_NS);
	    t.resume();	
	//t.reset();
	}
	
};

int sc_main(int, char**){
	test t("test");
	sc_start();
	return 0;
}

vs

#include "systemc.h"

class test : public sc_module {
	public :
	//sc_process_handle t ;
        sc_event e1,e2;
	SC_HAS_PROCESS(test);
	test(sc_module_name){
		SC_THREAD(run);
		//t = sc_get_current_process_handle();
		SC_THREAD(run2);
	} 
	void run(){
		wait(10,SC_NS);
		wait(5,SC_NS);
                e1.notify(); //here we want to suspend it
                wait(SC_ZERO_TIME);
                wait(e2);   ///here it will resume
		cout<<"T :run2 "<<sc_time_stamp().value()<<endl;
	}

	void run2(){
	    wait(10,SC_NS);
            wait(e1);
	    //t.suspend();
	    wait(20,SC_NS);
            e2.notify();
	    //t.resume();	
	//t.reset();
	}
	
};

int sc_main(int, char**){
	test t("test");
	sc_start();
	return 0;
}

our purpose is same in both cases ...so what is the difference whether i use wait(e) or suspend/resume

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