2012-04-12 21:08:20 -04:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-01-24 18:37:01 -05:00
|
|
|
//=============================================================================
|
|
|
|
|
//
|
2026-01-26 20:24:34 -05:00
|
|
|
// This program is free software; you can 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-FileCopyrightText: 2001-2026 Wilson Snyder
|
2020-03-21 11:24:24 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2010-01-24 18:37:01 -05:00
|
|
|
//
|
|
|
|
|
//=============================================================================
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
2021-03-20 17:46:00 -04:00
|
|
|
/// \brief Verilated tracing in VCD format for SystemC header
|
|
|
|
|
///
|
2023-11-09 12:48:23 +00:00
|
|
|
/// User wrapper code should use this header when creating VCD SystemC traces.
|
2010-01-24 18:37:01 -05:00
|
|
|
///
|
2017-10-26 20:05:42 -04:00
|
|
|
/// This class is not threadsafe, as the SystemC kernel is not threadsafe.
|
|
|
|
|
///
|
2010-01-24 18:37:01 -05:00
|
|
|
//=============================================================================
|
|
|
|
|
|
2021-03-03 21:57:07 -05:00
|
|
|
#ifndef VERILATOR_VERILATED_VCD_SC_H_
|
|
|
|
|
#define VERILATOR_VERILATED_VCD_SC_H_
|
2010-01-24 18:37:01 -05:00
|
|
|
|
2018-10-14 13:43:24 -04:00
|
|
|
#include "verilatedos.h"
|
2022-08-05 10:56:57 +01:00
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
#include "verilated_sc_trace.h"
|
2010-01-24 18:37:01 -05:00
|
|
|
#include "verilated_vcd_c.h"
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
// VerilatedVcdSc
|
2023-11-09 12:48:23 +00: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-24 18:37:01 -05:00
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
class VerilatedVcdSc final : VerilatedScTraceBase, public VerilatedVcdC {
|
2017-11-01 18:51:41 -04:00
|
|
|
// CONSTRUCTORS
|
|
|
|
|
VL_UNCOPYABLE(VerilatedVcdSc);
|
2020-04-13 22:51:35 -04:00
|
|
|
|
2010-01-24 18:37:01 -05:00
|
|
|
public:
|
|
|
|
|
VerilatedVcdSc() {
|
2023-11-09 12:48:23 +00:00
|
|
|
spTrace()->set_time_unit(VerilatedScTraceBase::getScTimeUnit());
|
|
|
|
|
spTrace()->set_time_resolution(VerilatedScTraceBase::getScTimeResolution());
|
|
|
|
|
VerilatedScTraceBase::enableDeltaCycles(false);
|
2010-01-24 18:37:01 -05:00
|
|
|
}
|
|
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
// METHODS
|
2021-12-23 08:41:11 +09:00
|
|
|
// Override VerilatedVcdC. Must be called after starting simulation.
|
2022-11-29 22:17:50 -05:00
|
|
|
void open(const char* filename) override VL_MT_SAFE {
|
2023-11-09 12:48:23 +00:00
|
|
|
VerilatedScTraceBase::checkScElaborationDone();
|
2022-11-29 22:17:50 -05:00
|
|
|
VerilatedVcdC::open(filename);
|
|
|
|
|
}
|
2021-12-23 08:41:11 +09:00
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
// METHODS - for SC kernel
|
|
|
|
|
// Called from SystemC kernel
|
|
|
|
|
void cycle() override { VerilatedVcdC::dump(sc_core::sc_time_stamp().to_double()); }
|
2010-01-24 18:37:01 -05:00
|
|
|
};
|
|
|
|
|
|
2018-08-22 19:14:06 -04:00
|
|
|
#endif // Guard
|