Services - tools - models - for embedded software development
Embecosm divider strip
Prev  Next

6.3.1.  Constructor for the VCD Trace Module

The constructor only provides any functionality if tracing has been enabled using the -trace flag. The entire code is conditional on VM_TRACE.

The constructor is passed a pointer to the Verilator model to be traced and the name of the VCD file to use. A new instance of SpTraceVcdFile is allocated. Its time resolution is set to match that of the SystemC model (obtained using sc_get_time_resolution). The Verilator model is instructed to dump signals down to maximum depth (99) using its trace function. Finally the named dump file is opened using the open function of the SystemPerl trace file.

In this example, a utility function, setSpTimeResolution is used to convert the time resolution from the format in SystemC to the string used by SystemPerl.

Finally the constructor declares driveTrace to be a method sensitive to the clock. It will be called on each clock edge and used to dump all traced signals.

Embecosm divider strip