Use functor pointers where vvp_ipoint_t is unneeded.

This commit is contained in:
steve 2001-11-07 03:34:41 +00:00
parent 9572ddd7e8
commit fa23dafdae
14 changed files with 92 additions and 50 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: arith.cc,v 1.19 2001/11/04 05:03:21 steve Exp $"
#ident "$Id: arith.cc,v 1.20 2001/11/07 03:34:41 steve Exp $"
#endif
# include "arith.h"
@ -36,7 +36,7 @@ void vvp_arith_::output_x_(vvp_ipoint_t base, bool push, unsigned val)
vvp_ipoint_t ptr = ipoint_index(base,idx);
functor_t obj = functor_index(ptr);
obj->put_oval(ptr, push, val);
obj->put_oval(push, val);
}
}
@ -49,7 +49,7 @@ void vvp_arith_::output_val_(vvp_ipoint_t base, bool push, unsigned long sum)
unsigned val = sum & 1;
sum >>= 1;
obj->put_oval(ptr, push, val);
obj->put_oval(push, val);
}
}
@ -79,7 +79,7 @@ void vvp_wide_arith_::output_val_(vvp_ipoint_t base, bool push)
page += 1;
}
obj->put_oval(ptr, push, val);
obj->put_oval(push, val);
}
}
@ -213,7 +213,7 @@ void vvp_arith_mult::wide(vvp_ipoint_t base, bool push)
unsigned val = sum[idx];
obj->put_oval(ptr, push, val);
obj->put_oval(push, val);
}
delete[]sum;
@ -369,7 +369,7 @@ void vvp_cmp_ge::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
}
}
put_oval(base, push, out_val);
put_oval(push, out_val);
}
void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
@ -403,7 +403,7 @@ void vvp_cmp_gt::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
}
}
put_oval(base, push, out_val);
put_oval(push, out_val);
}
@ -442,7 +442,7 @@ void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
for (unsigned idx = 0 ; idx < amount ; idx += 1) {
optr = ipoint_index(base, idx);
ofp = functor_index(optr);
ofp->put_oval(optr, push, 0);
ofp->put_oval(push, 0);
}
for (unsigned idx = amount ; idx < wid_ ; idx += 1) {
@ -451,7 +451,7 @@ void vvp_shiftl::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
iptr = ipoint_index(base, idx - amount);
ifp = functor_index(iptr);
ofp->put_oval(optr, push, ifp->ival & 3);
ofp->put_oval(push, ifp->ival & 3);
}
}
}
@ -494,13 +494,13 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
iptr = ipoint_index(base, idx + amount);
ifp = functor_index(iptr);
ofp->put_oval(optr, push, ifp->ival & 3);
ofp->put_oval(push, ifp->ival & 3);
}
for (unsigned idx = wid_-amount; idx < wid_ ; idx += 1) {
optr = ipoint_index(base, idx);
ofp = functor_index(optr);
ofp->put_oval(optr, push, 0);
ofp->put_oval(push, 0);
}
}
}
@ -508,6 +508,9 @@ void vvp_shiftr::set(vvp_ipoint_t i, bool push, unsigned val, unsigned)
/*
* $Log: arith.cc,v $
* Revision 1.20 2001/11/07 03:34:41 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.19 2001/11/04 05:03:21 steve
* MacOSX 10.1 updates.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: bufif.cc,v 1.2 2001/10/31 04:27:46 steve Exp $"
#ident "$Id: bufif.cc,v 1.3 2001/11/07 03:34:42 steve Exp $"
#endif
# include "bufif.h"
@ -80,11 +80,14 @@ void vvp_bufif1_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
break;
}
put_ostr(ptr, push, val, str);
put_ostr(push, val, str);
}
/*
* $Log: bufif.cc,v $
* Revision 1.3 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.2 2001/10/31 04:27:46 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.h,v 1.36 2001/11/01 03:00:19 steve Exp $"
#ident "$Id: codes.h,v 1.37 2001/11/07 03:34:42 steve Exp $"
#endif
@ -106,6 +106,7 @@ struct vvp_code_s {
vvp_memory_t mem;
struct __vpiHandle*handle;
struct __vpiScope*scope;
functor_t fun_ptr;
};
union {
@ -147,6 +148,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/*
* $Log: codes.h,v $
* Revision 1.37 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.36 2001/11/01 03:00:19 steve
* Add force/cassign/release/deassign support. (Stephan Boettcher)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.113 2001/11/06 03:07:21 steve Exp $"
#ident "$Id: compile.cc,v 1.114 2001/11/07 03:34:42 steve Exp $"
#endif
# include "arith.h"
@ -579,7 +579,7 @@ static vvp_ipoint_t make_const_functor(unsigned val,
functor_t obj = new const_functor_s(str0, str1);
functor_define(fdx, obj);
obj->put_oval(fdx, false, val);
obj->put_oval(false, val);
return fdx;
}
@ -955,7 +955,7 @@ void compile_udp_functor(char*label, char*type,
free(argv);
if (u->sequ)
udp->put_oval(fdx, false, u->init);
udp->put_oval(false, u->init);
}
@ -1341,6 +1341,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.114 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.113 2001/11/06 03:07:21 steve
* Code rearrange. (Stephan Boettcher)
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: force.cc,v 1.2 2001/11/01 04:42:40 steve Exp $"
#ident "$Id: force.cc,v 1.3 2001/11/07 03:34:42 steve Exp $"
#endif
# include "codes.h"
@ -158,7 +158,7 @@ void var_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned val, unsigned)
unsigned pp = ipoint_port(ptr);
if (assigned() && pp==1 || !assigned() && pp==0) {
put_oval(ptr, push, val);
put_oval(push, val);
}
}
@ -249,6 +249,9 @@ bool of_DEASSIGN(vthread_t thr, vvp_code_t cp)
/*
* $Log: force.cc,v $
* Revision 1.3 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.2 2001/11/01 04:42:40 steve
* Handle procedural constant functor pointers.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: functor.h,v 1.37 2001/11/06 03:07:22 steve Exp $"
#ident "$Id: functor.h,v 1.38 2001/11/07 03:34:42 steve Exp $"
#endif
# include "pointers.h"
@ -29,7 +29,7 @@
* to have its output propagated, and the delay is the delay to
* schedule the propagation.
*/
extern void schedule_functor(vvp_ipoint_t fun, unsigned delay);
extern void schedule_functor(functor_t fun, unsigned delay);
/*
* The vvp_ipoint_t is an integral type that is 32bits. The low 2 bits
@ -85,8 +85,6 @@ extern void schedule_functor(vvp_ipoint_t fun, unsigned delay);
* value.
*/
typedef struct functor_s *functor_t;
/*
* signal strengths
*/
@ -182,8 +180,8 @@ struct functor_s {
inline unsigned char get() { return oval; }
inline unsigned char get_ostr() { return ostr; }
void put(vvp_ipoint_t ipt, unsigned val);
void put_oval(vvp_ipoint_t ptr, bool push, unsigned val);
void put_ostr(vvp_ipoint_t ptr, bool push, unsigned val, unsigned str);
void put_oval(bool push, unsigned val);
void put_ostr(bool push, unsigned val, unsigned str);
bool disable(vvp_ipoint_t ptr);
bool enable(vvp_ipoint_t ptr);
void propagate(bool push);
@ -217,7 +215,7 @@ inline void functor_s::propagate(bool push)
}
}
inline void functor_s::put_oval(vvp_ipoint_t ptr, bool push, unsigned val)
inline void functor_s::put_oval(bool push, unsigned val)
{
switch (val) {
case 0:
@ -240,12 +238,11 @@ inline void functor_s::put_oval(vvp_ipoint_t ptr, bool push, unsigned val)
if (push)
propagate(true);
else
schedule_functor(ptr, 0);
schedule_functor(this, 0);
}
}
inline void functor_s::put_ostr(vvp_ipoint_t ptr, bool push,
unsigned val, unsigned str)
inline void functor_s::put_ostr(bool push, unsigned val, unsigned str)
{
if (val != oval || str != ostr) {
ostr = str;
@ -255,7 +252,7 @@ inline void functor_s::put_ostr(vvp_ipoint_t ptr, bool push,
if (push)
propagate(true);
else
schedule_functor(ptr, 0);
schedule_functor(this, 0);
}
}
@ -306,9 +303,8 @@ unsigned functor_get(vvp_ipoint_t ptr)
* the way.
*/
inline static
void functor_propagate(vvp_ipoint_t ptr, bool push=true)
void functor_propagate(functor_t fp, bool push=true)
{
functor_t fp = functor_index(ptr);
fp->propagate(push);
}
@ -373,6 +369,9 @@ extern vvp_fvector_t vvp_fvector_continuous_new(unsigned size, vvp_ipoint_t p);
/*
* $Log: functor.h,v $
* Revision 1.38 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.37 2001/11/06 03:07:22 steve
* Code rearrange. (Stephan Boettcher)
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: logic.cc,v 1.1 2001/11/06 03:07:22 steve Exp $"
#ident "$Id: logic.cc,v 1.2 2001/11/07 03:34:42 steve Exp $"
#endif
# include "logic.h"
@ -52,7 +52,7 @@ void table_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned)
val >>= 2 * (ival&0x03);
val &= 0x03;
put_oval(ptr, push, val);
put_oval(push, val);
}
/*
@ -136,6 +136,9 @@ void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
/*
* $Log: logic.cc,v $
* Revision 1.2 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.1 2001/11/06 03:07:22 steve
* Code rearrange. (Stephan Boettcher)
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: memory.cc,v 1.12 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: memory.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#endif
#include "memory.h"
@ -317,7 +317,7 @@ void update_data(vvp_memory_port_t data)
vvp_ipoint_t dx = ipoint_index(data->ix, i);
functor_t df = functor_index(dx);
unsigned char out = get_bit(data->cur_bits, i + data->bitoff);
df->put_oval(dx, false, out);
df->put_oval(false, out);
}
}
@ -338,7 +338,7 @@ void update_data_ports(vvp_memory_t mem, vvp_memory_bits_t bits, int bit,
{
vvp_ipoint_t ix = ipoint_index(a->ix, i);
functor_t df = functor_index(ix);
df->put_oval(ix, false, val);
df->put_oval(false, val);
}
}
a = a->next;

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: npmos.cc,v 1.5 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: npmos.cc,v 1.6 2001/11/07 03:34:42 steve Exp $"
#endif
# include "npmos.h"
@ -82,11 +82,14 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned s)
str = HiZ;
}
put_ostr(ptr, push, val, str);
put_ostr(push, val, str);
}
/*
* $Log: npmos.cc,v $
* Revision 1.6 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.5 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: pointers.h,v 1.6 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: pointers.h,v 1.7 2001/11/07 03:34:42 steve Exp $"
#endif
/*
@ -46,6 +46,11 @@ typedef unsigned long vvp_ipoint_t;
#error "I need an unsigned type that is 32 bits!"
#endif
/*
* This is a native-pointer version of the vvp_ipoint_t
*/
typedef struct functor_s *functor_t;
/*
* Given a functor generic address and a desired port, this function
* makes a complete vvp_ipoint_t that points to the port of the given
@ -101,6 +106,9 @@ typedef struct vvp_fvector_s *vvp_fvector_t;
/*
* $Log: pointers.h,v $
* Revision 1.7 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.6 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: resolv.cc,v 1.7 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: resolv.cc,v 1.8 2001/11/07 03:34:42 steve Exp $"
#endif
# include "resolv.h"
@ -164,11 +164,14 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
}
/* If the output changes, then create a propagation event. */
put_ostr(i, push, val, sval);
put_ostr(push, val, sval);
}
/*
* $Log: resolv.cc,v $
* Revision 1.8 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.7 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: schedule.cc,v 1.12 2001/09/15 18:27:05 steve Exp $"
#ident "$Id: schedule.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#endif
# include "schedule.h"
@ -51,6 +51,7 @@ struct event_s {
union {
vthread_t thr;
vvp_ipoint_t fun;
functor_t funp;
vvp_gen_event_t obj;
};
unsigned val :2;
@ -237,12 +238,12 @@ void schedule_vthread(vthread_t thr, unsigned delay)
schedule_event_(cur);
}
void schedule_functor(vvp_ipoint_t fun, unsigned delay)
void schedule_functor(functor_t funp, unsigned delay)
{
struct event_s*cur = e_alloc();
cur->delay = delay;
cur->fun = fun;
cur->funp = funp;
cur->type = TYPE_PROP;
schedule_event_(cur);
@ -319,7 +320,7 @@ void schedule_simulate(void)
case TYPE_PROP:
//printf("Propagate %p\n", cur->fun);
functor_propagate(cur->fun);
functor_propagate(cur->funp);
e_free(cur);
break;
@ -360,6 +361,9 @@ void schedule_simulate(void)
/*
* $Log: schedule.cc,v $
* Revision 1.13 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.12 2001/09/15 18:27:05 steve
* Make configure detect malloc.h
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: udp.cc,v 1.12 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: udp.cc,v 1.13 2001/11/07 03:34:42 steve Exp $"
#endif
#include "udp.h"
@ -36,7 +36,7 @@ void udp_functor_s::set(vvp_ipoint_t i, bool, unsigned val, unsigned)
// old_ival is set on the way out
put(i, val);
unsigned char out = udp->propagate(this, i);
put_oval(i, false, out);
put_oval(false, out);
}
@ -350,6 +350,9 @@ void vvp_udp_s::compile_row_(udp_table_entry_t row, char *rchr)
/*
* $Log: udp.cc,v $
* Revision 1.13 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.12 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vpi_signal.cc,v 1.28 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: vpi_signal.cc,v 1.29 2001/11/07 03:34:42 steve Exp $"
#endif
/*
@ -404,7 +404,7 @@ static void functor_poke(struct __vpiSignal*rfp, unsigned idx,
{
vvp_ipoint_t ptr = vvp_fvector_get(rfp->bits,idx);
functor_t fu = functor_index(ptr);
fu->put_ostr(ptr, true, val, str);
fu->put_ostr(true, val, str);
}
static vpiHandle signal_put_value(vpiHandle ref, s_vpi_value*vp,
@ -552,6 +552,9 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag,
/*
* $Log: vpi_signal.cc,v $
* Revision 1.29 2001/11/07 03:34:42 steve
* Use functor pointers where vvp_ipoint_t is unneeded.
*
* Revision 1.28 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.