Support rnpmos devices. (Philip Blundell)

This commit is contained in:
steve 2001-10-18 17:30:25 +00:00
parent ce7d64f427
commit 73283768a5
4 changed files with 82 additions and 80 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvp_scope.c,v 1.50 2001/10/16 02:19:27 steve Exp $"
#ident "$Id: vvp_scope.c,v 1.51 2001/10/18 17:30:25 steve Exp $"
#endif
# include "vvp_priv.h"
@ -595,13 +595,11 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
break;
case IVL_LO_RPMOS:
fprintf(stderr, "vvp.tgt: error: Unhandled logic of type RPMOS\n");
ltype = "?";
ltype = "RPMOS";
break;
case IVL_LO_RNMOS:
fprintf(stderr, "vvp.tgt: error: Unhandled logic of type RNMOS\n");
ltype = "?";
ltype = "RNMOS";
break;
case IVL_LO_NOTIF0:
@ -1213,6 +1211,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
/*
* $Log: vvp_scope.c,v $
* Revision 1.51 2001/10/18 17:30:25 steve
* Support rnpmos devices. (Philip Blundell)
*
* Revision 1.50 2001/10/16 02:19:27 steve
* Support IVL_LPM_DIVIDE for structural divide.
*

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.108 2001/10/16 02:47:37 steve Exp $"
#ident "$Id: compile.cc,v 1.109 2001/10/18 17:30:25 steve Exp $"
#endif
# include "arith.h"
@ -682,6 +682,14 @@ void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
obj->obj = new vvp_nmos_s;
obj->mode = M42;
} else if (strcmp(type, "RPMOS") == 0) {
obj->obj = new vvp_rpmos_s;
obj->mode = M42;
} else if (strcmp(type, "RNMOS") == 0) {
obj->obj = new vvp_rnmos_s;
obj->mode = M42;
} else if (strcmp(type, "MUXZ") == 0) {
obj->table = ft_MUXZ;
@ -1594,6 +1602,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.109 2001/10/18 17:30:25 steve
* Support rnpmos devices. (Philip Blundell)
*
* Revision 1.108 2001/10/16 02:47:37 steve
* Add arith/div object.
*

View File

@ -17,44 +17,43 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: npmos.cc,v 1.2 2001/10/11 18:20:51 steve Exp $"
#ident "$Id: npmos.cc,v 1.3 2001/10/18 17:30:26 steve Exp $"
#endif
# include "npmos.h"
# include "functor.h"
# include "schedule.h"
void vvp_pmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
/* from IEEE 1384-1995 Table 7-8 */
static unsigned char rmos_table[8] = { 0, 1, 1, 2, 2, 3, 5, 5 };
/* just reduce SUPPLY to STRONG */
static unsigned char mos_table[8] = { 0, 1, 2, 3, 4, 5, 6, 6 };
static inline unsigned reduce_strength(unsigned is0, unsigned char *table)
{
unsigned vals = is0 & 0x88;
unsigned s1 = table[is0 & 0x7];
unsigned s2 = table[(is0 & 0x70) >> 4];
return vals | s1 | (s2 << 4);
}
static void mos_set(vvp_ipoint_t ptr, functor_t fp, bool push, unsigned in1_on, unsigned char *table)
{
unsigned in0 = fp->ival & 0x03;
unsigned in1 = (fp->ival >> 2) & 0x03;
unsigned is0 = fp->istr[0];
// Reduce SUPPLY to STRONG
if ((is0 & 0x70) == 0x70)
is0 &= 0xef;
if ((is0 & 0x07) == 0x07)
is0 &= 0xfe;
unsigned is0 = reduce_strength(fp->istr[0], table);
unsigned char outH = 0x88 | ((is0 & 3)<<4) | (0);
unsigned char outL = 0x00 | ((is0 & 3)<<0) | (0);
unsigned char outX = 0x80 | (is0 & 3) | (is0 & 0x30);
if (in0 == 3 || in1 == 1) {
fp->oval = 3;
fp->ostr = HiZ;
} else {
switch (in1) {
case 0:
if (in1 == in1_on) {
// gate on; output follows input
fp->oval = in0;
fp->ostr = is0;
break;
default:
} else if (in1 == 2 || in1 == 3) {
// gate X or Z; output is undefined
fp->oval = 2;
switch (in0) {
case 0:
@ -67,8 +66,10 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
fp->ostr = outX;
break;
}
break;
}
} else {
// gate off; output is high impedance
fp->oval = 3;
fp->ostr = HiZ;
}
if (push)
@ -77,60 +78,31 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
schedule_functor(ptr, 0);
}
void vvp_pmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
{
mos_set(ptr, fp, push, 0, mos_table);
}
void vvp_nmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
{
unsigned in0 = fp->ival & 0x03;
unsigned in1 = (fp->ival >> 2) & 0x03;
unsigned is0 = fp->istr[0];
mos_set(ptr, fp, push, 1, mos_table);
}
// Reduce SUPPLY to STRONG
if ((is0 & 0x70) == 0x70)
is0 &= 0xef;
if ((is0 & 0x07) == 0x07)
is0 &= 0xfe;
void vvp_rpmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
{
mos_set(ptr, fp, push, 0, rmos_table);
}
unsigned char outH = 0x88 | ((is0 & 3)<<4) | (0);
unsigned char outL = 0x00 | ((is0 & 3)<<0) | (0);
unsigned char outX = 0x80 | (is0 & 3) | (is0 & 0x30);
if (in0 == 3 || in1 == 0) {
fp->oval = 3;
fp->ostr = HiZ;
} else {
switch (in1) {
case 1:
fp->oval = in0;
fp->ostr = is0;
break;
default:
fp->oval = 2;
switch (in0) {
case 0:
fp->ostr = outL;
break;
case 1:
fp->ostr = outH;
break;
default:
fp->ostr = outX;
break;
}
break;
}
}
if (push)
functor_propagate(ptr);
else
schedule_functor(ptr, 0);
void vvp_rnmos_s::set(vvp_ipoint_t ptr, functor_t fp, bool push)
{
mos_set(ptr, fp, push, 1, rmos_table);
}
/*
* $Log: npmos.cc,v $
* Revision 1.3 2001/10/18 17:30:26 steve
* Support rnpmos devices. (Philip Blundell)
*
* Revision 1.2 2001/10/11 18:20:51 steve
* npmos devices pass strength.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: npmos.h,v 1.1 2001/10/09 02:28:17 steve Exp $"
#ident "$Id: npmos.h,v 1.2 2001/10/18 17:30:26 steve Exp $"
#endif
# include "functor.h"
@ -40,10 +40,28 @@ class vvp_nmos_s : public vvp_fobj_s {
private: // not implemented
};
class vvp_rpmos_s : public vvp_fobj_s {
public:
virtual void set(vvp_ipoint_t i, functor_t f, bool push);
private: // not implemented
};
class vvp_rnmos_s : public vvp_fobj_s {
public:
virtual void set(vvp_ipoint_t i, functor_t f, bool push);
private: // not implemented
};
/*
* $Log: npmos.h,v $
* Revision 1.1 2001/10/09 02:28:17 steve
* Add the PMOS and NMOS functor types.
* Revision 1.2 2001/10/18 17:30:26 steve
* Support rnpmos devices. (Philip Blundell)
* Revision 1.1 2001/10/09 02:28:17 steve Add the
* PMOS and NMOS functor types.
*
* Revision 1.1 2001/05/31 04:12:43 steve
* Make the bufif0 and bufif1 gates strength aware,