Skip to content

Commit

Permalink
Shuffle link_drivers_constant for speed.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jun 19, 2002
1 parent b4b5ac9 commit d7fb472
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions link_const.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: link_const.cc,v 1.11 2001/08/25 23:50:03 steve Exp $"
#ident "$Id: link_const.cc,v 1.12 2002/06/19 04:18:46 steve Exp $"
#endif

# include "config.h"
Expand All @@ -33,15 +33,17 @@
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()) {
const NetNet*sig;
Link::DIR cur_dir;

if (cur == &lnk)
continue;
if (cur->get_dir() == Link::INPUT)

cur_dir = cur->get_dir();
if (cur_dir == Link::INPUT)
continue;

/* If this is an input or inout port of a root module,
Expand All @@ -57,28 +59,27 @@ bool link_drivers_constant(const Link&lnk)
is not constant because it connects to an unspecified
outside world. */

if (sig = dynamic_cast<const NetNet*>(cur->get_obj())) do {
if (sig->port_type() == NetNet::NOT_A_PORT)
break;
if (cur_dir == Link::PASSIVE) {

const NetObj*obj = cur->get_obj();
if (obj->scope()->parent() != 0)
continue;

if (sig->port_type() == NetNet::POUTPUT)
break;
sig = dynamic_cast<const NetNet*>(cur->get_obj());
assert(sig);

if (sig->scope()->parent())
break;
if (sig->port_type() == NetNet::NOT_A_PORT)
continue;

flag = false;
} while(0);
if (sig->port_type() == NetNet::POUTPUT)
continue;

return false;

/* If the link is PASSIVE then it doesn't count as a
driver if its initial value is Vz. PASSIVE nodes
include wires and tri nets. */
if (cur->get_dir() == Link::PASSIVE)
continue;
}

if (! dynamic_cast<const NetConst*>(cur->get_obj()))
flag = false;
return false;

/* If there is a supply net, then this nexus will have a
constant value independent of any drivers. */
Expand All @@ -92,7 +93,7 @@ bool link_drivers_constant(const Link&lnk)
}
}

return flag;
return true;
}

verinum::V driven_value(const Link&lnk)
Expand Down Expand Up @@ -123,6 +124,9 @@ verinum::V driven_value(const Link&lnk)

/*
* $Log: link_const.cc,v $
* Revision 1.12 2002/06/19 04:18:46 steve
* Shuffle link_drivers_constant for speed.
*
* Revision 1.11 2001/08/25 23:50:03 steve
* Change the NetAssign_ class to refer to the signal
* instead of link into the netlist. This is faster
Expand Down

0 comments on commit d7fb472

Please sign in to comment.