Jump to content

Error: (E519) wait() is only allowed in SC_THREADs and SC_CTHREADs


Recommended Posts

Hello everyone,

 

I have a runtime error when trying to simulate the top level of a system containing 2 sc_threads.

An example of my code architecture is presented hereunder, do you see any problem?

Here is my error :

Error: (E519) wait() is only allowed in SC_THREADs and SC_CTHREADs:
        in SC_METHODs use next_trigger() instead
In file: ../../../../src/sysc/kernel/sc_wait.cpp:166
In process: Test_top.th1.Thread_test @ 0 s

TB_test_top.cpp:

#include "Test_top.h"

int sc_main(int argc, char* argv[]) {
    Test_top topLevel("topLevel");
    sc_start(70, SC_NS);
};

Test_top.h:

#include <systemc>
#include "Thread.h"
class Test_top {
    Test_top();
};

Test_top.cpp:

#include "Test_top.h"
Test_top::Test_top(){
    Thread th1("th1");
    Thread th2("th2");
};

Thread.h:

#include <systemc>
SC_MODULE (Thread){
    void Thread_test();
    SC_HAS_PROCESS(Thread);
    Thread(sc_module_name instanceName) :
            sc_module(instanceName){
        SC_THREAD(Thread_test);
    }
};

Thread.cpp

#include "Thread.h"
void Thread::Thread_test(){
    ...
    wait(...);
    ...
};

Thank you for your comments!

 

Link to post
Share on other sites

Hi. 

 

I had no problems running your code (with SystemC 2.3.0). 

Only compiler errors: 





Test_top topLevel("topLevel");

This constructor doesn't exist. 

After fixing this, the example ran without errors.

 

But there is a big problem in your code: You declare the two 'Thread' instances as local variables in the Test_top constructor. Since they are local variables, they will be created in the constructor and destroyed when the constructor exits. Hence, when you start the simulation, no SC_MODULE is available anymore. In older SystemC releases, this may lead to the observed error because of some internal clean up issues. 

 

Greetings

Ralph

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