Jump to content
kjhyland

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.

thanks,

K

Share this post


Link to post
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.

thanks,

Kevin

Share this post


Link to post
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.

HTH

-Eyck

Share this post


Link to post
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 

TRACE_VAR(tracef,dpu.idu.weight_reader.m_traffic_gen._STATE_);

thanks again Eyck and Ameya,

K

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×