2012-04-13 03:08:20 +02:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-12-25 20:39:41 +01:00
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2021-03-20 22:46:00 +01:00
|
|
|
// Code available from: https://verilator.org
|
|
|
|
|
//
|
2022-01-01 14:26:40 +01:00
|
|
|
// Copyright 2009-2022 by Wilson Snyder. This program is free software; you can
|
2010-12-25 20:39:41 +01:00
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
2020-03-21 16:24:24 +01:00
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
2010-12-25 20:39:41 +01:00
|
|
|
// Version 2.0.
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2010-12-25 20:39:41 +01:00
|
|
|
//
|
|
|
|
|
//=========================================================================
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
2021-03-20 22:46:00 +01:00
|
|
|
/// \brief Verilated VPI header
|
2010-12-25 20:39:41 +01:00
|
|
|
///
|
2021-03-20 22:46:00 +01:00
|
|
|
/// This file contains routines related to using VPI with Verilated models.
|
2010-12-25 20:39:41 +01:00
|
|
|
///
|
2021-03-20 22:46:00 +01:00
|
|
|
/// User wrapper code may need to include this if controlling Verilated
|
|
|
|
|
/// models that use ths VPI.
|
2010-12-25 20:39:41 +01:00
|
|
|
///
|
|
|
|
|
//=========================================================================
|
2019-10-05 02:17:11 +02:00
|
|
|
|
2021-03-04 03:57:07 +01:00
|
|
|
#ifndef VERILATOR_VERILATED_VPI_H_
|
2021-03-20 22:46:00 +01:00
|
|
|
#define VERILATOR_VERILATED_VPI_H_
|
2010-12-25 20:39:41 +01:00
|
|
|
|
2018-10-14 19:43:24 +02:00
|
|
|
#include "verilatedos.h"
|
2010-12-25 20:39:41 +01:00
|
|
|
#include "verilated.h"
|
|
|
|
|
#include "verilated_syms.h"
|
|
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
// From IEEE 1800-2009 annex K
|
|
|
|
|
|
|
|
|
|
#include "vltstd/vpi_user.h"
|
|
|
|
|
|
2015-09-26 04:57:28 +02:00
|
|
|
//======================================================================
|
2013-01-18 03:40:37 +01:00
|
|
|
|
2021-03-28 17:50:05 +02:00
|
|
|
/// Class for namespace-like groupng of Verilator VPI functions.
|
|
|
|
|
|
2020-11-19 03:32:16 +01:00
|
|
|
class VerilatedVpi final {
|
2010-12-25 20:39:41 +01:00
|
|
|
public:
|
2021-03-21 02:11:53 +01:00
|
|
|
/// Call timed callbacks.
|
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2017-10-27 03:51:51 +02:00
|
|
|
static void callTimedCbs() VL_MT_UNSAFE_ONE;
|
2021-03-21 02:11:53 +01:00
|
|
|
/// Call value based callbacks.
|
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2020-10-27 02:55:27 +01:00
|
|
|
static bool callValueCbs() VL_MT_UNSAFE_ONE;
|
2021-03-21 02:11:53 +01:00
|
|
|
/// Call callbacks of arbitrary types.
|
|
|
|
|
/// User wrapper code should call this from their main loops.
|
2022-03-27 21:27:40 +02:00
|
|
|
static bool callCbs(const uint32_t reason) VL_MT_UNSAFE_ONE;
|
2020-03-28 18:47:21 +01:00
|
|
|
/// Returns time of the next registered VPI callback, or
|
2021-03-21 02:11:53 +01:00
|
|
|
/// ~(0ULL) if none are registered
|
2020-03-28 18:47:21 +01:00
|
|
|
static QData cbNextDeadline() VL_MT_UNSAFE_ONE;
|
2021-03-07 14:28:13 +01:00
|
|
|
|
|
|
|
|
// Self test, for internal use only
|
2017-10-27 03:51:51 +02:00
|
|
|
static void selfTest() VL_MT_UNSAFE_ONE;
|
2010-12-25 20:39:41 +01:00
|
|
|
};
|
|
|
|
|
|
2018-11-29 01:59:10 +01:00
|
|
|
#endif // Guard
|