Support tri0 and tri1 resolvers.

This commit is contained in:
steve 2001-12-15 01:54:38 +00:00
parent cd1524e6ca
commit 7d494fd3d5
3 changed files with 44 additions and 6 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.115 2001/12/06 03:31:24 steve Exp $"
#ident "$Id: compile.cc,v 1.116 2001/12/15 01:54:38 steve Exp $"
#endif
# include "arith.h"
@ -858,7 +858,13 @@ void compile_resolver(char*label, char*type, unsigned argc, struct symb_s*argv)
functor_t obj = 0;
if (strcmp(type,"tri") == 0) {
obj = new resolv_functor_s;
obj = new resolv_functor_s(3);
} else if (strcmp(type,"tri0") == 0) {
obj = new resolv_functor_s(0);
} else if (strcmp(type,"tri1") == 0) {
obj = new resolv_functor_s(1);
} else {
fprintf(stderr, "invalid resolver type: %s\n", type);
@ -1344,6 +1350,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.116 2001/12/15 01:54:38 steve
* Support tri0 and tri1 resolvers.
*
* Revision 1.115 2001/12/06 03:31:24 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)

View File

@ -17,11 +17,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: resolv.cc,v 1.9 2001/12/06 03:31:25 steve Exp $"
#ident "$Id: resolv.cc,v 1.10 2001/12/15 01:54:39 steve Exp $"
#endif
# include "resolv.h"
# include "schedule.h"
# include <assert.h>
/*
* A signal value is unambiguous if the top 4 bits and the bottom 4
@ -132,6 +133,17 @@ static unsigned blend(unsigned a, unsigned b)
return res;
}
resolv_functor_s::resolv_functor_s(unsigned hiz_value)
{
istr[0]=istr[1]=istr[2]=istr[3]=StX;
assert(hiz_value < 4);
hiz_ = hiz_value;
}
resolv_functor_s::~resolv_functor_s()
{
}
/*
* Resolve the strength values of the inputs, two at a time. Pairs of
* inputs are resolved with the blend function, and the final value is
@ -149,7 +161,7 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
unsigned val;
if (sval == HiZ) {
val = 3;
val = hiz_;
} else switch (sval & 0x88) {
case 0x00:
@ -175,6 +187,9 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
/*
* $Log: resolv.cc,v $
* Revision 1.10 2001/12/15 01:54:39 steve
* Support tri0 and tri1 resolvers.
*
* Revision 1.9 2001/12/06 03:31:25 steve
* Support functor delays for gates and UDP devices.
* (Stephan Boettcher)

View File

@ -19,21 +19,35 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: resolv.h,v 1.3 2001/10/31 04:27:47 steve Exp $"
#ident "$Id: resolv.h,v 1.4 2001/12/15 01:54:39 steve Exp $"
#endif
# include "functor.h"
/*
* This functor type resolves its inputs using the verilog method of
* combining signals, and outputs that resolved value. If the result
* is HiZ, then drive the hiz_value instead. This supports tri0 and
* tri1.
*/
class resolv_functor_s: public functor_s {
public:
resolv_functor_s() { istr[0]=istr[1]=istr[2]=istr[3]=StX; }
explicit resolv_functor_s(unsigned hiz_value);
~resolv_functor_s();
virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
private:
unsigned char istr[4];
unsigned hiz_;
};
/*
* $Log: resolv.h,v $
* Revision 1.4 2001/12/15 01:54:39 steve
* Support tri0 and tri1 resolvers.
*
* Revision 1.3 2001/10/31 04:27:47 steve
* Rewrite the functor type to have fewer functor modes,
* and use objects to manage the different types.