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.
This commit is contained in:
parent
8dd2fc7095
commit
42e4ff47c8
|
|
@ -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
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/*
|
||||
|
|
@ -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())
|
||||
|
|
@ -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
|
||||
|
|
|
|||
14
elab_sig.cc
14
elab_sig.cc
|
|
@ -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"
|
||||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
40
elaborate.cc
40
elaborate.cc
|
|
@ -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
|
||||
|
||||
/*
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
12
main.cc
12
main.cc
|
|
@ -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[] =
|
||||
|
|
@ -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);
|
||||
|
|
@ -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 },
|
||||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/*
|
||||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
40
net_link.cc
40
net_link.cc
|
|
@ -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"
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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_;
|
||||
|
|
@ -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);
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
40
netlist.cc
40
netlist.cc
|
|
@ -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.132 2000/07/07 04:53:54 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.133 2000/07/14 06:12:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -163,7 +163,7 @@ Link* find_next_output(Link*lnk)
|
|||
}
|
||||
|
||||
NetObj::NetObj(const string&n, unsigned np)
|
||||
: name_(n), npins_(np), delay1_(0), delay2_(0), delay3_(0), mark_(false)
|
||||
: name_(n), npins_(np), delay1_(0), delay2_(0), delay3_(0)
|
||||
{
|
||||
pins_ = new Link[npins_];
|
||||
for (unsigned idx = 0 ; idx < npins_ ; idx += 1) {
|
||||
|
|
@ -274,10 +274,20 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
|
|||
{
|
||||
assert(scope_);
|
||||
|
||||
ivalue_ = new verinum::V[npins];
|
||||
verinum::V init_value = verinum::Vz;
|
||||
switch (t) {
|
||||
case REG:
|
||||
case IMPLICIT_REG:
|
||||
case INTEGER:
|
||||
init_value = verinum::Vx;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < npins ; idx += 1) {
|
||||
pin(idx).set_name("P", idx);
|
||||
ivalue_[idx] = verinum::Vz;
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
|
||||
scope_->add_signal(this);
|
||||
|
|
@ -291,10 +301,20 @@ NetNet::NetNet(NetScope*s, const string&n, Type t, long ms, long ls)
|
|||
{
|
||||
assert(scope_);
|
||||
|
||||
ivalue_ = new verinum::V[pin_count()];
|
||||
verinum::V init_value = verinum::Vz;
|
||||
switch (t) {
|
||||
case REG:
|
||||
case IMPLICIT_REG:
|
||||
case INTEGER:
|
||||
init_value = verinum::Vx;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
|
||||
pin(idx).set_name("P", idx);
|
||||
ivalue_[idx] = verinum::Vz;
|
||||
pin(idx).set_init(init_value);
|
||||
}
|
||||
|
||||
scope_->add_signal(this);
|
||||
|
|
@ -2438,6 +2458,14 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.133 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.132 2000/07/07 04:53:54 steve
|
||||
* Add support for non-constant delays in delay statements,
|
||||
* Support evaluating ! in constant expressions, and
|
||||
|
|
|
|||
44
netlist.h
44
netlist.h
|
|
@ -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.144 2000/07/07 04:53:54 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.145 2000/07/14 06:12:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -96,9 +96,6 @@ class NetObj {
|
|||
// all have the same values.
|
||||
bool has_compat_attributes(const NetObj&that) const;
|
||||
|
||||
bool test_mark() const { return mark_; }
|
||||
void set_mark(bool flag=true) { mark_ = flag; }
|
||||
|
||||
Link&pin(unsigned idx);
|
||||
const Link&pin(unsigned idx) const;
|
||||
|
||||
|
|
@ -114,8 +111,6 @@ class NetObj {
|
|||
unsigned delay3_;
|
||||
|
||||
map<string,string> attributes_;
|
||||
|
||||
bool mark_;
|
||||
};
|
||||
|
||||
class Link {
|
||||
|
|
@ -136,12 +131,22 @@ class Link {
|
|||
void set_dir(DIR d);
|
||||
DIR get_dir() const;
|
||||
|
||||
// A link has a drive strength for 0 and 1 values. The drive0
|
||||
// strength is for when the link has the value 0, and drive1
|
||||
// strength is for when the link has a value 1.
|
||||
void drive0(strength_t);
|
||||
void drive1(strength_t);
|
||||
|
||||
strength_t drive0() const;
|
||||
strength_t drive1() const;
|
||||
|
||||
// A link has an initial value that is used by the nexus to
|
||||
// figure out its initial value. Normally, only the object
|
||||
// that contains the link sets the initial value, and only the
|
||||
// attached Nexus gets it. The default link value is Vx.
|
||||
void set_init(verinum::V val);
|
||||
verinum::V get_init() const;
|
||||
|
||||
void cur_link(NetObj*&net, unsigned &pin);
|
||||
void cur_link(const NetObj*&net, unsigned &pin) const;
|
||||
|
||||
|
|
@ -174,11 +179,13 @@ class Link {
|
|||
NetObj*get_obj();
|
||||
unsigned get_pin() const;
|
||||
|
||||
// A link of an object (sometimes called a "pin") has a
|
||||
// name. It is convenient for the name to have a string and an
|
||||
// integer part.
|
||||
void set_name(const string&, unsigned inst =0);
|
||||
const string& get_name() const;
|
||||
unsigned get_inst() const;
|
||||
|
||||
|
||||
private:
|
||||
// The NetNode manages these. They point back to the
|
||||
// NetNode so that following the links can get me here.
|
||||
|
|
@ -187,6 +194,7 @@ class Link {
|
|||
|
||||
DIR dir_;
|
||||
strength_t drive0_, drive1_;
|
||||
verinum::V init_;
|
||||
|
||||
// These members name the pin of the link. If the name
|
||||
// has width, then the ninst_ member is the index of the
|
||||
|
|
@ -223,6 +231,7 @@ class Nexus {
|
|||
~Nexus();
|
||||
|
||||
string name() const;
|
||||
verinum::V get_init() const;
|
||||
|
||||
Link*first_nlink();
|
||||
const Link* first_nlink()const;
|
||||
|
|
@ -278,6 +287,10 @@ class NetNode : public NetObj {
|
|||
* automatically adds itself to the scope.
|
||||
*
|
||||
* NetNet objects are located by searching NetScope objects.
|
||||
*
|
||||
* All the pins of a NetNet object are PASSIVE: they do not drive
|
||||
* anything and they are not a data sink, per se. The pins follow the
|
||||
* values on the nexus.
|
||||
*/
|
||||
class NetNet : public NetObj, public LineInfo {
|
||||
|
||||
|
|
@ -297,7 +310,7 @@ class NetNet : public NetObj, public LineInfo {
|
|||
const NetScope* scope() const;
|
||||
|
||||
Type type() const { return type_; }
|
||||
void type(Type t) { type_ = t; }
|
||||
//void type(Type t) { type_ = t; }
|
||||
|
||||
PortType port_type() const { return port_type_; }
|
||||
void port_type(PortType t) { port_type_ = t; }
|
||||
|
|
@ -323,10 +336,12 @@ class NetNet : public NetObj, public LineInfo {
|
|||
void decr_eref();
|
||||
unsigned get_eref() const;
|
||||
|
||||
#if 0
|
||||
verinum::V get_ival(unsigned pin) const
|
||||
{ return ivalue_[pin]; }
|
||||
void set_ival(unsigned pin, verinum::V val)
|
||||
{ ivalue_[pin] = val; }
|
||||
#endif
|
||||
|
||||
virtual void dump_net(ostream&, unsigned) const;
|
||||
|
||||
|
|
@ -344,8 +359,6 @@ class NetNet : public NetObj, public LineInfo {
|
|||
|
||||
bool local_flag_;
|
||||
unsigned eref_count_;
|
||||
|
||||
verinum::V*ivalue_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -2571,9 +2584,6 @@ class Design {
|
|||
void functor(struct functor_t*);
|
||||
bool emit(ostream&, struct target_t*) const;
|
||||
|
||||
void clear_node_marks();
|
||||
NetNode*find_node(bool (*test)(const NetNode*));
|
||||
|
||||
// This is incremented by elaboration when an error is
|
||||
// detected. It prevents code being emitted.
|
||||
unsigned errors;
|
||||
|
|
@ -2648,6 +2658,14 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.145 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.144 2000/07/07 04:53:54 steve
|
||||
* Add support for non-constant delays in delay statements,
|
||||
* Support evaluating ! in constant expressions, and
|
||||
|
|
|
|||
27
netlist.txt
27
netlist.txt
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: netlist.txt,v 1.8 2000/03/08 04:36:54 steve Exp $"
|
||||
#ident "$Id: netlist.txt,v 1.9 2000/07/14 06:12:57 steve Exp $"
|
||||
|
||||
|
||||
Note that the netlist.h header contains detailed descriptions of how
|
||||
|
|
@ -60,13 +60,20 @@ changed during processing.
|
|||
STRUCTURAL LINKS
|
||||
|
||||
The NetNode and NetNet classes contain arrays of Link objects, one
|
||||
object per pin. Each pin is a single bit. The Link objects link
|
||||
circularly to all the NetNode and NetNet objects' links that are
|
||||
connected together in the design. This way, code that examines a node
|
||||
object per pin. Each pin is a single bit. The Link objects link to all
|
||||
the NetNode and NetNet objects' links that are connected together in
|
||||
the design, and to a Nexus object. This way, code that examines a node
|
||||
of the design can discover what is connected to each pin.
|
||||
|
||||
See the NetObj::Link class definition for a description of the link
|
||||
methods.
|
||||
The connected set of links also has common properties that are stored
|
||||
or access from the Nexus object. All the Links that are connected
|
||||
together are also connected to a single Nexus object. This object is
|
||||
useful for accessing the properties and values that come from the
|
||||
connected set of links. The Nexus object is also handy for iterating
|
||||
over the connected set of Links.
|
||||
|
||||
See the Link class definition in netlist.h for a description of the link
|
||||
methods, and the Nexus class for nexus global methods.
|
||||
|
||||
Currently, a link has 3 possible direction properties:
|
||||
|
||||
|
|
@ -263,6 +270,14 @@ some task calls. C++ programmers recognize this as inlining a task.)
|
|||
|
||||
|
||||
$Log: netlist.txt,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/03/08 04:36:54 steve
|
||||
Redesign the implementation of scopes and parameters.
|
||||
I now generate the scopes and notice the parameters
|
||||
|
|
|
|||
104
propinit.cc
104
propinit.cc
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1998 Stephen Williams (steve@picturel.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: propinit.cc,v 1.4 2000/06/25 19:59:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The propinit function runs through the devices that can impose
|
||||
* initial values in the netlist and propogates those values. The
|
||||
* process works by first scanning the active devices for outputs that
|
||||
* they generate.
|
||||
*/
|
||||
|
||||
# include "netlist.h"
|
||||
|
||||
/*
|
||||
* prop_sequdp_output takes the output from the located sequential UDP
|
||||
* device and propogates it to the signals connected to it.
|
||||
*/
|
||||
static bool is_sequ_udp(const NetNode*net)
|
||||
{
|
||||
const NetUDP*udp;
|
||||
if ((udp = dynamic_cast<const NetUDP*>(net)) == 0)
|
||||
return false;
|
||||
|
||||
return udp->is_sequential();
|
||||
}
|
||||
|
||||
static void prop_sequdp_output(NetUDP*udp)
|
||||
{
|
||||
/* Get from the UDP class the initial output value. */
|
||||
verinum::V ival;
|
||||
switch (udp->get_initial()) {
|
||||
case '0':
|
||||
ival = verinum::V0;
|
||||
break;
|
||||
case '1':
|
||||
ival = verinum::V1;
|
||||
break;
|
||||
default:
|
||||
ival = verinum::Vx;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Take the output value and write it to all the NetNet pins
|
||||
that are connected to the output pin. */
|
||||
|
||||
Nexus*nex = udp->pin(0).nexus();
|
||||
for (Link*lnk = nex->first_nlink()
|
||||
; lnk ; lnk = lnk->next_nlink()) {
|
||||
|
||||
if (NetNet*sig = dynamic_cast<NetNet*>(lnk->get_obj()))
|
||||
sig->set_ival(lnk->get_pin(), ival);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void propinit(Design*des)
|
||||
{
|
||||
des->clear_node_marks();
|
||||
while (NetNode*net = des->find_node(&is_sequ_udp)) {
|
||||
net->set_mark();
|
||||
prop_sequdp_output(dynamic_cast<NetUDP*>(net));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: propinit.cc,v $
|
||||
* 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.
|
||||
*
|
||||
* Revision 1.3 2000/05/07 04:37:56 steve
|
||||
* Carry strength values from Verilog source to the
|
||||
* pform and netlist for gates.
|
||||
*
|
||||
* Change vvm constants to use the driver_t to drive
|
||||
* a constant value. This works better if there are
|
||||
* multiple drivers on a signal.
|
||||
*
|
||||
* Revision 1.2 2000/02/23 02:56:55 steve
|
||||
* Macintosh compilers do not support ident.
|
||||
*
|
||||
* Revision 1.1 1998/12/20 02:05:41 steve
|
||||
* Function to calculate wire initial value.
|
||||
*
|
||||
*/
|
||||
|
||||
10
syn-rules.y
10
syn-rules.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: syn-rules.y,v 1.5 2000/06/25 19:59:42 steve Exp $"
|
||||
#ident "$Id: syn-rules.y,v 1.6 2000/07/14 06:12:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -193,6 +193,12 @@ static void make_RAM_CE(Design*des, NetProcTop*top, NetEvWait*wclk,
|
|||
des->delete_process(top);
|
||||
}
|
||||
|
||||
/*
|
||||
* An assignment in an initial statement is the same as giving the
|
||||
* nexus an initial value. For synthesized netlists, we can just set
|
||||
* the initial value for the link and get rid of the assignment
|
||||
* process.
|
||||
*/
|
||||
static void make_initializer(Design*des, NetProcTop*top, NetAssign*asn)
|
||||
{
|
||||
NetESignal*rsig = dynamic_cast<NetESignal*> (asn->rval());
|
||||
|
|
@ -207,7 +213,7 @@ static void make_initializer(Design*des, NetProcTop*top, NetAssign*asn)
|
|||
; cur ; cur = cur->next_nlink()) {
|
||||
|
||||
if (NetNet*net = dynamic_cast<NetNet*> (cur->get_obj()))
|
||||
net->set_ival(cur->get_pin(), bit);
|
||||
cur->set_init(bit);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19
t-vvm.cc
19
t-vvm.cc
|
|
@ -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.161 2000/07/07 04:53:54 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.162 2000/07/14 06:12:57 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -1098,8 +1098,10 @@ void target_vvm::signal(ostream&os, const NetNet*sig)
|
|||
"].connect(&" << net_name << ", " << idx << ");" << endl;
|
||||
|
||||
// Propogate the initial value to inputs throughout.
|
||||
if (new_nexus_flag)
|
||||
emit_init_value_(sig->pin(idx), sig->get_ival(idx));
|
||||
if (new_nexus_flag) {
|
||||
verinum::V init = sig->pin(idx).nexus()->get_init();
|
||||
emit_init_value_(sig->pin(idx), init);
|
||||
}
|
||||
}
|
||||
|
||||
os << "static vvm_signal_t " << net_name << ";" << endl;
|
||||
|
|
@ -1125,9 +1127,10 @@ void target_vvm::signal(ostream&os, const NetNet*sig)
|
|||
to the inputs of all the connected devices. */
|
||||
for (unsigned idx = 0 ; idx < sig->pin_count() ; idx += 1) {
|
||||
|
||||
verinum::V init = sig->pin(idx).nexus()->get_init();
|
||||
init_code << " " << mangle(sig->name()) << ".init_P("
|
||||
<< idx << ", ";
|
||||
switch (sig->get_ival(idx)) {
|
||||
switch (init) {
|
||||
case verinum::V0:
|
||||
init_code << "St0";
|
||||
break;
|
||||
|
|
@ -3083,6 +3086,14 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.162 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.161 2000/07/07 04:53:54 steve
|
||||
* Add support for non-constant delays in delay statements,
|
||||
* Support evaluating ! in constant expressions, and
|
||||
|
|
|
|||
12
t-xnf.cc
12
t-xnf.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: t-xnf.cc,v 1.31 2000/06/28 18:38:54 steve Exp $"
|
||||
#ident "$Id: t-xnf.cc,v 1.32 2000/07/14 06:12:58 steve Exp $"
|
||||
#endif
|
||||
|
||||
/* XNF BACKEND
|
||||
|
|
@ -84,7 +84,7 @@ verinum::V link_get_ival(const Link&lnk)
|
|||
continue;
|
||||
|
||||
if (const NetNet*sig = dynamic_cast<const NetNet*>(cur->get_obj()))
|
||||
return sig->get_ival(cur->get_pin());
|
||||
return cur->nexus()->get_init();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -878,6 +878,14 @@ extern const struct target tgt_xnf = { "xnf", &target_xnf_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-xnf.cc,v $
|
||||
* Revision 1.32 2000/07/14 06:12:58 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.31 2000/06/28 18:38:54 steve
|
||||
* Use nexus type to get nexus name.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue