[#74021] wip: SystemC support
This commit is contained in:
parent
59a9197abe
commit
9a3c6fda91
|
|
@ -0,0 +1,24 @@
|
||||||
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
// THIS MODULE IS PUBLICLY LICENSED
|
||||||
|
//
|
||||||
|
// 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 for SystemC 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,56 @@
|
||||||
|
// -*- 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_saif_c.h"
|
||||||
|
#include "verilated_sc_trace.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());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
@ -1824,10 +1824,6 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
|
||||||
addIncDirUser(parseFileArg(optdir, string{valp}));
|
addIncDirUser(parseFileArg(optdir, string{valp}));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_systemC && m_traceFormat == TraceFormat::SAIF) {
|
|
||||||
fl->v3warn(E_UNSUPPORTED, "Unsupported: SAIF trace with SystemC.");
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.finalize();
|
parser.finalize();
|
||||||
|
|
||||||
for (int i = 0; i < argc;) {
|
for (int i = 0; i < argc;) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
%Error-UNSUPPORTED: Unsupported: SAIF trace with SystemC.
|
|
||||||
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
|
|
||||||
%Error: Exiting due to
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
|
||||||
#
|
|
||||||
# Copyright 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
|
|
||||||
|
|
||||||
import vltest_bootstrap
|
|
||||||
|
|
||||||
test.scenarios('linter')
|
|
||||||
|
|
||||||
test.top_filename = "t/t_trace_fst_sc.v"
|
|
||||||
|
|
||||||
if not test.have_sc:
|
|
||||||
test.skip("No SystemC installed")
|
|
||||||
|
|
||||||
test.lint(fails=test.vlt_all,
|
|
||||||
verilator_flags2=["--sc --trace-saif --lint-only"],
|
|
||||||
expect_filename=test.golden_filename)
|
|
||||||
|
|
||||||
test.passes()
|
|
||||||
Loading…
Reference in New Issue