diff --git a/ivl.def b/ivl.def index f400859bf..3c57b27bf 100644 --- a/ivl.def +++ b/ivl.def @@ -78,6 +78,8 @@ ivl_lpm_data ivl_lpm_datab ivl_lpm_define ivl_lpm_enable +ivl_lpm_file +ivl_lpm_lineno ivl_lpm_name ivl_lpm_q ivl_lpm_scope diff --git a/t-dll-api.cc b/t-dll-api.cc index 81709d643..c09937c77 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -823,6 +823,17 @@ extern "C" ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net) } } +/* The file name and line number are only set for system functions! */ +extern "C" const char* ivl_lpm_file(ivl_lpm_t net) +{ + return net->file.str(); +} + +extern "C" unsigned ivl_lpm_lineno(ivl_lpm_t net) +{ + return net->lineno; +} + extern "C" ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx) { assert(net); diff --git a/t-dll.cc b/t-dll.cc index a40990fd5..36cebfe01 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1047,6 +1047,7 @@ bool dll_target::net_sysfunction(const NetSysFunc*net) struct ivl_lpm_s*obj = new struct ivl_lpm_s; obj->type = IVL_LPM_SFUNC; + FILE_NAME(obj, net); obj->name = net->name(); obj->scope = find_scope(des_, net->scope()); assert(obj->scope); diff --git a/t-dll.h b/t-dll.h index b54789b62..e7547664b 100644 --- a/t-dll.h +++ b/t-dll.h @@ -1,7 +1,7 @@ #ifndef __t_dll_H #define __t_dll_H /* - * Copyright (c) 2000-2004 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 @@ -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: t-dll.h,v 1.143 2007/06/02 03:42:13 steve Exp $" -#endif # include "target.h" # include "ivl_target.h" @@ -292,6 +289,8 @@ struct ivl_lpm_s { ivl_lpm_type_t type; ivl_scope_t scope; perm_string name; + perm_string file; + unsigned lineno; // Value returned by ivl_lpm_width; unsigned width; @@ -701,4 +700,10 @@ static inline void FILE_NAME(ivl_expr_t expr, const LineInfo*info) expr->lineno = info->get_lineno(); } +static inline void FILE_NAME(ivl_lpm_t lpm, const LineInfo*info) +{ + lpm->file = info->get_file(); + lpm->lineno = info->get_lineno(); +} + #endif diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 8eb57ddac..302cdd60d 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -1958,7 +1958,9 @@ static void draw_type_string_of_nex(ivl_nexus_t nex) static void draw_lpm_sfunc(ivl_lpm_t net) { unsigned idx; - fprintf(vvp_out, "L_%p .sfunc \"%s\"", net, ivl_lpm_string(net)); + fprintf(vvp_out, "L_%p .sfunc %u %u \"%s\"", net, + ivl_file_table_get(ivl_lpm_file(net)), ivl_lpm_lineno(net), + ivl_lpm_string(net)); /* Print the function type descriptor string. */ fprintf(vvp_out, ", \""); diff --git a/vvp/compile.h b/vvp/compile.h index 0f588fa32..6c8ad9044 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -205,6 +205,7 @@ extern void compile_reduce_xnor(char*label, struct symb_s arg); extern void compile_extend_signed(char*label, long width, struct symb_s arg); extern void compile_sfunc(char*label, char*name, char*format_string, + long file_idx, long line_no, unsigned argc, struct symb_s*argv); extern void compile_repeat(char*label, long width, long repeat, struct symb_s arg); diff --git a/vvp/parse.y b/vvp/parse.y index 38928313a..96da52ca8 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -379,12 +379,13 @@ statement { compile_extend_signed($1, $3, $5); } /* System function call */ - | T_LABEL K_SFUNC T_STRING ',' T_STRING ',' symbols ';' - { compile_sfunc($1, $3, $5, $7.cnt, $7.vect); } + | T_LABEL K_SFUNC T_NUMBER T_NUMBER T_STRING ',' T_STRING ',' + symbols ';' + { compile_sfunc($1, $5, $7, $3, $4, $9.cnt, $9.vect); } /* System function call - no arguments */ - | T_LABEL K_SFUNC T_STRING ',' T_STRING ';' - { compile_sfunc($1, $3, $5, 0, NULL); } + | T_LABEL K_SFUNC T_NUMBER T_NUMBER T_STRING ',' T_STRING ';' + { compile_sfunc($1, $5, $7, $3, $4, 0, NULL); } /* Shift nodes. */ diff --git a/vvp/sfunc.cc b/vvp/sfunc.cc index b86be5b30..074d329da 100644 --- a/vvp/sfunc.cc +++ b/vvp/sfunc.cc @@ -127,6 +127,7 @@ static int make_vpi_argv(unsigned argc, vpiHandle*vpi_argv, void compile_sfunc(char*label, char*name, char*format_string, + long file_idx, long line_no, unsigned argc, struct symb_s*argv) { vpiHandle*vpi_argv = new vpiHandle[argc]; @@ -136,7 +137,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, 0, 0); + argc, vpi_argv, file_idx, line_no); assert(sys); /* Create and connect the functor to the label. */