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_val
ivl_process_file
ivl_process_lineno
ivl_process_scope
ivl_process_stmt
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 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

View File

@ -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_;

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
* 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_;
}

10
t-dll.h
View File

@ -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

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
* 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;
}

View File

@ -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);