Jump to content

Undefined process control interaction: attempt to disable a thread with timeout wait:


rahuljn

Recommended Posts

Hi Experts

 

With the below programe, I have following error

 

Error: (E559) Undefined process control interaction: attempt to disable a thread with timeout wait: t.func2
In file: ../../../../systemc-2.3.0/src/sysc/kernel/sc_process.cpp:345
In process: t.func1 @ 5 ns
I am not able to figure out why ?

Can you please help

 

#include "systemc.h"

class test : public sc_module {
    public :
    SC_HAS_PROCESS(test);
    test(sc_module_name name){
        SC_THREAD(func1);
         func1_p = sc_get_current_process_handle();
        SC_THREAD(func2);
         func2_p = sc_get_current_process_handle();
    }
    sc_process_handle func1_p,func2_p;

    void func1(){
        for(;;){
            wait(5,SC_NS);
            func2_p.disable();
            wait(5,SC_NS);
            func2_p.enable();
        }
    }

    void func2(){
        for(;;){
            wait(10,SC_NS);
            cout<<sc_time_stamp().value()<<endl;
        }
    }
};

int sc_main(int, char*[]){
    test t("t");
    sc_start(SC_ZERO_TIME);
    sc_start();
    /*cout<<sc_time_stamp().value()<<endl;
    if(sc_get_status() == SC_PAUSED){sc_start(10,SC_NS);}
    cout<<sc_time_stamp().value()<<endl;*/
    return 0;
}

Link to comment
Share on other sites

Please consider the following processes instead the one I posted before

 

void func1(){
 wait(5,SC_NS);
 func2_p.disable();
 wait(5,SC_NS);
 func2_p.enable();
    }

    void func2(){
 for(;;){
     wait(10,SC_NS);
     cout<<sc_time_stamp().value()<<endl;
 }
    }

Link to comment
Share on other sites

I have following two processes

void func1(){

        wait(5,SC_NS);
        func2_p.disable();
        cout<<func2_p.dump_state()<<endl;
        wait(5,SC_NS);
        func2_p.enable();
        cout<<func2_p.dump_state()<<endl;
        wait(5,SC_NS);
    }

    void func2(){
        for(;;){
            wait(1,SC_NS);
            cout<<sc_time_stamp().value()<<endl;
        }
    }

 

when I run, I get

1000
2000
3000
4000
[disabled ]
5000
[ normal]
 

seems calling  func2_p.enable(); has no effect, it is not enabling the func2.

Can you please help ?

Link to comment
Share on other sites

As the original error message says, you are not supposed to disable() a process that is within a timed wait (i.e. wait(xx,SC_NS); in your case).  See Section 5.6.6.2 of IEEE 1666-2011.

 

Moreover, since your func2 process has no static sensitivity, the process will not run again after it is enabled, unless it is explicitly reset.
See 5.6.6.2 again, quoting:

 

If a time-out occurs while a process instance is disabled and that process instance is sensitive to no other events aside from the time-out itself, the process instance will not run again (unless it is reset) and the implementation may issue a warning.

 

If you want to enable/disable a process, the target process should be sensitive to events, instead of using timed waits itself.

 

/Philipp

Link to comment
Share on other sites

Hi Philipp

 

I tried to use explicit reset but the func2 is not running after enable

 

void func1(){
        wait(5,SC_NS);
        func2_p.disable();
        wait(20,SC_NS);
        func2_p.enable();
        func2_p.reset();
        wait(5,SC_NS);
    }

    void func2(){
        cout<<"func2 start"<<endl;
        for(;;){
            wait(1,SC_NS);
            cout<<sc_time_stamp().value()<<endl;
        }
    }

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