M42 implementation of mode 2 (Stephan Boettcher)

This commit is contained in:
steve 2001-10-12 03:00:08 +00:00
parent ad6bbe539f
commit 6cf2ddf541
4 changed files with 51 additions and 51 deletions

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.104 2001/10/12 02:53:47 steve Exp $"
#ident "$Id: compile.cc,v 1.105 2001/10/12 03:00:08 steve Exp $"
#endif
# include "arith.h"
@ -1180,7 +1180,7 @@ void compile_event(char*label, char*type,
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
obj->event->threads = 0;
obj->event->ival = obj->ival;
obj->old_ival = obj->ival;
if (strcmp(type,"posedge") == 0)
obj->event->vvp_edge_tab = vvp_edge_posedge;
@ -1206,7 +1206,7 @@ void compile_named_event(char*label, char*name)
obj->oval = 2;
obj->odrive0 = 6;
obj->odrive1 = 6;
obj->mode = 2;
obj->mode = 1;
obj->out = 0;
#if defined(WITH_DEBUG)
obj->breakpoint = 0;
@ -1214,7 +1214,8 @@ void compile_named_event(char*label, char*name)
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
obj->event->threads = 0;
obj->event->ival = obj->ival;
obj->event->vvp_edge_tab = 0;
obj->old_ival = obj->ival;
free(label);
free(name);
@ -1231,7 +1232,7 @@ void compile_event_or(char*label, unsigned argc, struct symb_s*argv)
obj->oval = 2;
obj->odrive0 = 6;
obj->odrive1 = 6;
obj->mode = 2;
obj->mode = 1;
obj->out = 0;
#if defined(WITH_DEBUG)
obj->breakpoint = 0;
@ -1239,7 +1240,7 @@ void compile_event_or(char*label, unsigned argc, struct symb_s*argv)
obj->event = new struct vvp_event_s;
obj->event->threads = 0;
obj->event->ival = obj->ival;
obj->old_ival = obj->ival;
obj->event->vvp_edge_tab = 0;
/* Link the outputs of the named events to me. */
@ -1568,6 +1569,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.105 2001/10/12 03:00:08 steve
* M42 implementation of mode 2 (Stephan Boettcher)
*
* Revision 1.104 2001/10/12 02:53:47 steve
* functor lookup includes vpi signal search.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: functor.cc,v 1.26 2001/08/08 01:05:06 steve Exp $"
#ident "$Id: functor.cc,v 1.27 2001/10/12 03:00:09 steve Exp $"
#endif
# include "functor.h"
@ -218,7 +218,7 @@ const unsigned char vvp_edge_anyedge[16] = {
* have. The latter is to support wider event/or then a single functor
* can support.
*/
static void functor_set_mode1(functor_t fp)
static void functor_set_mode1(vvp_ipoint_t iptr, functor_t fp)
{
vvp_event_t ep = fp->event;
@ -227,44 +227,31 @@ static void functor_set_mode1(functor_t fp)
if (ep->threads || fp->out) {
for (unsigned idx = 0 ; idx < 4 ; idx += 1) {
unsigned oval = (ep->ival >> 2*idx) & 3;
unsigned nval = (fp->ival >> 2*idx) & 3;
unsigned char edge_p = 1;
if (ep->vvp_edge_tab) {
vvp_ipoint_t idx = ipoint_port(iptr);
unsigned oval = (fp->old_ival >> 2*idx) & 3;
unsigned nval = (fp->ival >> 2*idx) & 3;
unsigned val = (oval << 2) | nval;
unsigned char edge_p = ep->vvp_edge_tab[val];
edge_p = ep->vvp_edge_tab[val];
}
if (edge_p) {
vthread_t tmp = ep->threads;
ep->threads = 0;
vthread_schedule_list(tmp);
if (fp->out)
schedule_assign(fp->out, 0, 0);
}
if (edge_p) {
vthread_t tmp = ep->threads;
ep->threads = 0;
vthread_schedule_list(tmp);
if (fp->out)
schedule_assign(fp->out, 0, 0);
}
}
/* the new value is the new old value. */
ep->ival = fp->ival;
}
/*
* A mode-2 functor is a named event. In this case, any set at all is
* enough to trigger the blocked threads.
*/
static void functor_set_mode2(functor_t fp)
{
vvp_event_t ep = fp->event;
if (ep->threads) {
vthread_t tmp = ep->threads;
ep->threads = 0;
vthread_schedule_list(tmp);
}
if (fp->out)
schedule_assign(fp->out, 0, 0);
fp->old_ival = fp->ival;
}
/*
@ -281,15 +268,14 @@ void functor_set(vvp_ipoint_t ptr, unsigned bit, unsigned str, bool push)
/* Store the value and strengths in the input bits. */
functor_put_input(fp, pp, bit, str);
assert(fp->mode != 2);
switch (fp->mode) {
case 0:
functor_set_mode0(ptr, fp, push);
break;
case 1:
functor_set_mode1(fp);
break;
case 2:
functor_set_mode2(fp);
functor_set_mode1(ptr, fp);
break;
case M42:
if (!fp->obj) {
@ -370,6 +356,9 @@ const unsigned char ft_var[16] = {
/*
* $Log: functor.cc,v $
* Revision 1.27 2001/10/12 03:00:09 steve
* M42 implementation of mode 2 (Stephan Boettcher)
*
* Revision 1.26 2001/08/08 01:05:06 steve
* Initial implementation of vvp_fvectors.
* (Stephan Boettcher)

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.32 2001/10/09 16:57:47 steve Exp $"
#ident "$Id: functor.h,v 1.33 2001/10/12 03:00:09 steve Exp $"
#endif
# include "pointers.h"
@ -144,10 +144,12 @@ struct functor_s {
unsigned breakpoint : 1;
#endif
/* functor mode: 0 == table ; 1 == event ; 2 == named event */
/* functor mode: 0 == table ; 1 == event */
unsigned mode : 2;
/* General purpose flag for M42 functor's convenience */
unsigned flag42 : 1;
union {
unsigned char old_ival; // mode 3
unsigned char old_ival; // mode 1, UDP
};
};
@ -202,7 +204,6 @@ extern const unsigned char vvp_edge_anyedge[16];
struct vvp_event_s {
vthread_t threads;
unsigned char ival;
const unsigned char*vvp_edge_tab;
};
@ -319,6 +320,9 @@ extern const unsigned char ft_var[];
/*
* $Log: functor.h,v $
* Revision 1.33 2001/10/12 03:00:09 steve
* M42 implementation of mode 2 (Stephan Boettcher)
*
* Revision 1.32 2001/10/09 16:57:47 steve
* Collect functor reference handling into a single function. (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: vpi_callback.cc,v 1.6 2001/09/15 18:27:05 steve Exp $"
#ident "$Id: vpi_callback.cc,v 1.7 2001/10/12 03:00:09 steve Exp $"
#endif
/*
@ -107,11 +107,11 @@ struct vvp_cb_fobj_s *vvp_fvector_make_callback(vvp_fvector_t vec,
fu->mode = M42;
fu->obj = obj;
} else {
fu->mode = edge ? 1 : 2;
fu->mode = 1;
fu->event = (struct vvp_event_s*)
malloc(sizeof (struct vvp_event_s));
fu->event->threads = 0;
fu->event->ival = fu->ival;
fu->old_ival = fu->ival;
fu->event->vvp_edge_tab = edge;
fu->out = ipoint_input_index(ipoint_index(fdx, nfun-1), 3);
}
@ -260,6 +260,9 @@ void vpip_trip_monitor_callbacks(void)
/*
* $Log: vpi_callback.cc,v $
* Revision 1.7 2001/10/12 03:00:09 steve
* M42 implementation of mode 2 (Stephan Boettcher)
*
* Revision 1.6 2001/09/15 18:27:05 steve
* Make configure detect malloc.h
*