2012-04-13 01:08:20 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2010-12-25 19:39:41 +00:00
|
|
|
//*************************************************************************
|
|
|
|
//
|
2021-01-01 15:29:54 +00:00
|
|
|
// Copyright 2009-2021 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
|
|
|
|
/// \brief Verilator: VPI implementation code
|
|
|
|
///
|
2017-10-20 01:33:22 +00:00
|
|
|
/// This file must be compiled and linked against all objects
|
|
|
|
/// created from Verilator or called by Verilator that use the VPI.
|
2010-12-25 19:39:41 +00:00
|
|
|
///
|
2019-11-08 03:33:59 +00:00
|
|
|
/// Code available from: https://verilator.org
|
2010-12-25 19:39:41 +00:00
|
|
|
///
|
|
|
|
//=========================================================================
|
2019-10-05 00:17:11 +00:00
|
|
|
|
2015-09-26 02:57:28 +00:00
|
|
|
#ifndef _VERILATED_VPI_H_
|
2018-11-29 00:59:10 +00:00
|
|
|
#define _VERILATED_VPI_H_ 1 ///< Header Guard
|
2010-12-25 19:39:41 +00:00
|
|
|
|
2018-10-14 17:43:24 +00:00
|
|
|
#include "verilatedos.h"
|
2010-12-25 19:39:41 +00:00
|
|
|
#include "verilated.h"
|
|
|
|
#include "verilated_syms.h"
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
// From IEEE 1800-2009 annex K
|
|
|
|
|
|
|
|
#include "vltstd/vpi_user.h"
|
|
|
|
|
2015-09-26 02:57:28 +00:00
|
|
|
//======================================================================
|
2013-01-18 02:40:37 +00:00
|
|
|
|
2020-11-19 02:32:16 +00:00
|
|
|
class VerilatedVpi final {
|
2010-12-25 19:39:41 +00:00
|
|
|
public:
|
2017-10-20 01:33:22 +00:00
|
|
|
/// Call timed callbacks
|
|
|
|
/// Users should call this from their main loops
|
2017-10-27 01:51:51 +00:00
|
|
|
static void callTimedCbs() VL_MT_UNSAFE_ONE;
|
2017-10-20 01:33:22 +00:00
|
|
|
/// Call value based callbacks
|
|
|
|
/// Users should call this from their main loops
|
2020-10-27 01:55:27 +00:00
|
|
|
static bool callValueCbs() VL_MT_UNSAFE_ONE;
|
2019-09-21 11:43:20 +00:00
|
|
|
/// Call callbacks of arbitrary types
|
|
|
|
/// Users can call this from their application code
|
|
|
|
static bool callCbs(vluint32_t reason) VL_MT_UNSAFE_ONE;
|
2020-03-28 17:47:21 +00:00
|
|
|
/// Returns time of the next registered VPI callback, or
|
|
|
|
/// ~(0) if none are registered
|
|
|
|
static QData cbNextDeadline() VL_MT_UNSAFE_ONE;
|
2017-10-20 01:33:22 +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
|