Add support for supply nets (PR#17)

This commit is contained in:
steve 2000-11-20 00:58:40 +00:00
parent 1f07ba52b6
commit f4443a7dfa
9 changed files with 108 additions and 56 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_sig.cc,v 1.4 2000/09/07 22:37:48 steve Exp $"
#ident "$Id: elab_sig.cc,v 1.5 2000/11/20 00:58:40 steve Exp $"
#endif
# include "Module.h"
@ -343,15 +343,14 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
sig->set_line(*this);
sig->port_type(port_type_);
sig->set_attributes(attributes);
verinum::V iv = verinum::Vz;
if (wtype == NetNet::REG)
iv = verinum::Vx;
}
}
/*
* $Log: elab_sig.cc,v $
* Revision 1.5 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.4 2000/09/07 22:37:48 steve
* ack, detect when lval fails.
*

View File

@ -17,15 +17,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: link_const.cc,v 1.5 2000/07/14 06:12:57 steve Exp $"
#ident "$Id: link_const.cc,v 1.6 2000/11/20 00:58:40 steve Exp $"
#endif
# include "netlist.h"
# include "netmisc.h"
/*
* Scan the link for drivers. If there are only constant drivers, then
* the nexus has a known constant value. If there is a supply net,
* then the nexus again has a known constant value.
*/
bool link_drivers_constant(const Link&lnk)
{
const Nexus*nex = lnk.nexus();
bool flag = true;
for (const Link*cur = nex->first_nlink()
; cur ; cur = cur->next_nlink()) {
@ -43,53 +50,54 @@ bool link_drivers_constant(const Link&lnk)
continue;
if (! dynamic_cast<const NetConst*>(cur->get_obj()))
return false;
flag = false;
/* If there is a supply net, then this nexus will have a
constant value independent of any drivers. */
if (const NetNet*sig = dynamic_cast<const NetNet*>(cur->get_obj()))
switch (sig->type()) {
case NetNet::SUPPLY0:
case NetNet::SUPPLY1:
return true;
default:
break;
}
}
return true;
return flag;
}
verinum::V driven_value(const Link&lnk)
{
verinum::V val = verinum::Vx;
const Nexus*nex = lnk.nexus();
for (const Link*cur = nex->first_nlink()
; cur ; cur = cur->next_nlink()) {
const NetConst*obj;
if (obj = dynamic_cast<const NetConst*>(cur->get_obj()))
return obj->value(cur->get_pin());
const NetNet*sig;
if (obj = dynamic_cast<const NetConst*>(cur->get_obj())) {
val = obj->value(cur->get_pin());
} else if (sig = dynamic_cast<const NetNet*>(cur->get_obj())) {
if (sig->type() == NetNet::SUPPLY0)
return verinum::V0;
if (sig->type() == NetNet::SUPPLY1)
return verinum::V1;
}
}
return lnk.get_init();
}
NetConst* link_const_value(Link&pin, unsigned&idx)
{
NetConst*robj = 0;
unsigned ridx = 0;
Nexus*nex = pin.nexus();
for (Link*cur = nex->first_nlink()
; cur ; cur = cur->next_nlink()) {
NetConst*tmp;
if ((tmp = dynamic_cast<NetConst*>(cur->get_obj())) == 0)
continue;
if (robj != 0)
continue;
robj = tmp;
ridx = cur->get_pin();
}
idx = ridx;
return robj;
}
/*
* $Log: link_const.cc,v $
* Revision 1.6 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.5 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.145 2000/11/11 00:03:36 steve Exp $"
#ident "$Id: netlist.cc,v 1.146 2000/11/20 00:58:40 steve Exp $"
#endif
# include <cassert>
@ -316,6 +316,12 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
case INTEGER:
init_value = verinum::Vx;
break;
case SUPPLY0:
init_value = verinum::V0;
break;
case SUPPLY1:
init_value = verinum::V1;
break;
default:
break;
}
@ -343,6 +349,12 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls)
case INTEGER:
init_value = verinum::Vx;
break;
case SUPPLY0:
init_value = verinum::V0;
break;
case SUPPLY1:
init_value = verinum::V1;
break;
default:
break;
}
@ -2454,6 +2466,9 @@ bool NetUDP::sequ_glob_(string input, char output)
/*
* $Log: netlist.cc,v $
* Revision 1.146 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.145 2000/11/11 00:03:36 steve
* Add support for the t-dll backend grabing flip-flops.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.179 2000/11/11 01:52:09 steve Exp $"
#ident "$Id: netlist.h,v 1.180 2000/11/20 00:58:40 steve Exp $"
#endif
/*
@ -313,7 +313,7 @@ class NetNet : public NetObj, public LineInfo {
public:
enum Type { IMPLICIT, IMPLICIT_REG, WIRE, TRI, TRI1, SUPPLY0,
WAND, TRIAND, TRI0, SUPPLY1, WOR, TRIOR, REG,
SUPPLY1, WAND, TRIAND, TRI0, WOR, TRIOR, REG,
INTEGER, TIME };
enum PortType { NOT_A_PORT, PIMPLICIT, PINPUT, POUTPUT, PINOUT };
@ -2812,6 +2812,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.180 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.179 2000/11/11 01:52:09 steve
* change set for support of nmos, pmos, rnmos, rpmos, notif0, and notif1
* change set to correct behavior of bufif0 and bufif1

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netmisc.h,v 1.9 2000/09/20 02:53:15 steve Exp $"
#ident "$Id: netmisc.h,v 1.10 2000/11/20 00:58:40 steve Exp $"
#endif
# include "netlist.h"
@ -33,14 +33,6 @@
extern NetExpr*pad_to_width(NetExpr*expr, unsigned wid);
extern NetNet*pad_to_width(Design*des, const string&p, NetNet*n, unsigned w);
/*
* Check to see if the link has a constant value driven to it. If
* there is only a NetConst driving this pin, the return a pointer to
* that NetConst object. Also, return the index of the bit in that
* constant through the idx parameter.
*/
extern NetConst* link_const_value(Link&pin, unsigned&idx);
/*
* This local function returns true if all the the possible drivers of
* this link are constant. It will also return true if there are no
@ -65,6 +57,9 @@ extern unsigned count_lval_width(const class NetAssign_*first);
/*
* $Log: netmisc.h,v $
* Revision 1.10 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.9 2000/09/20 02:53:15 steve
* Correctly measure comples l-values of assignments.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-vvm.cc,v 1.184 2000/11/11 01:52:09 steve Exp $"
#ident "$Id: t-vvm.cc,v 1.185 2000/11/20 00:58:40 steve Exp $"
#endif
# include <iostream>
@ -1124,6 +1124,16 @@ void target_vvm::signal(const NetNet*sig)
handles the different semantics. */
switch (sig->type()) {
case NetNet::SUPPLY0:
init_code << " nexus_wire_table[" << ncode
<< "].resolution_function = vvm_resolution_sup0;"
<< endl;
break;
case NetNet::SUPPLY1:
init_code << " nexus_wire_table[" << ncode
<< "].resolution_function = vvm_resolution_sup1;"
<< endl;
break;
case NetNet::TRI0:
init_code << " nexus_wire_table[" << ncode
<< "].resolution_function = vvm_resolution_tri0;"
@ -3347,6 +3357,9 @@ extern const struct target tgt_vvm = {
};
/*
* $Log: t-vvm.cc,v $
* Revision 1.185 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.184 2000/11/11 01:52:09 steve
* change set for support of nmos, pmos, rnmos, rpmos, notif0, and notif1
* change set to correct behavior of bufif0 and bufif1

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vvm_nexus.cc,v 1.10 2000/10/23 00:32:48 steve Exp $"
#ident "$Id: vvm_nexus.cc,v 1.11 2000/11/20 00:58:40 steve Exp $"
#endif
# include "vvm_nexus.h"
@ -276,6 +276,16 @@ vpip_bit_t vvm_resolution_wire(const vpip_bit_t*bits, unsigned nbits)
return vpip_bits_resolve(bits, nbits);
}
vpip_bit_t vvm_resolution_sup0(const vpip_bit_t*, unsigned)
{
return Su0;
}
vpip_bit_t vvm_resolution_sup1(const vpip_bit_t*, unsigned)
{
return Su1;
}
vpip_bit_t vvm_resolution_tri0(const vpip_bit_t*bits, unsigned nbits)
{
if (nbits == 0) return Pu0;
@ -317,6 +327,9 @@ void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val,
/*
* $Log: vvm_nexus.cc,v $
* Revision 1.11 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.10 2000/10/23 00:32:48 steve
* Nexus value is initially unknown so that it propogates for sure.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vvm_nexus.h,v 1.5 2000/08/02 00:57:03 steve Exp $"
#ident "$Id: vvm_nexus.h,v 1.6 2000/11/20 00:58:41 steve Exp $"
#endif
# include "vvm.h"
@ -151,6 +151,8 @@ class vvm_nexus {
extern vpip_bit_t vvm_resolution_wire(const vpip_bit_t*bits, unsigned nbits);
extern vpip_bit_t vvm_resolution_sup0(const vpip_bit_t*bits, unsigned nbits);
extern vpip_bit_t vvm_resolution_sup1(const vpip_bit_t*bits, unsigned nbits);
extern vpip_bit_t vvm_resolution_tri0(const vpip_bit_t*bits, unsigned nbits);
extern vpip_bit_t vvm_resolution_tri1(const vpip_bit_t*bits, unsigned nbits);
@ -164,6 +166,9 @@ extern void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val,
/*
* $Log: vvm_nexus.h,v $
* Revision 1.6 2000/11/20 00:58:41 steve
* Add support for supply nets (PR#17)
*
* Revision 1.5 2000/08/02 00:57:03 steve
* tri01 support in vvm.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: xnfio.cc,v 1.16 2000/10/07 19:45:43 steve Exp $"
#ident "$Id: xnfio.cc,v 1.17 2000/11/20 00:58:40 steve Exp $"
#endif
# include "functor.h"
@ -319,13 +319,11 @@ bool xnfio_f::compare_sideb_const(Design*des, NetCompare*dev)
/* Is the B side all constant? */
for (unsigned idx = 0 ; idx < dev->width() ; idx += 1) {
NetConst*cobj;
unsigned cidx;
cobj = link_const_value(dev->pin_DataB(idx), cidx);
if (cobj == 0)
if (! link_drivers_constant(dev->pin_DataB(idx)))
return false;
side.set(idx, cobj->value(cidx));
side.set(idx, driven_value(dev->pin_DataB(idx)));
}
/* Handle the special case of comparing A to 0. Use an N-input
@ -365,6 +363,9 @@ void xnfio(Design*des)
/*
* $Log: xnfio.cc,v $
* Revision 1.17 2000/11/20 00:58:40 steve
* Add support for supply nets (PR#17)
*
* Revision 1.16 2000/10/07 19:45:43 steve
* Put logic devices into scopes.
*