2012-04-13 01:08:20 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2009-12-04 12:05:44 +00:00
|
|
|
//*************************************************************************
|
|
|
|
//
|
|
|
|
// Copyright 2009-2009 by Wilson Snyder. This program is free software; you can
|
|
|
|
// 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-12-04 12:05:44 +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-12-04 12:05:44 +00:00
|
|
|
//
|
|
|
|
//*************************************************************************
|
|
|
|
|
2010-04-10 10:46:24 +00:00
|
|
|
#include "svdpi.h"
|
2009-12-04 12:05:44 +00:00
|
|
|
|
2022-08-05 09:56:57 +00:00
|
|
|
#include <cstdio>
|
|
|
|
|
2009-12-04 12:05:44 +00:00
|
|
|
//======================================================================
|
|
|
|
|
2020-10-28 22:42:36 +00:00
|
|
|
// clang-format off
|
2009-12-04 12:05:44 +00:00
|
|
|
#if defined(VERILATOR)
|
|
|
|
# include "Vt_dpi_sys__Dpi.h"
|
|
|
|
#elif defined(VCS)
|
|
|
|
# include "../vc_hdrs.h"
|
|
|
|
#elif defined(CADENCE)
|
|
|
|
# define NEED_EXTERNS
|
|
|
|
#else
|
|
|
|
# error "Unknown simulator for DPI test"
|
|
|
|
#endif
|
2020-10-28 22:42:36 +00:00
|
|
|
// clang-format on
|
2009-12-04 12:05:44 +00:00
|
|
|
|
|
|
|
#ifdef NEED_EXTERNS
|
|
|
|
extern "C" {
|
|
|
|
|
2020-10-28 00:03:17 +00:00
|
|
|
extern void dpii_sys_task(int i);
|
|
|
|
extern int dpii_sys_func(int i);
|
2009-12-04 12:05:44 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
|
|
|
static int hidden = 0;
|
|
|
|
|
2019-11-10 01:35:12 +00:00
|
|
|
void dpii_sys_task(int i) { hidden = i; }
|
|
|
|
int dpii_sys_func(int i) { return i + hidden; }
|