2013-08-14 21:37:13 -04:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2026-01-26 20:24:34 -05:00
|
|
|
// This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
// under the terms of either the GNU Lesser General Public License Version 3
|
|
|
|
|
// or the Perl Artistic License Version 2.0.
|
|
|
|
|
// SPDX-FileCopyrightText: 2009-2009 Wilson Snyder
|
2020-03-21 11:24:24 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2013-08-14 21:37:13 -04:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
|
2022-08-05 10:56:57 +01:00
|
|
|
#include "svdpi.h"
|
|
|
|
|
|
2013-08-14 21:37:13 -04:00
|
|
|
#include <cstdio>
|
2013-10-13 20:05:57 -04:00
|
|
|
#include <cstring>
|
2013-08-14 21:37:13 -04:00
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
|
2020-10-28 18:42:36 -04:00
|
|
|
// clang-format off
|
2013-08-14 21:37:13 -04:00
|
|
|
#if defined(VERILATOR)
|
|
|
|
|
# include "Vt_dpi_string__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 18:42:36 -04:00
|
|
|
// clang-format on
|
2013-08-14 21:37:13 -04:00
|
|
|
|
|
|
|
|
#ifdef NEED_EXTERNS
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
2020-10-27 20:03:17 -04:00
|
|
|
extern int dpii_string(const char* s);
|
2013-08-14 21:37:13 -04:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//======================================================================
|
|
|
|
|
|
|
|
|
|
int dpii_string(const char* s) {
|
2020-10-27 20:03:17 -04:00
|
|
|
printf("dpii_string: %s\n", s);
|
2022-09-14 21:10:19 -04:00
|
|
|
return std::strlen(s);
|
2013-08-14 21:37:13 -04:00
|
|
|
}
|