Add vpiFile and vpiLineNo for system functions.

Add the vpiFile and vpiLineNo properties to system functions.
Most other objects have stubs that return "N/A"/0. Interactive
functions (called from the debugger) use <interactive> for the
file name.
This commit is contained in:
Cary R 2008-01-01 09:45:02 -08:00 committed by Stephen Williams
parent 9fd7c008f3
commit 77061faa5c
24 changed files with 222 additions and 559 deletions

View File

@ -48,6 +48,10 @@ ivl_expr_uvalue
ivl_expr_value
ivl_expr_width
ivl_file_table_dump
ivl_file_table_get
ivl_file_table_init
ivl_logic_attr
ivl_logic_attr_cnt
ivl_logic_attr_val
@ -172,8 +176,6 @@ ivl_process_scope
ivl_process_stmt
ivl_process_type
ivl_statement_file
ivl_statement_lineno
ivl_statement_type
ivl_stmt_block_count
@ -189,6 +191,8 @@ ivl_stmt_cond_true
ivl_stmt_delay_expr
ivl_stmt_delay_val
ivl_stmt_events
ivl_stmt_file
ivl_stmt_lineno
ivl_stmt_lval
ivl_stmt_lvals
ivl_stmt_lwidth

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.144 2007/04/02 01:12:34 steve Exp $"
#endif
# include "config.h"
# include "StringHeap.h"
@ -31,6 +28,15 @@
static StringHeap api_strings;
struct ltstr
{
bool operator()(const char*s1, const char*s2) const
{
return strcmp(s1, s2) < 0;
}
};
static map<const char*, unsigned, ltstr> file_names;
/* THE FOLLOWING ARE FUNCTIONS THAT ARE CALLED FROM THE TARGET. */
extern "C" const char*ivl_design_flag(ivl_design_t des, const char*key)
@ -489,6 +495,46 @@ extern "C" unsigned ivl_expr_width(ivl_expr_t net)
return net->width_;
}
extern "C" void ivl_file_table_dump(FILE*fp)
{
assert(fp);
unsigned size = file_names.size();
fprintf(fp, "# The file index is used to find the file name in the "
"following table.\n:file_names %u;\n", size);
/* We want to print the names in index order so convert the map
* to a vector in the correct order. */
vector<const char*> names(size);
map<const char*, unsigned, ltstr>::iterator cur;
for (cur = file_names.begin(); cur != file_names.end(); cur++) {
names[(*cur).second] = (*cur).first;
}
for (unsigned idx = 0; idx < size; idx++) {
fprintf(fp, " \"%s\";\n", names[idx]);
}
}
extern "C" unsigned ivl_file_table_get(const char*name)
{
if (name == NULL) return 0;
/* The new index is the current map size. This is inserted only
* if the file name is not currently in the map. */
file_names.insert(make_pair(name, file_names.size()));
return file_names[name];
}
extern "C" void ivl_file_table_init()
{
assert(file_names.empty());
/* The first two index entries do not depend on a real file name
* and are always available. */
file_names["N/A"] = 0;
file_names["<interactive>"] = 1;
}
extern "C" const char* ivl_logic_attr(ivl_net_logic_t net, const char*key)
{
assert(net);
@ -1653,12 +1699,12 @@ extern "C" ivl_statement_type_t ivl_statement_type(ivl_statement_t net)
return net->type_;
}
extern "C" const char* ivl_statement_file(ivl_statement_t net)
extern "C" const char* ivl_stmt_file(ivl_statement_t net)
{
return net->file.str();
}
extern "C" unsigned ivl_statement_lineno(ivl_statement_t net)
extern "C" unsigned ivl_stmt_lineno(ivl_statement_t net)
{
return net->lineno;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: statement.c,v 1.13 2007/04/02 01:12:34 steve Exp $"
#endif
# include "config.h"
# include "priv.h"
@ -325,7 +322,7 @@ void show_statement(ivl_statement_t net, unsigned ind)
case IVL_ST_STASK: {
fprintf(out, "%*sCall %s(%u parameters); /* %s:%u */\n",
ind, "", ivl_stmt_name(net), ivl_stmt_parm_count(net),
ivl_statement_file(net), ivl_statement_lineno(net));
ivl_stmt_file(net), ivl_stmt_lineno(net));
for (idx = 0 ; idx < ivl_stmt_parm_count(net) ; idx += 1)
if (ivl_stmt_parm(net, idx))
show_expression(ivl_stmt_parm(net, idx), ind+4);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: draw_vpi.c,v 1.17 2007/02/14 05:59:24 steve Exp $"
#endif
# include "vvp_priv.h"
# include <string.h>
@ -293,7 +290,9 @@ static void draw_vpi_taskfunc_args(const char*call_string,
void draw_vpi_task_call(ivl_statement_t tnet)
{
char call_string[1024];
sprintf(call_string, " %%vpi_call \"%s\"", ivl_stmt_name(tnet));
sprintf(call_string, " %%vpi_call %u %u \"%s\"",
ivl_file_table_get(ivl_stmt_file(tnet)),
ivl_stmt_lineno(tnet), ivl_stmt_name(tnet));
draw_vpi_taskfunc_args(call_string, tnet, 0);
}
@ -304,8 +303,9 @@ struct vector_info draw_vpi_func_call(ivl_expr_t fnet, unsigned wid)
res.base = allocate_vector(wid);
res.wid = wid;
sprintf(call_string, " %%vpi_func \"%s\", %u, %u",
ivl_expr_name(fnet), res.base, res.wid);
sprintf(call_string, " %%vpi_func %u %u \"%s\", %u, %u",
ivl_file_table_get(ivl_expr_file(fnet)),
ivl_expr_lineno(fnet), ivl_expr_name(fnet), res.base, res.wid);
draw_vpi_taskfunc_args(call_string, 0, fnet);
@ -317,8 +317,9 @@ int draw_vpi_rfunc_call(ivl_expr_t fnet)
char call_string[1024];
int res = allocate_word();
sprintf(call_string, " %%vpi_func/r \"%s\", %d",
ivl_expr_name(fnet), res);
sprintf(call_string, " %%vpi_func/r %u %u \"%s\", %d",
ivl_file_table_get(ivl_expr_file(fnet)),
ivl_expr_lineno(fnet), ivl_expr_name(fnet), res);
draw_vpi_taskfunc_args(call_string, 0, fnet);

View File

@ -1021,7 +1021,7 @@ static struct vector_info draw_load_add_immediate(ivl_expr_t le,
imm = get_number_immediate(re);
/* Load the immidiate value into word register 0 */
/* Load the immediate value into word register 0 */
fprintf(vvp_out, " %%ix/load 0, %lu;\n", imm);
lv.base = allocate_vector(wid);
@ -1734,7 +1734,7 @@ static void draw_signal_dest(ivl_expr_t exp, struct vector_info res,
if (swid > res.wid)
swid = res.wid;
/* If this is an access to an array, handle that by emiting a
/* If this is an access to an array, handle that by emitting a
load/av instruction. */
if (ivl_signal_array_count(sig) > 1) {
ivl_expr_t ix = ivl_expr_oper1(exp);
@ -1913,7 +1913,7 @@ static struct vector_info draw_select_expr(ivl_expr_t exp, unsigned wid,
res.wid = wid;
/* First look for the self expression in the lookaside, and
allocate that if possible. If I find it, then immediatly
allocate that if possible. If I find it, then immediately
return that. */
if ( (res.base = allocate_vector_exp(exp, wid, alloc_exclusive)) != 0) {
fprintf(vvp_out, "; Reuse base=%u wid=%u from lookaside.\n",
@ -2087,8 +2087,10 @@ static struct vector_info draw_sfunc_expr(ivl_expr_t exp, unsigned wid)
|| ivl_expr_value(exp) == IVL_VT_BOOL);
res.base = allocate_vector(wid);
res.wid = wid;
fprintf(vvp_out, " %%vpi_func \"%s\", %u, %u;\n",
ivl_expr_name(exp), res.base, res.wid);
fprintf(vvp_out, " %%vpi_func %u %u \"%s\", %u, %u;\n",
ivl_file_table_get(ivl_expr_file(exp)),
ivl_expr_lineno(exp), ivl_expr_name(exp),
res.base, res.wid);
return res;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2005 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_real.c,v 1.22 2007/06/12 02:36:58 steve Exp $"
#endif
/*
* This file includes functions for evaluating REAL expressions.
@ -124,7 +121,7 @@ static int draw_number_real(ivl_expr_t exp)
positive equivalent, and set the sign bit in the exponent
field.
To get the positive equivilent of mant we need to take the
To get the positive equivalent of mant we need to take the
negative of the mantissa (0-mant) but also be aware that
the bits may not have been as many bits as the width of the
mant variable. This would lead to spurious '1' bits in the
@ -213,8 +210,9 @@ static int draw_sfunc_real(ivl_expr_t exp)
case IVL_VT_REAL:
if (ivl_expr_parms(exp) == 0) {
res = allocate_word();
fprintf(vvp_out, " %%vpi_func/r \"%s\", %d;\n",
ivl_expr_name(exp), res);
fprintf(vvp_out, " %%vpi_func/r %u %u \"%s\", %d;\n",
ivl_file_table_get(ivl_expr_file(exp)),
ivl_expr_lineno(exp), ivl_expr_name(exp), res);
} else {
res = draw_vpi_rfunc_call(exp);
@ -441,79 +439,3 @@ int draw_eval_real(ivl_expr_t exp)
return res;
}
/*
* $Log: eval_real.c,v $
* Revision 1.22 2007/06/12 02:36:58 steve
* handle constant inf values.
*
* Revision 1.21 2007/06/07 03:20:15 steve
* Properly handle signed conversion to real
*
* Revision 1.20 2007/02/26 19:49:50 steve
* Spelling fixes (larry doolittle)
*
* Revision 1.19 2007/02/20 05:58:36 steve
* Handle unary minus of real valued expressions.
*
* Revision 1.18 2007/02/14 05:59:46 steve
* Handle type of ternary expressions properly.
*
* Revision 1.17 2007/01/16 05:44:16 steve
* Major rework of array handling. Memories are replaced with the
* more general concept of arrays. The NetMemory and NetEMemory
* classes are removed from the ivl core program, and the IVL_LPM_RAM
* lpm type is removed from the ivl_target API.
*
* Revision 1.16 2006/10/10 23:54:28 steve
* Fix rendering of signed numbers in real expressions.
*
* Revision 1.15 2006/08/09 05:19:08 steve
* Add support for real valued modulus.
*
* Revision 1.14 2005/07/13 04:52:31 steve
* Handle functions with real values.
*
* Revision 1.13 2005/07/11 16:56:51 steve
* Remove NetVariable and ivl_variable_t structures.
*
* Revision 1.12 2005/07/07 16:22:50 steve
* Generalize signals to carry types.
*
* Revision 1.11 2004/10/04 01:10:57 steve
* Clean up spurious trailing white space.
*
* Revision 1.10 2003/12/19 01:27:10 steve
* Fix various unsigned compare warnings.
*
* Revision 1.9 2003/05/25 02:50:08 steve
* Add % in real expressions.
*
* Revision 1.8 2003/04/23 02:22:47 steve
* Fix word register leak.
*
* Revision 1.7 2003/03/28 02:33:56 steve
* Add support for division of real operands.
*
* Revision 1.6 2003/03/15 04:45:18 steve
* Allow real-valued vpi functions to have arguments.
*
* Revision 1.5 2003/03/08 01:04:01 steve
* Excess precision breaks some targets.
*
* Revision 1.4 2003/02/07 02:46:16 steve
* Handle real value subtract and comparisons.
*
* Revision 1.3 2003/01/28 04:15:50 steve
* Deliver residual bits of real value.
*
* Revision 1.2 2003/01/27 00:14:37 steve
* Support in various contexts the $realtime
* system task.
*
* Revision 1.1 2003/01/26 21:16:00 steve
* Rework expression parsing and elaboration to
* accommodate real/realtime values and expressions.
*
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vvp.c,v 1.17 2004/10/04 01:10:57 steve Exp $"
#endif
/*
*/
@ -82,6 +79,9 @@ int target_design(ivl_design_t des)
return -1;
}
/* Initialize the file name table. */
ivl_file_table_init();
draw_execute_header(des);
{ int pre = ivl_design_time_precision(des);
@ -105,23 +105,11 @@ int target_design(ivl_design_t des)
rc = ivl_design_process(des, draw_process, 0);
/* Dump the file name table. */
ivl_file_table_dump(vvp_out);
fclose(vvp_out);
return rc;
}
/*
* $Log: vvp.c,v $
* Revision 1.17 2004/10/04 01:10:57 steve
* Clean up spurious trailing white space.
*
* Revision 1.16 2003/05/16 03:22:52 steve
* Use fopen64 to open output file.
*
* Revision 1.15 2002/08/12 01:35:03 steve
* conditional ident string using autoconfig.
*
* Revision 1.14 2002/08/11 23:47:04 steve
* Add missing Log and Ident strings.
*
*/

View File

@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vvp_process.c,v 1.133 2007/02/27 05:13:34 steve Exp $"
#endif
# include "vvp_priv.h"
# include <string.h>
@ -1333,7 +1330,9 @@ static int show_system_task_call(ivl_statement_t net)
unsigned parm_count = ivl_stmt_parm_count(net);
if (parm_count == 0) {
fprintf(vvp_out, " %%vpi_call \"%s\";\n", ivl_stmt_name(net));
fprintf(vvp_out, " %%vpi_call %u %u \"%s\";\n",
ivl_file_table_get(ivl_stmt_file(net)),
ivl_stmt_lineno(net), ivl_stmt_name(net));
clear_expression_lookaside();
return 0;
}

View File

@ -1,7 +1,7 @@
#ifndef __vpi_user_H
#define __vpi_user_H
/*
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_user.h,v 1.37 2007/03/14 04:05:51 steve Exp $"
#endif
#if defined(__MINGW32__) || defined (__CYGWIN32__)
@ -137,13 +134,13 @@ typedef struct t_vpi_value {
The "da" field of the s_vpi_delay
structure shall be a user allocated
array of "s_vpi_time" struture
array of "s_vpi_time" structure
The arrary shall store delay values returned
The array shall store delay values returned
by vpi_get_delay(). The number of elements in
the array shall be determined by
(1) The number of delays to be retrived
(1) The number of delays to be retrieved
( normally this is used in vpi_get_delays (..) )
{
(1.1) Setted by "no_of_delays" field
@ -221,7 +218,7 @@ typedef struct t_vpi_value {
typedef struct t_vpi_delay {
struct t_vpi_time *da; /* Array of delay datas */
struct t_vpi_time *da; /* Array of delay data */
PLI_INT32 no_of_delays ;
PLI_INT32 time_type; /* vpiScaledRealTime, vpiSimTime */
PLI_INT32 mtm_flag;
@ -309,6 +306,8 @@ typedef struct t_vpi_delay {
#define vpiName 2
#define vpiFullName 3
#define vpiSize 4
#define vpiFile 5
#define vpiLineNo 6
#define vpiTopModule 7
#define vpiDefName 9
#define vpiTimeUnit 11
@ -565,93 +564,4 @@ extern void vpip_format_strength(char*str, s_vpi_value*value);
EXTERN_C_END
/*
* $Log: vpi_user.h,v $
* Revision 1.37 2007/03/14 04:05:51 steve
* VPI tasks take PLI_BYTE* by the standard.
*
* Revision 1.36 2004/10/04 01:10:56 steve
* Clean up spurious trailing white space.
*
* Revision 1.35 2004/09/05 21:30:16 steve
* Better type safety.
*
* Revision 1.34 2004/03/09 04:29:26 steve
* Define function types.
*
* Revision 1.33 2004/02/19 21:32:46 steve
* Add sysfunctype to calltf structure.
*
* Revision 1.32 2004/01/13 02:55:50 steve
* Get value for vpoiConstType correct.
*
* Revision 1.31 2003/12/07 20:06:24 steve
* tfname can be constant.
*
* Revision 1.30 2003/10/30 03:42:51 steve
* Details on the vpi_get_file function.
*
* Revision 1.29 2003/07/15 03:49:22 steve
* Spelling fixes.
*
* Revision 1.28 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.27 2003/05/29 02:21:45 steve
* Implement acc_fetch_defname and its infrastructure in vvp.
*
* Revision 1.26 2003/05/23 04:04:02 steve
* Add vpi_fopen and vpi_get_file.
*
* Revision 1.25 2003/05/15 16:51:08 steve
* Arrange for mcd id=00_00_00_01 to go to stdout
* as well as a user specified log file, set log
* file to buffer lines.
*
* Add vpi_flush function, and clear up some cunfused
* return codes from other vpi functions.
*
* Adjust $display and vcd/lxt messages to use the
* standard output/log file.
*
* Revision 1.24 2003/04/20 02:49:07 steve
* acc_fetch_value support for %v format.
*
* Revision 1.23 2003/03/13 18:26:12 steve
* Verilog 2001 standart types.
*
* Revision 1.22 2003/03/13 04:34:35 steve
* Add VPI_TRACE tracing of VPI calls.
* vpi_handle_by_name takes a const char*.
*
* Revision 1.21 2003/03/12 02:49:38 steve
* Move _vpiNexisId safely out of the way.
*
* Revision 1.20 2003/03/10 23:40:54 steve
* Keep parameter constants for the ivl_target API.
*
* Revision 1.19 2003/02/17 06:39:47 steve
* Add at least minimal implementations for several
* acc_ functions. Add support for standard ACC
* string handling.
*
* Add the _pli_types.h header file to carry the
* IEEE1364-2001 standard PLI type declarations.
*
* Revision 1.18 2003/02/01 05:50:27 steve
* Make $time and $realtime available to $display uniquely.
*
* Revision 1.17 2003/01/26 21:15:59 steve
* Rework expression parsing and elaboration to
* accommodate real/realtime values and expressions.
*
* Revision 1.16 2003/01/09 04:10:17 steve
* Add vpi_put_userdata
*/
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compile.cc,v 1.232 2007/06/07 03:20:16 steve Exp $"
#endif
# include "arith.h"
# include "compile.h"
@ -1598,7 +1595,9 @@ void compile_fork(char*label, struct symb_s dest, struct symb_s scope)
compile_vpi_lookup(&code->handle, scope.text);
}
void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
void compile_vpi_call(char*label, char*name,
long file_idx, long line_no,
unsigned argc, vpiHandle*argv)
{
if (label)
compile_codelabel(label);
@ -1609,7 +1608,8 @@ void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
/* Create a vpiHandle that bundles the call information, and
store that handle in the instruction. */
code->handle = vpip_build_vpi_call(name, 0, 0, 0, argc, argv);
code->handle = vpip_build_vpi_call(name, 0, 0, 0, argc, argv,
file_idx, line_no);
if (code->handle == 0)
compile_errors += 1;
@ -1619,6 +1619,7 @@ void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
void compile_vpi_func_call(char*label, char*name,
unsigned vbit, int vwid,
long file_idx, long line_no,
unsigned argc, vpiHandle*argv)
{
if (label)
@ -1630,7 +1631,8 @@ void compile_vpi_func_call(char*label, char*name,
/* Create a vpiHandle that bundles the call information, and
store that handle in the instruction. */
code->handle = vpip_build_vpi_call(name, vbit, vwid, 0, argc, argv);
code->handle = vpip_build_vpi_call(name, vbit, vwid, 0, argc, argv,
file_idx, line_no);
if (code->handle == 0)
compile_errors += 1;

View File

@ -21,12 +21,19 @@
# include <stdio.h>
# include <fstream>
# include <vector>
# include "parse_misc.h"
# include "vpi_user.h"
# include "vvp_net.h"
using namespace std;
/*
* The file names are kept in this vector. Entry 0 is "N/A" and 1 is
* for interactive commands.
*/
extern vector<const char*> file_names;
/*
* The functions described here are the compile time support
* functions. Various bits of the compile process are taken care of
@ -327,6 +334,7 @@ extern void compile_code(char*label, char*mnem, comp_operands_t opa);
extern void compile_disable(char*label, struct symb_s symb);
extern void compile_vpi_call(char*label, char*name,
long file_idx, long line_no,
unsigned argc, vpiHandle*argv);
/* Compile a function call. The vbit and vwid encode the return
@ -335,6 +343,7 @@ extern void compile_vpi_call(char*label, char*name,
code that represents the function type. */
extern void compile_vpi_func_call(char*label, char*name,
unsigned vbit, int vwid,
long file_idx, long line_no,
unsigned argc, vpiHandle*argv);
extern void compile_fork(char*label, struct symb_s targ_s,

View File

@ -3,7 +3,7 @@
%{
/*
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -20,9 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: lexor.lex,v 1.66 2007/04/10 01:26:16 steve Exp $"
#endif
# include "parse_misc.h"
# include "compile.h"
@ -33,9 +30,10 @@
%%
/* These are some special header keywords. */
/* These are some special header/footer keywords. */
^":vpi_module" { return K_vpi_module; }
^":vpi_time_precision" { return K_vpi_time_precision; }
^":file_names" { return K_file_names; }
/* A label is any non-blank text that appears left justified. */
@ -187,7 +185,7 @@
assert(yylval.text);
return T_SYMBOL; }
/* Symbols may include komma `,' in certain constructs */
/* Symbols may include comma `,' in certain constructs */
[A-Z]"<"[.$_a-zA-Z0-9/,]*">" {
yylval.text = strdup(yytext);
@ -214,220 +212,3 @@ int yywrap()
return -1;
}
/*
* $Log: lexor.lex,v $
* Revision 1.66 2007/04/10 01:26:16 steve
* variable arrays generated without writing a record for each word.
*
* Revision 1.65 2007/01/16 05:44:16 steve
* Major rework of array handling. Memories are replaced with the
* more general concept of arrays. The NetMemory and NetEMemory
* classes are removed from the ivl core program, and the IVL_LPM_RAM
* lpm type is removed from the ivl_target API.
*
* Revision 1.64 2006/11/22 06:10:05 steve
* Fix spurious event from net8 that is forced.
*
* Revision 1.63 2006/09/23 04:57:20 steve
* Basic support for specify timing.
*
* Revision 1.62 2006/07/30 02:51:36 steve
* Fix/implement signed right shift.
*
* Revision 1.61 2006/06/18 04:15:50 steve
* Add support for system functions in continuous assignments.
*
* Revision 1.60 2006/05/17 04:15:25 steve
* Lexor os never interactive.
*
* Revision 1.59 2006/03/08 05:29:42 steve
* Add support for logic parameters.
*
* Revision 1.58 2006/01/02 05:32:07 steve
* Require explicit delay node from source.
*
* Revision 1.57 2005/11/25 17:55:26 steve
* Put vec8 and vec4 nets into seperate net classes.
*
* Revision 1.56 2005/10/12 17:23:15 steve
* Add alias nodes.
*
* Revision 1.55 2005/07/06 04:29:25 steve
* Implement real valued signals and arith nodes.
*
* Revision 1.54 2005/05/24 01:43:27 steve
* Add a sign-extension node.
*
* Revision 1.53 2005/05/08 23:40:14 steve
* Add support for variable part select.
*
* Revision 1.52 2005/04/28 04:59:53 steve
* Remove dead functor code.
*
* Revision 1.51 2005/04/24 20:07:26 steve
* Add DFF nodes.
*
* Revision 1.50 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.49 2005/02/07 22:42:42 steve
* Add .repeat functor and BIFIF functors.
*
* Revision 1.48 2005/02/03 04:55:13 steve
* Add support for reduction logic gates.
*
* Revision 1.47 2005/01/22 01:06:20 steve
* Implement the .cmp/eeq LPM node.
*
* Revision 1.46 2005/01/09 20:11:15 steve
* Add the .part/pv node and related functionality.
*
* Revision 1.45 2004/12/29 23:45:13 steve
* Add the part concatenation node (.concat).
*
* Add a vvp_event_anyedge class to handle the special
* case of .event statements of edge type. This also
* frees the posedge/negedge types to handle all 4 inputs.
*
* Implement table functor recv_vec4 method to receive
* and process vectors.
*
* Revision 1.44 2004/12/11 02:31:29 steve
* Rework of internals to carry vectors through nexus instead
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
* down this path.
*
* Revision 1.43 2004/06/30 02:15:57 steve
* Add signed LPM divide.
*
* Revision 1.42 2004/06/16 16:33:26 steve
* Add structural equality compare nodes.
*
* Revision 1.41 2003/08/26 16:26:02 steve
* ifdef idents correctly.
*
* Revision 1.40 2003/04/11 05:15:39 steve
* Add signed versions of .cmp/gt/ge
*
* Revision 1.39 2003/03/10 23:37:07 steve
* Direct support for string parameters.
*
* Revision 1.38 2003/02/09 23:33:26 steve
* Spelling fixes.
*
* Revision 1.37 2003/01/27 00:14:37 steve
* Support in various contexts the $realtime
* system task.
*
* Revision 1.36 2003/01/25 23:48:06 steve
* Add thread word array, and add the instructions,
* %add/wr, %cmp/wr, %load/wr, %mul/wr and %set/wr.
*
* Revision 1.35 2002/12/21 00:55:58 steve
* The $time system task returns the integer time
* scaled to the local units. Change the internal
* implementation of vpiSystemTime the $time functions
* to properly account for this. Also add $simtime
* to get the simulation time.
*
* Revision 1.34 2002/06/21 04:58:55 steve
* Add support for special integer vectors.
*
* Revision 1.33 2002/04/14 03:53:20 steve
* Allow signed constant vectors for call_vpi parameters.
*
* Revision 1.32 2002/03/18 00:19:34 steve
* Add the .ufunc statement.
*
* Revision 1.31 2002/03/01 05:42:50 steve
* out-of-memory asserts.
*
* Revision 1.30 2002/02/27 05:46:33 steve
* carriage return is white space.
*
* Revision 1.29 2002/01/03 04:19:02 steve
* Add structural modulus support down to vvp.
*
* Revision 1.28 2001/11/01 03:00:19 steve
* Add force/cassign/release/deassign support. (Stephan Boettcher)
*
* Revision 1.27 2001/10/16 02:47:37 steve
* Add arith/div object.
*
* Revision 1.26 2001/07/07 02:57:33 steve
* Add the .shift/r functor.
*
* Revision 1.25 2001/07/06 04:46:44 steve
* Add structural left shift (.shift/l)
*
* Revision 1.24 2001/06/30 23:03:17 steve
* support fast programming by only writing the bits
* that are listed in the input file.
*
* Revision 1.23 2001/06/18 03:10:34 steve
* 1. Logic with more than 4 inputs
* 2. Id and name mangling
* 3. A memory leak in draw_net_in_scope()
* (Stephan Boettcher)
*
* Revision 1.22 2001/06/16 23:45:05 steve
* Add support for structural multiply in t-dll.
* Add code generators and vvp support for both
* structural and behavioral multiply.
*
* Revision 1.21 2001/06/15 04:07:58 steve
* Add .cmp statements for structural comparison.
*
* Revision 1.20 2001/06/07 03:09:03 steve
* Implement .arith/sub subtraction.
*
* Revision 1.19 2001/06/05 03:05:41 steve
* Add structural addition.
*
* Revision 1.18 2001/05/20 00:46:12 steve
* Add support for system function calls.
*
* Revision 1.17 2001/05/10 00:26:53 steve
* VVP support for memories in expressions,
* including general support for thread bit
* vectors as system task parameters.
* (Stephan Boettcher)
*
* Revision 1.16 2001/05/09 02:53:25 steve
* Implement the .resolv syntax.
*
* Revision 1.15 2001/05/01 01:09:39 steve
* Add support for memory objects. (Stephan Boettcher)
*
* Revision 1.14 2001/04/24 02:23:59 steve
* Support for UDP devices in VVP (Stephen Boettcher)
*
* Revision 1.13 2001/04/18 04:21:23 steve
* Put threads into scopes.
*
* Revision 1.12 2001/04/14 05:10:56 steve
* support the .event/or statement.
*
* Revision 1.11 2001/04/05 01:34:26 steve
* Add the .var/s and .net/s statements for VPI support.
*
* Revision 1.10 2001/04/04 04:33:08 steve
* Take vector form as parameters to vpi_call.
*
* Revision 1.9 2001/03/26 04:00:39 steve
* Add the .event statement and the %wait instruction.
*
* Revision 1.8 2001/03/25 19:36:45 steve
* Accept <> characters in labels and symbols.
*
* Revision 1.7 2001/03/25 00:35:35 steve
* Add the .net statement.
*
* Revision 1.6 2001/03/23 02:40:22 steve
* Add the :module header statement.
*
* Revision 1.5 2001/03/20 02:48:40 steve
* Copyright notices.
*
*/

View File

@ -31,6 +31,8 @@
*/
extern FILE*yyin;
vector <const char*> file_names;
/*
* Local variables.
*/
@ -81,7 +83,7 @@ static struct __vpiModPath*modpath_dst = 0;
%token K_MEM K_MEM_P K_MEM_I
%token K_VAR K_VAR_S K_VAR_I K_VAR_R K_vpi_call K_vpi_func K_vpi_func_r
%token K_disable K_fork
%token K_vpi_module K_vpi_time_precision
%token K_vpi_module K_vpi_time_precision K_file_names
%token <text> T_INSTR
%token <text> T_LABEL
@ -105,10 +107,11 @@ static struct __vpiModPath*modpath_dst = 0;
%%
source_file : header_lines_opt program ;
source_file : header_lines_opt program footer_lines;
header_lines_opt : header_lines | ;
header_lines
: header_line
| header_lines header_line
@ -123,6 +126,17 @@ header_line
{ compile_vpi_time_precision(-$3); }
;
footer_lines
: K_file_names T_NUMBER ';' { file_names.reserve($2) }
name_strings
name_strings
: T_STRING ';'
{ file_names.push_back($1); }
| name_strings T_STRING ';'
{ file_names.push_back($2); }
;
/* A program is simply a list of statements. No other structure. */
program
: statement
@ -423,16 +437,18 @@ statement
statement is a variant of %vpi_call that includes a thread vector
after the name, and is used for function calls. */
| label_opt K_vpi_call T_STRING argument_opt ';'
{ compile_vpi_call($1, $3, $4.argc, $4.argv); }
| label_opt K_vpi_call T_NUMBER T_NUMBER T_STRING argument_opt ';'
{ compile_vpi_call($1, $5, $3, $4, $6.argc, $6.argv); }
| label_opt K_vpi_func T_STRING ','
| label_opt K_vpi_func T_NUMBER T_NUMBER T_STRING ','
T_NUMBER ',' T_NUMBER argument_opt ';'
{ compile_vpi_func_call($1, $3, $5, $7, $8.argc, $8.argv); }
{ compile_vpi_func_call($1, $5, $7, $9, $3, $4,
$10.argc, $10.argv); }
| label_opt K_vpi_func_r T_STRING ',' T_NUMBER argument_opt ';'
{ compile_vpi_func_call($1, $3, $5, -vpiRealConst,
$6.argc, $6.argv); }
| label_opt K_vpi_func_r T_NUMBER T_NUMBER T_STRING ',' T_NUMBER
argument_opt ';'
{ compile_vpi_func_call($1, $5, $7, -vpiRealConst, $3, $4,
$8.argc, $8.argv); }
/* %disable statements are instructions that takes a scope reference
as an operand. It therefore is parsed uniquely. */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006 Stephen Williams (steve@icarus.com)
* Copyright (c) 2006-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: sfunc.cc,v 1.1 2006/06/18 04:15:50 steve Exp $"
#endif
# include "compile.h"
# include "sfunc.h"
@ -139,7 +136,7 @@ void compile_sfunc(char*label, char*name, char*format_string,
vvp_net_t*ptr = new vvp_net_t;
vpiHandle sys = vpip_build_vpi_call(name, 0, width_code, ptr,
argc, vpi_argv);
argc, vpi_argv, 0, 0);
assert(sys);
/* Create and connect the functor to the label. */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: stop.cc,v 1.16 2006/06/18 04:15:50 steve Exp $"
#endif
/*
* This file provides a simple command line debugger for the vvp
@ -28,7 +25,6 @@
# include "config.h"
# include "vpi_priv.h"
# include "vthread.h"
# include "schedule.h"
@ -175,7 +171,8 @@ static void cmd_call(unsigned argc, char*argv[])
when we finish. */
if (errors == 0) {
vpiHandle call_handle = vpip_build_vpi_call(argv[0], 0, 0, 0,
vpi_argc, vpi_argv);
vpi_argc, vpi_argv,
1, 0);
if (call_handle == 0)
goto out;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,11 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_const.cc,v 1.39 2007/04/12 04:45:52 steve Exp $"
#endif
# include "vpi_priv.h"
# include "compile.h"
# include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
@ -34,6 +32,9 @@ static int string_get(int code, vpiHandle ref)
struct __vpiStringConst*rfp;
switch (code) {
case vpiLineNo:
return 0; // Not implemented for now!
case vpiSize:
rfp = (struct __vpiStringConst*)ref;
@ -254,6 +255,9 @@ static char* string_param_get_str(int code, vpiHandle obj)
assert(obj->vpi_type->type_code == vpiParameter);
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
return generic_get_str(code, &rfp->scope->base, rfp->basename, NULL);
}
@ -314,6 +318,9 @@ static int binary_get(int code, vpiHandle ref)
case vpiConstType:
return vpiBinaryConst;
case vpiLineNo:
return 0; // Not implemented for now!
case vpiSigned:
return rfp->signed_flag? 1 : 0;
@ -427,6 +434,9 @@ static char* binary_param_get_str(int code, vpiHandle obj)
assert(obj->vpi_type->type_code == vpiParameter);
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
return generic_get_str(code, &rfp->scope->base, rfp->basename, NULL);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2003 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,10 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_event.cc,v 1.11 2005/06/12 01:10:26 steve Exp $"
#endif
# include "compile.h"
# include "vpi_priv.h"
# include <stdio.h>
#ifdef HAVE_MALLOC_H
@ -35,6 +33,9 @@ static char* named_event_get_str(int code, vpiHandle ref)
struct __vpiNamedEvent*obj = (struct __vpiNamedEvent*)ref;
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
return generic_get_str(code, &obj->scope->base, obj->name, NULL);
}
@ -89,7 +90,7 @@ vpiHandle vpip_make_named_event(const char*name, vvp_net_t*funct)
*
* This also handles the case where the callback has been removed. The
* vpi_remove_cb doesn't actually remove any callbacks, it marks them
* as cancelled by clearing the cb_rtn function. This function reaps
* as canceled by clearing the cb_rtn function. This function reaps
* those marked handles when it scans the list.
*/
void vpip_run_named_event_callbacks(vpiHandle ref)
@ -122,45 +123,3 @@ void vpip_run_named_event_callbacks(vpiHandle ref)
}
}
/*
* $Log: vpi_event.cc,v $
* Revision 1.11 2005/06/12 01:10:26 steve
* Remove useless references to functor.h
*
* Revision 1.10 2004/12/11 02:31:30 steve
* Rework of internals to carry vectors through nexus instead
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
* down this path.
*
* Revision 1.9 2003/05/04 20:43:36 steve
* Event callbacks support vpi_remove_cb.
*
* Revision 1.8 2003/04/23 03:09:25 steve
* VPI Access to named events.
*
* Revision 1.7 2003/03/06 04:32:00 steve
* Use hashed name strings for identifiers.
*
* Revision 1.6 2003/02/02 01:40:24 steve
* Five vpi_free_object a default behavior.
*
* Revision 1.5 2002/08/12 01:35:08 steve
* conditional ident string using autoconfig.
*
* Revision 1.4 2002/07/12 18:23:30 steve
* Use result buf for event and scope names.
*
* Revision 1.3 2002/07/05 17:14:15 steve
* Names of vpi objects allocated as vpip_strings.
*
* Revision 1.2 2002/05/19 05:18:16 steve
* Add callbacks for vpiNamedEvent objects.
*
* Revision 1.1 2002/05/18 02:34:11 steve
* Add vpi support for named events.
*
* Add vpi_mode_flag to track the mode of the
* vpi engine. This is for error checking.
*
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2005 Stephen Williams (steve@icarus.com>
* Copyright (c) 1999-2007 Stephen Williams (steve@icarus.com>
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
*
* This source code is free software; you can redistribute it
@ -17,10 +17,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_memory.cc,v 1.33 2006/03/06 05:43:15 steve Exp $"
#endif
# include "compile.h"
# include "vpi_priv.h"
# include "memory.h"
# include "statistics.h"
@ -103,6 +101,9 @@ static char* memory_get_str(int code, vpiHandle ref)
struct __vpiMemory*rfp = (struct __vpiMemory*)ref;
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
return generic_get_str(code, &rfp->scope->base, rfp->name, NULL);
}

View File

@ -365,6 +365,8 @@ struct __vpiSysTaskCall {
unsigned vbit;
signed vwid;
class vvp_net_t*fnet;
unsigned file_idx;
unsigned line_no;
};
extern struct __vpiSysTaskCall*vpip_cur_task;
@ -457,7 +459,9 @@ extern vpiHandle vpip_build_vpi_call(const char*name,
unsigned vbit, int vwid,
class vvp_net_t*fnet,
unsigned argc,
vpiHandle*argv);
vpiHandle*argv,
long file_idx,
long line_no);
extern vthread_t vpip_current_vthread;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,10 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_real.cc,v 1.11 2005/09/20 18:34:02 steve Exp $"
#endif
# include "compile.h"
# include "vpi_priv.h"
# include "schedule.h"
# include <stdio.h>
@ -49,6 +47,10 @@ static char* real_var_get_str(int code, vpiHandle ref)
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
char *nm, *ixs;
if (rfp->parent) {
nm = strdup(vpi_get_str(vpiName, rfp->parent));

View File

@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_scope.cc,v 1.36 2006/04/10 00:37:43 steve Exp $"
#endif
# include "compile.h"
# include "vpi_priv.h"
@ -64,6 +61,9 @@ static int scope_get(int code, vpiHandle obj)
assert(handle_is_scope(obj));
switch (code) {
case vpiLineNo:
return 0; // Not implemented for now!
case vpiTimeUnit:
return ref->time_units;
@ -115,6 +115,10 @@ static char* scope_get_str(int code, vpiHandle obj)
char buf[4096]; // XXX is a fixed buffer size really reliable?
const char *p=0;
switch (code) {
case vpiFile:
p = file_names[0]; // Not implemented for now!
break;
case vpiFullName:
buf[0] = 0;
construct_scope_fullname(ref, buf);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2006 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,15 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_signal.cc,v 1.76 2007/01/16 05:44:16 steve Exp $"
#endif
/*
* vpiReg handles are handled here. These objects represent vectors of
* .var objects that can be manipulated by the VPI module.
*/
# include "compile.h"
# include "vpi_priv.h"
# include "schedule.h"
# include "statistics.h"
@ -129,6 +127,8 @@ static int signal_get(int code, vpiHandle ref)
assert(rfp);
switch (code) {
case vpiLineNo:
return 0; // Not implemented for now!
case vpiSigned:
return rfp->signed_flag != 0;
@ -170,6 +170,10 @@ static char* signal_get_str(int code, vpiHandle ref)
struct __vpiSignal*rfp = (struct __vpiSignal*)ref;
if (code == vpiFile) { // Not implemented for now!
return simple_set_rbuf_str(file_names[0]);
}
char *nm, *ixs;
if (rfp->parent) {
nm = strdup(vpi_get_str(vpiName, rfp->parent));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_tasks.cc,v 1.35 2007/04/12 04:45:53 steve Exp $"
#endif
/*
* This file keeps the table of system/task definitions. This table is
@ -80,6 +77,10 @@ static int systask_get(int type, vpiHandle ref)
switch (type) {
case vpiTimeUnit:
return rfp->scope->time_units;
case vpiLineNo:
return rfp->line_no;
default:
return vpiUndefined;
}
@ -95,6 +96,10 @@ static int sysfunc_get(int type, vpiHandle ref)
switch (type) {
case vpiSize:
return rfp->vwid;
case vpiLineNo:
return rfp->line_no;
default:
return vpiUndefined;
}
@ -112,6 +117,9 @@ static char *systask_get_str(int type, vpiHandle ref)
|| (ref->vpi_type->type_code == vpiSysFuncCall));
switch (type) {
case vpiFile:
assert(rfp->file_idx < file_names.size());
return simple_set_rbuf_str(file_names[rfp->file_idx]);
case vpiName:
return simple_set_rbuf_str(rfp->defn->info.tfname);
@ -434,7 +442,7 @@ static const struct __vpirt vpip_sysfunc_rnet_rt = {
systask_iter
};
/* **** Manipulate the internal datastructures. **** */
/* **** Manipulate the internal data structures. **** */
static struct __vpiUserSystf**def_table = 0;
static unsigned def_count = 0;
@ -485,7 +493,8 @@ struct __vpiUserSystf* vpip_find_systf(const char*name)
*/
vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, int vwid,
class vvp_net_t*fnet,
unsigned argc, vpiHandle*argv)
unsigned argc, vpiHandle*argv,
long file_idx, long line_no)
{
struct __vpiUserSystf*defn = vpip_find_systf(name);
if (defn == 0) {
@ -550,7 +559,9 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, int vwid,
obj->vbit = vbit;
obj->vwid = vwid;
obj->fnet = fnet;
obj->userdata = 0;
obj->file_idx = (unsigned) file_idx;
obj->line_no = (unsigned) line_no;
obj->userdata = 0;
compile_compiletf(obj);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2002 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_time.cc,v 1.17 2005/12/05 21:19:55 steve Exp $"
#endif
# include "config.h"
# include "vpi_priv.h"
@ -81,7 +78,7 @@ vvp_time64_t vpip_scaled_real_to_time64(double val, struct __vpiScope*scope)
double scale = pow(10.0L, units - vpi_time_precision);
val *= scale;
return val;
return (vvp_time64_t) val;
}
static int timevar_time_get(int code, vpiHandle ref)