Jump to content

Using sc_trace inside SC_THREAD


Recommended Posts


I am trying to dump internal signals of an SC_MODULE's processes (SC_THREAD process) in a VCD. SC_MODULE has multiple processes and I need to dump signals from each of those processes in the same VCD. 

Currently, I am trying with one SC_THREAD process and I see this error when I add sc_trace inside the while loop:

Error: (E720) sc_trace_file already initialized: sc_trace() failed:
    No traces can be added to 'traces.vcd' once trace recording has started.
    To add tracing of 'A_val', create a new trace file.
In file: ../../../src/sysc/tracing/sc_trace_file_base.cpp:239


Here is my code:

  sc_in<sc_int<10>> A;
  sc_in<sc_int<10>> B;
  sc_out<sc_int<10>> S;
  sc_trace_file* Tf;

  void do_sum();
      Tf = sc_create_vcd_trace_file("traces");
        sensitive << A << B;
  ~SUM() {

void SUM::do_sum() {
    int A_val, B_val, S_val;
    while(true) {
    A_val = A.read();
    B_val = B.read();
    S_val = A_val + B_val;

    sc_trace(Tf, A_val, "A_val");
    sc_trace(Tf, B_val, "B_val");
    sc_trace(Tf, S_val, "S_val");



Can someone please help me with this?

Thanks in advance.



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.

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