[#72179] add SAIF trace class for SystemC
This commit is contained in:
parent
9878587753
commit
5b126f3258
|
|
@ -0,0 +1,24 @@
|
|||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//=============================================================================
|
||||
//
|
||||
// Code available from: https://verilator.org
|
||||
//
|
||||
// Copyright 2001-2025 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
//
|
||||
//=============================================================================
|
||||
///
|
||||
/// \file
|
||||
/// \brief Verilated tracing in SAIF Format implementation code
|
||||
///
|
||||
/// This file is deprecated, only verilated_saif_sc.h is needed.
|
||||
/// It is provided only for backward compatibility with user's linker scripts.
|
||||
///
|
||||
//=============================================================================
|
||||
|
||||
#ifdef VL_NO_LEGACY
|
||||
#error "verilated_saif_sc.cpp is deprecated; verilated_saif_sc.h is self-sufficient"
|
||||
#endif
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright 2001-2025 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
//
|
||||
//=============================================================================
|
||||
///
|
||||
/// \file
|
||||
/// \brief Verilated tracing in SAIF format for SystemC header
|
||||
///
|
||||
/// User wrapper code should use this header when creating SAIF SystemC traces.
|
||||
///
|
||||
/// This class is not threadsafe, as the SystemC kernel is not threadsafe.
|
||||
///
|
||||
//=============================================================================
|
||||
|
||||
#ifndef VERILATOR_VERILATED_SAIF_SC_H_
|
||||
#define VERILATOR_VERILATED_SAIF_SC_H_
|
||||
|
||||
#include "verilatedos.h"
|
||||
|
||||
#include "verilated_sc_trace.h"
|
||||
#include "verilated_saif_c.h"
|
||||
|
||||
//=============================================================================
|
||||
// VerilatedSaifSc
|
||||
/// Trace file used to create SAIF dump for SystemC version of Verilated models. It's very similar
|
||||
/// to its C version (see the class VerilatedSaifC)
|
||||
|
||||
class VerilatedSaifSc final : VerilatedScTraceBase, public VerilatedSaifC {
|
||||
// CONSTRUCTORS
|
||||
VL_UNCOPYABLE(VerilatedSaifSc);
|
||||
|
||||
public:
|
||||
VerilatedSaifSc() {
|
||||
spTrace()->set_time_unit(VerilatedScTraceBase::getScTimeUnit());
|
||||
spTrace()->set_time_resolution(VerilatedScTraceBase::getScTimeResolution());
|
||||
VerilatedScTraceBase::enableDeltaCycles(false);
|
||||
}
|
||||
|
||||
// METHODS
|
||||
// Override VerilatedSaifC. Must be called after starting simulation.
|
||||
void open(const char* filename) override VL_MT_SAFE {
|
||||
VerilatedScTraceBase::checkScElaborationDone();
|
||||
VerilatedSaifC::open(filename);
|
||||
}
|
||||
|
||||
// METHODS - for SC kernel
|
||||
// Called from SystemC kernel
|
||||
void cycle() override { VerilatedSaifC::dump(sc_core::sc_time_stamp().to_double()); }
|
||||
};
|
||||
|
||||
#endif // Guard
|
||||
|
|
@ -1010,10 +1010,10 @@ class VlTest:
|
|||
else:
|
||||
self.trace_format = 'fst-c' # pylint: disable=attribute-defined-outside-init
|
||||
elif re.search(r'-trace-saif', checkflags):
|
||||
# if self.sc:
|
||||
# self.trace_format = 'fst-sc' # pylint: disable=attribute-defined-outside-init
|
||||
# else:
|
||||
self.trace_format = 'saif-c' # pylint: disable=attribute-defined-outside-init
|
||||
if self.sc:
|
||||
self.trace_format = 'saif-sc' # pylint: disable=attribute-defined-outside-init
|
||||
else:
|
||||
self.trace_format = 'saif-c' # pylint: disable=attribute-defined-outside-init
|
||||
elif self.sc:
|
||||
self.trace_format = 'vcd-sc' # pylint: disable=attribute-defined-outside-init
|
||||
else:
|
||||
|
|
@ -1874,8 +1874,8 @@ class VlTest:
|
|||
fh.write("#include \"verilated_vcd_sc.h\"\n")
|
||||
if self.trace and self.trace_format == 'saif-c':
|
||||
fh.write("#include \"verilated_saif_c.h\"\n")
|
||||
# if self.trace and self.trace_format == 'saif-sc':
|
||||
# fh.write("#include \"verilated_saif_sc.h\"\n")
|
||||
if self.trace and self.trace_format == 'saif-sc':
|
||||
fh.write("#include \"verilated_saif_sc.h\"\n")
|
||||
if self.savable:
|
||||
fh.write("#include \"verilated_save.h\"\n")
|
||||
|
||||
|
|
@ -1961,8 +1961,8 @@ class VlTest:
|
|||
fh.write(" std::unique_ptr<VerilatedVcdSc> tfp{new VerilatedVcdSc};\n")
|
||||
if self.trace_format == 'saif-c':
|
||||
fh.write(" std::unique_ptr<VerilatedSaifC> tfp{new VerilatedSaifC};\n")
|
||||
# if self.trace_format == 'saif-sc':
|
||||
# fh.write(" std::unique_ptr<VerilatedSaifSc> tfp{new VerilatedSaifSc};\n")
|
||||
if self.trace_format == 'saif-sc':
|
||||
fh.write(" std::unique_ptr<VerilatedSaifSc> tfp{new VerilatedSaifSc};\n")
|
||||
if self.sc:
|
||||
fh.write(" sc_core::sc_start(sc_core::SC_ZERO_TIME);" +
|
||||
" // Finish elaboration before trace and open\n")
|
||||
|
|
|
|||
Loading…
Reference in New Issue