Jump to content

VCD dump with Hierarchy systemc-2.3.2


Recommended Posts

Hi -

I am tracing variables from a system C model but the hierarchy of the class structure is not mirrored in the vcd file.

All variables are collected flat under a SystemC module.

Am I doing something wrong? I've tried enabling the tracing of the vars from the top level and from within the class hierarchy itself, but it doesn't seem to make a difference.



Link to comment
Share on other sites

Hi Ameya -

I did to access the signal, but not in the name string.

I copied the hierarchy of the probe to the name string and, to my surpirse, the hierarchy was dumped.

originally I had

sc_trace(_trace_, top.dpu.idu.weight_reader.m_traffic_gen._STATE_, "traffic_reader_state");

which provided no hierarchy.

I changed it to this, and it worked!

sc_trace(_trace_, top.dpu.idu.weight_reader.m_traffic_gen._STATE_, "top.dpu.idu.weight_reader.m_traffic_gen._STATE_");

thanks for the prompt - very much appreciated.



Link to comment
Share on other sites

Hi Kevin,

if you check here https://github.com/Minres/SystemC-Components/blob/master/incl/scc/utilities.h there are three macros which make live easier:

#define TRACE_VAR(F, X)    sc_core::sc_trace(F, X, std::string(this->name()) + "." #X)
#define TRACE_ARR(F, X, I) sc_core::sc_trace(F, X[I], (std::string(this->name()) + "." #X "(" + std::to_string(I) + ")").c_str());
#define TRACE_SIG(F, X)    sc_core::sc_trace(F, X, X.name())

They can be used with local variables and arrays as well with SystemC objects providing the name() funtion. This way tracing a signal becomes as easy as (assuming _STATE_ being a signal or port):

TRACE_VAR(_trace_, top.dpu.idu.weight_reader.m_traffic_gen._STATE_);

Pls. note: the first 2 macros are assumed to be used within a sc_module.



Link to comment
Share on other sites

Just to confirm for other readers - the macros work as described.

sc_trace(tracef, dpu.idu.weight_reader.m_traffic_gen._STATE_, "dpu.idu.weight_reader.m_traffic_gen._STATE_"); 

equivalent to 


thanks again Eyck and Ameya,


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