Jump to content

sc_trace for all sc_signal,sc_in, sc_out


Recommended Posts



I have a query regarding sc_trace.


Is it possible to have directly get all the signals and ports dumped into the VCD file.

I am trying something like this in sc_main:


Top top1("top1");

sc_trace_file *tf = sc_create_vcd_trace_file("waveforms");
sc_simcontext *context = sc_get_curr_simcontext();
sc_object *optr = context->first_object();
while(optr) {
    if (std::string(optr->kind()) == "sc_signal") optr->trace(tf);        
    optr = context->next_object();


With this I am not getting anything into the waveforms.vcd.

Could anyone please suggest the correct way to do the above.


Thanks for the help.



Samyak Jaroli

Student, India

Link to comment
Share on other sites

There has been a discussion on tracing all signals (and ports) in a design in this forum before, see http://forums.accellera.org/topic/138-why-sc-object-menber-function-trace-deprecated/

Short answer: sc_object::trace is not part of the IEEE 1666 SystemC standard and won't work the way you expect.

Secondly, sc_simcontext is also not part of the standard. You should not use it within your designs. To traverse the SystemC object hierarchy, use the sc_get_top_level_objects() and [sc_object::get_child_objects()[/i] functions. An example can be found in the thread linked above.

Greetings from Oldenburg,


Link to comment
Share on other sites

  • 4 years later...

Hello, I've created a script for GDB that automatically calls sc_trace for all signals, ports and plain member variables.  It requires a small patch for SystemC library: moving some sc_trace definitions from .h to .cpp so they are not in-lined or garbage collected.  

Here it is:


Since I've tested it only with my design, it may be buggy. Please report any issues on github.

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