From 2fad8d4cffe523a60bc285b557d65782113decc9 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 18 Aug 2002 22:07:16 +0000 Subject: [PATCH] Detect temporaries in sequential block synthesis. --- async.cc | 8 ++++++- net_link.cc | 34 +++++++++++++++++++++++++++++- net_nex_input.cc | 55 ++++++++++++++++++++++++++++++++++++++++++------ netlist.h | 10 ++++++++- synth2.cc | 14 +++++++++--- 5 files changed, 109 insertions(+), 12 deletions(-) diff --git a/async.cc b/async.cc index 06b0516d7..d0e234433 100644 --- a/async.cc +++ b/async.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: async.cc,v 1.3 2002/08/12 01:34:58 steve Exp $" +#ident "$Id: async.cc,v 1.4 2002/08/18 22:07:16 steve Exp $" #endif # include "config.h" @@ -38,6 +38,9 @@ bool NetCondit::is_asynchronous() bool NetEvWait::is_asynchronous() { + /* The "sense" set contains the set of Nexa that are in the + sensitivity list. We also presume here that the list is + only LEVEL sensitive. */ NexusSet*sense = new NexusSet; for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) { NexusSet*tmp = event(idx)->nex_async_(); @@ -78,6 +81,9 @@ bool NetProcTop::is_asynchronous() /* * $Log: async.cc,v $ + * Revision 1.4 2002/08/18 22:07:16 steve + * Detect temporaries in sequential block synthesis. + * * Revision 1.3 2002/08/12 01:34:58 steve * conditional ident string using autoconfig. * diff --git a/net_link.cc b/net_link.cc index 1a44f24cb..310f5eaa8 100644 --- a/net_link.cc +++ b/net_link.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_link.cc,v 1.10 2002/08/12 01:34:59 steve Exp $" +#ident "$Id: net_link.cc,v 1.11 2002/08/18 22:07:16 steve Exp $" #endif # include "config.h" @@ -424,6 +424,35 @@ void NexusSet::add(const NexusSet&that) add(that.items_[idx]); } +void NexusSet::rem(Nexus*that) +{ + if (nitems_ == 0) + return; + + unsigned ptr = bsearch_(that); + if ((ptr >= nitems_) || (items_[ptr] != that)) + return; + + if (nitems_ == 1) { + free(items_); + items_ = 0; + nitems_ = 0; + return; + } + + for (unsigned idx = ptr ; idx < (nitems_-1) ; idx += 1) + items_[idx] = items_[idx+1]; + + items_ = (Nexus**)realloc(items_, (nitems_-1) * sizeof(Nexus*)); + nitems_ -= 1; +} + +void NexusSet::rem(const NexusSet&that) +{ + for (unsigned idx = 0 ; idx < that.nitems_ ; idx += 1) + rem(that.items_[idx]); +} + Nexus* NexusSet::operator[] (unsigned idx) const { assert(idx < nitems_); @@ -457,6 +486,9 @@ bool NexusSet::contains(const NexusSet&that) const /* * $Log: net_link.cc,v $ + * Revision 1.11 2002/08/18 22:07:16 steve + * Detect temporaries in sequential block synthesis. + * * Revision 1.10 2002/08/12 01:34:59 steve * conditional ident string using autoconfig. * diff --git a/net_nex_input.cc b/net_nex_input.cc index a05cc9fca..f82d093f6 100644 --- a/net_nex_input.cc +++ b/net_nex_input.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: net_nex_input.cc,v 1.5 2002/08/12 01:34:59 steve Exp $" +#ident "$Id: net_nex_input.cc,v 1.6 2002/08/18 22:07:16 steve Exp $" #endif # include "config.h" @@ -173,20 +173,60 @@ NexusSet* NetAssignBase::nex_input() return result; } +/* + * The nex_input of a begin/end block is the NexusSet of bits that the + * block reads from outside the block. That means it is the union of + * the nex_input for all the substatements. + * + * The input set for a sequential set is not exactly the union of the + * input sets because there is the possibility of intermediate values, + * that don't deserve to be in the input set. To wit: + * + * begin + * t = a + b; + * c = ~t; + * end + * + * In this example, "t" should not be in the input set because it is + * used by the sequence as a temporary value. + */ NexusSet* NetBlock::nex_input() { if (last_ == 0) return new NexusSet; - NetProc*cur = last_; - NexusSet*result = cur->nex_input(); - cur = cur->next_; - while (cur != last_) { + if (type_ == PARA) { + cerr << get_line() << ": internal error: Sorry, " + << "I don't know how to synthesize fork/join blocks." + << endl; + return 0; + } + + NetProc*cur = last_->next_; + /* This is the accumulated input set. */ + NexusSet*result = new NexusSet; + /* This is an accumulated output set. */ + NexusSet*prev = new NexusSet; + + do { + /* Get the inputs for the current statement. */ NexusSet*tmp = cur->nex_input(); + + /* Remove from the input set those bits that are outputs + from previous statements. They aren't really inputs + to the block, just internal intermediate values. */ + tmp->rem(*prev); + + /* Add the corrected set to the accumulated input set. */ result->add(*tmp); delete tmp; + + /* Add the current outputs to the accumulated output + set, for processing of later statements. */ + cur->nex_output(*prev); + cur = cur->next_; - } + } while (cur != last_->next_); return result; } @@ -318,6 +358,9 @@ NexusSet* NetWhile::nex_input() /* * $Log: net_nex_input.cc,v $ + * Revision 1.6 2002/08/18 22:07:16 steve + * Detect temporaries in sequential block synthesis. + * * Revision 1.5 2002/08/12 01:34:59 steve * conditional ident string using autoconfig. * diff --git a/netlist.h b/netlist.h index f7891eb44..c7b65910b 100644 --- a/netlist.h +++ b/netlist.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: netlist.h,v 1.258 2002/08/16 05:18:27 steve Exp $" +#ident "$Id: netlist.h,v 1.259 2002/08/18 22:07:16 steve Exp $" #endif /* @@ -282,9 +282,14 @@ class NexusSet { unsigned count() const; + // Add the nexus to the set, if it is not already present. void add(Nexus*that); void add(const NexusSet&that); + // Remove the nexus from the set, if it is present. + void rem(Nexus*that); + void rem(const NexusSet&that); + Nexus* operator[] (unsigned idx) const; // Return true if this set contains every nexus in that set. @@ -3011,6 +3016,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.259 2002/08/18 22:07:16 steve + * Detect temporaries in sequential block synthesis. + * * Revision 1.258 2002/08/16 05:18:27 steve * Fix intermix of node functors and node delete. * diff --git a/synth2.cc b/synth2.cc index 769a83244..5edb4d1f2 100644 --- a/synth2.cc +++ b/synth2.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: synth2.cc,v 1.7 2002/08/12 01:35:00 steve Exp $" +#ident "$Id: synth2.cc,v 1.8 2002/08/18 22:07:16 steve Exp $" #endif # include "config.h" @@ -282,11 +282,13 @@ void synth2_f::process(class Design*des, class NetProcTop*top) return; if (! top->is_asynchronous()) { + bool synth_error_flag = false; if (top->attribute("ivl_combinational").as_ulong() != 0) { cerr << top->get_line() << ": error: " << "Process is marked combinational," << " but isn't really." << endl; des->errors += 1; + synth_error_flag = true; } if (top->attribute("ivl_synthesis_on").as_ulong() != 0) { @@ -294,10 +296,13 @@ void synth2_f::process(class Design*des, class NetProcTop*top) << "Process is marked for synthesis," << " but I can't do it." << endl; des->errors += 1; + synth_error_flag = true; } - cerr << top->get_line() << ": warning: " - << "Process not synthesized." << endl; + if (! synth_error_flag) + cerr << top->get_line() << ": warning: " + << "Process not synthesized." << endl; + return; } @@ -319,6 +324,9 @@ void synth2(Design*des) /* * $Log: synth2.cc,v $ + * Revision 1.8 2002/08/18 22:07:16 steve + * Detect temporaries in sequential block synthesis. + * * Revision 1.7 2002/08/12 01:35:00 steve * conditional ident string using autoconfig. *