Handle connectsion to internally unconnected modules (PR#38)

This commit is contained in:
steve 2000-11-05 06:05:59 +00:00
parent 61ad0b23c8
commit f4ed0e35af
3 changed files with 46 additions and 8 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Module.cc,v 1.12 2000/05/16 04:05:15 steve Exp $"
#ident "$Id: Module.cc,v 1.13 2000/11/05 06:05:59 steve Exp $"
#endif
# include "Module.h"
@ -68,10 +68,19 @@ unsigned Module::port_count() const
return ports_.count();
}
/*
* Return the array of PEIdent object that are at this port of the
* module. If the port is internally unconnected, return an empty
* array.
*/
const svector<PEIdent*>& Module::get_port(unsigned idx) const
{
assert(idx < ports_.count());
return ports_[idx]->expr;
if (ports_[idx])
return ports_[idx]->expr;
else
return svector<PEIdent*>();
}
unsigned Module::find_port(const string&name) const
@ -125,6 +134,9 @@ const list<PProcess*>& Module::get_behaviors() const
/*
* $Log: Module.cc,v $
* Revision 1.13 2000/11/05 06:05:59 steve
* Handle connectsion to internally unconnected modules (PR#38)
*
* Revision 1.12 2000/05/16 04:05:15 steve
* Module ports are really special PEIdent
* expressions, because a name can be used

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Module.h,v 1.20 2000/07/22 22:09:03 steve Exp $"
#ident "$Id: Module.h,v 1.21 2000/11/05 06:05:59 steve Exp $"
#endif
# include <list>
@ -124,7 +124,10 @@ class Module {
private:
const string name_;
/* This is an array of port descriptors, which is in turn a
named array of PEident pointers. */
svector<port_t*> ports_;
map<string,PWire*> wires_;
list<PGate*> gates_;
list<PProcess*> behaviors_;
@ -139,6 +142,9 @@ class Module {
/*
* $Log: Module.h,v $
* Revision 1.21 2000/11/05 06:05:59 steve
* Handle connectsion to internally unconnected modules (PR#38)
*
* Revision 1.20 2000/07/22 22:09:03 steve
* Parse and elaborate timescale to scopes.
*

View File

@ -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.195 2000/10/28 00:51:42 steve Exp $"
#ident "$Id: elaborate.cc,v 1.196 2000/11/05 06:05:59 steve Exp $"
#endif
/*
@ -467,20 +467,29 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
// the pins, elaborate the expressions attached to them, and
// bind them to the port of the elaborated module.
// This can get rather complicated because the port can be
// unconnected (meaning an empty paramter is passed) connected
// to a concatenation, or connected to an internally
// unconnected port.
for (unsigned idx = 0 ; idx < pins->count() ; idx += 1) {
// Skip unconnected module ports.
// Skip unconnected module ports. This happens when a
// null parameter is passed in.
if ((*pins)[idx] == 0)
continue;
// Inside the module, the port is one or more signals,
// that were already elaborated. List all those signals,
// and I will connect them up later.
// Inside the module, the port is zero or more signals
// that were already elaborated. List all those signals
// and the NetNet equivilents.
svector<PEIdent*> mport = rmod->get_port(idx);
svector<NetNet*>prts (mport.count());
// Count the internal pins of the port.
unsigned prts_pin_count = 0;
for (unsigned ldx = 0 ; ldx < mport.count() ; ldx += 1) {
PEIdent*pport = mport[ldx];
assert(pport);
prts[ldx] = pport->elaborate_port(des, my_scope);
if (prts[ldx] == 0)
continue;
@ -489,6 +498,13 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
prts_pin_count += prts[ldx]->pin_count();
}
// If I find that the port in unconnected inside the
// module, then there is nothing to connect. Skip the
// paramter.
if (prts_pin_count == 0) {
continue;
}
NetNet*sig = (*pins)[idx]->elaborate_net(des, path,
prts_pin_count,
0, 0, 0);
@ -500,6 +516,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
assert(sig);
// Check that the parts have matching pin counts. If
// not, they are different widths. Note that idx is 0
// based, but users count parameter positions from 1.
@ -2283,6 +2300,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.196 2000/11/05 06:05:59 steve
* Handle connectsion to internally unconnected modules (PR#38)
*
* Revision 1.195 2000/10/28 00:51:42 steve
* Add scope to threads in vvm, pass that scope
* to vpi sysTaskFunc objects, and add vpi calls