diff --git a/ivl.def b/ivl.def index 6a74bf7cb..dfcf064cf 100644 --- a/ivl.def +++ b/ivl.def @@ -191,6 +191,8 @@ ivl_path_source ivl_process_attr_cnt ivl_process_attr_val +ivl_process_file +ivl_process_lineno ivl_process_scope ivl_process_stmt ivl_process_type diff --git a/ivl_target.h b/ivl_target.h index 13d4b68db..7535bd0d4 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -1695,6 +1695,9 @@ extern ivl_statement_t ivl_process_stmt(ivl_process_t net); extern unsigned ivl_process_attr_cnt(ivl_process_t net); extern ivl_attribute_t ivl_process_attr_val(ivl_process_t net, unsigned idx); +extern const char* ivl_process_file(ivl_process_t net); +extern unsigned ivl_process_lineno(ivl_process_t net); + /* * These functions manage statements of various type. This includes * all the different kinds of statements (as enumerated in diff --git a/t-dll-api.cc b/t-dll-api.cc index cf3c9b83c..e9db3bf5e 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1438,6 +1438,18 @@ extern int ivl_path_source_negedge(ivl_delaypath_t net) return net->negedge ? 1 : 0; } +extern "C" const char*ivl_process_file(ivl_process_t net) +{ + assert(net); + return net->file.str(); +} + +extern "C" unsigned ivl_process_lineno(ivl_process_t net) +{ + assert(net); + return net->lineno; +} + extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net) { return net->type_; diff --git a/t-dll-proc.cc b/t-dll-proc.cc index 5d843e9d4..e3c693748 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2008 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 @@ -17,9 +17,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: $" -#endif # include "config.h" @@ -50,6 +47,7 @@ bool dll_target::process(const NetProcTop*net) default: assert(0); } + FILE_NAME(obj, net); /* Save the scope of the process. */ obj->scope_ = lookup_scope_(net->scope()); @@ -745,4 +743,3 @@ void dll_target::proc_while(const NetWhile*net) net->emit_proc_recurse(this); stmt_cur_ = save_cur_; } - diff --git a/t-dll.h b/t-dll.h index 5bc4c3fb4..3bb1b9279 100644 --- a/t-dll.h +++ b/t-dll.h @@ -539,7 +539,7 @@ struct ivl_parameter_s { unsigned lineno; }; /* - * All we know about a process it its type (initial or always) and the + * All we know about a process is its type (initial or always) and the * single statement that is it. A process also has a scope, although * that generally only matters for VPI calls. */ @@ -547,6 +547,8 @@ struct ivl_process_s { ivl_process_type_t type_; ivl_scope_t scope_; ivl_statement_t stmt_; + perm_string file; + unsigned lineno; struct ivl_attribute_s*attr; unsigned nattr; @@ -763,4 +765,10 @@ static inline void FILE_NAME(ivl_switch_t net, const LineInfo*info) net->lineno = info->get_lineno(); } +static inline void FILE_NAME(ivl_process_t net, const LineInfo*info) +{ + net->file = info->get_file(); + net->lineno = info->get_lineno(); +} + #endif diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index 814c25008..4c3a16833 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2008 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 @@ -168,8 +168,7 @@ static vpiHandle timevar_handle(int code, vpiHandle ref) } } - -static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) +static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func) { /* Keep a persistent structure for passing time values back to the caller. */ @@ -210,11 +209,13 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) break; case vpiRealVal: - /* Oops, in this case I want a double power of 10 to do - the scaling, instead of the integer scaling done - everywhere else. */ - vp->value.real = vpip_time_to_scaled_real(schedule_simtime(), - rfp->scope); + /* If this is an integer based call (anything but $realtime) + * just return the value as a double. */ + if (is_int_func) vp->value.real = double (simtime); + /* This is a call to $realtime to return a real value so + * scale this using the scaled real rules. */ + else vp->value.real = vpip_time_to_scaled_real(schedule_simtime(), + rfp->scope); break; case vpiBinStrVal: @@ -251,11 +252,21 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) } } +static void timevar_get_ivalue(vpiHandle ref, s_vpi_value*vp) +{ + timevar_get_value(ref, vp, true); +} + +static void timevar_get_rvalue(vpiHandle ref, s_vpi_value*vp) +{ + timevar_get_value(ref, vp, false); +} + static const struct __vpirt vpip_system_time_rt = { vpiSysFuncCall, timevar_time_get, timevar_time_get_str, - timevar_get_value, + timevar_get_ivalue, 0, timevar_handle, 0 @@ -265,7 +276,7 @@ static const struct __vpirt vpip_system_simtime_rt = { vpiSysFuncCall, timevar_time_get, timevar_simtime_get_str, - timevar_get_value, + timevar_get_ivalue, 0, timevar_handle, 0 @@ -275,7 +286,7 @@ static const struct __vpirt vpip_system_realtime_rt = { vpiSysFuncCall, timevar_realtime_get, timevar_realtime_get_str, - timevar_get_value, + timevar_get_rvalue, 0, timevar_handle, 0 @@ -315,4 +326,3 @@ void vpip_set_time_precision(int pre) { vpi_time_precision = pre; } - diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index f77850c3e..a8c669e26 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -56,6 +56,11 @@ void* vvp_net_t::operator new (size_t size) return return_this; } +void vvp_net_t::operator delete(void*) +{ + assert(0); +} + void* vvp_net_fun_t::operator new(size_t size) { // Link in an initial chunk of space for net_fun_t @@ -411,14 +416,14 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val) /* Skip any leading bits. */ for (int idx = (signed) nwords; idx > (signed) my_words; idx -=1) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; fraction = fraction - (double) bits; fraction = ldexp(fraction, BITS_PER_WORD); } /* Convert the remaining bits as appropriate. */ if (my_words == 0) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; abits_val_ = bits; fraction = fraction - (double) bits; /* Round any fractional part up. */ @@ -426,7 +431,7 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val) } else { if (nwords < my_words) my_words = nwords; for (int idx = (signed)my_words; idx >= 0; idx -= 1) { - unsigned bits = (unsigned) fraction; + unsigned long bits = (unsigned long) fraction; abits_ptr_[idx] = bits; fraction = fraction - (double) bits; fraction = ldexp(fraction, BITS_PER_WORD);