SystemC VCD trace does not set correct precision
Use of the SpTraceVCD functions does not appear to set the trace precision correctly.
When creating an instance of
SpTraceVcdCFile, the time resolution is held in the associated
SpTraceVcd object (private variable
m_timeRes, which can be set by the
set_time_precision() function). This defaults to 10e-9 (1ns), which is inconsistent with SystemC's default of 10e-12 (1ps). It can be overridden by explicitly, e.g:
SpTraceVcdCFile *tfp = new SpTraceVcdCFile (); tfp->spTrace()->set_time_resolution ("1 ps");
Really this should be set automatically in a SystemC environment by calling the underlying
sc_get_time_precision() function from the constructor of
SpTraceVcdCFile. The code to do this exists in the class
SpTraceVcdFile, but I cannot see that this class is currently used.
#2 Updated by Jeremy Bennett almost 5 years ago
Ah thanks - my misunderstanding from reading the example in the distribution.
I've tried, but can't see how to use
SpTraceFile to assist in SystemC tracing (the class I referred to as
SpTraceVcdFile is in fact
SpTraceFile). This is a subclass of the abstract class
sc_trace used to do SystemC tracing. However I can't see how to use it. There should be an alternative to
sc_create_vcd_trace_file to create instances, which I can't find. I also ran into issues when I tried including the header
"SpTraceVcd.h", it got upset if I included it after any of the
Really I don't really want to do SystemC tracing - it's the underlying Verilog signals I'm after, so my approach was correct, but since I'm in the C world, I need to set the precision.
From my past experience, this is the usual scenario - it's the underlying signals that need to be traced. An option to allow Verilator to do this and automatically pick up the SystemC time precision would be a nice enhancement for the future.
#3 Updated by Wilson Snyder over 4 years ago
- Status changed from AskedReporter to WillNotFix
I looked at doing this again, and it makes a bit as a mess as the C tracing isn't at all systemc aware, and making it so breaks compiles when there's no systemc. So until a major tracing rewrite comes I'll need to punt. Sorry.