2012-04-13 01:08:20 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2009-07-07 21:51:00 +00:00
|
|
|
//*************************************************************************
|
|
|
|
//
|
2021-03-20 21:46:00 +00:00
|
|
|
// Code available from: https://verilator.org
|
|
|
|
//
|
2024-01-01 08:19:59 +00:00
|
|
|
// Copyright 2009-2024 by Wilson Snyder. This program is free software; you can
|
2009-07-07 21:51:00 +00:00
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
2020-03-21 15:24:24 +00:00
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
2009-07-07 21:51:00 +00:00
|
|
|
// Version 2.0.
|
2020-03-21 15:24:24 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2009-07-07 21:51:00 +00:00
|
|
|
//
|
|
|
|
//*************************************************************************
|
|
|
|
///
|
|
|
|
/// \file
|
2021-03-20 21:46:00 +00:00
|
|
|
/// \brief Verilated SystemC header for all Verilated SystemC files
|
2009-07-07 21:51:00 +00:00
|
|
|
///
|
2021-03-20 21:46:00 +00:00
|
|
|
/// This file is included automatically by Verilator at the top of all
|
|
|
|
/// SystemC files it generates. It contains functions Verilated code uses
|
|
|
|
/// internally to connect the Verilated model into SystemC.
|
2009-07-07 21:51:00 +00:00
|
|
|
///
|
2021-03-20 21:46:00 +00:00
|
|
|
/// User wrapper code is not required to include nor use anything in this
|
|
|
|
/// header, but may prefer to include it in place of "verilated.h" when
|
|
|
|
/// using Verilator with SystemC.
|
2009-07-07 21:51:00 +00:00
|
|
|
///
|
|
|
|
//*************************************************************************
|
2019-10-05 00:17:11 +00:00
|
|
|
|
2021-03-04 02:57:07 +00:00
|
|
|
#ifndef VERILATOR_VERILATED_SC_H_
|
2021-03-20 21:46:00 +00:00
|
|
|
#define VERILATOR_VERILATED_SC_H_
|
2009-07-07 21:51:00 +00:00
|
|
|
|
|
|
|
#include "verilatedos.h"
|
2018-10-14 17:43:24 +00:00
|
|
|
|
2023-04-17 09:57:29 +00:00
|
|
|
#include <systemc>
|
2009-07-07 21:51:00 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
2021-03-20 21:46:00 +00:00
|
|
|
// For \internal use, get a pointer to m_data in the sc_bv_base class,
|
|
|
|
// getting around that it is protected. So make an exposing class, then
|
|
|
|
// use cast magic to get at it. Saves patching get_datap in SystemC.
|
2009-07-07 21:51:00 +00:00
|
|
|
#define VL_SC_BV_DATAP(bv) (VlScBvExposer::sp_datap(bv))
|
2021-03-20 21:46:00 +00:00
|
|
|
// This class is thread safe (though most of SystemC is not).
|
2023-04-17 09:57:29 +00:00
|
|
|
class VlScBvExposer final : public sc_dt::sc_bv_base {
|
2009-07-07 21:51:00 +00:00
|
|
|
public:
|
2023-04-17 09:57:29 +00:00
|
|
|
static const uint32_t* sp_datap(const sc_dt::sc_bv_base& base) VL_MT_SAFE {
|
2019-12-22 23:09:46 +00:00
|
|
|
return static_cast<const VlScBvExposer*>(&base)->sp_datatp();
|
|
|
|
}
|
2022-03-27 19:27:40 +00:00
|
|
|
const uint32_t* sp_datatp() const { return reinterpret_cast<uint32_t*>(m_data); }
|
2009-07-07 21:51:00 +00:00
|
|
|
// Above reads this protected element in sc_bv_base:
|
|
|
|
// sc_digit* m_data; // data array
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
2018-11-29 00:59:10 +00:00
|
|
|
#endif // Guard
|