Skip to content

Commit

Permalink
Move inital value handling from NetNet to Nexus
Browse files Browse the repository at this point in the history
 objects. This allows better propogation of inital
 values.

 Clean up constant propagation  a bit to account
 for regs that are not really values.
  • Loading branch information
steve committed Jul 14, 2000
1 parent 8dd2fc7 commit 42e4ff4
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 194 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Expand Up @@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.60 2000/07/11 23:07:28 steve Exp $"
#ident "$Id: Makefile.in,v 1.61 2000/07/14 06:12:56 steve Exp $"
#
#
SHELL = /bin/sh
Expand Down Expand Up @@ -67,7 +67,7 @@ distclean: clean
rm -f Makefile

TT = t-null.o t-verilog.o t-vvm.o t-xnf.o
FF = nodangle.o propinit.o synth.o syn-rules.o xnfio.o
FF = nodangle.o synth.o syn-rules.o xnfio.o

O = main.o cprop.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
elab_net.o elab_pexpr.o elab_scope.o elab_sig.o emit.o eval.o eval_tree.o \
Expand Down
18 changes: 15 additions & 3 deletions design_dump.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: design_dump.cc,v 1.89 2000/07/07 04:53:53 steve Exp $"
#ident "$Id: design_dump.cc,v 1.90 2000/07/14 06:12:57 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -79,8 +79,12 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
o << " #(" << rise_time() << "," << fall_time() << "," <<
decay_time() << ") init=";
for (unsigned idx = pin_count() ; idx > 0 ; idx -= 1)
o << ivalue_[idx-1];
o << endl;
o << pin(idx-1).get_init();

o << " (";
for (unsigned idx = pin_count() ; idx > 0 ; idx -= 1)
o << pin(idx-1).nexus()->get_init();
o << ")" << endl;

for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
if (! pin(idx).is_linked())
Expand Down Expand Up @@ -973,6 +977,14 @@ void Design::dump(ostream&o) const

/*
* $Log: design_dump.cc,v $
* Revision 1.90 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.89 2000/07/07 04:53:53 steve
* Add support for non-constant delays in delay statements,
* Support evaluating ! in constant expressions, and
Expand Down
14 changes: 9 additions & 5 deletions elab_sig.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: elab_sig.cc,v 1.1 2000/05/02 16:27:38 steve Exp $"
#ident "$Id: elab_sig.cc,v 1.2 2000/07/14 06:12:57 steve Exp $"
#endif

# include "Module.h"
Expand Down Expand Up @@ -206,15 +206,19 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
verinum::V iv = verinum::Vz;
if (wtype == NetNet::REG)
iv = verinum::Vx;

for (unsigned idx = 0 ; idx < wid ; idx += 1)
sig->set_ival(idx, iv);

}
}

/*
* $Log: elab_sig.cc,v $
* Revision 1.2 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.1 2000/05/02 16:27:38 steve
* Move signal elaboration to a seperate pass.
*
Expand Down
40 changes: 31 additions & 9 deletions elaborate.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: elaborate.cc,v 1.177 2000/07/07 04:53:54 steve Exp $"
#ident "$Id: elaborate.cc,v 1.178 2000/07/14 06:12:57 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -100,14 +100,28 @@ void PGAssign::elaborate(Design*des, const string&path) const
0, 0, 0, Link::STRONG,
Link::STRONG);
assert(rid);
for (unsigned idx = 0 ; idx < lval->pin_count() ; idx += 1) {
NetBUFZ*dev = new NetBUFZ(des->local_symbol(path));
connect(lval->pin(idx), dev->pin(0));
connect(rid->pin(idx), dev->pin(1));
dev->pin(0).drive0(drive0);
dev->pin(0).drive1(drive1);
des->add_node(dev);
}


/* If the right hand net is the same type as the left
side net (i.e. WIRE/WIRE) then it is enough to just
connect them together. Otherwise, put a bufz between
them to carry strengths from the rval */

if (rid->type() == lval->type())
for (unsigned idx = 0 ; idx < lval->pin_count(); idx += 1) {
connect(lval->pin(idx), rid->pin(idx));
}

else
for (unsigned idx = 0 ; idx < lval->pin_count(); idx += 1) {
NetBUFZ*dev = new NetBUFZ(des->local_symbol(path));
connect(lval->pin(idx), dev->pin(0));
connect(rid->pin(idx), dev->pin(1));
dev->pin(0).drive0(drive0);
dev->pin(0).drive1(drive1);
des->add_node(dev);
}

return;
}

Expand Down Expand Up @@ -2458,6 +2472,14 @@ Design* elaborate(const map<string,Module*>&modules,

/*
* $Log: elaborate.cc,v $
* Revision 1.178 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.177 2000/07/07 04:53:54 steve
* Add support for non-constant delays in delay statements,
* Support evaluating ! in constant expressions, and
Expand Down
21 changes: 18 additions & 3 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.4 2000/06/25 19:59:42 steve Exp $"
#ident "$Id: link_const.cc,v 1.5 2000/07/14 06:12:57 steve Exp $"
#endif

# include "netlist.h"
Expand All @@ -33,8 +33,15 @@ bool link_drivers_constant(const Link&lnk)
continue;
if (cur->get_dir() == Link::INPUT)
continue;
if (cur->get_dir() == Link::PASSIVE)

/* If the link is PASSIVE then it doesn't count as a
driver if its initial value is Vz. This is pertinant
because REGs are PASSIVE but can receive values from
procedural assignments. */
if ((cur->get_dir() == Link::PASSIVE)
&& (cur->get_init() == verinum::Vz))
continue;

if (! dynamic_cast<const NetConst*>(cur->get_obj()))
return false;
}
Expand All @@ -53,7 +60,7 @@ verinum::V driven_value(const Link&lnk)
return obj->value(cur->get_pin());
}

