From 8abbe9ea6e2d2afb3f7103c3b5b35a490119206b Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 13 Oct 2002 14:22:47 +0000 Subject: [PATCH] * nero/src/UDefs.h, nero/src/UConst.cpp, nero/src/ADefs.h, nero/src/AAstar.cpp, nero/src/nero.cpp : - Bug : J'autorisait 6 niveaux de routage dans la grille (donc, comme l'ALU1 ne compte pas, jusqu'a l'ALU7) mais je n'avais parametre les fonctions de traduction vers MBK que jusqu'a l'ALU6. - Bug : quant un bug (une exception) se produisait dans la fonction de sauvegarde "emergency()" il n'etait pas catche et provoquait un coredump de mauvais aloi. Maintenant il les erreurs sont re-catchee et la sauvegarde est interrompue. - La non-convergence de l'algorithme ASimple/AAstar est detectee : quant la priorite sur un net depasse la valeur max (2^7), on arrete tout... - Bug : on n'assurait pas l'exclusivite terminal/obstacle (un terminal pouvait etre un obstacle). Ceci avait l'inconvenient d'autoriser des noeuds a la fois connecteurs et obstacles. Consequence : comme lors de l'examen des successeurs d'un noeud on regarde d'abord si on a affaire a un obstacle, certains connecteurs ne pouvaient jamais etre ateint (cas d'un connecteur CALU2 noye dans du TALU2 dans les RAMs). Maintenant l'exclusivite est garantie (un obstacle ne peut inclure de terminal et un terminal desactive obligatoirement l'obstacle). - Bug/2 : Je n'autorisait pas les segments de longueur nulle, or ca existe : connecteur "ad3" de la cellule "sensedecad". --- alliance/src/nero/configure.in | 2 +- alliance/src/nero/src/AAstar.cpp | 22 ++++++++++++++------- alliance/src/nero/src/ADefs.h | 24 ++++++++++++++++++++-- alliance/src/nero/src/ASimple.cpp | 6 +++--- alliance/src/nero/src/MMBK.cpp | 33 ++++++++++++++++++++++++++++++- alliance/src/nero/src/MNet.cpp | 5 +++-- alliance/src/nero/src/MNodes.cpp | 5 +++-- alliance/src/nero/src/MPower.cpp | 12 +++++------ alliance/src/nero/src/RMBK.cpp | 19 +++++++++--------- alliance/src/nero/src/UConst.cpp | 4 +++- alliance/src/nero/src/UDefs.h | 4 +++- alliance/src/nero/src/nero.cpp | 28 +++++++++++++++++++++----- 12 files changed, 124 insertions(+), 40 deletions(-) diff --git a/alliance/src/nero/configure.in b/alliance/src/nero/configure.in index 998e207c..88c519a6 100644 --- a/alliance/src/nero/configure.in +++ b/alliance/src/nero/configure.in @@ -3,7 +3,7 @@ AC_INIT(src/nero.cpp) NERO_MAJOR_VERSION=1 NERO_MINOR_VERSION=0 -NERO_VERSION=$POIRE_MAJOR_VERSION.$POIRE_MINOR_VERSION +NERO_VERSION=$NERO_MAJOR_VERSION.$NERO_MINOR_VERSION AC_SUBST(NERO_MAJOR_VERSION) AC_SUBST(NERO_MINOR_VERSION) diff --git a/alliance/src/nero/src/AAstar.cpp b/alliance/src/nero/src/AAstar.cpp index 9141c936..1c4f11ec 100644 --- a/alliance/src/nero/src/AAstar.cpp +++ b/alliance/src/nero/src/AAstar.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: AAstar.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: AAstar.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -295,7 +295,7 @@ void CAStar::CNodeAS::successors (CNodeASSet &NS, CNet *net, CNodeAS *(*success - //cdebug << "+ CAStar::CNodeAS::successors()." << endl; + //cdebug << "+ CAStar::CNodeAS::successors()." << "\n"; cost_z = D::cost_VIA; // Alternate costs of edges : @@ -325,7 +325,6 @@ void CAStar::CNodeAS::successors (CNodeASSet &NS, CNet *net, CNodeAS *(*success (*success)[edge] = NULL; if (neighbor.inside() && !neighbor.isnodehole()) { - //cdebug << "+ " << neighbor << endl; pNodeAS = AS (neighbor); if (!pNodeAS) { @@ -530,6 +529,10 @@ void CAStar::load (CNet *pNet, int delta=0, int expand=0) net->unroute (); _tree.addterm (*(net->terms[0])); + + //cerr << " Starting term := \"" + // << net->terms[0]->name + // << "\"\n"; } @@ -562,7 +565,7 @@ bool CAStar::step (void) throw (trapped_astar) } while ( pNodeAS->tagged && D::optim_AStar_queue ); - //cdebug << "+ " << pNodeAS->point << endl; + cdebug << "+ Examining " << pNodeAS->point << "\n"; // We process the node : tag it. if (D::optim_AStar_queue) pNodeAS->tagged = true; @@ -572,7 +575,7 @@ bool CAStar::step (void) throw (trapped_astar) for (edge = 0; edge < 6; edge++) { if (successors[edge] == NULL) continue; - //cdebug << "+ " << successors[edge]->point << endl; + cdebug << "+ " << successors[edge]->point << "\n"; // The successor belongs to the current net. // (it may be not the actual target). if ( (successors[edge]->point.node().data.owner == net) @@ -617,6 +620,9 @@ bool CAStar::nexttarget (void) for (i = 0; i < net->size; i++) { if (_tree.reached.find (i) == endSet) { _tree.settarget ( net->terms[i]->lowest() ); + //cerr << " Next target := \"" + // << net->terms[i]->name + // << "\"\n"; break; } } @@ -747,7 +753,7 @@ void CAStar::dump (void) // ------------------------------------------------------------------- // Method : "CAStar::route()". -void CAStar::route (CNet *pNet) + void CAStar::route (CNet *pNet) throw (reach_max_pri) { int pri; int increase, expand; @@ -762,7 +768,7 @@ void CAStar::route (CNet *pNet) iterations_reroute = 0; iterations_kind = &iterations_route; - //if (pNet->name == "ctl.seq_ep_30") cdebug.on (); + //if (pNet->name == "nbus0_30") cdebug.on (); do { if (hysteresis) { @@ -785,6 +791,8 @@ void CAStar::route (CNet *pNet) hysteresis = true; } while ((increase < 15) && !routed); + if (increase >= 15) throw reach_max_pri (pNet); + if (routed) dump(); clear (); diff --git a/alliance/src/nero/src/ADefs.h b/alliance/src/nero/src/ADefs.h index e210822b..d865d318 100644 --- a/alliance/src/nero/src/ADefs.h +++ b/alliance/src/nero/src/ADefs.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: ADefs.h,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: ADefs.h,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -81,6 +81,26 @@ + // --------------------------------------------------------------- + // Maximum priority reached exception. + + class reach_max_pri : public except_done { + + // Attributes. + public: CNet *net; + + // Constructor. + public: reach_max_pri (CNet *pNet) { net = pNet; } + + // Overridables. + public: const char* what () const throw () { + return ((char*)"Maximum priority reached in AStar."); + } + }; + + + + // --------------------------------------------------------------- // AStar algorithm class. // @@ -263,7 +283,7 @@ public: void clear (void); public: void load (CNet *pNet, int delta=0, int expand=0); public: bool search (void); - public: void route (CNet *pNet); + public: void route (CNet *pNet) throw (reach_max_pri); }; diff --git a/alliance/src/nero/src/ASimple.cpp b/alliance/src/nero/src/ASimple.cpp index 8fed4449..caeece9f 100644 --- a/alliance/src/nero/src/ASimple.cpp +++ b/alliance/src/nero/src/ASimple.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: ASimple.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: ASimple.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -81,8 +81,8 @@ bool CASimple::step (void) net = _queue.pop (); cmess2 << " - [" << setw(4) << _queue.queue.size() - << "] \"" << net->name << "\" (" - << net->bb << ")\n"; + << "] (hp := " << setw(5) << net->bb.hp << ") " + << "\"" << net->name << "\"\n"; _astar.route (net); iterations_route += _astar.iterations_route; diff --git a/alliance/src/nero/src/MMBK.cpp b/alliance/src/nero/src/MMBK.cpp index e1f44fed..b399ab71 100644 --- a/alliance/src/nero/src/MMBK.cpp +++ b/alliance/src/nero/src/MMBK.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MMBK.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: MMBK.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -179,6 +179,7 @@ CEnv::CEnv (void) D::TRACK_WIDTH_ALU4 = ::MBK::SCALE (D::_TRACK_WIDTH_ALU4); D::TRACK_WIDTH_ALU5 = ::MBK::SCALE (D::_TRACK_WIDTH_ALU5); D::TRACK_WIDTH_ALU6 = ::MBK::SCALE (D::_TRACK_WIDTH_ALU6); + D::TRACK_WIDTH_ALU7 = ::MBK::SCALE (D::_TRACK_WIDTH_ALU7); // Grid spacing. grid_dx = D::X_GRID; @@ -191,18 +192,21 @@ CEnv::CEnv (void) ALU2W[ALU4] = D::TRACK_WIDTH_ALU4; ALU2W[ALU5] = D::TRACK_WIDTH_ALU5; ALU2W[ALU6] = D::TRACK_WIDTH_ALU6; + ALU2W[ALU7] = D::TRACK_WIDTH_ALU7; ALU2W[CALU1] = D::TRACK_WIDTH_ALU1; ALU2W[CALU2] = D::TRACK_WIDTH_ALU2; ALU2W[CALU3] = D::TRACK_WIDTH_ALU3; ALU2W[CALU4] = D::TRACK_WIDTH_ALU4; ALU2W[CALU5] = D::TRACK_WIDTH_ALU5; ALU2W[CALU6] = D::TRACK_WIDTH_ALU6; + ALU2W[CALU7] = D::TRACK_WIDTH_ALU7; ALU2W[TALU1] = D::TRACK_WIDTH_ALU1; ALU2W[TALU2] = D::TRACK_WIDTH_ALU2; ALU2W[TALU3] = D::TRACK_WIDTH_ALU3; ALU2W[TALU4] = D::TRACK_WIDTH_ALU4; ALU2W[TALU5] = D::TRACK_WIDTH_ALU5; ALU2W[TALU6] = D::TRACK_WIDTH_ALU6; + ALU2W[TALU7] = D::TRACK_WIDTH_ALU7; // Layer to Z translation table. ALU2Z[ALU1] = 0; @@ -211,18 +215,21 @@ CEnv::CEnv (void) ALU2Z[ALU4] = 3; ALU2Z[ALU5] = 4; ALU2Z[ALU6] = 5; + ALU2Z[ALU7] = 6; ALU2Z[CALU1] = 0; ALU2Z[CALU2] = 1; ALU2Z[CALU3] = 2; ALU2Z[CALU4] = 3; ALU2Z[CALU5] = 4; ALU2Z[CALU6] = 5; + ALU2Z[CALU7] = 6; ALU2Z[TALU1] = 0; ALU2Z[TALU2] = 1; ALU2Z[TALU3] = 2; ALU2Z[TALU4] = 3; ALU2Z[TALU5] = 4; ALU2Z[TALU6] = 5; + ALU2Z[TALU7] = 6; } @@ -1066,6 +1073,30 @@ long cmpALU (char layer1, char layer2) case TALU6: return(F_EQUAL_T); } break; + + case ALU7: + switch(layer2) { + case ALU7: return(F_EQUAL_M); + case CALU7: return(F_EQUAL_C); + case TALU7: return(F_EQUAL_T); + } + break; + + case ALU8: + switch(layer2) { + case ALU8: return(F_EQUAL_M); + case CALU8: return(F_EQUAL_C); + case TALU8: return(F_EQUAL_T); + } + break; + + case ALU9: + switch(layer2) { + case ALU9: return(F_EQUAL_M); + case CALU9: return(F_EQUAL_C); + case TALU9: return(F_EQUAL_T); + } + break; } return(0); diff --git a/alliance/src/nero/src/MNet.cpp b/alliance/src/nero/src/MNet.cpp index b06b628c..8dedf3db 100644 --- a/alliance/src/nero/src/MNet.cpp +++ b/alliance/src/nero/src/MNet.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MNet.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: MNet.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -161,7 +161,8 @@ CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net) throw (dup_t pNode = &coord.addnode (); } - pNode->data.owner = net; + pNode->data.owner = net; + pNode->data.obstacle = false; pNode->setid (ident); nodes.push_back (coord); diff --git a/alliance/src/nero/src/MNodes.cpp b/alliance/src/nero/src/MNodes.cpp index e69e283a..3976fd9d 100644 --- a/alliance/src/nero/src/MNodes.cpp +++ b/alliance/src/nero/src/MNodes.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MNodes.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: MNodes.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -121,7 +121,8 @@ void CMatrixNodes::obstacle (CRect &rect, int z) for (x = rect.x1; x <= X; x++) { for (y = rect.y1; y <= Y; y++) { - (*this)[ coord.set (x, y, z) ].data.obstacle = true; + if ( ! (*this)[ coord.set (x, y, z) ].terminal () ) + (*this)[ coord ].data.obstacle = true; } } } diff --git a/alliance/src/nero/src/MPower.cpp b/alliance/src/nero/src/MPower.cpp index 3520c352..dbc82318 100644 --- a/alliance/src/nero/src/MPower.cpp +++ b/alliance/src/nero/src/MPower.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MPower.cpp,v 1.1 2002/10/02 21:23:48 jpc Exp $ +// $Id: MPower.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -145,7 +145,7 @@ CPowers::CPowers ( CFig *fig // Check the segment width. if (seg->WIDTH != width) { cerr << hwarn (""); - cerr << " " << layer2a (layer) << " \"" << flatSeg.NAME + cerr << " " << layer2a (layer) << " \"" << seg->NAME <<"\" segment at (" << UNSCALE (seg->X1) << "," << UNSCALE (seg->Y1) << ") doesn't have the rigth witdth :" @@ -167,7 +167,7 @@ CPowers::CPowers ( CFig *fig if (flatSeg.Y1 != flatSeg.Y2) { cerr << hwarn (""); - cerr << " " << layer2a (layer) << " \"" << flatSeg.NAME + cerr << " " << layer2a (layer) << " \"" << seg->NAME <<"\" segment at (" << UNSCALE (seg->X1) << "," << UNSCALE (seg->Y1) << ") is not " << mess1; @@ -180,7 +180,7 @@ CPowers::CPowers ( CFig *fig if ( (cmpALU (alayer, CALU1) & F_CALU) && !fig->phfig.onslice (flatSeg.Y1)) { cerr << hwarn (""); - cerr << " " << layer2a (layer) << " \"" << flatSeg.NAME + cerr << " " << layer2a (layer) << " \"" << seg->NAME <<"\" segment at (" << UNSCALE (seg->X1) << "," << UNSCALE (seg->Y1) << ") is not on a slice boundary.\n"; @@ -201,7 +201,7 @@ CPowers::CPowers ( CFig *fig if (flatSeg.X1 != flatSeg.X2) { cerr << hwarn (""); - cerr << " " << layer2a (layer) << " \"" << flatSeg.NAME + cerr << " " << layer2a (layer) << " \"" << seg->NAME <<"\" segment at (" << UNSCALE (seg->X1) << "," << UNSCALE (seg->Y1) << ") is not " << mess1; @@ -224,7 +224,7 @@ CPowers::CPowers ( CFig *fig if (itLine != endLine) { if (itLine->second.type != segType) { cerr << herr (""); - cerr << " " << layer2a (layer) << " \"" << flatSeg.NAME + cerr << " " << layer2a (layer) << " \"" << seg->NAME <<"\" segment at (" << UNSCALE (seg->X1) << "," << UNSCALE (seg->Y1) << ") conflict with power line at" diff --git a/alliance/src/nero/src/RMBK.cpp b/alliance/src/nero/src/RMBK.cpp index e9ae57a2..80a43870 100644 --- a/alliance/src/nero/src/RMBK.cpp +++ b/alliance/src/nero/src/RMBK.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: RMBK.cpp,v 1.1 2002/10/02 21:23:48 jpc Exp $ +// $Id: RMBK.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -130,11 +130,12 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int rtype) } // Power grid. - if (( MBK::ISVDD (pSeg->NAME) - || MBK::ISVSS (pSeg->NAME)) && (pSeg->LAYER != MBK::CALU1)) { - rect->setSeg (*pSeg); + if (MBK::ISVDD (pSeg->NAME) || MBK::ISVSS (pSeg->NAME)) { + if (pSeg->LAYER != MBK::CALU1) { + rect->setSeg (*pSeg); - drgrid->nodes->obstacle (rect->grid, MBK::env.layer2z (pSeg->LAYER)); + drgrid->nodes->obstacle (rect->grid, MBK::env.layer2z (pSeg->LAYER)); + } continue; } @@ -390,7 +391,7 @@ void CRBox::mbksave (string &name) if (inseg && (pNextNet != pNet)) { // We are changing of segment owner. // Dump the current one. - if (seg.X1 < seg.X2) { + if (seg.X1 <= seg.X2) { // This is not a "dot" segment (i.e a VIA). fig->addphseg (seg); } @@ -421,7 +422,7 @@ void CRBox::mbksave (string &name) } else { if (inseg) { // Dump the current one. - if (seg.X1 < seg.X2) { + if (seg.X1 <= seg.X2) { // This is not a "dot" segment (i.e a VIA). fig->addphseg (seg); } @@ -455,7 +456,7 @@ void CRBox::mbksave (string &name) if (inseg && (pNextNet != pNet)) { // We are changing of segment owner. // Dump the current one. - if (seg.Y1 < seg.Y2) { + if (seg.Y1 <= seg.Y2) { // This is not a "dot" segment (i.e a VIA). fig->addphseg (seg); } @@ -500,7 +501,7 @@ void CRBox::mbksave (string &name) if (inseg) { // This segment touch the AB. - if (seg.Y1 < seg.Y2) { + if (seg.Y1 <= seg.Y2) { // This is not a "dot" segment (i.e a VIA). fig->addphseg (seg); } diff --git a/alliance/src/nero/src/UConst.cpp b/alliance/src/nero/src/UConst.cpp index ebef34c9..d195d21c 100644 --- a/alliance/src/nero/src/UConst.cpp +++ b/alliance/src/nero/src/UConst.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: UConst.cpp,v 1.1 2002/10/02 21:23:48 jpc Exp $ +// $Id: UConst.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -63,6 +63,7 @@ namespace D { const long _TRACK_WIDTH_ALU4 = 2; const long _TRACK_WIDTH_ALU5 = 2; const long _TRACK_WIDTH_ALU6 = 2; + const long _TRACK_WIDTH_ALU7 = 2; long X_GRID; long Y_GRID; @@ -75,6 +76,7 @@ namespace D { long TRACK_WIDTH_ALU4; long TRACK_WIDTH_ALU5; long TRACK_WIDTH_ALU6; + long TRACK_WIDTH_ALU7; diff --git a/alliance/src/nero/src/UDefs.h b/alliance/src/nero/src/UDefs.h index 31a6ab4a..feccc612 100644 --- a/alliance/src/nero/src/UDefs.h +++ b/alliance/src/nero/src/UDefs.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: UDefs.h,v 1.1 2002/10/02 21:23:48 jpc Exp $ +// $Id: UDefs.h,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -88,6 +88,7 @@ namespace D { extern const long _TRACK_WIDTH_ALU4; extern const long _TRACK_WIDTH_ALU5; extern const long _TRACK_WIDTH_ALU6; + extern const long _TRACK_WIDTH_ALU7; extern long X_GRID; extern long Y_GRID; @@ -100,6 +101,7 @@ namespace D { extern long TRACK_WIDTH_ALU4; extern long TRACK_WIDTH_ALU5; extern long TRACK_WIDTH_ALU6; + extern long TRACK_WIDTH_ALU7; } diff --git a/alliance/src/nero/src/nero.cpp b/alliance/src/nero/src/nero.cpp index 7268efa9..f5303f2b 100644 --- a/alliance/src/nero/src/nero.cpp +++ b/alliance/src/nero/src/nero.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: nero.cpp,v 1.1 2002/10/02 21:23:49 jpc Exp $ +// $Id: nero.cpp,v 1.2 2002/10/13 14:22:47 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -9,7 +9,7 @@ // | S i m p l e R o u t e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : alliance-support@asim.lip6.fr | +// | E-mail : alliance-users@asim.lip6.fr | // | ============================================================== | // | C++ Module : "./nero.cpp" | // | ************************************************************** | @@ -102,7 +102,16 @@ void emergency (void) string name = "emergency"; - if (crbox) crbox->mbksave (name); + try { + if (crbox) crbox->mbksave (name); + } + + catch (...) { + cerr << herr ("\n"); + cerr << " An exception have occurs in the emergency backup function itself !\n"; + cerr << " Sorry, can't save the partially routed figure.\n\n"; + cerr << " This is a bug. Please e-mail to \"alliance-users@asim.lip6.fr\".\n\n"; + } } @@ -233,8 +242,17 @@ int main (int argc, char *argv[]) exit (1); } + catch (reach_max_pri &e) { + cerr << "\n\n" + << " Negotiation algorithm failed, NeRo was unable to route this" + << " design.\n Maximum priority reached for net " + << "\"" << e.net->name << "\".\n\n"; + + emergency (); + exit (1); + } catch (except_done &e) { - cerr << e.what () << endl; + //cerr << e.what () << endl; emergency (); exit (1); @@ -244,7 +262,7 @@ int main (int argc, char *argv[]) catch (...) { cerr << herr ("\n"); cerr << " An unexpected exception have occurs.\n\n"; - cerr << " This is a bug. Please e-mail to \"alliance-support@asim.lip6.fr\".\n\n"; + cerr << " This is a bug. Please e-mail to \"alliance-users@asim.lip6.fr\".\n\n"; exit (1); }