2012-04-13 01:08:20 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-12-25 19:39:41 +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
|
2010-12-25 19:39:41 +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
|
2010-12-25 19:39:41 +00:00
|
|
|
// Version 2.0.
|
2020-03-21 15:24:24 +00:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2010-12-25 19:39:41 +00:00
|
|
|
//
|
|
|
|
//=========================================================================
|
|
|
|
///
|
|
|
|
/// \file
|
2021-03-20 21:46:00 +00:00
|
|
|
/// \brief Verilated VPI header
|
2010-12-25 19:39:41 +00:00
|
|
|
///
|
2021-03-20 21:46:00 +00:00
|
|
|
/// This file contains routines related to using VPI with Verilated models.
|
2010-12-25 19:39:41 +00:00
|
|
|
///
|
2021-03-20 21:46:00 +00:00
|
|
|
/// User wrapper code may need to include this if controlling Verilated
|
|
|
|
/// models that use ths VPI.
|
2010-12-25 19:39:41 +00:00
|
|
|
///
|
|
|
|
//=========================================================================
|
2019-10-05 00:17:11 +00:00
|
|
|
|
2021-03-04 02:57:07 +00:00
|
|
|
#ifndef VERILATOR_VERILATED_VPI_H_
|
2021-03-20 21:46:00 +00:00
|
|
|
#define VERILATOR_VERILATED_VPI_H_
|
2010-12-25 19:39:41 +00:00
|
|
|
|
2018-10-14 17:43:24 +00:00
|
|
|
#include "verilatedos.h"
|
2022-08-05 09:56:57 +00:00
|
|
|
|
2010-12-25 19:39:41 +00:00
|
|
|
#include "verilated.h"
|
|
|
|
#include "verilated_syms.h"
|
|
|
|
|
|
|
|
//======================================================================
|
2024-03-02 14:05:21 +00:00
|
|
|
// From IEEE 1800-2023 annex M
|
2010-12-25 19:39:41 +00:00
|
|
|
|
2023-10-23 00:41:40 +00:00
|
|
|
#include "vltstd/sv_vpi_user.h"
|
2010-12-25 19:39:41 +00:00
|
|
|
|
2015-09-26 02:57:28 +00:00
|
|
|
//======================================================================
|
2013-01-18 02:40:37 +00:00
|
|
|
|
2022-12-02 23:46:38 +00:00
|
|
|
/// Class for namespace-like grouping of Verilator VPI functions.
|
2021-03-28 15:50:05 +00:00
|
|
|
|
2020-11-19 02:32:16 +00:00
|
|
|
class VerilatedVpi final {
|
2010-12-25 19:39:41 +00:00
|
|
|
public:
|
2021-03-21 01:11:53 +00:00
|
|
|
/// Call timed callbacks.
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2017-10-27 01:51:51 +00:00
|
|
|
static void callTimedCbs() VL_MT_UNSAFE_ONE;
|
2021-03-21 01:11:53 +00:00
|
|
|
/// Call value based callbacks.
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2020-10-27 01:55:27 +00:00
|
|
|
static bool callValueCbs() VL_MT_UNSAFE_ONE;
|
2021-03-21 01:11:53 +00:00
|
|
|
/// Call callbacks of arbitrary types.
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2022-07-30 15:52:35 +00:00
|
|
|
static bool callCbs(uint32_t reason) VL_MT_UNSAFE_ONE;
|
2024-08-27 21:36:51 +00:00
|
|
|
/// Returns true if there are callbacks of the given reason registered.
|
|
|
|
/// User wrapper code should call this from their main loops.
|
|
|
|
static bool hasCbs(uint32_t reason) VL_MT_UNSAFE_ONE;
|
2020-03-28 17:47:21 +00:00
|
|
|
/// Returns time of the next registered VPI callback, or
|
2021-03-21 01:11:53 +00:00
|
|
|
/// ~(0ULL) if none are registered
|
2020-03-28 17:47:21 +00:00
|
|
|
static QData cbNextDeadline() VL_MT_UNSAFE_ONE;
|
2023-01-21 18:43:27 +00:00
|
|
|
/// Debug dump of callbacks
|
|
|
|
static void dumpCbs() VL_MT_UNSAFE_ONE;
|
2024-04-25 13:07:31 +00:00
|
|
|
/// Checks VPI dirty state (i.e. whether vpi_put_value() has
|
|
|
|
/// been called since the last clearEvalNeeded())
|
|
|
|
static bool evalNeeded() VL_MT_UNSAFE_ONE;
|
|
|
|
/// Clears VPI dirty state (see evalNeeded())
|
|
|
|
static void clearEvalNeeded() VL_MT_UNSAFE_ONE;
|
2024-05-01 22:56:50 +00:00
|
|
|
/// Perform inertially delayed puts
|
|
|
|
static void doInertialPuts() VL_MT_UNSAFE_ONE;
|
2021-03-07 13:28:13 +00:00
|
|
|
|
|
|
|
// Self test, for internal use only
|
2017-10-27 01:51:51 +00:00
|
|
|
static void selfTest() VL_MT_UNSAFE_ONE;
|
2010-12-25 19:39:41 +00:00
|
|
|
};
|
|
|
|
|
2018-11-29 00:59:10 +00:00
|
|
|
#endif // Guard
|