return verinum::Vz;
return lnk.get_init();
}

NetConst* link_const_value(Link&pin, unsigned&idx)
Expand Down Expand Up @@ -83,6 +90,14 @@ NetConst* link_const_value(Link&pin, unsigned&idx)

/*
* $Log: link_const.cc,v $
* 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
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.4 2000/06/25 19:59:42 steve
* Redesign Links to include the Nexus class that
* carries properties of the connected set of links.
Expand Down
12 changes: 9 additions & 3 deletions main.cc
Expand Up @@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: main.cc,v 1.34 2000/05/13 20:55:47 steve Exp $"
#ident "$Id: main.cc,v 1.35 2000/07/14 06:12:57 steve Exp $"
#endif

const char NOTICE[] =
Expand Down Expand Up @@ -87,7 +87,6 @@ extern Design* elaborate(const map<string,Module*>&modules,
const string&root);

extern void cprop(Design*des);
extern void propinit(Design*des);
extern void synth(Design*des);
extern void syn_rules(Design*des);
extern void nodangle(Design*des);
Expand All @@ -100,7 +99,6 @@ static struct net_func_map {
} func_table[] = {
{ "cprop", &cprop },
{ "nodangle",&nodangle },
{ "propinit",&propinit },
{ "synth", &synth },
{ "syn-rules", &syn_rules },
{ "xnfio", &xnfio },
Expand Down Expand Up @@ -305,6 +303,14 @@ int main(int argc, char*argv[])

/*
* $Log: main.cc,v $
* Revision 1.35 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.34 2000/05/13 20:55:47 steve
* Use yacc based synthesizer.
*
Expand Down
38 changes: 9 additions & 29 deletions net_design.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: net_design.cc,v 1.8 2000/05/02 16:27:38 steve Exp $"
#ident "$Id: net_design.cc,v 1.9 2000/07/14 06:12:57 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -468,36 +468,16 @@ void Design::delete_process(NetProcTop*top)
delete top;
}

void Design::clear_node_marks()
{
if (nodes_ == 0)
return;

NetNode*cur = nodes_;
do {
cur->set_mark(false);
cur = cur->node_next_;
} while (cur != nodes_);
}

NetNode* Design::find_node(bool (*func)(const NetNode*))
{
if (nodes_ == 0)
return 0;

NetNode*cur = nodes_->node_next_;
do {
if ((cur->test_mark() == false) && func(cur))
return cur;

cur = cur->node_next_;
} while (cur != nodes_->node_next_);

return 0;
}

/*
* $Log: net_design.cc,v $
* Revision 1.9 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.8 2000/05/02 16:27:38 steve
* Move signal elaboration to a seperate pass.
*
Expand Down
40 changes: 37 additions & 3 deletions net_link.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: net_link.cc,v 1.1 2000/06/25 19:59:42 steve Exp $"
#ident "$Id: net_link.cc,v 1.2 2000/07/14 06:12:57 steve Exp $"
#endif

# include "netlist.h"
Expand Down Expand Up @@ -47,8 +47,8 @@ void connect(Link&l, Link&r)
}

Link::Link()
: dir_(PASSIVE), drive0_(STRONG), drive1_(STRONG),
inst_(0), next_(0), nexus_(0)
: dir_(PASSIVE), drive0_(STRONG), drive1_(STRONG), init_(verinum::Vx),
inst_(0), next_(0), nexus_(0)
{
(new Nexus()) -> relink(this);
}
Expand Down Expand Up @@ -102,6 +102,17 @@ Link::strength_t Link::drive1() const
return drive1_;
}

void Link::set_init(verinum::V val)
{
init_ = val;
}

verinum::V Link::get_init() const
{
return init_;
}


void Link::cur_link(NetObj*&net, unsigned &pin)
{
net = node_;
Expand Down Expand Up @@ -195,6 +206,21 @@ Nexus::~Nexus()
assert(list_ == 0);
}

verinum::V Nexus::get_init() const
{
assert(list_);
for (Link*cur = list_ ; cur ; cur = cur->next_) {
if (cur->get_dir() == Link::OUTPUT)
return verinum::Vx;

if ((cur->get_dir() == Link::PASSIVE)
&& (cur->get_init() != verinum::Vz))
return cur->get_init();
}

return verinum::Vz;
}

void Nexus::unlink(Link*that)
{
assert(that);
Expand Down Expand Up @@ -293,6 +319,14 @@ string Nexus::name() const

/*
* $Log: net_link.cc,v $
* Revision 1.2 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital
* values.
*
* Clean up constant propagation a bit to account
* for regs that are not really values.
*
* Revision 1.1 2000/06/25 19:59:42 steve
* Redesign Links to include the Nexus class that
* carries properties of the connected set of links.
Expand Down

0 comments on commit 42e4ff4

Please sign in to comment.