Jump to content
Sign in to follow this  

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

Recommended Posts

Hi everyone,

I have a runtime error when trying to simulate a sc_module

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:94


#include "systemc.h"

template<typename IN_T, typename OUT_T>
SC_MODULE (pe) {
    sc_in<bool> clk;
    sc_in<bool> rst;
    sc_fifo_in<IN_T> Input;
    sc_fifo_out<OUT_T> Output;

    void pe_proc();

    pe(sc_module_name name_, int p_time_) :
            sc_module(name_), p_time(p_time_) {
        SC_CTHREAD(pe_proc, clk.pos());
        reset_signal_is(rst, true);
    int p_time;

template<typename IN_T, typename OUT_T>
void pe<IN_T, OUT_T>::pe_proc(void) {

    IN_T in_val;
    OUT_T out_val;
    // Reset code
    // Reset internal variables
    in_val = 0;
    out_val = 0;
    // Reset outputs

    while (true) {
        // Read inputs
        in_val = Input.read();
        // Algorithm code
        for (int i = 0; i < p_time; i++) {
        // write outputs
        out_val = (OUT_T) in_val;



Share this post

Link to post
Share on other sites

Hello @chatbq,

There is not enough context, probably the exception is being thrown from another module.

Overall the code seems fine.

You can try and see from where the exception is being thrown from the debugger.


Ameya Vikram Singh

Share this post

Link to post
Share on other sites

Hi @AmeyaVS

I have solved this problem. This runtime error shows up when I try to trace out the wave of sc_fifo.

Use the built-in trace() method of sc_fifo instate of sc_trace() solving this problem.

#include "system.h"


int sc_main (int argc, char* argv[])
    top = new SYSTEM("top");
    sc_trace_file *tr= sc_create_vcd_trace_file("pe");

    sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
                                               sc_core::SC_DO_NOTHING );
    return 0;


Share this post

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.

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.

Sign in to follow this  

  • Create New...