2012-04-13 03:08:20 +02:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-01-25 00:37:01 +01:00
|
|
|
//=============================================================================
|
|
|
|
|
//
|
2025-01-01 14:30:25 +01:00
|
|
|
// Copyright 2001-2025 by Wilson Snyder. This program is free software; you can
|
2020-03-21 16:24:24 +01:00
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
|
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2010-01-25 00:37:01 +01:00
|
|
|
//
|
|
|
|
|
//=============================================================================
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
2021-03-20 22:46:00 +01:00
|
|
|
/// \brief Verilated tracing in VCD format for SystemC header
|
|
|
|
|
///
|
2023-11-09 13:48:23 +01:00
|
|
|
/// User wrapper code should use this header when creating VCD SystemC traces.
|
2010-01-25 00:37:01 +01:00
|
|
|
///
|
2017-10-27 02:05:42 +02:00
|
|
|
/// This class is not threadsafe, as the SystemC kernel is not threadsafe.
|
|
|
|
|
///
|
2010-01-25 00:37:01 +01:00
|
|
|
//=============================================================================
|
|
|
|
|
|
2021-03-04 03:57:07 +01:00
|
|
|
#ifndef VERILATOR_VERILATED_VCD_SC_H_
|
|
|
|
|
#define VERILATOR_VERILATED_VCD_SC_H_
|
2010-01-25 00:37:01 +01:00
|
|
|
|
2018-10-14 19:43:24 +02:00
|
|
|
#include "verilatedos.h"
|
2022-08-05 11:56:57 +02:00
|
|
|
|
2023-11-09 13:48:23 +01:00
|
|
|
#include "verilated_sc_trace.h"
|
2010-01-25 00:37:01 +01:00
|
|
|
#include "verilated_vcd_c.h"
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
// VerilatedVcdSc
|
2023-11-09 13:48:23 +01:00
|
|
|
/// Trace file used to create VCD dump for SystemC version of Verilated models. It's very similar
|
|
|
|
|
/// to its C version (see the class VerilatedVcdC)
|
2010-01-25 00:37:01 +01:00
|
|
|
|
2023-11-09 13:48:23 +01:00
|
|
|
class VerilatedVcdSc final : VerilatedScTraceBase, public VerilatedVcdC {
|
2017-11-01 23:51:41 +01:00
|
|
|
// CONSTRUCTORS
|
|
|
|
|
VL_UNCOPYABLE(VerilatedVcdSc);
|
2020-04-14 04:51:35 +02:00
|
|
|
|
2010-01-25 00:37:01 +01:00
|
|
|
public:
|
|
|
|
|
VerilatedVcdSc() {
|
2023-11-09 13:48:23 +01:00
|
|
|
spTrace()->set_time_unit(VerilatedScTraceBase::getScTimeUnit());
|
|
|
|
|
spTrace()->set_time_resolution(VerilatedScTraceBase::getScTimeResolution());
|
|
|
|
|
VerilatedScTraceBase::enableDeltaCycles(false);
|
2010-01-25 00:37:01 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-09 13:48:23 +01:00
|
|
|
// METHODS
|
2021-12-23 00:41:11 +01:00
|
|
|
// Override VerilatedVcdC. Must be called after starting simulation.
|
2022-11-30 04:17:50 +01:00
|
|
|
void open(const char* filename) override VL_MT_SAFE {
|
2023-11-09 13:48:23 +01:00
|
|
|
VerilatedScTraceBase::checkScElaborationDone();
|
2022-11-30 04:17:50 +01:00
|
|
|
VerilatedVcdC::open(filename);
|
|
|
|
|
}
|
2021-12-23 00:41:11 +01:00
|
|
|
|
2023-11-09 13:48:23 +01:00
|
|
|
// METHODS - for SC kernel
|
|
|
|
|
// Called from SystemC kernel
|
|
|
|
|
void cycle() override { VerilatedVcdC::dump(sc_core::sc_time_stamp().to_double()); }
|
2010-01-25 00:37:01 +01:00
|
|
|
};
|
|
|
|
|
|
2018-08-23 01:14:06 +02:00
|
|
|
#endif // Guard
|