Rework vpi_get_delay of modpaths
Cleanup klunky implementation of vpi_get/put_delays for modpath objects. Remove some useless members. Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
parent
2fac019d9d
commit
859d8b3502
53
vvp/delay.cc
53
vvp/delay.cc
|
|
@ -425,17 +425,7 @@ void vvp_fun_modpath::run_run()
|
|||
vvp_fun_modpath_src::vvp_fun_modpath_src(vvp_time64_t del[12])
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < 12 ; idx += 1)
|
||||
{
|
||||
delay_[idx] = del[idx];
|
||||
/*
|
||||
Added By Yang.
|
||||
|
||||
Make the delay[12] value to be Public
|
||||
make the get_delays(), put_delays() to
|
||||
be possible
|
||||
*/
|
||||
delay [idx] = del[idx];
|
||||
}
|
||||
|
||||
next_ = 0;
|
||||
wake_time_ = 0;
|
||||
|
|
@ -446,6 +436,18 @@ vvp_fun_modpath_src::~vvp_fun_modpath_src()
|
|||
{
|
||||
}
|
||||
|
||||
void vvp_fun_modpath_src::get_delay12(vvp_time64_t val[12]) const
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < 12 ; idx += 1)
|
||||
val[idx] = delay_[idx];
|
||||
}
|
||||
|
||||
void vvp_fun_modpath_src::put_delay12(const vvp_time64_t val[12])
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < 12 ; idx += 1)
|
||||
delay_[idx] = val[idx];
|
||||
}
|
||||
|
||||
void vvp_fun_modpath_src::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit)
|
||||
{
|
||||
if (port.port() == 0) {
|
||||
|
|
@ -567,16 +569,21 @@ static int modpath_src_free_object( vpiHandle ref )
|
|||
*/
|
||||
static void modpath_src_put_delays ( vpiHandle ref, p_vpi_delay delays )
|
||||
{
|
||||
int i ;
|
||||
vvp_time64_t tmp[12];
|
||||
int idx;
|
||||
struct __vpiModPathSrc * src = vpip_modpath_src_from_handle( ref) ;
|
||||
assert(src) ;
|
||||
|
||||
vvp_fun_modpath_src *fun = dynamic_cast<vvp_fun_modpath_src*>(src->net->fun);
|
||||
assert( fun );
|
||||
assert(delays->no_of_delays == 12);
|
||||
assert(delays->time_type == vpiSimTime);
|
||||
|
||||
for ( i = 0 ; i < delays->no_of_delays ; i++) {
|
||||
fun->delay[i] = delays->da[ i ].real ;
|
||||
for (idx = 0 ; idx < delays->no_of_delays ; idx += 1) {
|
||||
tmp[idx] = vpip_timestruct_to_time(delays->da+idx);
|
||||
}
|
||||
|
||||
fun->put_delay12(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -589,14 +596,24 @@ static void modpath_src_put_delays ( vpiHandle ref, p_vpi_delay delays )
|
|||
|
||||
static void modpath_src_get_delays ( vpiHandle ref, p_vpi_delay delays )
|
||||
{
|
||||
int i ;
|
||||
struct __vpiModPathSrc * src = vpip_modpath_src_from_handle( ref) ;
|
||||
struct __vpiModPathSrc*src = vpip_modpath_src_from_handle( ref) ;
|
||||
assert(src);
|
||||
|
||||
vvp_fun_modpath_src *fun = dynamic_cast<vvp_fun_modpath_src*>(src->net->fun);
|
||||
assert( fun );
|
||||
for ( i = 0 ; i < delays->no_of_delays ; i++)
|
||||
delays->da[ i ].real = fun->delay[i];
|
||||
assert(fun);
|
||||
switch (delays->no_of_delays) {
|
||||
case 12:
|
||||
{ int idx;
|
||||
vvp_time64_t tmp[12];
|
||||
fun->get_delay12(tmp);
|
||||
for (idx = 0; idx < 12; idx += 1) {
|
||||
vpip_time_to_timestruct(delays->da+idx, tmp[idx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
51
vvp/delay.h
51
vvp/delay.h
|
|
@ -18,9 +18,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: delay.h,v 1.15 2007/03/02 06:13:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
@ -187,14 +184,8 @@ class vvp_fun_modpath_src : public vvp_net_fun_t {
|
|||
void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit);
|
||||
virtual bool test_vec4(const vvp_vector4_t&bit);
|
||||
|
||||
/*
|
||||
Added By Yang.
|
||||
|
||||
Make the Delay Value be Public too
|
||||
make the get_delays(), put_delays() be possible
|
||||
*/
|
||||
vvp_time64_t delay[12];
|
||||
|
||||
void get_delay12(vvp_time64_t out[12]) const;
|
||||
void put_delay12(const vvp_time64_t in[12]);
|
||||
|
||||
private:
|
||||
// FIXME: Needs to be a 12-value array
|
||||
|
|
@ -223,42 +214,4 @@ class vvp_fun_modpath_edge : public vvp_fun_modpath_src {
|
|||
bool negedge_;
|
||||
};
|
||||
|
||||
/*
|
||||
* $Log: delay.h,v $
|
||||
* Revision 1.15 2007/03/02 06:13:22 steve
|
||||
* Add support for edge sensitive spec paths.
|
||||
*
|
||||
* Revision 1.14 2007/03/01 06:19:39 steve
|
||||
* Add support for conditional specify delay paths.
|
||||
*
|
||||
* Revision 1.13 2007/01/26 05:15:41 steve
|
||||
* More literal implementation of inertial delay model.
|
||||
*
|
||||
* Revision 1.12 2006/09/29 03:57:01 steve
|
||||
* Modpath delay chooses correct delay for edge.
|
||||
*
|
||||
* Revision 1.11 2006/09/23 04:57:20 steve
|
||||
* Basic support for specify timing.
|
||||
*
|
||||
* Revision 1.10 2006/01/02 05:32:07 steve
|
||||
* Require explicit delay node from source.
|
||||
*
|
||||
* Revision 1.9 2005/07/06 04:29:25 steve
|
||||
* Implement real valued signals and arith nodes.
|
||||
*
|
||||
* Revision 1.8 2005/06/22 00:04:49 steve
|
||||
* Reduce vvp_vector4 copies by using const references.
|
||||
*
|
||||
* Revision 1.7 2005/06/02 16:02:11 steve
|
||||
* Add support for notif0/1 gates.
|
||||
* Make delay nodes support inertial delay.
|
||||
* Add the %force/link instruction.
|
||||
*
|
||||
* Revision 1.6 2005/05/14 19:43:23 steve
|
||||
* Move functor delays to vvp_delay_fun object.
|
||||
*
|
||||
* Revision 1.5 2005/04/03 05:45:51 steve
|
||||
* Rework the vvp_delay_t class.
|
||||
*
|
||||
*/
|
||||
#endif // __delay_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __vpi_priv_H
|
||||
#define __vpi_priv_H
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2007 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,9 +18,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: vpi_priv.h,v 1.74 2007/04/12 04:25:59 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
# include "pointers.h"
|
||||
|
|
@ -231,19 +228,6 @@ struct __vpiModPathSrc {
|
|||
/* This is the input expression for this modpath. */
|
||||
struct __vpiModPathTerm path_term_in;
|
||||
|
||||
/* Just Temporary */
|
||||
vvp_time64_t use_delay [12] ;
|
||||
/*
|
||||
Conform the IEEE1364, we use the
|
||||
standard delay value structure
|
||||
(p_vpi_time) to represent delay values
|
||||
of each modpath_src delay
|
||||
|
||||
the "p_vpi_time" is defined in the
|
||||
"vpi_user.h"
|
||||
*/
|
||||
p_vpi_delay delays ;
|
||||
|
||||
/* This is the input net for the modpath. signals on this net
|
||||
are used to determine the modpath. They are *not* propagated
|
||||
anywhere. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue