From 89d90c5430d4462a45120b45af93c793e705e524 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 17 Oct 2002 21:57:27 +0000 Subject: [PATCH] * attila/src/MDRGrid.cpp, attila/src/MDefs.h, attila/src/MNet.cpp, attila/src/MPri.cpp, attila/src/RMBK.cpp : - Bug : la modification pour router les RAMs (segments de taille nulle) a introduit un bug : pleins de petits segments de taille nulle apparaissaient superposes aux segments normaux. C'etait produit par le balayage dans la direction perpendiculaire a la direction preferentielle quant elle rencontrait un segment. Conclusion : pour l'instant on ne peut pas router une RAM seule. - Bug : dans "::newaccess()" je ne verifiait pas si le noeud etait deja pris par un autre signal. J'espere que c'est ce qui provo- quait les SIGABRT (du a un auto-ecrasement du programme...) - Bug : Et les VIAs patate ! Prise en compte des VIAs des alimentations et transformation en obstacles. - L'espacement des pistes de routage ALU5 et superieures est desormait de 2 pitchs (10 lambdas) pour faire plaisir a druc. --- alliance/src/nero/src/AAstar.cpp | 12 +++++- alliance/src/nero/src/MDRGrid.cpp | 3 +- alliance/src/nero/src/MDefs.h | 5 ++- alliance/src/nero/src/MMBK.cpp | 46 ++++++++++++++++++++++- alliance/src/nero/src/MMBK.h | 14 ++++--- alliance/src/nero/src/MNet.cpp | 20 ++++++++-- alliance/src/nero/src/MPri.cpp | 45 ++++++++++++---------- alliance/src/nero/src/RMBK.cpp | 62 ++++++++++++++++++++++++++++--- alliance/src/nero/src/USys.cpp | 5 ++- 9 files changed, 172 insertions(+), 40 deletions(-) diff --git a/alliance/src/nero/src/AAstar.cpp b/alliance/src/nero/src/AAstar.cpp index 54fcefce..4c3b61d4 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.3 2002/10/15 14:35:36 jpc Exp $ +// $Id: AAstar.cpp,v 1.4 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -768,11 +768,13 @@ void CAStar::dump (void) iterations_reroute = 0; iterations_kind = &iterations_route; - //if (pNet->name == "c2 0") cdebug.on (); + //if (pNet->name == "acc_i_down") cdebug.on (); do { if (hysteresis) { + cdebug << "About to clear." << "\n"; clear (); + cdebug << "cleared." << "\n"; pri = 255 + (1 << increase++); @@ -783,12 +785,18 @@ void CAStar::dump (void) else pri = 0; + cdebug << "About to load net " << iterations_kind << "\n"; load (pNet, pri, expand); + cdebug << "loading done " << iterations_kind << "\n"; + cdebug << "About to route net " << iterations_kind << "\n"; routed = !search (); + cdebug << "routing done " << iterations_kind << "\n"; *iterations_kind += iterations; + cdebug << "mark 1.\n"; hysteresis = true; + cdebug << "mark 2.\n"; } while ((increase < 15) && !routed); if (increase >= 15) throw reach_max_pri (pNet); diff --git a/alliance/src/nero/src/MDRGrid.cpp b/alliance/src/nero/src/MDRGrid.cpp index 08c5b6f8..79664022 100644 --- a/alliance/src/nero/src/MDRGrid.cpp +++ b/alliance/src/nero/src/MDRGrid.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MDRGrid.cpp,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: MDRGrid.cpp,v 1.2 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -336,6 +336,7 @@ CDRGrid::CDRGrid (int x, int y, int z) XYZ = XY * Z; size = XY * (Z - 1); + nodes = new CMatrixNodes (this); pri = new CMatrixPri (this); diff --git a/alliance/src/nero/src/MDefs.h b/alliance/src/nero/src/MDefs.h index 627dac17..54f6ae91 100644 --- a/alliance/src/nero/src/MDefs.h +++ b/alliance/src/nero/src/MDefs.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MDefs.h,v 1.2 2002/10/15 14:35:37 jpc Exp $ +// $Id: MDefs.h,v 1.3 2002/10/17 21:57:27 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -518,7 +518,8 @@ public: CDRGrid::iterator &lowest (void); // Modifiers. - public: CNode *newaccess (int x, int y, int z, int ident, CNet *net) throw (dup_term); + public: CNode *newaccess (int x, int y, int z, int ident, CNet *net) + throw (dup_term, bad_grab); public: void newaccess (CRect &rect, int z, int ident, CNet *net); public: void lockalone (bool global=false); public: void setid (int ident); diff --git a/alliance/src/nero/src/MMBK.cpp b/alliance/src/nero/src/MMBK.cpp index b399ab71..f9675f60 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.2 2002/10/13 14:22:47 jpc Exp $ +// $Id: MMBK.cpp,v 1.3 2002/10/17 21:57:27 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -1105,6 +1105,50 @@ long cmpALU (char layer1, char layer2) + +// ------------------------------------------------------------------- +// Function : "topVIALayer()". + +char topVIALayer (char type) +{ + switch (type) { + case CONT_VIA: return (ALU1); break; + case CONT_VIA2: return (ALU2); break; + case CONT_VIA3: return (ALU3); break; + case CONT_VIA4: return (ALU4); break; + case CONT_VIA5: return (ALU5); break; + case CONT_VIA6: return (ALU6); break; + case CONT_VIA7: return (ALU7); break; + } + + return (ALU8); +} + + + + + +// ------------------------------------------------------------------- +// Function : "bottomVIALayer()". + +char bottomVIALayer (char type) +{ + switch (type) { + case CONT_VIA: return (ALU2); break; + case CONT_VIA2: return (ALU3); break; + case CONT_VIA3: return (ALU4); break; + case CONT_VIA4: return (ALU5); break; + case CONT_VIA5: return (ALU6); break; + case CONT_VIA6: return (ALU7); break; + case CONT_VIA7: return (ALU8); break; + } + + return (ALU9); +} + + + + // ------------------------------------------------------------------- // End of MBK namespace. diff --git a/alliance/src/nero/src/MMBK.h b/alliance/src/nero/src/MMBK.h index e77e42e6..512f9fff 100644 --- a/alliance/src/nero/src/MMBK.h +++ b/alliance/src/nero/src/MMBK.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MMBK.h,v 1.1 2002/10/02 21:23:47 jpc Exp $ +// $Id: MMBK.h,v 1.2 2002/10/17 21:57:27 jpc Exp $ // // /-----------------------------------------------------------------\ // | | @@ -89,11 +89,13 @@ namespace MBK { extern char *layer2a (char layer); extern bool isobs (char layer); - extern bool isALU(char layer); - extern bool isCALU(char layer); - extern char layer2ALU(char layer); - extern char layer2CALU(char layer); - extern long cmpALU(char layer1, char layer2); + extern bool isALU (char layer); + extern bool isCALU (char layer); + extern char layer2ALU (char layer); + extern char layer2CALU (char layer); + extern long cmpALU (char layer1, char layer2); + extern char topVIALayer (char type); + extern char bottomVIALayer (char type); diff --git a/alliance/src/nero/src/MNet.cpp b/alliance/src/nero/src/MNet.cpp index 8dedf3db..8dfdd4d1 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.2 2002/10/13 14:22:47 jpc Exp $ +// $Id: MNet.cpp,v 1.3 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -138,7 +138,8 @@ CDRGrid::iterator &CTerm::lowest (void) // ------------------------------------------------------------------- // Method : "CTerm::newaccess()". -CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net) throw (dup_term) +CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net) + throw (dup_term, bad_grab) { list::iterator itNode; CDRGrid::iterator coord; @@ -161,6 +162,19 @@ CNode *CTerm::newaccess (int x, int y, int z, int ident, CNet *net) throw (dup_t pNode = &coord.addnode (); } + // Check if the node has already been took by another terminal. + if (pNode->data.owner && (pNode->data.owner != net)) + throw bad_grab ( pNode->data.owner->terms[pNode->getid()]->name + , net->name + , coord.x() + , coord.y() + , coord.z() + , 0 + , pNode->data.pri + , pNode->terminal() + , pNode->data.ident + ); + pNode->data.owner = net; pNode->data.obstacle = false; pNode->setid (ident); @@ -189,7 +203,7 @@ void CTerm::newaccess (CRect &rect, int z, int ident, CNet *net) if (z > 0) return; // Only z=0 rectangles are stored (ALU1 is not in the grid). - //if ((rect.x1 != rect.x2) || (rect.y1 != rect.y2)) + // if ((rect.x1 != rect.x2) || (rect.y1 != rect.y2)) // No! Store all ALU1 rectangles. rects.push_back (rect); } diff --git a/alliance/src/nero/src/MPri.cpp b/alliance/src/nero/src/MPri.cpp index 7e395701..d9f6d79e 100644 --- a/alliance/src/nero/src/MPri.cpp +++ b/alliance/src/nero/src/MPri.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: MPri.cpp,v 1.2 2002/10/15 14:35:37 jpc Exp $ +// $Id: MPri.cpp,v 1.3 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -87,7 +87,7 @@ void CMatrixPri::findfree (int index, CNet &net) void CMatrixPri::clear (void) { - memset (_grid, (char)0, _drgrid->size); + memset (_grid, (char)0, (size_t)(_drgrid->size)); cleared = true; offset = 0; @@ -174,12 +174,14 @@ void CMatrixPri::load (CNet &net, bool global, int expand=0) // Enable z=1 (in case of global signal, no effet otherwise). if (coord.z() < _drgrid->Z - 1) (*this)[ coord.dz(1) ] = (char)1; - // Check for blocked upper nodes. - other = (*_drgrid->nodes)[coord].data.owner; - if ( (*_drgrid->nodes)[coord].data.obstacle - || ((other != NULL) && (other != &net)) ) { - cdebug << "Looking for an escape!\n" << "\n"; - findfree (coord, net); + if (global) { + // Check for blocked upper nodes. + other = (*_drgrid->nodes)[coord].data.owner; + if ( (*_drgrid->nodes)[coord].data.obstacle + || ((other != NULL) && (other != &net)) ) { + cdebug << "Looking for an escape!\n" << "\n"; + findfree (coord, net); + } } continue; @@ -188,12 +190,14 @@ void CMatrixPri::load (CNet &net, bool global, int expand=0) (*this)[ coord.dz(1) ] = nextPri (currentPri); nextBorder->push (new CDRGrid::iterator (coord)); - // Check for blocked upper nodes. - other = (*_drgrid->nodes)[coord].data.owner; - if ( (*_drgrid->nodes)[coord].data.obstacle - || ((other != NULL) && (other != &net)) ) { - cdebug << "Looking for an escape!\n" << "\n"; - findfree (coord, net); + if (global) { + // Check for blocked upper nodes. + other = (*_drgrid->nodes)[coord].data.owner; + if ( (*_drgrid->nodes)[coord].data.obstacle + || ((other != NULL) && (other != &net)) ) { + cdebug << "Looking for an escape!\n" << "\n"; + findfree (coord, net); + } } // Enable z=2 (in case of global signal, no effet otherwise). @@ -201,11 +205,13 @@ void CMatrixPri::load (CNet &net, bool global, int expand=0) // Look if the upper node is blocked, in that case expand the // allowed zone till a non-blocked node is found. - other = (*_drgrid->nodes)[coord].data.owner; - if ( (*_drgrid->nodes)[coord].data.obstacle - || ((other != NULL) && (other != &net)) ) { - cdebug << "Looking for an escape!\n" << "\n"; - findfree (coord, net); + if (global) { + other = (*_drgrid->nodes)[coord].data.owner; + if ( (*_drgrid->nodes)[coord].data.obstacle + || ((other != NULL) && (other != &net)) ) { + cdebug << "Looking for an escape!\n" << "\n"; + findfree (coord, net); + } } } } @@ -213,6 +219,7 @@ void CMatrixPri::load (CNet &net, bool global, int expand=0) // Set to one all the points inside the enclosing box. // (except those in the initial queues) + cdebug << _bb << "\n"; for (x = _bb.x1; x <= _bb.x2; x++) { for (y = _bb.y1; y <= _bb.y2; y++) { for (z = (global) ? 3 : 1; z < _drgrid->Z; z++) { diff --git a/alliance/src/nero/src/RMBK.cpp b/alliance/src/nero/src/RMBK.cpp index e155ab7d..da283a79 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.3 2002/10/15 14:35:37 jpc Exp $ +// $Id: RMBK.cpp,v 1.4 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -44,6 +44,7 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int rtype) MBK::phcon_list *pPhcon; MBK::losig_list *pSig; MBK::phseg_list *pSeg, flatSeg; + MBK::phvia_list *pVIA; MBK::phfig_list *pModel; MBK::CXRect *rect; MBK::CIns *pIns; @@ -173,6 +174,33 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int rtype) } + // Browse for obstacle VIAs. + for (pVIA = fig->phfig.fig->PHVIA; pVIA != NULL; pVIA = pVIA->NEXT) { + // Only power VIAs must be obstacles. + if ( (! MBK::ISVDD (pVIA->NAME)) && (! MBK::ISVSS (pVIA->NAME))) + continue; + + for (x = 0; x < 2; x++) { + switch (x) { + case 0: flatSeg.LAYER = MBK::topVIALayer (pVIA->TYPE); break; + case 1: flatSeg.LAYER = MBK::bottomVIALayer (pVIA->TYPE); break; + } + } + + if (flatSeg.LAYER == MBK::CALU1) continue; + + flatSeg.X1 = pVIA->XVIA - pVIA->DX / 2; + flatSeg.X2 = pVIA->XVIA - pVIA->DX / 2; + flatSeg.Y1 = pVIA->YVIA; + flatSeg.Y2 = pVIA->YVIA; + flatSeg.WIDTH = pVIA->DY; + + rect->setSeg (flatSeg); + + drgrid->nodes->obstacle (rect->grid, MBK::env.layer2z (flatSeg.LAYER)); + } + + // Browse layout for terminals. for (pPhcon = fig->phfig.fig->PHCON; pPhcon != NULL; pPhcon = pPhcon->NEXT) { if (fig->lofig.signals.find(pPhcon->NAME) == endSig) { @@ -343,6 +371,30 @@ void CRBox::mbkload (MBK::CFig *mbkfig, int z, int rtype) } } + // On routing level above ALU4, use only half of the tracks. + + // Vertical tracks. + for (zz = 4; zz < mZ; zz += 2) { + for (x = 2; x < mX; x += 2) { + for (y = 1; y < mY - 1; y++) { + node = &( coord.set(x,y,zz).node() ); + + if ( !node->terminal() ) node->data.obstacle = true; + } + } + } + + // Horizontal tracks. + for (zz = 5; zz < mZ; zz += 2) { + for (y = 2; y < mY; y += 2) { + for (x = 1; x < mX; x++) { + node = &( coord.set(x,y,zz).node() ); + + if ( !node->terminal() ) node->data.obstacle = true; + } + } + } + // This flag ensure that a figure has been successfully loaded. @@ -402,7 +454,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); } @@ -433,7 +485,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); } @@ -467,7 +519,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); } @@ -512,7 +564,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/USys.cpp b/alliance/src/nero/src/USys.cpp index 7f8d4ef6..19cf28dd 100644 --- a/alliance/src/nero/src/USys.cpp +++ b/alliance/src/nero/src/USys.cpp @@ -1,7 +1,7 @@ // -*- C++ -*- // -// $Id: USys.cpp,v 1.1 2002/10/02 21:23:49 jpc Exp $ +// $Id: USys.cpp,v 1.2 2002/10/17 21:57:27 jpc Exp $ // // /----------------------------------------------------------------\ // | | @@ -77,6 +77,7 @@ static void trap_sig(int aSig) case SIGFPE: case SIGBUS: case SIGSEGV: + case SIGABRT: emergency (); // Ouch !! This may result from a program bug. @@ -98,6 +99,7 @@ static void trap_sig(int aSig) cerr << "(core will be dumped).\n"; if ( (signal(SIGFPE , SIG_DFL) == SIG_ERR) || (signal(SIGBUS , SIG_DFL) == SIG_ERR) + || (signal(SIGABRT, SIG_DFL) == SIG_ERR) || (signal(SIGSEGV, SIG_DFL) == SIG_ERR)) exit (1); else { @@ -201,6 +203,7 @@ CInterrupt::CInterrupt (void) // Set the trap function for SIGFPE, SIGBUS and SIGSEGV signals. if ( (signal(SIGFPE , trap_sig) == SIG_ERR) || (signal(SIGBUS , trap_sig) == SIG_ERR) + || (signal(SIGABRT, trap_sig) == SIG_ERR) || (signal(SIGSEGV, trap_sig) == SIG_ERR)) trap_sig (SIGTFLT); }