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

6.3.  VCD Tracing

6.3.1. Constructor for the VCD Trace Module
6.3.2. Destructor for the VCD Trace Module
6.3.3. The trace method, driveTrace

SystemC has its own tracing functions for generating VCDs (sc_create_vcd_trace_file, sc_close_vcd_trace_file and sc_trace). However these only allow tracing of SystemC signals.

Tracing the signals in the underlying Verilator model requires a SystemC module which can drive Verilator's trace functions. In this example, that module is TraceSC.

Tracing must be enabled when the Verilator model is created, by use of the -trace flag. This can be conveniently passed in using the VFLAGS macro with the Makefile. When tracing has been turned on the VM_TRACE macro is defined, so C++ code can be made conditional by using #if VM_TRACE.

Tracing requires that the main model header is included and the SystemPerl VCD tracing header. However the latter is only available if the -trace flag has been used, so its inclusion must be conditional:

#include "Vorpsoc_fpga_top.h"

#if VM_TRACE
#include <SpTraceVcdC.h>
#endif
      

Tracing requires a SystemC method to be woken on each clock edge to generate trace output, a pointer to the Verilator model and a pointer to a the SystemPerl trace file object of type SpTraceVcdFile. This last is only available if the -trace flag has been used, so its definition must be conditional on VM_TRACE.

Embecosm divider strip