diff --git a/ivl_target.h b/ivl_target.h index 6879b63a3..f4665febe 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: ivl_target.h,v 1.121 2003/08/15 02:23:52 steve Exp $" +#ident "$Id: ivl_target.h,v 1.122 2003/08/22 23:14:26 steve Exp $" #endif #ifdef __cplusplus @@ -1027,6 +1027,13 @@ extern int ivl_scope_time_units(ivl_scope_t net); * signal. If the signal is a vector, the idx can be a non-zero * value, and the result is the nexus for the specified bit. * + * ivl_signal_msb + * ivl_signal_lsb + * These functions return the left and right indices, respectively, + * of the signal. If the signal is a scalar, both return 0. However, + * it doesn't mean that the signal is a scalar if both return 0, one + * can have a vector with 0 as both indices. + * * ivl_signal_port * If the signal is a port to a module, this function returns the * port direction. If the signal is not a port, it returns @@ -1069,6 +1076,8 @@ extern int ivl_scope_time_units(ivl_scope_t net); extern ivl_nexus_t ivl_signal_pin(ivl_signal_t net, unsigned idx); extern unsigned ivl_signal_pins(ivl_signal_t net); +extern int ivl_signal_msb(ivl_signal_t net); +extern int ivl_signal_lsb(ivl_signal_t net); extern ivl_signal_port_t ivl_signal_port(ivl_signal_t net); extern int ivl_signal_signed(ivl_signal_t net); extern int ivl_signal_integer(ivl_signal_t net); @@ -1223,6 +1232,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.122 2003/08/22 23:14:26 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.121 2003/08/15 02:23:52 steve * Add synthesis support for synchronous reset. * diff --git a/t-dll-api.cc b/t-dll-api.cc index 7e6b5f5ad..8e149f4bd 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll-api.cc,v 1.102 2003/08/15 02:23:53 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.103 2003/08/22 23:14:26 steve Exp $" #endif # include "config.h" @@ -1490,6 +1490,17 @@ extern "C" unsigned ivl_signal_pins(ivl_signal_t net) return net->width_; } +extern "C" int ivl_signal_msb(ivl_signal_t net) +{ + assert(net->lsb_dist == 1 || net->lsb_dist == -1); + return net->lsb_index + net->lsb_dist * (net->width_ - 1); +} + +extern "C" int ivl_signal_lsb(ivl_signal_t net) +{ + return net->lsb_index; +} + extern "C" ivl_signal_port_t ivl_signal_port(ivl_signal_t net) { return net->port_; @@ -1872,6 +1883,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.103 2003/08/22 23:14:26 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.102 2003/08/15 02:23:53 steve * Add synthesis support for synchronous reset. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 302e09a6c..3b6b640e0 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_scope.c,v 1.95 2003/07/30 01:13:28 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.96 2003/08/22 23:14:26 steve Exp $" #endif # include "vvp_priv.h" @@ -561,8 +561,8 @@ void draw_input_from_net(ivl_nexus_t nex) */ static void draw_reg_in_scope(ivl_signal_t sig) { - int msb = ivl_signal_pins(sig) - 1; - int lsb = 0; + int msb = ivl_signal_msb(sig); + int lsb = ivl_signal_lsb(sig); const char*signed_flag = ivl_signal_integer(sig) ? "/i" : ivl_signal_signed(sig)? "/s" : ""; @@ -579,8 +579,8 @@ static void draw_reg_in_scope(ivl_signal_t sig) static void draw_net_in_scope(ivl_signal_t sig) { unsigned idx; - int msb = ivl_signal_pins(sig) - 1; - int lsb = 0; + int msb = ivl_signal_msb(sig); + int lsb = ivl_signal_lsb(sig); typedef const char*const_charp; const_charp* args; @@ -1654,6 +1654,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.96 2003/08/22 23:14:26 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.95 2003/07/30 01:13:28 steve * Add support for triand and trior. * diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 06cf66045..0fd03d58c 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_lxt.c,v 1.21 2003/05/15 16:51:09 steve Exp $" +#ident "$Id: sys_lxt.c,v 1.22 2003/08/22 23:14:27 steve Exp $" #endif # include "config.h" @@ -522,7 +522,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) info->time.type = vpiSimTime; info->item = item; - info->sym = lt_symbol_add(dump_file, ident, 0 /* array rows */, vpi_get(vpiSize, item)-1, 0, LT_SYM_F_BITS); + info->sym = lt_symbol_add(dump_file, ident, 0 /* array rows */, vpi_get(vpiLeftRange, item), vpi_get(vpiRightRange, item), LT_SYM_F_BITS); info->scheduled = 0; cb.time = &info->time; @@ -794,6 +794,9 @@ void sys_lxt_register() /* * $Log: sys_lxt.c,v $ + * Revision 1.22 2003/08/22 23:14:27 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.21 2003/05/15 16:51:09 steve * Arrange for mcd id=00_00_00_01 to go to stdout * as well as a user specified log file, set log diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index e86790e93..722f91f01 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_vcd.c,v 1.45 2003/08/06 18:24:55 steve Exp $" +#ident "$Id: sys_vcd.c,v 1.46 2003/08/22 23:14:27 steve Exp $" #endif # include "config.h" @@ -516,9 +516,18 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) info->cb = vpi_register_cb(&cb); } - fprintf(dump_file, "$var %s %u %s %s $end\n", + fprintf(dump_file, "$var %s %u %s %s", type, vpi_get(vpiSize, item), ident, name); + /* FIXME + if (vpi_get(vpiVector, item) + */ + if (vpi_get(vpiSize, item) > 1 + || vpi_get(vpiLeftRange, item) != 0) { + fprintf(dump_file, "[%i:%i]", vpi_get(vpiLeftRange, item), + vpi_get(vpiRightRange, item)); + } + fprintf(dump_file, " $end\n"); break; case vpiRealVar: @@ -793,6 +802,9 @@ void sys_vcd_register() /* * $Log: sys_vcd.c,v $ + * Revision 1.46 2003/08/22 23:14:27 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.45 2003/08/06 18:24:55 steve * Fix error truncating bitvec in output. * diff --git a/vvp/parse.y b/vvp/parse.y index bfccda769..a9bea104b 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -1,7 +1,7 @@ %{ /* - * Copyright (c) 2001 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2003 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,8 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#if !defined(WINNT) -#ident "$Id: parse.y,v 1.54 2003/05/29 02:21:45 steve Exp $" +#ifdef HAVE_CVS_IDENT +#ident "$Id: parse.y,v 1.55 2003/08/22 23:14:27 steve Exp $" #endif # include "parse_misc.h" @@ -75,6 +75,7 @@ extern FILE*yyin; %token T_SYMBOL %token T_VECTOR +%type signed_t_number %type symbol symbol_opt %type symbols symbols_net %type numbers @@ -353,10 +354,10 @@ statement creates a functor with the same name that acts as the output of the variable in the netlist. */ - | T_LABEL K_VAR T_STRING ',' T_NUMBER ',' T_NUMBER ';' + | T_LABEL K_VAR T_STRING ',' signed_t_number ',' signed_t_number ';' { compile_variable($1, $3, $5, $7, 0 /* unsigned */ ); } - | T_LABEL K_VAR_S T_STRING ',' T_NUMBER ',' T_NUMBER ';' + | T_LABEL K_VAR_S T_STRING ',' signed_t_number ',' signed_t_number ';' { compile_variable($1, $3, $5, $7, 1 /* signed */ ); } | T_LABEL K_VAR_I T_STRING ',' T_NUMBER ',' T_NUMBER ';' @@ -577,6 +578,11 @@ o_komma | ',' ; +signed_t_number + : T_NUMBER { $$ = $1; } + | '-' T_NUMBER { $$ = -$2; } + ; + delay : /* empty */ { $$ = 0; } @@ -607,6 +613,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.55 2003/08/22 23:14:27 steve + * Preserve variable ranges all the way to the vpi. + * * Revision 1.54 2003/05/29 02:21:45 steve * Implement acc_fetch_defname and its infrastructure in vvp. * @@ -626,148 +635,4 @@ int compile_design(const char*path) * Revision 1.49 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.48 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.47 2002/06/21 04:58:55 steve - * Add support for special integer vectors. - * - * Revision 1.46 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. - * - * Revision 1.45 2002/03/31 04:06:49 steve - * Update for newer bison. - * - * Revision 1.44 2002/03/18 00:19:34 steve - * Add the .ufunc statement. - * - * Revision 1.43 2002/01/03 04:19:02 steve - * Add structural modulus support down to vvp. - * - * Revision 1.42 2001/12/14 02:04:49 steve - * Support strength syntax on functors. - * - * Revision 1.41 2001/12/06 03:31:25 steve - * Support functor delays for gates and UDP devices. - * (Stephan Boettcher) - * - * Revision 1.40 2001/11/01 03:00:19 steve - * Add force/cassign/release/deassign support. (Stephan Boettcher) - * - * Revision 1.39 2001/10/31 04:27:47 steve - * Rewrite the functor type to have fewer functor modes, - * and use objects to manage the different types. - * (Stephan Boettcher) - * - * Revision 1.38 2001/10/16 02:47:37 steve - * Add arith/div object. - * - * Revision 1.37 2001/10/15 02:58:27 steve - * Carry the type of the scope (Stephan Boettcher) - * - * Revision 1.36 2001/07/11 04:43:57 steve - * support postpone of $systask parameters. (Stephan Boettcher) - * - * Revision 1.35 2001/07/07 02:57:33 steve - * Add the .shift/r functor. - * - * Revision 1.34 2001/07/06 04:46:44 steve - * Add structural left shift (.shift/l) - * - * Revision 1.33 2001/06/30 23:03:17 steve - * support fast programming by only writing the bits - * that are listed in the input file. - * - * Revision 1.32 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.31 2001/06/15 04:07:58 steve - * Add .cmp statements for structural comparison. - * - * Revision 1.30 2001/06/15 03:28:31 steve - * Change the VPI call process so that loaded .vpi modules - * use a function table instead of implicit binding. - * - * Revision 1.29 2001/06/07 03:09:03 steve - * Implement .arith/sub subtraction. - * - * Revision 1.28 2001/06/05 03:05:41 steve - * Add structural addition. - * - * Revision 1.27 2001/05/20 00:46:12 steve - * Add support for system function calls. - * - * Revision 1.26 2001/05/09 02:53:25 steve - * Implement the .resolv syntax. - * - * Revision 1.25 2001/05/02 23:16:50 steve - * Document memory related opcodes, - * parser uses numbv_s structures instead of the - * symbv_s and a mess of unions, - * Add the %is/sub instruction. - * (Stephan Boettcher) - * - * Revision 1.24 2001/05/02 04:05:17 steve - * Remove the init parameter of functors, and instead use - * the special C symbols to initialize inputs. This is - * clearer and more regular. - * - * Revision 1.23 2001/05/01 01:09:39 steve - * Add support for memory objects. (Stephan Boettcher) - * - * Revision 1.22 2001/04/24 02:23:59 steve - * Support for UDP devices in VVP (Stephen Boettcher) - * - * Revision 1.21 2001/04/23 00:37:58 steve - * Support unconnected .net objects. - * - * Revision 1.20 2001/04/18 04:21:23 steve - * Put threads into scopes. - * - * Revision 1.19 2001/04/14 05:10:56 steve - * support the .event/or statement. - * - * Revision 1.18 2001/04/05 01:34:26 steve - * Add the .var/s and .net/s statements for VPI support. - * - * Revision 1.17 2001/04/04 04:33:08 steve - * Take vector form as parameters to vpi_call. - * - * Revision 1.16 2001/04/02 00:24:30 steve - * Take numbers as system task parameters. - * - * Revision 1.15 2001/04/01 06:40:45 steve - * Support empty statements for hanging labels. - * - * Revision 1.14 2001/03/29 03:46:36 steve - * Support named events as mode 2 functors. - * - * Revision 1.13 2001/03/26 04:00:39 steve - * Add the .event statement and the %wait instruction. - * - * Revision 1.12 2001/03/25 00:35:35 steve - * Add the .net statement. - * - * Revision 1.11 2001/03/23 02:40:22 steve - * Add the :module header statement. - * - * Revision 1.10 2001/03/21 05:13:03 steve - * Allow var objects as vpiHandle arguments to %vpi_call. - * - * Revision 1.9 2001/03/20 06:16:24 steve - * Add support for variable vectors. - * - * Revision 1.8 2001/03/20 02:48:40 steve - * Copyright notices. - * */