Add the mode-42 functor concept to UDPs.
This commit is contained in:
parent
73c4893ef7
commit
986885bd70
|
|
@ -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.42 2001/04/26 05:12:02 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.43 2001/04/26 15:52:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -341,7 +341,7 @@ void compile_udp_functor(char*label, char*type,
|
|||
iobj->ival = 0xaa;
|
||||
iobj->old_ival = obj->ival;
|
||||
iobj->oval = u->init;
|
||||
iobj->mode = 3;
|
||||
iobj->mode = M42;
|
||||
if (idx)
|
||||
{
|
||||
iobj->out = fdx;
|
||||
|
|
@ -957,6 +957,9 @@ void compile_dump(FILE*fd)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.43 2001/04/26 15:52:22 steve
|
||||
* Add the mode-42 functor concept to UDPs.
|
||||
*
|
||||
* Revision 1.42 2001/04/26 05:12:02 steve
|
||||
* Implement simple MUXZ for ?: operators.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.13 2001/04/24 02:23:59 steve Exp $"
|
||||
#ident "$Id: functor.cc,v 1.14 2001/04/26 15:52:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "functor.h"
|
||||
|
|
@ -214,27 +214,6 @@ static void functor_set_mode2(functor_t fp)
|
|||
schedule_assign(fp->out, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* A mode-3 functor is a UDP.
|
||||
*/
|
||||
static void functor_set_mode3(vvp_ipoint_t ptr, functor_t fp)
|
||||
{
|
||||
/* If we are down the tree, just propagate */
|
||||
if (!fp->udp)
|
||||
{
|
||||
functor_propagate(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char out = udp_propagate(ptr);
|
||||
|
||||
if (out != fp->oval)
|
||||
{
|
||||
fp->oval = out;
|
||||
functor_propagate(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the addressed bit of the functor, and recalculate the
|
||||
* output. If the output changes any, then generate the necessary
|
||||
|
|
@ -262,8 +241,12 @@ void functor_set(vvp_ipoint_t ptr, unsigned bit, bool push)
|
|||
case 2:
|
||||
functor_set_mode2(fp);
|
||||
break;
|
||||
case 3:
|
||||
functor_set_mode3(ptr, fp);
|
||||
case M42:
|
||||
if (!fp->obj) {
|
||||
ptr = fp->out;
|
||||
fp = functor_index(ptr);
|
||||
}
|
||||
fp->obj->set(ptr, fp, push);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -272,6 +255,8 @@ unsigned functor_get(vvp_ipoint_t ptr)
|
|||
{
|
||||
functor_t fp = functor_index(ptr);
|
||||
assert(fp);
|
||||
if (fp->mode == M42 && fp->obj && fp->obj->get)
|
||||
return fp->obj->get(ptr, fp);
|
||||
return fp->oval & 3;
|
||||
}
|
||||
|
||||
|
|
@ -331,6 +316,9 @@ const unsigned char ft_var[16] = {
|
|||
|
||||
/*
|
||||
* $Log: functor.cc,v $
|
||||
* Revision 1.14 2001/04/26 15:52:22 steve
|
||||
* Add the mode-42 functor concept to UDPs.
|
||||
*
|
||||
* Revision 1.13 2001/04/24 02:23:59 steve
|
||||
* Support for UDP devices in VVP (Stephen Boettcher)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.15 2001/04/26 05:12:02 steve Exp $"
|
||||
#ident "$Id: functor.h,v 1.16 2001/04/26 15:52:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "pointers.h"
|
||||
|
|
@ -83,6 +83,7 @@ struct functor_s {
|
|||
vvp_truth_t table;
|
||||
vvp_event_t event;
|
||||
struct vvp_udp_s *udp; // mode 3
|
||||
struct vvp_fobj_s *obj;
|
||||
};
|
||||
|
||||
/* This is the output for the device. */
|
||||
|
|
@ -102,6 +103,21 @@ struct functor_s {
|
|||
|
||||
typedef struct functor_s *functor_t;
|
||||
|
||||
/*
|
||||
* This a an `obj' structute for mode-42 functors.
|
||||
* Each instance stores the get and set funtion pointers, for speed.
|
||||
* Future, less important pointers may be pushed one level out to a
|
||||
* `per type' kind of table.
|
||||
*/
|
||||
|
||||
#define M42 42
|
||||
|
||||
typedef struct vvp_fobj_s vvp_fobj_t;
|
||||
struct vvp_fobj_s {
|
||||
unsigned (*get)(vvp_ipoint_t i, functor_t f);
|
||||
void (*set)(vvp_ipoint_t i, functor_t f, bool push);
|
||||
};
|
||||
|
||||
/*
|
||||
* If functor mode is 1, the event member is valid and the vvp_event_s
|
||||
* points to the extended event information.
|
||||
|
|
@ -185,6 +201,9 @@ extern const unsigned char ft_var[];
|
|||
|
||||
/*
|
||||
* $Log: functor.h,v $
|
||||
* Revision 1.16 2001/04/26 15:52:22 steve
|
||||
* Add the mode-42 functor concept to UDPs.
|
||||
*
|
||||
* Revision 1.15 2001/04/26 05:12:02 steve
|
||||
* Implement simple MUXZ for ?: operators.
|
||||
*
|
||||
|
|
|
|||
20
vvp/udp.cc
20
vvp/udp.cc
|
|
@ -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.2 2001/04/26 03:10:55 steve Exp $"
|
||||
#ident "$Id: udp.cc,v 1.3 2001/04/26 15:52:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include "udp.h"
|
||||
|
|
@ -28,6 +28,18 @@
|
|||
|
||||
static symbol_table_t udp_table;
|
||||
|
||||
|
||||
static void udp_functor_set(vvp_ipoint_t ptr, functor_t fp, bool)
|
||||
{
|
||||
unsigned char out = udp_propagate(ptr);
|
||||
|
||||
if (out != fp->oval)
|
||||
{
|
||||
fp->oval = out;
|
||||
functor_propagate(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
struct vvp_udp_s *udp_create(char *label)
|
||||
{
|
||||
if (!udp_table)
|
||||
|
|
@ -47,6 +59,9 @@ struct vvp_udp_s *udp_create(char *label)
|
|||
u->init = 3;
|
||||
u->table = 0x0;
|
||||
|
||||
u->get = 0x0;
|
||||
u->set = udp_functor_set;
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
|
|
@ -194,6 +209,9 @@ unsigned char udp_propagate(vvp_ipoint_t uix)
|
|||
|
||||
/*
|
||||
* $Log: udp.cc,v $
|
||||
* Revision 1.3 2001/04/26 15:52:22 steve
|
||||
* Add the mode-42 functor concept to UDPs.
|
||||
*
|
||||
* Revision 1.2 2001/04/26 03:10:55 steve
|
||||
* Redo and simplify UDP behavior.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: udp.h,v 1.3 2001/04/26 03:10:55 steve Exp $"
|
||||
#ident "$Id: udp.h,v 1.4 2001/04/26 15:52:22 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include "pointers.h"
|
||||
#include "functor.h"
|
||||
#include "udp.h"
|
||||
|
||||
struct vvp_udp_s
|
||||
struct vvp_udp_s : public vvp_fobj_s
|
||||
{
|
||||
char *name;
|
||||
unsigned short sequ;
|
||||
|
|
@ -42,6 +42,9 @@ unsigned char udp_propagate(vvp_ipoint_t);
|
|||
|
||||
/*
|
||||
* $Log: udp.h,v $
|
||||
* Revision 1.4 2001/04/26 15:52:22 steve
|
||||
* Add the mode-42 functor concept to UDPs.
|
||||
*
|
||||
* Revision 1.3 2001/04/26 03:10:55 steve
|
||||
* Redo and simplify UDP behavior.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue