Give tri0 and tri1 their proper strengths.

This commit is contained in:
steve 2001-12-15 02:11:51 +00:00
parent 7d494fd3d5
commit ace6b0a767
3 changed files with 25 additions and 16 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.116 2001/12/15 01:54:38 steve Exp $"
#ident "$Id: compile.cc,v 1.117 2001/12/15 02:11:51 steve Exp $"
#endif
# include "arith.h"
@ -858,13 +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(3);
obj = new resolv_functor_s(HiZ);
} else if (strcmp(type,"tri0") == 0) {
obj = new resolv_functor_s(0);
obj = new resolv_functor_s(Pu0);
} else if (strcmp(type,"tri1") == 0) {
obj = new resolv_functor_s(1);
obj = new resolv_functor_s(Pu1);
} else {
fprintf(stderr, "invalid resolver type: %s\n", type);
@ -1350,6 +1350,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.117 2001/12/15 02:11:51 steve
* Give tri0 and tri1 their proper strengths.
*
* Revision 1.116 2001/12/15 01:54:38 steve
* Support tri0 and tri1 resolvers.
*

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.10 2001/12/15 01:54:39 steve Exp $"
#ident "$Id: resolv.cc,v 1.11 2001/12/15 02:11:51 steve Exp $"
#endif
# include "resolv.h"
@ -133,11 +133,10 @@ static unsigned blend(unsigned a, unsigned b)
return res;
}
resolv_functor_s::resolv_functor_s(unsigned hiz_value)
resolv_functor_s::resolv_functor_s(unsigned char pull)
{
istr[0]=istr[1]=istr[2]=istr[3]=StX;
assert(hiz_value < 4);
hiz_ = hiz_value;
hiz_ = pull;
}
resolv_functor_s::~resolv_functor_s()
@ -154,14 +153,15 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
unsigned pp = ipoint_port(i);
istr[pp] = str;
unsigned sval = istr[0];
unsigned sval = hiz_;
sval = blend(sval, istr[0]);
sval = blend(sval, istr[1]);
sval = blend(sval, istr[2]);
sval = blend(sval, istr[3]);
unsigned val;
if (sval == HiZ) {
val = hiz_;
val = 3;
} else switch (sval & 0x88) {
case 0x00:
@ -187,6 +187,9 @@ void resolv_functor_s::set(vvp_ipoint_t i, bool push, unsigned, unsigned str)
/*
* $Log: resolv.cc,v $
* Revision 1.11 2001/12/15 02:11:51 steve
* Give tri0 and tri1 their proper strengths.
*
* Revision 1.10 2001/12/15 01:54:39 steve
* Support tri0 and tri1 resolvers.
*

View File

@ -19,32 +19,35 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: resolv.h,v 1.4 2001/12/15 01:54:39 steve Exp $"
#ident "$Id: resolv.h,v 1.5 2001/12/15 02:11:51 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.
* combining signals, and outputs that resolved value. The puller
* value is also blended with the result. This helps with the
* implementation of tri0 and tri1, which have pull constants attached.
*/
class resolv_functor_s: public functor_s {
public:
explicit resolv_functor_s(unsigned hiz_value);
explicit resolv_functor_s(unsigned char 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_;
unsigned char hiz_;
};
/*
* $Log: resolv.h,v $
* Revision 1.5 2001/12/15 02:11:51 steve
* Give tri0 and tri1 their proper strengths.
*
* Revision 1.4 2001/12/15 01:54:39 steve
* Support tri0 and tri1 resolvers.
*