chatbq Posted April 20, 2019 Report Share Posted April 20, 2019 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 pe.h #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(); SC_HAS_PROCESS(pe); 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); } private: 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 wait(); while (true) { // Read inputs in_val = Input.read(); // Algorithm code for (int i = 0; i < p_time; i++) { wait(); } // write outputs out_val = (OUT_T) in_val; Output.write(out_val); } } Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted April 20, 2019 Report Share Posted April 20, 2019 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. Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
chatbq Posted April 22, 2019 Author Report Share Posted April 22, 2019 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" SYSTEM *top = NULL; int sc_main (int argc, char* argv[]) { top = new SYSTEM("top"); sc_trace_file *tr= sc_create_vcd_trace_file("pe"); sc_trace(tr,top->clk_sig,"clock"); top->Input.trace(tr); top->Output.trace(tr); sc_trace(tr,top->rst_sig,"rst"); sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING ); sc_start(); sc_close_vcd_trace_file(tr); return 0; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.