diff --git a/README.txt b/README.txt index a1f3e8e7a..ad10d1bbc 100644 --- a/README.txt +++ b/README.txt @@ -344,6 +344,19 @@ language that are defined. The $sizeof function is deprecated in favor of $bits, which is the same thing, but included in the SystemVerilog definition. + $simtime + The $simtime system function returns as a 64bit value the + simulation time, unscaled by the time units of local + scope. This is different from the $time and $stime functions + which return the scaled times. This function is added for + regression testing of the compiler and run time, but can be + used by applications who really want the simulation time. + + Note that the simulation time can be confusing if there are + lots of different `timescales within a design. It is not in + general possible to predict what the simulation precision will + turn out to be. + Builtin system functions Certain of the system functions have well defined meanings, so diff --git a/elab_expr.cc b/elab_expr.cc index eed522037..17a0991b1 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elab_expr.cc,v 1.66 2002/09/21 21:28:18 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.67 2002/12/21 00:55:57 steve Exp $" #endif # include "config.h" @@ -215,6 +215,8 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope) const if (strcmp(path_.peek_name(0), "$time") == 0) wid = 64; + if (strcmp(path_.peek_name(0), "$simtime") == 0) + wid = 64; if (strcmp(path_.peek_name(0), "$stime") == 0) wid = 32; @@ -885,6 +887,13 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const /* * $Log: elab_expr.cc,v $ + * Revision 1.67 2002/12/21 00:55:57 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.66 2002/09/21 21:28:18 steve * Allow constant bit selects out of range. * diff --git a/ivl.def b/ivl.def index 021fc6558..d40390f4b 100644 --- a/ivl.def +++ b/ivl.def @@ -120,6 +120,7 @@ ivl_scope_port ivl_scope_ports ivl_scope_sigs ivl_scope_sig +ivl_scope_time_units ivl_scope_type ivl_scope_tname diff --git a/ivl_target.h b/ivl_target.h index 41139af6c..0545a774e 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.108 2002/10/23 01:47:17 steve Exp $" +#ident "$Id: ivl_target.h,v 1.109 2002/12/21 00:55:58 steve Exp $" #endif #ifdef __cplusplus @@ -861,6 +861,11 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net); * anything that can become and ivl_signal_t, include synthetic * signals generated by the compiler. * + * ivl_scope_time_units + * Scopes have their own intrinsic time units, typically from the + * timescale compiler directive. This method returns the units as a + * signed power of 10 value. + * * ivl_scope_type * ivl_scope_tname * Scopes have a type and a type name. For example, if a scope is @@ -891,6 +896,7 @@ extern unsigned ivl_scope_sigs(ivl_scope_t net); extern ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx); extern ivl_scope_type_t ivl_scope_type(ivl_scope_t net); extern const char* ivl_scope_tname(ivl_scope_t net); +extern int ivl_scope_time_units(ivl_scope_t net); /* SIGNALS @@ -1091,6 +1097,13 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.109 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.108 2002/10/23 01:47:17 steve * Fix synth2 handling of aset/aclr signals where * flip-flops are split by begin-end blocks. diff --git a/t-dll-api.cc b/t-dll-api.cc index f912255b3..91ef05794 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.88 2002/10/23 01:47:17 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.89 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" @@ -1157,6 +1157,12 @@ extern "C" ivl_signal_t ivl_scope_sig(ivl_scope_t net, unsigned idx) return net->sigs_[idx]; } +extern "C" int ivl_scope_time_units(ivl_scope_t net) +{ + assert(net); + return net->time_units; +} + extern "C" ivl_scope_type_t ivl_scope_type(ivl_scope_t net) { assert(net); @@ -1585,6 +1591,13 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.89 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.88 2002/10/23 01:47:17 steve * Fix synth2 handling of aset/aclr signals where * flip-flops are split by begin-end blocks. diff --git a/t-dll.cc b/t-dll.cc index 18c6274f4..b8607c272 100644 --- a/t-dll.cc +++ b/t-dll.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.cc,v 1.100 2002/11/05 02:12:35 steve Exp $" +#ident "$Id: t-dll.cc,v 1.101 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" @@ -435,6 +435,8 @@ void dll_target::add_root(ivl_design_s &des_, const NetScope *s) root_->mem_ = 0; root_->type_ = IVL_SCT_MODULE; root_->tname_ = root_->name_; + root_->time_units = s->time_unit(); + des_.nroots_++; if (des_.roots_) des_.roots_ = (ivl_scope_t *)realloc(des_.roots_, des_.nroots_ * sizeof(ivl_scope_t)); @@ -1776,6 +1778,7 @@ void dll_target::scope(const NetScope*net) scope->lpm_ = 0; scope->nmem_ = 0; scope->mem_ = 0; + scope->time_units = net->time_unit(); switch (net->type()) { case NetScope::MODULE: @@ -1981,6 +1984,13 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.101 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.100 2002/11/05 02:12:35 steve * Fix the call to FormatMessage under Windows. * diff --git a/t-dll.h b/t-dll.h index ba8d3dce3..54c4a1431 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll.h,v 1.95 2002/10/23 01:47:17 steve Exp $" +#ident "$Id: t-dll.h,v 1.96 2002/12/21 00:55:58 steve Exp $" #endif # include "target.h" @@ -500,6 +500,8 @@ struct ivl_scope_s { unsigned ports; ivl_signal_t*port; + + signed int time_units :8; }; /* @@ -622,6 +624,13 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.96 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.95 2002/10/23 01:47:17 steve * Fix synth2 handling of aset/aclr signals where * flip-flops are split by begin-end blocks. diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 1d5abf212..d53283f18 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: stub.c,v 1.70 2002/10/23 01:45:24 steve Exp $" +#ident "$Id: stub.c,v 1.71 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" @@ -666,26 +666,28 @@ static int show_scope(ivl_scope_t net, void*x) switch (ivl_scope_type(net)) { case IVL_SCT_MODULE: - fprintf(out, " module %s\n", ivl_scope_tname(net)); + fprintf(out, " module %s", ivl_scope_tname(net)); break; case IVL_SCT_FUNCTION: - fprintf(out, " function %s\n", ivl_scope_tname(net)); + fprintf(out, " function %s", ivl_scope_tname(net)); break; case IVL_SCT_BEGIN: - fprintf(out, " begin : %s\n", ivl_scope_tname(net)); + fprintf(out, " begin : %s", ivl_scope_tname(net)); break; case IVL_SCT_FORK: - fprintf(out, " fork : %s\n", ivl_scope_tname(net)); + fprintf(out, " fork : %s", ivl_scope_tname(net)); break; case IVL_SCT_TASK: - fprintf(out, " task %s\n", ivl_scope_tname(net)); + fprintf(out, " task %s", ivl_scope_tname(net)); break; default: - fprintf(out, " type(%u) %s\n", ivl_scope_type(net), + fprintf(out, " type(%u) %s", ivl_scope_type(net), ivl_scope_tname(net)); break; } + fprintf(out, " time units = 10e%d\n", ivl_scope_time_units(net)); + for (idx = 0 ; idx < ivl_scope_events(net) ; idx += 1) show_event(ivl_scope_event(net, idx)); @@ -728,6 +730,13 @@ int target_design(ivl_design_t des) /* * $Log: stub.c,v $ + * Revision 1.71 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.70 2002/10/23 01:45:24 steve * Fix synth2 handling of aset/aclr signals where * flip-flops are split by begin-end blocks. diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index e85877872..ad6d94c8e 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.81 2002/11/21 18:08:09 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.82 2002/12/21 00:55:58 steve Exp $" #endif # include "vvp_priv.h" @@ -1547,12 +1547,16 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) vvp_mangle_id(ivl_scope_name(net)), type, vvp_mangle_name(ivl_scope_name(net))); + if (parent) { fprintf(vvp_out, ", S_%s;\n", vvp_mangle_id(ivl_scope_name(parent))); - } - else + } else { + fprintf(vvp_out, ";\n"); + } + + fprintf(vvp_out, " .timescale %d;\n", ivl_scope_time_units(net)); /* Scan the scope for logic devices. For each device, draw out a functor that connects pin 0 to the output, and the @@ -1607,6 +1611,13 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.82 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.81 2002/11/21 18:08:09 steve * Better handling of select width of shifters. * diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 0564d0519..d5dcfbec8 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.12 2002/11/17 22:28:42 steve Exp $" +#ident "$Id: sys_lxt.c,v 1.13 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" @@ -343,6 +343,7 @@ static int sys_dumpoff_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) lt_set_time(dump_file, now.low); @@ -368,6 +369,7 @@ static int sys_dumpon_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) lt_set_time(dump_file, now.low); @@ -388,6 +390,7 @@ static int sys_dumpall_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) lt_set_time(dump_file, now.low); @@ -817,6 +820,13 @@ void sys_lxt_register() /* * $Log: sys_lxt.c,v $ + * Revision 1.13 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.12 2002/11/17 22:28:42 steve * Close old file if $dumpfile is called again. * diff --git a/vpi/sys_time.c b/vpi/sys_time.c index 202662da6..c0b69b341 100644 --- a/vpi/sys_time.c +++ b/vpi/sys_time.c @@ -17,14 +17,25 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_time.c,v 1.4 2002/08/12 01:35:05 steve Exp $" +#ident "$Id: sys_time.c,v 1.5 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" # include "vpi_user.h" +# include # include +static vpiHandle module_of_function(vpiHandle obj) +{ + while (vpi_get(vpiType, obj) != vpiModule) { + obj = vpi_handle(vpiScope, obj); + assert(obj); + } + + return obj; +} + static int sys_time_sizetf(char*x) { return 64; @@ -40,16 +51,39 @@ static int sys_time_calltf(char*name) s_vpi_value val; s_vpi_time now; vpiHandle call_handle; + vpiHandle mod; + int units, prec; + long scale; call_handle = vpi_handle(vpiSysTfCall, 0); assert(call_handle); + mod = module_of_function(call_handle); + + now.type = vpiSimTime; vpi_get_time(0, &now); + /* All the variants but $simtime return the time in units of + the local scope. The $simtime function returns the + simulation time. */ + if (strcmp(name, "$simtime") == 0) + units = vpi_get(vpiTimePrecision, 0); + else + units = vpi_get(vpiTimeUnit, mod); + + prec = vpi_get(vpiTimePrecision, 0); + scale = 1; + while (units > prec) { + scale *= 10; + units -= 1; + } + val.format = vpiIntVal; val.value.integer = now.low; assert(now.high == 0); + val.value.integer /= scale; + vpi_put_value(call_handle, &val, 0, vpiNoDelay); return 0; @@ -64,6 +98,7 @@ void sys_time_register() tf_data.calltf = sys_time_calltf; tf_data.compiletf = 0; tf_data.sizetf = sys_time_sizetf; + tf_data.user_data = "$time"; vpi_register_systf(&tf_data); tf_data.type = vpiSysFunc; @@ -71,11 +106,27 @@ void sys_time_register() tf_data.calltf = sys_time_calltf; tf_data.compiletf = 0; tf_data.sizetf = sys_stime_sizetf; + tf_data.user_data = "$stime"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysFunc; + tf_data.tfname = "$simtime"; + tf_data.calltf = sys_time_calltf; + tf_data.compiletf = 0; + tf_data.sizetf = sys_time_sizetf; + tf_data.user_data = "$simtime"; vpi_register_systf(&tf_data); } /* * $Log: sys_time.c,v $ + * Revision 1.5 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.4 2002/08/12 01:35:05 steve * conditional ident string using autoconfig. * diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 98a437039..179d93713 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.39 2002/11/17 22:28:42 steve Exp $" +#ident "$Id: sys_vcd.c,v 1.40 2002/12/21 00:55:58 steve Exp $" #endif # include "config.h" @@ -315,6 +315,7 @@ static int sys_dumpoff_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) fprintf(dump_file, "#%u\n", now.low); @@ -342,6 +343,7 @@ static int sys_dumpon_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) fprintf(dump_file, "#%u\n", now.low); @@ -364,6 +366,7 @@ static int sys_dumpall_calltf(char*name) if (dump_header_pending()) return 0; + now.type = vpiSimTime; vpi_get_time(0, &now); if (now.low > vcd_cur_time) fprintf(dump_file, "#%u\n", now.low); @@ -849,6 +852,13 @@ void sys_vcd_register() /* * $Log: sys_vcd.c,v $ + * Revision 1.40 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.39 2002/11/17 22:28:42 steve * Close old file if $dumpfile is called again. * diff --git a/vvp/compile.cc b/vvp/compile.cc index 14f51231e..21c1a62e4 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.cc,v 1.146 2002/11/21 22:43:13 steve Exp $" +#ident "$Id: compile.cc,v 1.147 2002/12/21 00:55:58 steve Exp $" #endif # include "arith.h" @@ -418,6 +418,18 @@ bool vpi_handle_resolv_list_s::resolve(bool mes) void compile_vpi_lookup(vpiHandle *handle, char*label) { + if (strcmp(label, "$time") == 0) { + *handle = vpip_sim_time(vpip_peek_current_scope()); + free(label); + return; + } + + if (strcmp(label, "$stime") == 0) { + *handle = vpip_sim_time(vpip_peek_current_scope()); + free(label); + return; + } + struct vpi_handle_resolv_list_s*res = new struct vpi_handle_resolv_list_s; @@ -576,8 +588,6 @@ void compile_vpi_symbol(const char*label, vpiHandle obj) void compile_init(void) { sym_vpi = new_symbol_table(); - compile_vpi_symbol("$time", vpip_sim_time()); - compile_vpi_symbol("$stime", vpip_sim_time()); sym_functors = new_symbol_table(); functor_init(); @@ -1483,6 +1493,13 @@ void compile_net(char*label, char*name, int msb, int lsb, bool signed_flag, /* * $Log: compile.cc,v $ + * Revision 1.147 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.146 2002/11/21 22:43:13 steve * %set/x0 instruction to support bounds checking. * diff --git a/vvp/compile.h b/vvp/compile.h index a9aaf7368..4d45dc2b6 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.h,v 1.45 2002/08/12 01:35:07 steve Exp $" +#ident "$Id: compile.h,v 1.46 2002/12/21 00:55:58 steve Exp $" #endif # include @@ -116,6 +116,7 @@ extern void compile_shiftl(char*label, long width, extern void compile_shiftr(char*label, long width, unsigned argc, struct symb_s*argv); +extern void compile_timescale(long units); extern void compile_vpi_symbol(const char*label, vpiHandle obj); extern void compile_vpi_lookup(vpiHandle *objref, char*label); @@ -251,6 +252,13 @@ extern void compile_net(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.46 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.45 2002/08/12 01:35:07 steve * conditional ident string using autoconfig. * diff --git a/vvp/lexor.lex b/vvp/lexor.lex index 862fc4ab5..292e7f9f7 100644 --- a/vvp/lexor.lex +++ b/vvp/lexor.lex @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: lexor.lex,v 1.34 2002/06/21 04:58:55 steve Exp $" +#ident "$Id: lexor.lex,v 1.35 2002/12/21 00:55:58 steve Exp $" #endif # include "parse_misc.h" @@ -100,6 +100,7 @@ ".shift/l" { return K_SHIFTL; } ".shift/r" { return K_SHIFTR; } ".thread" { return K_THREAD; } +".timescale" { return K_TIMESCALE; } ".ufunc" { return K_UFUNC; } ".var" { return K_VAR; } ".var/s" { return K_VAR_S; } @@ -173,6 +174,13 @@ int yywrap() /* * $Log: lexor.lex,v $ + * 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. * diff --git a/vvp/parse.y b/vvp/parse.y index 6f830f1c1..cb1b6d57c 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: parse.y,v 1.47 2002/06/21 04:58:55 steve Exp $" +#ident "$Id: parse.y,v 1.48 2002/12/21 00:55:58 steve Exp $" #endif # include "parse_misc.h" @@ -60,7 +60,7 @@ extern FILE*yyin; %token K_ARITH_DIV K_ARITH_MOD K_ARITH_MULT K_ARITH_SUB K_ARITH_SUM %token K_CMP_GE K_CMP_GT %token K_EVENT K_EVENT_OR K_FUNCTOR K_NET K_NET_S -%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_UFUNC +%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_TIMESCALE K_UFUNC %token K_UDP K_UDP_C K_UDP_S %token K_MEM K_MEM_P K_MEM_I %token K_FORCE @@ -295,6 +295,12 @@ statement | K_SCOPE T_SYMBOL ';' { compile_scope_recall($2); } + + | K_TIMESCALE T_NUMBER ';' + { compile_timescale($2); } + | K_TIMESCALE '-' T_NUMBER ';' + { compile_timescale(-$3); } + /* Thread statements declare a thread with its starting address. The starting address must already be defined. */ @@ -553,6 +559,13 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * 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. * diff --git a/vvp/vpi.txt b/vvp/vpi.txt index d754bfa30..ba8cb3b8b 100644 --- a/vvp/vpi.txt +++ b/vvp/vpi.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001 Stephen Williams (steve@icarus.com) * - * $Id: vpi.txt,v 1.5 2001/03/20 06:16:24 steve Exp $ + * $Id: vpi.txt,v 1.6 2002/12/21 00:55:58 steve Exp $ */ @@ -103,6 +103,7 @@ placed. A scope is created with a .scope directive, like so: