Merge similar probes within a module.
This commit is contained in:
parent
e0dcdf6b72
commit
fd09bc3e3e
18
elaborate.cc
18
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.173 2000/05/16 04:05:16 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.174 2000/05/27 19:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1832,8 +1832,17 @@ NetProc* PEventStatement::elaborate_st(Design*des, const string&path,
|
|||
expression (and not a named event) then add this
|
||||
event. Otherwise, we didn't use it so delete it. */
|
||||
if (expr_count > 0) {
|
||||
scope->add_event(ev);
|
||||
wa->add_event(ev);
|
||||
if (NetEvent*match = ev->find_similar_event()) {
|
||||
cerr << "XXXX Found similar event for " <<
|
||||
ev->name() << endl;
|
||||
delete ev;
|
||||
wa->add_event(match);
|
||||
|
||||
} else {
|
||||
|
||||
scope->add_event(ev);
|
||||
wa->add_event(ev);
|
||||
}
|
||||
} else {
|
||||
delete ev;
|
||||
}
|
||||
|
|
@ -2429,6 +2438,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.174 2000/05/27 19:33:23 steve
|
||||
* Merge similar probes within a module.
|
||||
*
|
||||
* Revision 1.173 2000/05/16 04:05:16 steve
|
||||
* Module ports are really special PEIdent
|
||||
* expressions, because a name can be used
|
||||
|
|
|
|||
77
net_event.cc
77
net_event.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_event.cc,v 1.6 2000/04/18 04:50:20 steve Exp $"
|
||||
#ident "$Id: net_event.cc,v 1.7 2000/05/27 19:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -93,6 +93,73 @@ unsigned NetEvent::nwait() const
|
|||
return waitref_;
|
||||
}
|
||||
|
||||
NetEvent* NetEvent::find_similar_event()
|
||||
{
|
||||
if (probes_ == 0)
|
||||
return 0;
|
||||
#define NCAND 256
|
||||
NetEvent*cand[NCAND];
|
||||
bool cflg[NCAND];
|
||||
unsigned ncand = 0;
|
||||
|
||||
NetEvProbe*cur = probes_;
|
||||
|
||||
/* First locate all the canditate events from the probe
|
||||
objects that are connected to them. */
|
||||
|
||||
for (NetNode*idx = cur->next_node()
|
||||
; idx && (idx != cur) ; idx = idx->next_node()) {
|
||||
NetEvProbe*tmp = dynamic_cast<NetEvProbe*>(idx);
|
||||
if (tmp == 0)
|
||||
continue;
|
||||
if (tmp->edge() != cur->edge())
|
||||
continue;
|
||||
|
||||
cand[ncand++] = tmp->event();
|
||||
assert(ncand <= NCAND);
|
||||
}
|
||||
|
||||
for (cur = cur->enext_ ; cur && ncand ; cur = cur->enext_) {
|
||||
for (unsigned idx = 0 ; idx < ncand ; idx += 1)
|
||||
cflg[idx] = false;
|
||||
|
||||
for (NetNode*idx = cur->next_node()
|
||||
; idx && (idx != cur) ; idx = idx->next_node()) {
|
||||
NetEvProbe*tmp = dynamic_cast<NetEvProbe*>(idx);
|
||||
if (tmp == 0)
|
||||
continue;
|
||||
if (tmp->edge() != cur->edge())
|
||||
continue;
|
||||
|
||||
for (unsigned srch = 0 ; srch < ncand ; srch += 1)
|
||||
if (cand[srch] == tmp->event()) {
|
||||
cflg[srch] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < ncand ; ) {
|
||||
if (cflg[idx]) {
|
||||
idx += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (unsigned tmp = idx ; idx+1 < ncand ; idx += 1) {
|
||||
cflg[tmp] = cflg[tmp+1];
|
||||
cand[tmp] = cand[tmp+1];
|
||||
}
|
||||
ncand -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < ncand ; idx += 1) {
|
||||
if (cand[idx]->nprobe() == nprobe())
|
||||
return cand[idx];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetEvTrig::NetEvTrig(NetEvent*ev)
|
||||
: event_(ev)
|
||||
{
|
||||
|
|
@ -155,6 +222,11 @@ NetEvProbe::edge_t NetEvProbe::edge() const
|
|||
return edge_;
|
||||
}
|
||||
|
||||
NetEvent* NetEvProbe::event()
|
||||
{
|
||||
return event_;
|
||||
}
|
||||
|
||||
const NetEvent* NetEvProbe::event() const
|
||||
{
|
||||
return event_;
|
||||
|
|
@ -225,6 +297,9 @@ NetProc* NetEvWait::statement()
|
|||
|
||||
/*
|
||||
* $Log: net_event.cc,v $
|
||||
* Revision 1.7 2000/05/27 19:33:23 steve
|
||||
* Merge similar probes within a module.
|
||||
*
|
||||
* Revision 1.6 2000/04/18 04:50:20 steve
|
||||
* Clean up unneeded NetEvent objects.
|
||||
*
|
||||
|
|
|
|||
37
netlist.cc
37
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.126 2000/05/19 01:43:16 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.127 2000/05/27 19:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -165,6 +165,11 @@ void Link::unlink()
|
|||
next_ = prev_ = this;
|
||||
}
|
||||
|
||||
bool Link::is_equal(const Link&that) const
|
||||
{
|
||||
return (node_ == that.node_) && (pin_ == that.pin_);
|
||||
}
|
||||
|
||||
bool Link::is_linked() const
|
||||
{
|
||||
return next_ != this;
|
||||
|
|
@ -399,12 +404,39 @@ const Link& NetObj::pin(unsigned idx) const
|
|||
return pins_[idx];
|
||||
}
|
||||
|
||||
NetNode::NetNode(const string&n, unsigned npins)
|
||||
: NetObj(n, npins), node_next_(0), node_prev_(0), design_(0)
|
||||
{
|
||||
}
|
||||
|
||||
NetNode::~NetNode()
|
||||
{
|
||||
if (design_)
|
||||
design_->del_node(this);
|
||||
}
|
||||
|
||||
NetNode* NetNode::next_node()
|
||||
{
|
||||
for (Link*pin0 = pin(0).next_link()
|
||||
; *pin0 != pin(0) ; pin0 = pin0->next_link()) {
|
||||
NetNode*cur = dynamic_cast<NetNode*>(pin0->get_obj());
|
||||
if (cur == 0)
|
||||
continue;
|
||||
if (cur->pin_count() != pin_count())
|
||||
continue;
|
||||
|
||||
|
||||
bool flag = true;
|
||||
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1)
|
||||
flag = flag && pin(idx).is_linked(cur->pin(idx));
|
||||
|
||||
if (flag == true)
|
||||
return cur;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetNet::NetNet(NetScope*s, const string&n, Type t, unsigned npins)
|
||||
: NetObj(n, npins), sig_next_(0), sig_prev_(0), scope_(s),
|
||||
type_(t), port_type_(NOT_A_PORT), msb_(npins-1), lsb_(0),
|
||||
|
|
@ -2604,6 +2636,9 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.127 2000/05/27 19:33:23 steve
|
||||
* Merge similar probes within a module.
|
||||
*
|
||||
* Revision 1.126 2000/05/19 01:43:16 steve
|
||||
* Accept different widths for add operands.
|
||||
*
|
||||
|
|
|
|||
20
netlist.h
20
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.138 2000/05/11 23:37:27 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.139 2000/05/27 19:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -160,8 +160,9 @@ class Link {
|
|||
// Return true if this link is connected to any pin of r.
|
||||
bool is_linked(const NetObj&r) const;
|
||||
|
||||
bool is_equal(const Link&that) const
|
||||
{ return (node_ == that.node_) && (pin_ == that.pin_); }
|
||||
// Return true if this is the same pin of the same object of
|
||||
// that link.
|
||||
bool is_equal(const Link&that) const;
|
||||
|
||||
// Return information about the object that this link is
|
||||
// a part of.
|
||||
|
|
@ -205,11 +206,14 @@ class Link {
|
|||
class NetNode : public NetObj {
|
||||
|
||||
public:
|
||||
explicit NetNode(const string&n, unsigned npins)
|
||||
: NetObj(n, npins), node_next_(0), node_prev_(0), design_(0) { }
|
||||
explicit NetNode(const string&n, unsigned npins);
|
||||
|
||||
virtual ~NetNode();
|
||||
|
||||
// This method locates the next node that has all its pins
|
||||
// connected to the same of my own pins.
|
||||
NetNode*next_node();
|
||||
|
||||
virtual void emit_node(ostream&, struct target_t*) const;
|
||||
virtual void dump_node(ostream&, unsigned) const;
|
||||
|
||||
|
|
@ -1401,6 +1405,8 @@ class NetEvent : public LineInfo {
|
|||
NetScope* scope();
|
||||
const NetScope* scope() const;
|
||||
|
||||
NetEvent* find_similar_event();
|
||||
|
||||
private:
|
||||
string name_;
|
||||
|
||||
|
|
@ -1479,6 +1485,7 @@ class NetEvProbe : public NetNode {
|
|||
~NetEvProbe();
|
||||
|
||||
edge_t edge() const;
|
||||
NetEvent* event();
|
||||
const NetEvent* event() const;
|
||||
|
||||
virtual void emit_node(ostream&, struct target_t*) const;
|
||||
|
|
@ -2575,6 +2582,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.139 2000/05/27 19:33:23 steve
|
||||
* Merge similar probes within a module.
|
||||
*
|
||||
* Revision 1.138 2000/05/11 23:37:27 steve
|
||||
* Add support for procedural continuous assignment.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue