2001-03-16 02:44:34 +01:00
|
|
|
#ifndef __vpi_priv_H
|
|
|
|
|
#define __vpi_priv_H
|
|
|
|
|
/*
|
2012-01-19 19:16:39 +01:00
|
|
|
* Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com)
|
2001-03-16 02:44:34 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
|
2010-10-08 03:01:11 +02:00
|
|
|
# include "sv_vpi_user.h"
|
2004-12-11 03:31:25 +01:00
|
|
|
# include "vvp_net.h"
|
2009-01-30 02:23:09 +01:00
|
|
|
# include "config.h"
|
2007-09-11 00:30:00 +02:00
|
|
|
|
2010-01-07 03:43:53 +01:00
|
|
|
# include <set>
|
|
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
/*
|
|
|
|
|
* Added to use some "vvp_fun_modpath_src"
|
|
|
|
|
* and "vvp_fun_modpath" classes definitions
|
|
|
|
|
*/
|
|
|
|
|
#include "delay.h"
|
|
|
|
|
|
|
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
/*
|
|
|
|
|
* This header file contains the internal definitions that the vvp
|
|
|
|
|
* program uses to implement the public interface in the vpi_user.h
|
|
|
|
|
* header file elsewhere.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-28 04:20:16 +01:00
|
|
|
/*
|
|
|
|
|
* Routines/definitions used to build the file/line number tracing object.
|
|
|
|
|
*/
|
|
|
|
|
#define _vpiFileLine 0x1000003
|
|
|
|
|
#define _vpiDescription 0x1000004
|
|
|
|
|
|
|
|
|
|
extern bool show_file_line;
|
2011-03-04 03:54:46 +01:00
|
|
|
extern bool code_is_instrumented;
|
2011-02-28 04:20:16 +01:00
|
|
|
|
|
|
|
|
extern vpiHandle vpip_build_file_line(char*description,
|
|
|
|
|
long file_idx, long lineno);
|
|
|
|
|
|
2009-01-30 03:17:09 +01:00
|
|
|
/*
|
|
|
|
|
* Private VPI properties that are only used in the cleanup code.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef CHECK_WITH_VALGRIND
|
|
|
|
|
#define _vpiFromThr 0x1000001
|
|
|
|
|
# define _vpiNoThr 0
|
|
|
|
|
# define _vpiVThr 1
|
|
|
|
|
# define _vpiWord 2
|
|
|
|
|
# define _vpi_at_PV 3
|
|
|
|
|
# define _vpi_at_A 4
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2002-05-18 04:34:11 +02:00
|
|
|
/*
|
|
|
|
|
* The vpi_mode_flag contains the major mode for VPI use. This is used
|
2003-02-10 00:33:26 +01:00
|
|
|
* to generate error messages when vpi functions are called
|
2002-05-18 04:34:11 +02:00
|
|
|
* incorrectly.
|
|
|
|
|
*/
|
|
|
|
|
enum vpi_mode_t {
|
|
|
|
|
VPI_MODE_NONE =0,
|
|
|
|
|
/* The compiler is calling a register function. */
|
|
|
|
|
VPI_MODE_REGISTER,
|
|
|
|
|
/* The compiler is calling a compiletf function. */
|
|
|
|
|
VPI_MODE_COMPILETF,
|
|
|
|
|
/* The compiler is calling a calltf function. */
|
|
|
|
|
VPI_MODE_CALLTF,
|
|
|
|
|
/* We are in the midst of a RWSync callback. */
|
|
|
|
|
VPI_MODE_RWSYNC,
|
|
|
|
|
/* We are in a ROSync callback. */
|
|
|
|
|
VPI_MODE_ROSYNC
|
|
|
|
|
};
|
|
|
|
|
extern vpi_mode_t vpi_mode_flag;
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2007-10-31 04:14:40 +01:00
|
|
|
/*
|
2012-01-19 19:16:39 +01:00
|
|
|
* This structure is the very base of a vpiHandle. Every handle
|
|
|
|
|
* structure is derived from this class so that the library can
|
|
|
|
|
* internally pass the derived types as pointers to one of these.
|
2007-10-31 04:14:40 +01:00
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
class __vpiHandle {
|
|
|
|
|
public:
|
2012-01-20 23:15:26 +01:00
|
|
|
inline __vpiHandle() { }
|
|
|
|
|
// The destructor is virtual so that dynamic types will work.
|
2012-01-20 20:39:48 +01:00
|
|
|
virtual ~__vpiHandle();
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2012-01-20 00:04:51 +01:00
|
|
|
virtual int get_type_code(void) const =0;
|
2012-01-20 20:39:48 +01:00
|
|
|
virtual int vpi_get(int code);
|
|
|
|
|
virtual char* vpi_get_str(int code);
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2012-01-20 20:39:48 +01:00
|
|
|
virtual void vpi_get_value(p_vpi_value val);
|
|
|
|
|
virtual vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
|
|
|
|
virtual vpiHandle vpi_handle(int code);
|
|
|
|
|
virtual vpiHandle vpi_iterate(int code);
|
|
|
|
|
virtual vpiHandle vpi_index(int idx);
|
|
|
|
|
virtual void vpi_get_delays(p_vpi_delay del);
|
|
|
|
|
virtual void vpi_put_delays(p_vpi_delay del);
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2012-01-20 23:15:26 +01:00
|
|
|
// Objects may have destroyer functions of their own. If so,
|
|
|
|
|
// then this virtual method will return a POINTER to that
|
|
|
|
|
// function. The pointer is used to "delete" the object, which
|
|
|
|
|
// is why the function itself cannot be a method.
|
|
|
|
|
typedef int (*free_object_fun_t)(vpiHandle);
|
|
|
|
|
virtual free_object_fun_t free_object_fun(void);
|
2012-01-19 19:16:39 +01:00
|
|
|
};
|
2007-10-31 04:14:40 +01:00
|
|
|
|
2010-01-07 01:08:20 +01:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
/*
|
|
|
|
|
* The vpiHandle for an iterator has this structure. The definition of
|
|
|
|
|
* the methods lives in vpi_iter.c
|
2002-05-03 17:44:11 +02:00
|
|
|
*
|
|
|
|
|
* The args and nargs members point to the array of vpiHandle objects
|
|
|
|
|
* that are to be iterated over. The next member is the index of the
|
|
|
|
|
* next item to be returned by a vpi_scan.
|
|
|
|
|
*
|
|
|
|
|
* The free_args_flag member is true if when this iterator object is
|
|
|
|
|
* released it must also free the args array.
|
2001-03-16 02:44:34 +01:00
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiIterator : public __vpiHandle {
|
|
|
|
|
__vpiIterator();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 23:15:26 +01:00
|
|
|
free_object_fun_t free_object_fun(void);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
vpiHandle *args;
|
|
|
|
|
unsigned nargs;
|
|
|
|
|
unsigned next;
|
2002-05-03 17:44:11 +02:00
|
|
|
bool free_args_flag;
|
2001-03-16 02:44:34 +01:00
|
|
|
};
|
|
|
|
|
|
2002-05-03 17:44:11 +02:00
|
|
|
extern vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args,
|
|
|
|
|
bool free_args_flag);
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2002-05-19 07:18:16 +02:00
|
|
|
/*
|
2003-02-10 00:33:26 +01:00
|
|
|
* This represents callback handles. There are some private types that
|
2012-01-19 19:16:39 +01:00
|
|
|
* are defined and used in vpi_callback.cc. The __vpiCallback are
|
|
|
|
|
* always used in association with vvp_vpi_callback objects.
|
2002-05-19 07:18:16 +02:00
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiCallback : public __vpiHandle {
|
|
|
|
|
__vpiCallback();
|
2012-01-23 05:37:01 +01:00
|
|
|
~__vpiCallback();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2002-05-19 07:18:16 +02:00
|
|
|
|
2012-01-30 02:31:19 +01:00
|
|
|
// Used for listing callbacks.
|
|
|
|
|
struct __vpiCallback*next;
|
|
|
|
|
|
2002-05-19 07:18:16 +02:00
|
|
|
// user supplied callback data
|
|
|
|
|
struct t_cb_data cb_data;
|
2012-02-02 19:49:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class value_callback : public __vpiCallback {
|
|
|
|
|
public:
|
|
|
|
|
explicit value_callback(p_cb_data data);
|
|
|
|
|
// Return true if the callback really is ready to be called
|
|
|
|
|
virtual bool test_value_callback_ready(void);
|
2002-05-19 07:18:16 +02:00
|
|
|
|
2012-02-02 19:49:59 +01:00
|
|
|
public:
|
|
|
|
|
// user supplied callback data
|
|
|
|
|
struct t_vpi_time cb_time;
|
|
|
|
|
struct t_vpi_value cb_value;
|
2002-05-19 07:18:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern void callback_execute(struct __vpiCallback*cur);
|
|
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiSystemTime : public __vpiHandle {
|
|
|
|
|
__vpiSystemTime();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char*vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiScope*scope;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct __vpiScopedTime : public __vpiSystemTime {
|
|
|
|
|
__vpiScopedTime();
|
2012-01-20 20:39:48 +01:00
|
|
|
char*vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2012-01-19 19:16:39 +01:00
|
|
|
};
|
|
|
|
|
struct __vpiScopedSTime : public __vpiSystemTime {
|
|
|
|
|
__vpiScopedSTime();
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char*vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2012-01-19 19:16:39 +01:00
|
|
|
};
|
|
|
|
|
struct __vpiScopedRealtime : public __vpiSystemTime {
|
|
|
|
|
__vpiScopedRealtime();
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char*vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2002-12-21 01:55:57 +01:00
|
|
|
};
|
|
|
|
|
|
2012-06-04 21:43:33 +02:00
|
|
|
struct __vpiPortInfo : public __vpiHandle {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2001-03-18 01:37:55 +01:00
|
|
|
/*
|
2002-12-21 01:55:57 +01:00
|
|
|
* Scopes are created by .scope statements in the source. These
|
2003-02-10 00:33:26 +01:00
|
|
|
* objects hold the items and properties that are knowingly bound to a
|
2002-12-21 01:55:57 +01:00
|
|
|
* scope.
|
2001-03-18 01:37:55 +01:00
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiScope : public __vpiHandle {
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char* vpi_get_str(int code);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
|
|
|
|
vpiHandle vpi_iterate(int code);
|
|
|
|
|
|
2001-10-15 03:49:50 +02:00
|
|
|
struct __vpiScope *scope;
|
2001-03-18 01:37:55 +01:00
|
|
|
/* The scope has a name. */
|
2002-07-05 19:14:15 +02:00
|
|
|
const char*name;
|
2003-05-29 04:21:45 +02:00
|
|
|
const char*tname;
|
2008-04-30 03:58:25 +02:00
|
|
|
unsigned file_idx;
|
|
|
|
|
unsigned lineno;
|
|
|
|
|
unsigned def_file_idx;
|
|
|
|
|
unsigned def_lineno;
|
2008-09-27 01:54:13 +02:00
|
|
|
bool is_automatic;
|
2009-05-21 23:41:58 +02:00
|
|
|
bool is_cell;
|
2002-12-21 01:55:57 +01:00
|
|
|
/* The scope has a system time of its own. */
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiScopedTime scoped_time;
|
|
|
|
|
struct __vpiScopedSTime scoped_stime;
|
|
|
|
|
struct __vpiScopedRealtime scoped_realtime;
|
2002-12-21 01:55:57 +01:00
|
|
|
/* Keep an array of internal scope items. */
|
2012-01-21 23:47:42 +01:00
|
|
|
class __vpiHandle**intern;
|
2001-03-18 01:37:55 +01:00
|
|
|
unsigned nintern;
|
2008-09-27 01:54:13 +02:00
|
|
|
/* Keep an array of items to be automatically allocated */
|
|
|
|
|
struct automatic_hooks_s**item;
|
|
|
|
|
unsigned nitem;
|
2008-10-28 18:52:39 +01:00
|
|
|
/* Keep a list of live contexts. */
|
|
|
|
|
vvp_context_t live_contexts;
|
2008-09-27 01:54:13 +02:00
|
|
|
/* Keep a list of freed contexts. */
|
2008-10-28 18:52:39 +01:00
|
|
|
vvp_context_t free_contexts;
|
2001-04-18 06:21:23 +02:00
|
|
|
/* Keep a list of threads in the scope. */
|
2010-01-07 03:43:53 +01:00
|
|
|
std::set<vthread_t> threads;
|
2002-12-21 01:55:57 +01:00
|
|
|
signed int time_units :8;
|
2007-09-28 20:21:08 +02:00
|
|
|
signed int time_precision :8;
|
2012-01-20 00:04:51 +01:00
|
|
|
|
|
|
|
|
protected:
|
2012-01-20 23:15:26 +01:00
|
|
|
inline __vpiScope() { }
|
2001-03-18 01:37:55 +01:00
|
|
|
};
|
2001-04-18 06:21:23 +02:00
|
|
|
|
|
|
|
|
extern struct __vpiScope* vpip_peek_current_scope(void);
|
2009-09-28 03:29:07 +02:00
|
|
|
extern void vpip_attach_to_scope(struct __vpiScope*scope, vpiHandle obj);
|
2001-03-18 01:37:55 +01:00
|
|
|
extern void vpip_attach_to_current_scope(vpiHandle obj);
|
2008-10-28 18:52:39 +01:00
|
|
|
extern struct __vpiScope* vpip_peek_context_scope(void);
|
|
|
|
|
extern unsigned vpip_add_item_to_context(automatic_hooks_s*item,
|
|
|
|
|
struct __vpiScope*scope);
|
2002-01-06 01:48:39 +01:00
|
|
|
extern vpiHandle vpip_make_root_iterator(void);
|
2012-01-21 23:47:42 +01:00
|
|
|
extern void vpip_make_root_iterator(class __vpiHandle**&table,
|
2003-02-23 07:41:54 +01:00
|
|
|
unsigned&ntable);
|
2001-03-18 01:37:55 +01:00
|
|
|
|
2001-03-20 07:16:23 +01:00
|
|
|
/*
|
|
|
|
|
* Signals include the variable types (reg, integer, time) and are
|
|
|
|
|
* distinguished by the vpiType code. They also have a parent scope,
|
|
|
|
|
* a declared name and declaration indices.
|
|
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiSignal : public __vpiHandle {
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char* vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
|
|
|
|
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
|
|
|
|
vpiHandle vpi_iterate(int code);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2009-01-30 02:23:09 +01:00
|
|
|
#ifdef CHECK_WITH_VALGRIND
|
|
|
|
|
struct __vpiSignal *pool;
|
|
|
|
|
#endif
|
2008-06-15 01:17:25 +02:00
|
|
|
union { // The scope or parent array that contains me.
|
|
|
|
|
vpiHandle parent;
|
|
|
|
|
struct __vpiScope* scope;
|
|
|
|
|
} within;
|
|
|
|
|
union { // The name of this reg/net, or the index for array words.
|
2007-12-03 20:41:52 +01:00
|
|
|
const char*name;
|
|
|
|
|
vpiHandle index;
|
|
|
|
|
} id;
|
2001-03-20 07:16:23 +01:00
|
|
|
/* The indices that define the width and access offset. */
|
|
|
|
|
int msb, lsb;
|
2001-04-04 19:43:19 +02:00
|
|
|
/* Flags */
|
|
|
|
|
unsigned signed_flag : 1;
|
2008-06-15 01:17:25 +02:00
|
|
|
unsigned is_netarray : 1; // This is word of a net array
|
2001-03-20 07:16:23 +01:00
|
|
|
/* The represented value is here. */
|
2004-12-11 03:31:25 +01:00
|
|
|
vvp_net_t*node;
|
2012-01-19 19:16:39 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static void*operator new(std::size_t size);
|
|
|
|
|
static void operator delete(void*); // not implemented
|
2012-01-20 00:04:51 +01:00
|
|
|
protected:
|
2012-01-20 23:15:26 +01:00
|
|
|
inline __vpiSignal() { }
|
2012-01-19 19:16:39 +01:00
|
|
|
private: // Not implemented
|
|
|
|
|
static void*operator new[] (std::size_t size);
|
|
|
|
|
static void operator delete[](void*);
|
2001-03-20 07:16:23 +01:00
|
|
|
};
|
2007-11-07 03:15:08 +01:00
|
|
|
extern unsigned vpip_size(__vpiSignal *sig);
|
2008-06-15 01:17:25 +02:00
|
|
|
extern struct __vpiScope* vpip_scope(__vpiSignal*sig);
|
|
|
|
|
|
2010-10-08 03:01:11 +02:00
|
|
|
extern vpiHandle vpip_make_int2(const char*name, int msb, int lsb,
|
2011-09-06 01:10:08 +02:00
|
|
|
bool signed_flag, vvp_net_t*vec);
|
2010-10-08 03:01:11 +02:00
|
|
|
extern vpiHandle vpip_make_int4(const char*name, int msb, int lsb,
|
|
|
|
|
vvp_net_t*vec);
|
|
|
|
|
extern vpiHandle vpip_make_var4(const char*name, int msb, int lsb,
|
2004-12-11 03:31:25 +01:00
|
|
|
bool signed_flag, vvp_net_t*net);
|
2012-01-20 00:04:51 +01:00
|
|
|
extern vpiHandle vpip_make_net4(const char*name, int msb, int lsb,
|
|
|
|
|
bool signed_flag, vvp_net_t*node);
|
2001-06-22 00:54:12 +02:00
|
|
|
|
2008-05-27 23:29:08 +02:00
|
|
|
/*
|
|
|
|
|
* This is used by system calls to represent a bit/part select of
|
|
|
|
|
* a simple variable or constant array word.
|
|
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiPV : public __vpiHandle {
|
|
|
|
|
__vpiPV();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char* vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
|
|
|
|
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2008-05-27 23:29:08 +02:00
|
|
|
vpiHandle parent;
|
|
|
|
|
vvp_net_t*net;
|
2008-06-14 01:22:18 +02:00
|
|
|
vpiHandle sbase;
|
2008-05-27 23:29:08 +02:00
|
|
|
int tbase;
|
|
|
|
|
unsigned twid, width;
|
2009-09-17 18:47:57 +02:00
|
|
|
bool is_signed;
|
2008-05-27 23:29:08 +02:00
|
|
|
};
|
|
|
|
|
extern vpiHandle vpip_make_PV(char*name, int base, int width);
|
2008-06-14 01:22:18 +02:00
|
|
|
extern vpiHandle vpip_make_PV(char*name, char*symbol, int width);
|
2008-08-28 01:26:18 +02:00
|
|
|
extern vpiHandle vpip_make_PV(char*name, vpiHandle handle, int width);
|
2009-09-17 18:47:57 +02:00
|
|
|
extern vpiHandle vpip_make_PV(char*name, int tbase, int twid, char*is_signed,
|
|
|
|
|
int width);
|
2008-05-27 23:29:08 +02:00
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiModPathTerm : public __vpiHandle {
|
|
|
|
|
__vpiModPathTerm();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2007-11-06 04:58:20 +01:00
|
|
|
vpiHandle expr;
|
2007-12-14 05:42:06 +01:00
|
|
|
/* The value returned by vpi_get(vpiEdge, ...); */
|
|
|
|
|
int edge;
|
2007-11-06 04:58:20 +01:00
|
|
|
};
|
|
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiModPathSrc : public __vpiHandle {
|
|
|
|
|
__vpiModPathSrc();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
|
|
|
|
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
|
|
|
|
vpiHandle vpi_iterate(int code);
|
|
|
|
|
vpiHandle vpi_index(int idx);
|
|
|
|
|
void vpi_get_delays(p_vpi_delay del);
|
|
|
|
|
void vpi_put_delays(p_vpi_delay del);
|
2012-01-20 23:15:26 +01:00
|
|
|
free_object_fun_t free_object_fun(void);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2007-11-06 04:58:20 +01:00
|
|
|
struct __vpiModPath *dest;
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
|
|
/* This is the input expression for this modpath. */
|
|
|
|
|
struct __vpiModPathTerm path_term_in;
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-11-06 04:58:20 +01:00
|
|
|
/* This is the input net for the modpath. signals on this net
|
|
|
|
|
are used to determine the modpath. They are *not* propagated
|
|
|
|
|
anywhere. */
|
|
|
|
|
vvp_net_t *net;
|
2007-09-11 00:30:00 +02:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
2008-09-04 18:41:51 +02:00
|
|
|
* The vpiMoaPath vpiHandle will define
|
2007-09-11 00:30:00 +02:00
|
|
|
* a vpiModPath of record .modpath as defined
|
|
|
|
|
* in the IEEE 1364
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct __vpiModPath {
|
|
|
|
|
struct __vpiScope *scope ;
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-10-31 04:14:40 +01:00
|
|
|
class vvp_fun_modpath*modpath;
|
|
|
|
|
|
2007-11-03 03:59:08 +01:00
|
|
|
struct __vpiModPathTerm path_term_out;
|
2007-09-11 00:30:00 +02:00
|
|
|
vvp_net_t *input_net ;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2008-09-04 18:41:51 +02:00
|
|
|
* The Function is used to create the vpiHandle
|
2007-09-11 00:30:00 +02:00
|
|
|
* for vpiModPath && vpiModPathIn objects
|
|
|
|
|
*/
|
|
|
|
|
|
2010-10-11 06:52:26 +02:00
|
|
|
extern struct __vpiModPathSrc* vpip_make_modpath_src(struct __vpiModPath*path,
|
|
|
|
|
vvp_net_t *net) ;
|
2007-09-11 00:30:00 +02:00
|
|
|
|
2007-11-06 04:58:20 +01:00
|
|
|
extern struct __vpiModPath* vpip_make_modpath(vvp_net_t *net) ;
|
2007-09-11 00:30:00 +02:00
|
|
|
|
|
|
|
|
|
2002-05-18 04:34:11 +02:00
|
|
|
/*
|
|
|
|
|
* These methods support the vpi creation of events. The name string
|
|
|
|
|
* passed in will be saved, so the caller must allocate it (or not
|
|
|
|
|
* free it) after it is handed to this function.
|
|
|
|
|
*/
|
2012-01-23 05:37:01 +01:00
|
|
|
class __vpiNamedEvent : public __vpiHandle {
|
2012-01-30 02:31:19 +01:00
|
|
|
|
2012-01-23 05:37:01 +01:00
|
|
|
public:
|
|
|
|
|
__vpiNamedEvent(__vpiScope*scope, const char*name);
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char* vpi_get_str(int code);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2012-01-23 05:37:01 +01:00
|
|
|
inline void add_vpi_callback(__vpiCallback*cb)
|
|
|
|
|
{ cb->next = callbacks_;
|
|
|
|
|
callbacks_ = cb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void run_vpi_callbacks(void);
|
|
|
|
|
|
2003-04-23 05:09:25 +02:00
|
|
|
/* The functor, used for %set operations. */
|
2004-12-11 03:31:25 +01:00
|
|
|
vvp_net_t*funct;
|
2012-01-23 05:37:01 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/* base name of the event object */
|
|
|
|
|
const char*name_;
|
|
|
|
|
/* Parent scope of this object. */
|
|
|
|
|
struct __vpiScope*scope_;
|
2002-05-19 07:18:16 +02:00
|
|
|
/* List of callbacks interested in this event. */
|
2012-01-30 02:31:19 +01:00
|
|
|
__vpiCallback*callbacks_;
|
2002-05-19 07:18:16 +02:00
|
|
|
};
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
extern vpiHandle vpip_make_named_event(const char*name, vvp_net_t*f);
|
2002-05-18 04:34:11 +02:00
|
|
|
|
2001-05-09 01:59:33 +02:00
|
|
|
/*
|
|
|
|
|
* Memory is an array of bits that is accessible in N-bit chunks, with
|
|
|
|
|
* N being the width of a word. The memory word handle just points
|
|
|
|
|
* back to the memory and uses an index to identify its position in
|
|
|
|
|
* the memory.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-02-27 21:34:48 +01:00
|
|
|
extern bool is_net_array(vpiHandle obj);
|
|
|
|
|
|
2003-01-26 00:48:05 +01:00
|
|
|
/*
|
|
|
|
|
* These are the various variable types.
|
|
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiRealVar : public __vpiHandle {
|
|
|
|
|
__vpiRealVar();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
char* vpi_get_str(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
|
|
|
|
vpiHandle vpi_put_value(p_vpi_value val, int flags);
|
|
|
|
|
vpiHandle vpi_handle(int code);
|
|
|
|
|
vpiHandle vpi_iterate(int code);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2008-10-29 02:52:32 +01:00
|
|
|
union { // The scope or parent array that contains me.
|
|
|
|
|
vpiHandle parent;
|
|
|
|
|
struct __vpiScope* scope;
|
|
|
|
|
} within;
|
2007-12-03 20:41:52 +01:00
|
|
|
/* The name of this variable, or the index for array words. */
|
|
|
|
|
union {
|
|
|
|
|
const char*name;
|
|
|
|
|
vpiHandle index;
|
|
|
|
|
} id;
|
2008-10-29 02:52:32 +01:00
|
|
|
unsigned is_netarray : 1; // This is word of a net array
|
2005-07-06 06:29:25 +02:00
|
|
|
vvp_net_t*net;
|
|
|
|
|
};
|
|
|
|
|
|
2008-10-29 02:52:32 +01:00
|
|
|
extern struct __vpiScope* vpip_scope(__vpiRealVar*sig);
|
2005-07-06 06:29:25 +02:00
|
|
|
extern vpiHandle vpip_make_real_var(const char*name, vvp_net_t*net);
|
2012-01-19 19:16:39 +01:00
|
|
|
|
2003-01-26 00:48:05 +01:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
/*
|
|
|
|
|
* When a loaded VPI module announces a system task/function, one
|
|
|
|
|
* __vpiUserSystf object is created to hold the definition of that
|
2001-05-20 02:46:12 +02:00
|
|
|
* task/function. The distinction between task and function is stored
|
|
|
|
|
* in the vpi_systf_data structure data that was supplied by the
|
|
|
|
|
* external module.
|
2001-03-16 02:44:34 +01:00
|
|
|
*
|
|
|
|
|
* When the compiler encounters a %vpi_call statement, it creates a
|
|
|
|
|
* __vpiSysTaskCall to represent that particular call. The call refers
|
|
|
|
|
* to the definition handle so that when the %vpi_call instruction is
|
|
|
|
|
* encountered at run-time, the definition can be located and used.
|
2001-05-20 02:46:12 +02:00
|
|
|
*
|
|
|
|
|
* The vpiSysTaskCall handles both functions and tasks, as the two are
|
|
|
|
|
* extremely similar. The different VPI type is reflected in a
|
|
|
|
|
* different vpi_type pointer in the base structure. The only
|
|
|
|
|
* additional part is the vbit/vwid that is used by the put of the
|
|
|
|
|
* system function call to place the values in the vthread bit space.
|
2001-03-16 02:44:34 +01:00
|
|
|
*/
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiUserSystf : public __vpiHandle {
|
|
|
|
|
__vpiUserSystf();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
|
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
s_vpi_systf_data info;
|
2010-04-12 08:39:08 +02:00
|
|
|
bool is_user_defn;
|
2001-03-16 02:44:34 +01:00
|
|
|
};
|
|
|
|
|
|
2010-04-12 08:39:08 +02:00
|
|
|
extern vpiHandle vpip_make_systf_iterator(void);
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
extern struct __vpiUserSystf* vpip_find_systf(const char*name);
|
|
|
|
|
|
|
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiSysTaskCall : public __vpiHandle {
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2001-04-18 06:21:23 +02:00
|
|
|
struct __vpiScope* scope;
|
2001-03-16 02:44:34 +01:00
|
|
|
struct __vpiUserSystf*defn;
|
|
|
|
|
unsigned nargs;
|
|
|
|
|
vpiHandle*args;
|
2003-01-09 05:09:44 +01:00
|
|
|
/* Support for vpi_get_userdata. */
|
|
|
|
|
void*userdata;
|
2001-05-20 02:46:12 +02:00
|
|
|
/* These represent where in the vthread to put the return value. */
|
2003-06-17 21:17:42 +02:00
|
|
|
unsigned vbit;
|
|
|
|
|
signed vwid;
|
2011-09-23 04:57:59 +02:00
|
|
|
class vvp_net_t*fnet;
|
2008-01-01 18:45:02 +01:00
|
|
|
unsigned file_idx;
|
2008-04-30 03:58:25 +02:00
|
|
|
unsigned lineno;
|
2008-05-28 00:11:17 +02:00
|
|
|
bool put_value;
|
2012-01-20 23:15:26 +01:00
|
|
|
protected:
|
|
|
|
|
inline __vpiSysTaskCall() { }
|
2001-03-16 02:44:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern struct __vpiSysTaskCall*vpip_cur_task;
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
/*
|
2003-02-24 07:35:45 +01:00
|
|
|
* The persistent flag to vpip_make_string_const causes the created
|
|
|
|
|
* handle to be persistent. This is necessary for cases where the
|
|
|
|
|
* string handle may be reused, which is the normal case.
|
2012-01-21 20:59:49 +01:00
|
|
|
*
|
|
|
|
|
* When constructing with a string, the class takes possession of the
|
|
|
|
|
* text value string, and will delete it in the constructor.
|
2001-03-18 05:35:18 +01:00
|
|
|
*/
|
|
|
|
|
|
2003-02-24 07:35:45 +01:00
|
|
|
vpiHandle vpip_make_string_const(char*text, bool persistent =true);
|
2012-06-04 21:43:33 +02:00
|
|
|
vpiHandle vpip_make_string_param(char*name, char*value, bool local_flag,
|
2008-05-06 04:46:30 +02:00
|
|
|
long file_idx, long lineno);
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiBinaryConst : public __vpiHandle {
|
|
|
|
|
__vpiBinaryConst();
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2006-03-06 06:43:15 +01:00
|
|
|
vvp_vector4_t bits;
|
2006-03-18 23:51:10 +01:00
|
|
|
/* TRUE if this constant is signed. */
|
|
|
|
|
int signed_flag :1;
|
|
|
|
|
/* TRUE if this constant has an explicit size (i.e. 19'h0 vs. 'h0) */
|
|
|
|
|
int sized_flag :1;
|
2001-04-02 02:24:30 +02:00
|
|
|
};
|
|
|
|
|
|
2007-04-12 06:25:58 +02:00
|
|
|
vpiHandle vpip_make_binary_const(unsigned wid, const char*bits);
|
2006-03-18 23:51:10 +01:00
|
|
|
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits,
|
2012-06-04 21:43:33 +02:00
|
|
|
bool signed_flag, bool local_flag,
|
2008-05-06 04:46:30 +02:00
|
|
|
long file_idx, long lineno);
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2012-01-19 19:16:39 +01:00
|
|
|
struct __vpiDecConst : public __vpiHandle {
|
|
|
|
|
__vpiDecConst(int val =0);
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2012-01-20 00:04:51 +01:00
|
|
|
|
2002-01-31 05:28:17 +01:00
|
|
|
int value;
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-21 20:59:49 +01:00
|
|
|
class __vpiRealConst : public __vpiHandle {
|
|
|
|
|
public:
|
|
|
|
|
__vpiRealConst(double);
|
2012-01-20 00:04:51 +01:00
|
|
|
int get_type_code(void) const;
|
2012-01-20 20:39:48 +01:00
|
|
|
int vpi_get(int code);
|
|
|
|
|
void vpi_get_value(p_vpi_value val);
|
2012-01-21 20:59:49 +01:00
|
|
|
public:
|
2006-06-18 06:15:50 +02:00
|
|
|
double value;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vpiHandle vpip_make_real_const(double value);
|
2012-06-04 21:43:33 +02:00
|
|
|
vpiHandle vpip_make_real_param(char*name, double value, bool local_flag,
|
2008-05-06 04:46:30 +02:00
|
|
|
long file_idx, long lineno);
|
2006-06-18 06:15:50 +02:00
|
|
|
|
2001-05-10 02:26:53 +02:00
|
|
|
/*
|
2004-10-04 03:10:51 +02:00
|
|
|
* This one looks like a constant, but really is a vector in the current
|
|
|
|
|
* thread.
|
2001-05-10 02:26:53 +02:00
|
|
|
*/
|
|
|
|
|
|
2002-04-14 04:56:19 +02:00
|
|
|
vpiHandle vpip_make_vthr_vector(unsigned base, unsigned wid, bool signed_flag);
|
2001-05-10 02:26:53 +02:00
|
|
|
|
2003-01-26 19:16:22 +01:00
|
|
|
vpiHandle vpip_make_vthr_word(unsigned base, const char*type);
|
|
|
|
|
|
2008-08-28 01:26:18 +02:00
|
|
|
vpiHandle vpip_make_vthr_A(char*label, unsigned index);
|
2008-06-10 17:47:30 +02:00
|
|
|
vpiHandle vpip_make_vthr_A(char*label, char*symbol);
|
2009-09-17 23:00:28 +02:00
|
|
|
vpiHandle vpip_make_vthr_A(char*label, unsigned tbase, unsigned twid,
|
|
|
|
|
char*is_signed);
|
2008-08-28 01:26:18 +02:00
|
|
|
vpiHandle vpip_make_vthr_A(char*label, vpiHandle handle);
|
2012-01-11 03:22:52 +01:00
|
|
|
vpiHandle vpip_make_vthr_APV(char*label, unsigned index, unsigned bit, unsigned wid);
|
2008-05-21 01:21:54 +02:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
/*
|
|
|
|
|
* This function is called before any compilation to load VPI
|
|
|
|
|
* modules. This gives the modules a chance to announce their
|
|
|
|
|
* contained functions before compilation commences. It is called only
|
2001-07-26 05:13:51 +02:00
|
|
|
* once per module.
|
2001-03-16 02:44:34 +01:00
|
|
|
*/
|
2001-07-26 05:13:51 +02:00
|
|
|
extern void vpip_load_module(const char*name);
|
|
|
|
|
|
|
|
|
|
# define VPIP_MODULE_PATH_MAX 64
|
2001-07-30 04:44:05 +02:00
|
|
|
extern const char* vpip_module_path[64];
|
2001-07-26 05:13:51 +02:00
|
|
|
extern unsigned vpip_module_path_cnt;
|
2001-03-16 02:44:34 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The vpip_build_vpi_call function creates a __vpiSysTaskCall object
|
|
|
|
|
* and returns the handle. The compiler uses this function when it
|
2004-06-30 05:00:36 +02:00
|
|
|
* encounters a %vpi_call or %vpi_func statement.
|
2001-03-16 02:44:34 +01:00
|
|
|
*
|
|
|
|
|
* The %vpi_call instruction has as its only parameter the handle that
|
|
|
|
|
* is returned by the vpip_build_vpi_call. This includes all the
|
|
|
|
|
* information needed by vpip_execute_vpi_call to actually execute the
|
2001-03-18 05:35:18 +01:00
|
|
|
* call. However, the vpiSysTaskCall that is the returned handle,
|
|
|
|
|
* holds a parameter argument list that is passed in here.
|
|
|
|
|
*
|
2001-05-20 02:46:12 +02:00
|
|
|
* The vbit and vwid fields are used if this turns out to be a system
|
|
|
|
|
* function. In that case, the vbit and vwid are used to address the
|
2004-06-30 05:00:36 +02:00
|
|
|
* vector in thread bit space where the result is supposed to go.
|
2001-05-20 02:46:12 +02:00
|
|
|
*
|
|
|
|
|
* Note that the argv array is saved in the handle, and should should
|
|
|
|
|
* not be released by the caller.
|
2001-03-16 02:44:34 +01:00
|
|
|
*/
|
2001-03-18 05:35:18 +01:00
|
|
|
extern vpiHandle vpip_build_vpi_call(const char*name,
|
2003-01-27 01:14:37 +01:00
|
|
|
unsigned vbit, int vwid,
|
2006-06-18 06:15:50 +02:00
|
|
|
class vvp_net_t*fnet,
|
2010-06-09 20:56:00 +02:00
|
|
|
bool func_as_task_err,
|
|
|
|
|
bool func_as_task_warn,
|
2001-03-18 05:35:18 +01:00
|
|
|
unsigned argc,
|
2008-01-01 18:45:02 +01:00
|
|
|
vpiHandle*argv,
|
|
|
|
|
long file_idx,
|
2008-04-30 03:58:25 +02:00
|
|
|
long lineno);
|
2001-03-16 02:44:34 +01:00
|
|
|
|
2001-05-10 02:26:53 +02:00
|
|
|
extern vthread_t vpip_current_vthread;
|
|
|
|
|
|
|
|
|
|
extern void vpip_execute_vpi_call(vthread_t thr, vpiHandle obj);
|
2001-03-16 02:44:34 +01:00
|
|
|
|
|
|
|
|
|
2001-03-18 01:37:55 +01:00
|
|
|
/*
|
|
|
|
|
* These are functions used by the compiler to prepare for compilation
|
|
|
|
|
* and to finish compilation in preparation for execution.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-01-09 04:10:15 +01:00
|
|
|
vpiHandle vpip_sim_time(struct __vpiScope*scope, bool is_stime);
|
2003-02-01 06:50:04 +01:00
|
|
|
vpiHandle vpip_sim_realtime(struct __vpiScope*scope);
|
2001-03-31 21:00:43 +02:00
|
|
|
|
2001-07-01 01:03:16 +02:00
|
|
|
extern int vpip_get_time_precision(void);
|
|
|
|
|
extern void vpip_set_time_precision(int pres);
|
|
|
|
|
|
2003-05-02 06:29:57 +02:00
|
|
|
extern int vpip_time_units_from_handle(vpiHandle obj);
|
2007-09-28 20:21:08 +02:00
|
|
|
extern int vpip_time_precision_from_handle(vpiHandle obj);
|
2003-05-02 06:29:57 +02:00
|
|
|
|
2002-04-20 06:33:23 +02:00
|
|
|
extern void vpip_time_to_timestruct(struct t_vpi_time*ts, vvp_time64_t ti);
|
|
|
|
|
extern vvp_time64_t vpip_timestruct_to_time(const struct t_vpi_time*ts);
|
|
|
|
|
|
2007-11-11 04:54:21 +01:00
|
|
|
extern double vpip_time_to_scaled_real(vvp_time64_t ti, struct __vpiScope*sc);
|
|
|
|
|
extern vvp_time64_t vpip_scaled_real_to_time64(double val, struct __vpiScope*sc);
|
|
|
|
|
|
2003-03-06 05:32:00 +01:00
|
|
|
/*
|
|
|
|
|
* These functions are used mostly as compile time to strings into
|
|
|
|
|
* permallocated memory. The vpip_string function is the most general,
|
|
|
|
|
* it allocates a fresh string no matter what. The vpip_name_string
|
|
|
|
|
* allocates a string and keeps a pointer in the hash, and tries to
|
|
|
|
|
* reuse it if it can. This us useful for handle names, which may be
|
|
|
|
|
* reused in different scopes.
|
|
|
|
|
*/
|
2002-07-05 19:14:15 +02:00
|
|
|
extern const char* vpip_string(const char*str);
|
2003-03-06 05:32:00 +01:00
|
|
|
extern const char* vpip_name_string(const char*str);
|
2002-01-06 18:50:50 +01:00
|
|
|
|
|
|
|
|
|
2002-02-03 02:01:51 +01:00
|
|
|
/*
|
|
|
|
|
* This function is used to make decimal string versions of various
|
2008-04-21 05:43:53 +02:00
|
|
|
* vectors. The input format is a vvp_vector4_t, and the result is
|
|
|
|
|
* written into buf, without overflowing nbuf.
|
2002-02-03 02:01:51 +01:00
|
|
|
*/
|
2006-02-21 03:39:27 +01:00
|
|
|
extern unsigned vpip_vec4_to_dec_str(const vvp_vector4_t&vec4,
|
|
|
|
|
char *buf, unsigned int nbuf,
|
|
|
|
|
int signed_flag);
|
2002-05-11 06:39:35 +02:00
|
|
|
|
|
|
|
|
|
2005-06-13 02:54:04 +02:00
|
|
|
extern void vpip_vec4_to_hex_str(const vvp_vector4_t&bits, char*buf,
|
2010-10-11 06:52:26 +02:00
|
|
|
unsigned nbuf);
|
2002-05-11 06:39:35 +02:00
|
|
|
|
2005-06-13 02:54:04 +02:00
|
|
|
extern void vpip_vec4_to_oct_str(const vvp_vector4_t&bits, char*buf,
|
2010-10-11 06:52:26 +02:00
|
|
|
unsigned nbuf);
|
2002-05-11 06:39:35 +02:00
|
|
|
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
extern void vpip_bin_str_to_vec4(vvp_vector4_t&val, const char*buf);
|
2006-02-21 03:39:27 +01:00
|
|
|
extern void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str);
|
Rework $plusarg routines.
This patch addresses a number of issues:
Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.
Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.
Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.
It simplifies the system task/functions error/warning messages.
It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.
Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.
Add support for setting a bit based value using a real value.
Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 22:28:19 +01:00
|
|
|
extern void vpip_dec_str_to_vec4(vvp_vector4_t&val, const char*str);
|
2006-02-21 03:39:27 +01:00
|
|
|
extern void vpip_hex_str_to_vec4(vvp_vector4_t&val, const char*str);
|
|
|
|
|
|
2008-05-17 01:20:22 +02:00
|
|
|
extern vvp_vector4_t vec4_from_vpi_value(s_vpi_value*vp, unsigned wid);
|
2009-03-28 03:12:11 +01:00
|
|
|
extern double real_from_vpi_value(s_vpi_value*vp);
|
2008-05-17 01:20:22 +02:00
|
|
|
|
2006-03-06 06:43:15 +01:00
|
|
|
extern void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width,
|
|
|
|
|
bool signed_flag, s_vpi_value*vp);
|
2010-11-22 02:24:46 +01:00
|
|
|
extern void vpip_vec2_get_value(const vvp_vector2_t&word_val, unsigned width,
|
|
|
|
|
bool signed_flag, s_vpi_value*vp);
|
2009-03-28 03:12:11 +01:00
|
|
|
extern void vpip_real_get_value(double real, s_vpi_value*vp);
|
2002-05-11 06:39:35 +02:00
|
|
|
|
2002-07-09 05:24:37 +02:00
|
|
|
/*
|
|
|
|
|
* Function defined in vpi_signal.cc to manage vpi_get_* persistent
|
|
|
|
|
* storage.
|
|
|
|
|
*/
|
|
|
|
|
enum vpi_rbuf_t {
|
|
|
|
|
RBUF_VAL =0,
|
|
|
|
|
/* Storage for *_get_value() */
|
2009-01-24 01:04:44 +01:00
|
|
|
RBUF_STR,
|
2002-07-09 05:24:37 +02:00
|
|
|
/* Storage for *_get_str() */
|
2009-01-24 01:04:44 +01:00
|
|
|
RBUF_DEL
|
|
|
|
|
/* Delete the storage for both buffers. */
|
2002-07-09 05:24:37 +02:00
|
|
|
};
|
2004-10-04 03:10:51 +02:00
|
|
|
extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
2007-12-19 00:11:50 +01:00
|
|
|
/* following two routines use need_result_buf(, RBUF_STR) */
|
|
|
|
|
extern char *simple_set_rbuf_str(const char *s1);
|
|
|
|
|
extern char *generic_get_str(int code, vpiHandle ref, const char *name, const char *index);
|
2002-07-09 05:24:37 +02:00
|
|
|
|
2009-01-16 20:09:48 +01:00
|
|
|
/* A routine to find the enclosing module. */
|
|
|
|
|
extern vpiHandle vpip_module(struct __vpiScope*scope);
|
|
|
|
|
|
2010-03-14 07:16:27 +01:00
|
|
|
extern int vpip_delay_selection;
|
|
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
#endif
|