OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [TraceSC.cpp] - Diff between revs 6 and 42

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 42
Line 26... Line 26...
 
 
// $Id: TraceSC.cpp 302 2009-02-13 17:22:07Z jeremy $
// $Id: TraceSC.cpp 302 2009-02-13 17:22:07Z jeremy $
 
 
#include "TraceSC.h"
#include "TraceSC.h"
 
 
 
using namespace std;
 
 
SC_HAS_PROCESS( TraceSC );
SC_HAS_PROCESS( TraceSC );
 
 
//! Constructor for the trace module
//! Constructor for the trace module
 
 
//! @param name           Name of this module, passed to the parent
//! @param name           Name of this module, passed to the parent
Line 44... Line 46...
  traceTarget (_traceTarget)
  traceTarget (_traceTarget)
{
{
#if VM_TRACE
#if VM_TRACE
 
 
  // Setup the name of the VCD dump file
  // Setup the name of the VCD dump file
 
  string dumpNameDefault("vlt-dump.vcd");
 
  string dumpSuffix("-vlt.vcd");
 
  string dumpDir("../results/"); // Note: hardcoded to store all VCDs in the ../results dir
 
  string testNameString;
 
  string vcdDumpFile;
 
 
  char* dumpName;
  if (argc > 1) // If we were passed a name on the command line, use it
  char* dumpSuffix = "-vlt.vcd\0";
 
  char* dumpNameDefault = "vlt-dump.vcd\0";
 
  // We will be passed the current test-name when we're called
 
  if (argc > 1)
 
    {
    {
      // Assume test name is first thing
      testNameString = (argv[1]);
      int testname_argv_index = 1;
      vcdDumpFile = dumpDir + testNameString + dumpSuffix;
      // Take the second argument as the test name and we'll 
 
      // concatendate "-vlt.vcd" on the end
 
      dumpName = (char*) malloc((strlen(argv[testname_argv_index] +
 
                                              strlen(dumpSuffix))*sizeof(char)));
 
      // Copy in the test name
 
      strcpy(dumpName, argv[testname_argv_index]);
 
      // Now add on the suffix
 
      strcat(dumpName, dumpSuffix);
 
 
 
      printf("VCD dumpfile: %s\n", dumpName);
 
    }
    }
  else
  else // otherwise use our default VCD dump file name
    dumpName = dumpNameDefault;
    vcdDumpFile = dumpDir + dumpNameDefault;
 
 
  Verilated::traceEverOn (true);
  Verilated::traceEverOn (true);
 
 
  cout << "Enabling VCD trace" << endl;
  cout << "Enabling VCD trace" << endl;
 
 
 
  printf("VCD dumpfile: %s\n", vcdDumpFile.c_str());
 
 
  // Establish a new trace with its correct time resolution, and trace to
  // Establish a new trace with its correct time resolution, and trace to
  // great depth.
  // great depth.
  spTraceFile = new SpTraceVcdCFile ();
  spTraceFile = new SpTraceVcdCFile ();
  setSpTimeResolution (sc_get_time_resolution ());
  setSpTimeResolution (sc_get_time_resolution ());
  traceTarget->trace (spTraceFile, 99);
  traceTarget->trace (spTraceFile, 99);
  spTraceFile->open (dumpName);
  spTraceFile->open (vcdDumpFile.c_str());
 
 
  // Method to drive the dump on each clock edge
  // Method to drive the dump on each clock edge
  SC_METHOD (driveTrace);
  SC_METHOD (driveTrace);
  sensitive << clk;
  sensitive << clk;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.