2012-04-13 01:08:20 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-01-24 23:37:01 +00:00
|
|
|
//=============================================================================
|
|
|
|
//
|
2024-01-01 08:19:59 +00:00
|
|
|
// Copyright 2001-2024 by Wilson Snyder. This program is free software; you can
|
2020-03-21 15:24:24 +00: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-24 23:37:01 +00:00
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
///
|
|
|
|
/// \file
|
2021-03-20 21:46:00 +00: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 23:37:01 +00:00
|
|
|
///
|
2017-10-27 00:05:42 +00:00
|
|
|
/// This class is not threadsafe, as the SystemC kernel is not threadsafe.
|
|
|
|
///
|
2010-01-24 23:37:01 +00:00
|
|
|
//=============================================================================
|
|
|
|
|
2021-03-04 02:57:07 +00:00
|
|
|
#ifndef VERILATOR_VERILATED_VCD_SC_H_
|
|
|
|
#define VERILATOR_VERILATED_VCD_SC_H_
|
2010-01-24 23:37:01 +00:00
|
|
|
|
2018-10-14 17:43:24 +00:00
|
|
|
#include "verilatedos.h"
|
2022-08-05 09:56:57 +00:00
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
#include "verilated_sc_trace.h"
|
2010-01-24 23:37:01 +00: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 23:37:01 +00:00
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
class VerilatedVcdSc final : VerilatedScTraceBase, public VerilatedVcdC {
|
2017-11-01 22:51:41 +00:00
|
|
|
// CONSTRUCTORS
|
|
|
|
VL_UNCOPYABLE(VerilatedVcdSc);
|
2020-04-14 02:51:35 +00:00
|
|
|
|
2010-01-24 23:37:01 +00: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 23:37:01 +00:00
|
|
|
}
|
|
|
|
|
2023-11-09 12:48:23 +00:00
|
|
|
// METHODS
|
2021-12-22 23:41:11 +00:00
|
|
|
// Override VerilatedVcdC. Must be called after starting simulation.
|
2022-11-30 03:17:50 +00:00
|
|
|
void open(const char* filename) override VL_MT_SAFE {
|
2023-11-09 12:48:23 +00:00
|
|
|
VerilatedScTraceBase::checkScElaborationDone();
|
2022-11-30 03:17:50 +00:00
|
|
|
VerilatedVcdC::open(filename);
|
|
|
|
}
|
2021-12-22 23:41:11 +00: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 23:37:01 +00:00
|
|
|
};
|
|
|
|
|
2018-08-22 23:14:06 +00:00
|
|
|
#endif // Guard
|