* nero/src/MNet.cpp,

nero/src/MDefs.h,
   nero/src/RMBK.cpp :
   - Ajout d'une prise en compte limitee du pre-routage. Ceci implique de
       pouvoir fusionner deux CTerm au cours de la construction d'un CNet.
       D'ou l'introduction d'une nouvelle exception "merge_term" qui est
       relachee par "CNet::newaccess()" pour etre attrapee par
       "CNet::newaccess()".
This commit is contained in:
Jean-Paul Chaput 2002-11-04 14:43:08 +00:00
parent d9d3489a97
commit 7b5147ff05
6 changed files with 183 additions and 69 deletions

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: MDefs.h,v 1.4 2002/10/29 18:46:03 jpc Exp $
// $Id: MDefs.h,v 1.5 2002/11/04 14:43:08 jpc Exp $
//
// /-----------------------------------------------------------------\
// | |
@ -534,6 +534,26 @@
// ---------------------------------------------------------------
// Terminal merging exception.
class merge_term : public except_done {
// Attributes.
public: int id;
// Constructor.
public: merge_term (int mergeid) { id = mergeid; }
// Overridables.
public: const char* what () const throw () {
return ((char*)"Terminal must be merged.");
}
};
// ---------------------------------------------------------------
// Terminal class.
@ -558,8 +578,9 @@
// Modifiers.
public: CNode *newaccess (int x, int y, int z, int ident, CNet *net)
throw (dup_term, bad_grab);
throw (dup_term, bad_grab, merge_term);
public: void newaccess (CRect &rect, int z, int ident, CNet *net);
public: void merge (CTerm *other, int ident, CNet *net);
public: void lockalone (bool global=false);
public: void setid (int ident);

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: MNet.cpp,v 1.5 2002/10/29 18:46:03 jpc Exp $
// $Id: MNet.cpp,v 1.6 2002/11/04 14:43:08 jpc Exp $
//
// /----------------------------------------------------------------\
// | |
@ -50,11 +50,11 @@ CTerm::~CTerm (void)
//list<CNode*>::iterator pNode;
//for (pNode = nodes.begin (); pNode != nodes.end (); pNode++) {
// if ((*pNode)->coord.z() == 0) delete (*pNode);
//}
//for (pNode = nodes.begin (); pNode != nodes.end (); pNode++)
// (*pNode)->ungrab ();
nodes.clear ();
rects.clear ();
}
@ -139,7 +139,7 @@ CDRGrid::iterator &CTerm::lowest (void)
// Method : "CTerm::newaccess()".
CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net)
throw (dup_term, bad_grab)
throw (dup_term, bad_grab, merge_term)
{
list<CDRGrid::iterator>::iterator itNode;
CDRGrid::iterator coord;
@ -150,20 +150,14 @@ CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net)
coord = net->_drgrid->origin;
coord.set (x, y, z);
// Check if the node is already in the list...
for (itNode = nodes.begin (); itNode != nodes.end (); itNode++) {
if (*itNode == coord) {
throw dup_term (name, *itNode);
}
}
pNode = &coord.node ();
if ((z == 0) && coord.isnodehole()) {
pNode = &coord.addnode ();
}
if (pNode->data.owner) {
// Check if the node has already been took by another terminal.
if (pNode->data.owner && (pNode->data.owner != net))
if (pNode->data.owner != net)
throw bad_grab ( pNode->data.owner->terms[pNode->getid()]->name
, net->name
, coord.x()
@ -175,6 +169,20 @@ CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net)
, pNode->data.ident
);
// Check if the node belongs to another terminal of this net.
// If so, send a merging exception to CNet::newaccess ().
if (pNode->getid () != ident) throw merge_term ( pNode->getid () );
return (NULL);
}
// Check if the node is already in the list (this should never appens !)
for (itNode = nodes.begin (); itNode != nodes.end (); itNode++) {
if (*itNode == coord) {
throw dup_term (name, *itNode);
}
}
pNode->data.owner = net;
pNode->data.obstacle = false;
pNode->setid (ident);
@ -211,6 +219,23 @@ void CTerm::newaccess (CRect &rect, int z, int ident, CNet *net)
// -------------------------------------------------------------------
// Method : "CTerm::merge()".
void CTerm::merge (CTerm *other, int ident, CNet *Net)
{
list<CDRGrid::iterator>::iterator coord;
for (coord = other->nodes.begin (); coord != other->nodes.end (); coord++) {
(*coord).node().setid (ident);
nodes.push_back (*coord);
}
}
// -------------------------------------------------------------------
// Method : "CTerm::lockalone()".
@ -423,7 +448,7 @@ void CNet::newaccess (string termName, int x, int y, int z)
void CNet::newaccess (string termName, CRect &rect, int z)
{
CCoord coord;
int id;
int id, mergeid;
// Find the terminal in the table.
@ -440,7 +465,31 @@ void CNet::newaccess (string termName, CRect &rect, int z)
}
// Add the access to the terminal & update the bounding box.
do {
mergeid = INT_MAX;
try {
terms[id]->newaccess (rect, z, id, this);
}
catch (merge_term &e) {
mergeid = e.id;
// Merge terminals ...
terms[mergeid]->merge (terms[id], mergeid, this);
// Erase the merged terminal.
delete terms[id];
terms.erase (terms.begin () + id);
size -= 1;
// Re-computes the terminal's ids.
for (id = 0; id < size; id++) terms[id]->setid (id);
id = mergeid;
}
} while (mergeid != INT_MAX);
// Update the bounding box.
bb.merge (coord.set (rect.x1, rect.y1, z));

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: RBox.cpp,v 1.2 2002/10/29 18:46:03 jpc Exp $
// $Id: RBox.cpp,v 1.3 2002/11/04 14:43:08 jpc Exp $
//
// /----------------------------------------------------------------\
// | |
@ -168,6 +168,46 @@ void CRBox::route (void)
// -------------------------------------------------------------------
// Method : "CRBox::findnet()".
CNet *CRBox::findnet (char *signame)
{
string name;
name = signame;
return (findnet(name));
}
// -------------------------------------------------------------------
// Method : "CRBox::findnet()".
CNet *CRBox::findnet (string &signame)
{
MNet::iterator itNet, endNet;
CNet *pNet;
endNet = nets.end ();
itNet = nets.find (signame);
if (itNet == endNet) {
pNet = NULL;
} else
pNet = itNet->second;
return (pNet);
}
// -------------------------------------------------------------------
// Method : "CRBox::getnet()".

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: RDefs.h,v 1.2 2002/10/29 18:46:03 jpc Exp $
// $Id: RDefs.h,v 1.3 2002/11/04 14:43:08 jpc Exp $
//
// /-----------------------------------------------------------------\
// | |
@ -58,6 +58,8 @@
public: ~CRBox (void);
// Modifiers.
public: CNet *findnet (string &signame);
public: CNet *findnet (char *signame);
public: CNet *getnet (string &signame);
public: CNet *getnet (char *signame);
public: void mbkload (MBK::CFig *mbkfig, int z, int zup, int rtype);

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: RMBK.cpp,v 1.5 2002/10/29 18:46:03 jpc Exp $
// $Id: RMBK.cpp,v 1.6 2002/11/04 14:43:08 jpc Exp $
//
// /----------------------------------------------------------------\
// | |
@ -111,6 +111,44 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int zup, int rtype)
rect = new MBK::CXRect (fig->XAB1(), fig->YAB1());
cmess2 << " o Loading external terminals.\n";
// Browse layout for terminals.
for (pPhcon = fig->phfig.fig->PHCON; pPhcon != NULL; pPhcon = pPhcon->NEXT) {
if (fig->lofig.signals.find(pPhcon->NAME) == endSig) {
cerr << hwarn ("")
<< " The terminal \"" << pPhcon->NAME << "\" at ("
<< MBK::UNSCALE (pPhcon->XCON) << ","
<< MBK::UNSCALE (pPhcon->YCON) << ") layer "
<< MBK::layer2a (pPhcon->LAYER) << "\n"
<< " do not not belong to any logical signal : ignored.\n";
continue;
}
pNet = getnet (pPhcon->NAME);
term_name = "external.";
term_name += pPhcon->NAME;
flatSeg.X1 = pPhcon->XCON;
flatSeg.Y1 = pPhcon->YCON;
flatSeg.X2 = pPhcon->XCON;
flatSeg.Y2 = pPhcon->YCON;
flatSeg.WIDTH = MBK::env.layer2width (pPhcon->LAYER);
flatSeg.LAYER = pPhcon->LAYER;
flatSeg.NAME = pPhcon->NAME;
rect->setSeg (flatSeg);
pNet->newaccess ( term_name
, rect->grid
, MBK::env.layer2z (pPhcon->LAYER)
);
}
cmess2 << " o Finding obstacles.\n";
@ -201,42 +239,6 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int zup, int rtype)
}
// Browse layout for terminals.
for (pPhcon = fig->phfig.fig->PHCON; pPhcon != NULL; pPhcon = pPhcon->NEXT) {
if (fig->lofig.signals.find(pPhcon->NAME) == endSig) {
cerr << hwarn ("")
<< " The terminal \"" << pPhcon->NAME << "\" at ("
<< MBK::UNSCALE (pPhcon->XCON) << ","
<< MBK::UNSCALE (pPhcon->YCON) << ") layer "
<< MBK::layer2a (pPhcon->LAYER) << "\n"
<< " do not not belong to any logical signal : ignored.\n";
continue;
}
pNet = getnet (pPhcon->NAME);
term_name = "external.";
term_name += pPhcon->NAME;
flatSeg.X1 = pPhcon->XCON;
flatSeg.Y1 = pPhcon->YCON;
flatSeg.X2 = pPhcon->XCON;
flatSeg.Y2 = pPhcon->YCON;
flatSeg.WIDTH = MBK::env.layer2width (pPhcon->LAYER);
flatSeg.LAYER = pPhcon->LAYER;
flatSeg.NAME = pPhcon->NAME;
rect->setSeg (flatSeg);
pNet->newaccess ( term_name
, rect->grid
, MBK::env.layer2z (pPhcon->LAYER)
);
}
// Browse instances & orphans for obstacles.
for (itIns = fig->instances.begin(); ; itIns++) {
if (itIns == endInstances) itIns = fig->orphans.begin ();

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// $Id: nero.cpp,v 1.3 2002/10/29 18:46:03 jpc Exp $
// $Id: nero.cpp,v 1.4 2002/11/04 14:43:08 jpc Exp $
//
// /----------------------------------------------------------------\
// | |
@ -94,7 +94,7 @@ static void help (void)
static void serial (void)
{
cout << " S/N 20021028.1\n";
cout << " S/N 20021104.1\n";
}