Nithin Posted March 4, 2021 Report Share Posted March 4, 2021 Hi, 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_MODULE (SUM) { 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(); SC_CTOR (SUM) { Tf = sc_create_vcd_trace_file("traces"); SC_THREAD(do_sum); sensitive << A << B; } ~SUM() { sc_close_vcd_trace_file(Tf); } }; void SUM::do_sum() { int A_val, B_val, S_val; while(true) { wait(); A_val = A.read(); B_val = B.read(); S.write(A.read()+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. Regards, Nithin Quote Link to comment Share on other sites More sharing options...
David Black Posted March 4, 2021 Report Share Posted March 4, 2021 You’re only allowed to call sc_trace one time for each variable and after that tracing is automatic. So you need to move the sc_trace calls out into the constructor or into end_of_elaboration or somewhere else before simulation starts. You also need to move your local variables in to the class as members. maehne 1 Quote Link to comment Share on other sites More sharing options...
Nithin Posted March 4, 2021 Author Report Share Posted March 4, 2021 Got it. Thank you David. 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.