Merge branch 'master' of git://icarus.com/~steve-icarus/verilog into vhdl

This commit is contained in:
Nick Gasson 2008-08-02 10:37:22 +01:00
commit 1cd13ecdbd
7 changed files with 58 additions and 21 deletions

View File

@ -191,6 +191,8 @@ ivl_path_source
ivl_process_attr_cnt ivl_process_attr_cnt
ivl_process_attr_val ivl_process_attr_val
ivl_process_file
ivl_process_lineno
ivl_process_scope ivl_process_scope
ivl_process_stmt ivl_process_stmt
ivl_process_type ivl_process_type

View File

@ -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 unsigned ivl_process_attr_cnt(ivl_process_t net);
extern ivl_attribute_t ivl_process_attr_val(ivl_process_t net, unsigned idx); 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 * These functions manage statements of various type. This includes
* all the different kinds of statements (as enumerated in * all the different kinds of statements (as enumerated in

View File

@ -1438,6 +1438,18 @@ extern int ivl_path_source_negedge(ivl_delaypath_t net)
return net->negedge ? 1 : 0; 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) extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net)
{ {
return net->type_; return net->type_;

View File

@ -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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT
#ident "$Id: $"
#endif
# include "config.h" # include "config.h"
@ -50,6 +47,7 @@ bool dll_target::process(const NetProcTop*net)
default: default:
assert(0); assert(0);
} }
FILE_NAME(obj, net);
/* Save the scope of the process. */ /* Save the scope of the process. */
obj->scope_ = lookup_scope_(net->scope()); obj->scope_ = lookup_scope_(net->scope());
@ -745,4 +743,3 @@ void dll_target::proc_while(const NetWhile*net)
net->emit_proc_recurse(this); net->emit_proc_recurse(this);
stmt_cur_ = save_cur_; stmt_cur_ = save_cur_;
} }

10
t-dll.h
View File

@ -539,7 +539,7 @@ struct ivl_parameter_s {
unsigned lineno; 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 * single statement that is it. A process also has a scope, although
* that generally only matters for VPI calls. * that generally only matters for VPI calls.
*/ */
@ -547,6 +547,8 @@ struct ivl_process_s {
ivl_process_type_t type_; ivl_process_type_t type_;
ivl_scope_t scope_; ivl_scope_t scope_;
ivl_statement_t stmt_; ivl_statement_t stmt_;
perm_string file;
unsigned lineno;
struct ivl_attribute_s*attr; struct ivl_attribute_s*attr;
unsigned nattr; unsigned nattr;
@ -763,4 +765,10 @@ static inline void FILE_NAME(ivl_switch_t net, const LineInfo*info)
net->lineno = info->get_lineno(); 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 #endif

View File

@ -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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * 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, bool is_int_func)
static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
{ {
/* Keep a persistent structure for passing time values back to /* Keep a persistent structure for passing time values back to
the caller. */ the caller. */
@ -210,11 +209,13 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
break; break;
case vpiRealVal: case vpiRealVal:
/* Oops, in this case I want a double power of 10 to do /* If this is an integer based call (anything but $realtime)
the scaling, instead of the integer scaling done * just return the value as a double. */
everywhere else. */ if (is_int_func) vp->value.real = double (simtime);
vp->value.real = vpip_time_to_scaled_real(schedule_simtime(), /* This is a call to $realtime to return a real value so
rfp->scope); * scale this using the scaled real rules. */
else vp->value.real = vpip_time_to_scaled_real(schedule_simtime(),
rfp->scope);
break; break;
case vpiBinStrVal: 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 = { static const struct __vpirt vpip_system_time_rt = {
vpiSysFuncCall, vpiSysFuncCall,
timevar_time_get, timevar_time_get,
timevar_time_get_str, timevar_time_get_str,
timevar_get_value, timevar_get_ivalue,
0, 0,
timevar_handle, timevar_handle,
0 0
@ -265,7 +276,7 @@ static const struct __vpirt vpip_system_simtime_rt = {
vpiSysFuncCall, vpiSysFuncCall,
timevar_time_get, timevar_time_get,
timevar_simtime_get_str, timevar_simtime_get_str,
timevar_get_value, timevar_get_ivalue,
0, 0,
timevar_handle, timevar_handle,
0 0
@ -275,7 +286,7 @@ static const struct __vpirt vpip_system_realtime_rt = {
vpiSysFuncCall, vpiSysFuncCall,
timevar_realtime_get, timevar_realtime_get,
timevar_realtime_get_str, timevar_realtime_get_str,
timevar_get_value, timevar_get_rvalue,
0, 0,
timevar_handle, timevar_handle,
0 0
@ -315,4 +326,3 @@ void vpip_set_time_precision(int pre)
{ {
vpi_time_precision = pre; vpi_time_precision = pre;
} }

View File

@ -56,6 +56,11 @@ void* vvp_net_t::operator new (size_t size)
return return_this; return return_this;
} }
void vvp_net_t::operator delete(void*)
{
assert(0);
}
void* vvp_net_fun_t::operator new(size_t size) void* vvp_net_fun_t::operator new(size_t size)
{ {
// Link in an initial chunk of space for net_fun_t // 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. */ /* Skip any leading bits. */
for (int idx = (signed) nwords; idx > (signed) my_words; idx -=1) { 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 = fraction - (double) bits;
fraction = ldexp(fraction, BITS_PER_WORD); fraction = ldexp(fraction, BITS_PER_WORD);
} }
/* Convert the remaining bits as appropriate. */ /* Convert the remaining bits as appropriate. */
if (my_words == 0) { if (my_words == 0) {
unsigned bits = (unsigned) fraction; unsigned long bits = (unsigned long) fraction;
abits_val_ = bits; abits_val_ = bits;
fraction = fraction - (double) bits; fraction = fraction - (double) bits;
/* Round any fractional part up. */ /* Round any fractional part up. */
@ -426,7 +431,7 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val)
} else { } else {
if (nwords < my_words) my_words = nwords; if (nwords < my_words) my_words = nwords;
for (int idx = (signed)my_words; idx >= 0; idx -= 1) { for (int idx = (signed)my_words; idx >= 0; idx -= 1) {
unsigned bits = (unsigned) fraction; unsigned long bits = (unsigned long) fraction;
abits_ptr_[idx] = bits; abits_ptr_[idx] = bits;
fraction = fraction - (double) bits; fraction = fraction - (double) bits;
fraction = ldexp(fraction, BITS_PER_WORD); fraction = ldexp(fraction, BITS_PER_WORD);