diff --git a/alliance/src/ocr/src/include/ocrAstar.h b/alliance/src/ocr/src/include/ocrAstar.h index 01300ba0..f6e52dd9 100644 --- a/alliance/src/ocr/src/include/ocrAstar.h +++ b/alliance/src/ocr/src/include/ocrAstar.h @@ -4,8 +4,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:14 $ + $Date: 2002/04/25 13:41:27 $ $Log: ocrAstar.h,v $ + Revision 1.2 2002/04/25 13:41:27 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:14 hcl Ca roule. @@ -21,6 +24,9 @@ #define AS_K_SEG 0 #define AS_K_EQUI 1 +void init_Astar (ocrRoutingDataBase *db); +ocrNaturalInt dig_around (); + ocrNaturalInt find_path_astar (ocrRoutingParameters * p_param, ocrWRoutingGrid * p_grid, ocrNaturalInt xsource, diff --git a/alliance/src/ocr/src/include/ocrConnectorUtil.h b/alliance/src/ocr/src/include/ocrConnectorUtil.h index 88e2c916..dbb390e5 100644 --- a/alliance/src/ocr/src/include/ocrConnectorUtil.h +++ b/alliance/src/ocr/src/include/ocrConnectorUtil.h @@ -4,8 +4,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:14 $ + $Date: 2002/04/25 13:41:27 $ $Log: ocrConnectorUtil.h,v $ + Revision 1.2 2002/04/25 13:41:27 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:14 hcl Ca roule. @@ -70,4 +73,20 @@ deleteConVirInConVirList (ocrVirtualConnector ** io_VirConList, ocrNaturalInt isCriticalConnector (ocrWRoutingGrid * i_pGrid, ocrConnector * i_pCon); + +void +markSegmentAsFree(ocrRoutingDataBase * i_pDataBase, ocrSignal * i_pSignal, + ocrNaturalInt INDEX); + +void +unMarkSegmentAsFree(ocrRoutingDataBase * i_pDataBase, + ocrSignal * i_pSignal, ocrNaturalInt INDEX); + +void +protectVC(ocrRoutingDataBase * i_pDataBase, + ocrVirtualConnector * i_pVirCon); +void +unProtectVC(ocrRoutingDataBase * i_pDataBase, + ocrVirtualConnector * i_pVirCon); +void countFreeVC(ocrRoutingDataBase * i_pDataBase); #endif /* _OCRCONNECTORUTIL_H_ */ diff --git a/alliance/src/ocr/src/include/ocrWRoutingDataBase.h b/alliance/src/ocr/src/include/ocrWRoutingDataBase.h index c2b67c79..d7395ab6 100644 --- a/alliance/src/ocr/src/include/ocrWRoutingDataBase.h +++ b/alliance/src/ocr/src/include/ocrWRoutingDataBase.h @@ -4,8 +4,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:16 $ + $Date: 2002/04/25 13:41:27 $ $Log: ocrWRoutingDataBase.h,v $ + Revision 1.2 2002/04/25 13:41:27 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:16 hcl Ca roule. @@ -102,7 +105,7 @@ typedef struct ocrWSegment /* list of pointer used for backtracking */ struct ocrWSegment *ROOT; /* temporarily chaining */ - struct ocrWSegment *AUX; + //struct ocrWSegment *AUX; /* Pointer used for chaining equi */ struct ocrWSegment *NEXT; @@ -189,9 +192,10 @@ typedef struct ocrSignal ocrVirtualConnector *VIA; ocrVirtualConnector *GLOBAL; - ocrNaturalShort WIN; ocrNaturalInt NB_CON; ocrNaturalInt TYPE; + ocrNaturalShort WIN; + ocrNaturalShort HARD; ocrNaturalShort PRIORITY; ocrNaturalShort INTEXT; ocrConnector *CON_LIST; diff --git a/alliance/src/ocr/src/rout/findNPointsPath.c b/alliance/src/ocr/src/rout/findNPointsPath.c index 43a3bc88..883d63de 100644 --- a/alliance/src/ocr/src/rout/findNPointsPath.c +++ b/alliance/src/ocr/src/rout/findNPointsPath.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/20 13:25:50 $ + $Date: 2002/04/25 13:41:31 $ $Log: findNPointsPath.c,v $ + Revision 1.3 2002/04/25 13:41:31 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.2 2002/03/20 13:25:50 hcl SymX bug. @@ -86,7 +89,7 @@ #include "ocrAstar.h" static char *res_id = - "$Id: findNPointsPath.c,v 1.2 2002/03/20 13:25:50 hcl Exp $"; + "$Id: findNPointsPath.c,v 1.3 2002/04/25 13:41:31 hcl Exp $"; #define MAX_HT 500 @@ -717,7 +720,7 @@ ocrNaturalInt biroute (ocrRoutingParameters *i_pParam, } break; case 1: - display (LEVEL, DEBUG, "\no Launching A*\n"); + /*display (LEVEL, DEBUG, "\no Launching A*\n");*/ if (l_pCon2) { l_uLength = find_path_astar(i_pParam, i_pGrid, l_pCon1->CON->X, @@ -817,8 +820,8 @@ findPathNPoints(ocrRoutingParameters * i_pParam, l_bOk = chooseInternalConnector(i_pGrid, con1, con2, 0); if (l_bOk != OCR_OK) { - display(LEVEL, DEBUG, "%s\n%s%ld\n", - "o No more connectors :", " unable to route ", i_pSignal->INDEX); + display(LEVEL, DEBUG, "%s\n%s%s\n", + "o No more connectors :", " unable to route ", i_pSignal->NAME); return OCRNATURALINT_MAX; } diff --git a/alliance/src/ocr/src/rout/ocrAstar.cpp b/alliance/src/ocr/src/rout/ocrAstar.cpp index e47557fd..9a637f6b 100644 --- a/alliance/src/ocr/src/rout/ocrAstar.cpp +++ b/alliance/src/ocr/src/rout/ocrAstar.cpp @@ -1,39 +1,47 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/04/10 12:56:54 $ + $Date: 2002/04/25 13:41:32 $ $Log: ocrAstar.cpp,v $ - Revision 1.2 2002/04/10 12:56:54 hcl - bouh + Revision 1.3 2002/04/25 13:41:32 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). ### -------------------------------------------------- ### */ extern "C" { -#include -#include -#include "mut.h" -#include "mlo.h" -#include "mlu.h" -#include "mph.h" -#include "mpu.h" -#include "ocr.h" -#include "ocrUtil.h" -#include "ocrWRoutingDataBase.h" -#include "ocrWindow.h" -#include "mbk_tree.h" -#include "ocrWRoutingUtil.h" -#include "ocrWRouting.h" -#include "ocrNpoints.h" -#include "display.h" -#include "ocrAstar.h" + #include + #include + #include "mut.h" + #include "mlo.h" + #include "mlu.h" + #include "mph.h" + #include "mpu.h" + #include "ocr.h" + #include "ocrUtil.h" + #include "ocrWRoutingDataBase.h" + #include "ocrWindow.h" + #include "mbk_tree.h" + #include "ocrWRoutingUtil.h" + #include "ocrWRouting.h" + #include "ocrNpoints.h" + #include "ocrConnectorUtil.h" + #include "display.h" + #include "ocrAstar.h" } #include #include +ocrNaturalInt reRoute ( + ocrRoutingDataBase * i_pDataBase, + ocrRoutingParameters * i_pParam, + ocrSignal * i_pSignal + ) +; + using namespace std; extern ocrOption *g_pOption; @@ -67,6 +75,8 @@ struct is_a_better_seg { typedef set ocrSegmentKeySet; typedef set ocrSegmentAdrSet; /*********************************************************************/ +#define FINDNPATH findPathNPoints + #define TAG_UNDEF 0 #define TAG_KEEP 1 #define TAG_CLEAN 2 @@ -90,6 +100,8 @@ ocrNaturalInt CUR_SIG_INDEX = 0; ocrWSegment *ze_best = NULL; ocrWSegment *ze_target = NULL; +ocrNaturalInt ripup = 1; + //ocrNaturalInt (*kost)(ocrWSegment *, ocrWSegment *); /*********************************************************************/ @@ -387,13 +399,14 @@ ocrWSegment *explore_equi (ocrWSegment *segment_source, ocrWSegment *segment_tar assert (segment_source != segment_target); /*display (LEVEL, DEBUG, "d starting exploration\n");*/ +debut: segment_source->COST = 0; segment_source->H = eval_equi (segment_source, segment_target); segment_source->HCOST = segment_source->H + 1000000; segment_source->TAG = TAG_TERRA; segment_source->ROOT = NULL; - segment_source->AUX = NULL; + //segment_source->AUX = NULL; ze_best = segment_source; terra_incognita.insert(segment_source); @@ -484,8 +497,15 @@ ocrWSegment *explore_equi (ocrWSegment *segment_source, ocrWSegment *segment_tar } /* while */ /* Failed */ + + /* dig the path to the target */ clean_tag (); + if (dig_around ()) { + return NULL; + } + clean_tag (); + goto debut; /*display (LEVEL, DEBUG, "d exploration failed\n");*/ @@ -518,13 +538,16 @@ ocrSignal *findSignal(ocrNaturalInt i_uIndex) (suspect->TAG != TAG_TERRA) \ ) \ { \ - suspect->TAG = TAG_TERRA; \ - suspect->COST = ze_best->COST + kost (ze_best, suspect); \ - suspect->H = eval_equi (suspect, ze_target); \ - suspects.insert (suspect); \ + if (((findSignal (suspect->SIGNAL_INDEX))->HARD) < 2) \ + { \ + suspect->TAG = TAG_TERRA; \ + suspect->COST = ze_best->COST + kost (ze_best, suspect); \ + suspect->H = eval_equi (suspect, ze_target); \ + suspects.insert (suspect); \ + } \ } -void dig_around () { +ocrNaturalInt dig_around () { ocrWSegment *suspect; ocrSignal *victime; @@ -578,6 +601,7 @@ void dig_around () { } /* end for i */ if (suspects.empty()) { + return 1; abort (); } @@ -585,17 +609,18 @@ void dig_around () { victime = findSignal((*suspects.begin())->SIGNAL_INDEX); suspects.erase (suspects.begin()); - deleteEquipotentielle(param, grid, victime); - if (victime) { + deleteEquipotentielle(param, grid, victime); ocr_db->RIPUP = addchain (ocr_db->RIPUP, (void *) victime); deleteEquipotentielle(param, grid, victime); victime->SEGMENT = NULL; victime->ROUTED = 0; ocr_db->NB_ROUTED--; - //unMarkSegmentAsFree(ocr_db, victime, victime->INDEX); + unMarkSegmentAsFree(ocr_db, victime, victime->INDEX); + display (LEVEL, VVERB, "\no rip up signal %s", victime->NAME); + countFreeVC (ocr_db); + goto fin; } - //countFreeVC (ocr_db); /* detruire equipotentielle victime @@ -604,9 +629,11 @@ void dig_around () { */ } while ( !(suspects.empty()) ); +fin: + clean_tag_set (suspects); - return; + return 0; } @@ -747,6 +774,61 @@ ocrNaturalInt check_path (ocrSignal *i_pSignal) { return dist; } +/* reroutage */ +ocrNaturalInt re_route () { + ocrSignal *l_pSignal; + ocrNaturalInt l_uLength; + ocrNaturalInt l_uReturnValue = 1; + chain_list *l_pSignalList; + ocrConnector *l_pCon; + + + + ripup = 0; + + // tant qu'il reste des signaux à re router + l_pSignalList = ocr_db->RIPUP; + while (l_pSignalList) { + + l_pSignal = (ocrSignal *) l_pSignalList->DATA; + +// fprintf (stdout, "reRoute : Routage du signal %ld \n", + // l_pSignal->INDEX); + markSegmentAsFree(ocr_db, l_pSignal, l_pSignal->INDEX); + for (l_pCon = l_pSignal->CON_LIST; l_pCon; l_pCon = l_pCon->NEXT) { + if (l_pCon->critVC) { + unProtectVC(ocr_db, l_pCon->critVC); + } + } + l_uLength = FINDNPATH(param, ocr_db->GRID, + l_pSignal, + NULL); + + if (l_uLength == OCRNATURALINT_MAX) { + l_uReturnValue = 0; + display(LEVEL, VVERB, "o Echec reRoute %ld\n", l_pSignal->INDEX); + l_pSignal->ROUTED = 2; + + deleteEquipotentielle(param, ocr_db->GRID, l_pSignal); + + l_pSignal->SEGMENT = NULL; + + ocr_db->NB_UNROUTED++; + l_pSignal->PRIORITY = ocr_db->NB_IT+1; + } else { + ocr_db->NB_ROUTED++; + l_pSignal->ROUTED = 1; + } + unMarkSegmentAsFree(ocr_db, l_pSignal, l_pSignal->INDEX); + + l_pSignalList = l_pSignalList->NEXT; + } + + freechain(ocr_db->RIPUP); + ocr_db->RIPUP = NULL; + ripup = 1; + return l_uReturnValue; +} ocrNaturalInt find_path_astar (ocrRoutingParameters * p_param, ocrWRoutingGrid * p_grid, @@ -809,6 +891,9 @@ ocrNaturalInt find_path_astar (ocrRoutingParameters * p_param, if ((segment_source != segment_dest) && (!isObstructed(segment_source))) { switch (mode) { case AS_K_SEG: //path = explore (segment_source, segment_dest); + segment_dest->SIGNAL_INDEX = CUR_SIG_INDEX; + path = explore_equi (segment_source, segment_dest); + segment_dest->SIGNAL_INDEX = WSEGMENT_FREE; break; case AS_K_EQUI: assert (i_pSignal->SEGMENT); //ze_best = NULL; @@ -850,6 +935,9 @@ ocrNaturalInt find_path_astar (ocrRoutingParameters * p_param, i_pSignal ); + //unMarkSegmentAsFree(ocr_db, i_pSignal, i_pSignal->INDEX); + + //re_route (); /*assert (((check_dist = check_path (i_pSignal)), dist == check_dist));*/ diff --git a/alliance/src/ocr/src/rout/ocrRouter.c b/alliance/src/ocr/src/rout/ocrRouter.c index 1a7a72dc..3fbde82f 100644 --- a/alliance/src/ocr/src/rout/ocrRouter.c +++ b/alliance/src/ocr/src/rout/ocrRouter.c @@ -1,10 +1,10 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/04/10 12:56:55 $ + $Date: 2002/04/25 13:41:32 $ $Log: ocrRouter.c,v $ - Revision 1.5 2002/04/10 12:56:55 hcl - bouh + Revision 1.6 2002/04/25 13:41:32 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). Revision 1.4 2002/04/03 09:52:19 hcl A little bit of C++. @@ -191,116 +191,6 @@ ocrSignal *findSignal(ocrRoutingDataBase * i_pDataBase, return NULL; } -/* protection des connecteurs isoles */ -void -protectVC(ocrRoutingDataBase * i_pDataBase, - ocrVirtualConnector * i_pVirCon) -{ - ocrWSegment *l_pSeg; - ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; - int z = 0; - - //if (i_pVirCon->Z > 0) - // z = i_pVirCon->Z - 1; - z = i_pVirCon->Z; - - //l_pSeg = getWSegmentCV (l_pGrid, i_pVirCon); - - //for (z = i_pVirCon->Z ; z <= i_pDataBase->NB_OF_LAYERS ; z++) { - - l_pSeg = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y, z); - if (l_pSeg->SIGNAL_INDEX != WSEGMENT_FREE) - return; - if (getWSegDirection(i_pDataBase->PARAM, l_pSeg) == ocrHorizontal) - l_pSeg = - splitWSegment(i_pDataBase->PARAM, l_pGrid, l_pSeg, - i_pVirCon->X, i_pVirCon->X, WSEGMENT_OBSTACLE); - else - l_pSeg = - splitWSegment(i_pDataBase->PARAM, l_pGrid, l_pSeg, - i_pVirCon->Y, i_pVirCon->Y, WSEGMENT_OBSTACLE); - - //} - - - return; -} - - -void -unProtectVC(ocrRoutingDataBase * i_pDataBase, - ocrVirtualConnector * i_pVirCon) -{ - ocrWSegment *l_pSeg, *seg1, *seg2; - ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; - int z = 0, i; - - //if (i_pVirCon->Z > 0) - // z = i_pVirCon->Z - 1; - z = i_pVirCon->Z; - - //for (z = i_pVirCon->Z ; z <= i_pDataBase->NB_OF_LAYERS ; z++) { - //l_pSeg = getWSegmentCV (l_pGrid, i_pVirCon); - l_pSeg = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y, z); - - - if (l_pSeg->SIGNAL_INDEX == WSEGMENT_OBSTACLE) { - //deleteSegment (i_pDataBase->PARAM, l_pGrid, l_pSeg); - l_pSeg->SIGNAL_INDEX = WSEGMENT_FREE; - - // Fusion des segments libres - //mergeWSegment (i_pDataBase, l_pGrid, l_pSeg); - //return; - if (getWSegDirection(i_pDataBase->PARAM, l_pSeg) == ocrHorizontal) { - //printf("deprotect (%ld,%ld,%d):", 5 * i_pVirCon->X, 5 * i_pVirCon->Y, z); - seg1 = getWSegment(l_pGrid, i_pVirCon->X - 1, i_pVirCon->Y, z); - if (seg1->SIGNAL_INDEX == WSEGMENT_FREE) { - l_pSeg->P_MIN = seg1->P_MIN; - //printf ("G%ld;", seg1->P_MIN * 5); - //mbkfree (seg1); - //freeWSegment (seg1); - } - - seg2 = getWSegment(l_pGrid, i_pVirCon->X + 1, i_pVirCon->Y, z); - if (seg2->SIGNAL_INDEX == WSEGMENT_FREE) { - l_pSeg->P_MAX = seg2->P_MAX; - //printf ("D%ld.", seg2->P_MAX * 5); - //freeWSegment (seg2); - //freeWSegment (seg2); - //mbkfree (seg2); - } - for (i = l_pSeg->P_MIN; i <= l_pSeg->P_MAX; i++) - setWGrid(l_pGrid, l_pSeg, i, i_pVirCon->Y, z); - //printf ("\n"); - } else { - seg1 = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y - 1, z); - if (seg1->SIGNAL_INDEX == WSEGMENT_FREE) { - l_pSeg->P_MIN = seg1->P_MIN; - //mbkfree (seg1); - //freeWSegment (seg1); - } - - seg2 = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y + 1, z); - if (seg2->SIGNAL_INDEX == WSEGMENT_FREE) { - l_pSeg->P_MAX = seg2->P_MAX; - //freeWSegment (seg2); - //mbkfree (seg2); - } - for (i = l_pSeg->P_MIN; i <= l_pSeg->P_MAX; i++) - setWGrid(l_pGrid, l_pSeg, i_pVirCon->X, i, z); - - - } - - - } else { - //printf ("non - de - protection !\n"); - } - //} - - return; -} - void noCritVC(ocrRoutingDataBase * i_pDataBase) { @@ -323,61 +213,6 @@ void noCritVC(ocrRoutingDataBase * i_pDataBase) return; } -void countFreeVC(ocrRoutingDataBase * i_pDataBase) -{ - - ocrNaturalInt i; - ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; - - // tous les sigs - for (i = 0; i < i_pDataBase->NB_SIGNAL; i++) { - ocrConnector *l_pCon; - - if (i_pDataBase->SIGNAL[i]->ROUTED - || i_pDataBase->SIGNAL[i]->NICHT_ZU_ROUTIEREN) - continue; - - // tous les cons - for (l_pCon = i_pDataBase->SIGNAL[i]->CON_LIST; l_pCon; - l_pCon = l_pCon->NEXT) { - ocrVirtualConnector *l_pVirCon; - ocrWSegment *l_pSeg; - if (l_pCon->critVC) { - protectVC(i_pDataBase, l_pCon->critVC); - //continue; - goto fin_lpcon; - } - // tous les vircons - l_pCon->NB_VC = 0; - for (l_pVirCon = l_pCon->VIR_CON_LIST; l_pVirCon; - l_pVirCon = l_pVirCon->NEXT) { - if (l_pVirCon->Z > 0) - goto fin_lpcon; - //continue; - // l_pSeg = getWSegment (l_pGrid, l_pVirCon->X, l_pVirCon->Y, l_pVirCon->Z - 1); - //else - l_pSeg = getWSegmentCV(l_pGrid, l_pVirCon); - if (l_pSeg->SIGNAL_INDEX == WSEGMENT_FREE) { - l_pCon->critVC = l_pVirCon; - (l_pCon->NB_VC)++; - } - } - - if (l_pCon->NB_VC == 1) { - protectVC(i_pDataBase, l_pCon->critVC); - } else { - l_pCon->critVC = NULL; - } - fin_lpcon: - } - } -// maj con->NB_VC - - - return; -} - - /** * route les signaux dans l'ordre : @@ -398,7 +233,8 @@ reRoute(ocrRoutingDataBase * i_pDataBase, chain_list *l_pSignalList; ocrConnector *l_pCon; - + if (i_pSignal == NULL) + goto skip; // routage du signal désigné par i_pSignal // fprintf (stdout, "reRoute : Routage du signal %ld \n", // i_pSignal->INDEX); @@ -417,9 +253,11 @@ reRoute(ocrRoutingDataBase * i_pDataBase, i_pSignal->ROUTED = 1; + display(LEVEL, VVERB, "o rerouted %s\n", i_pSignal->NAME); + } else { l_uReturnValue = 0; - display(LEVEL, VVERB, "o Echec reRoute %ld\n", i_pSignal->INDEX); + display(LEVEL, VVERB, "o Failed to reroute %s\n", i_pSignal->NAME); i_pSignal->ROUTED = 2; deleteEquipotentielle(i_pParam, i_pDataBase->GRID, i_pSignal); @@ -430,11 +268,17 @@ reRoute(ocrRoutingDataBase * i_pDataBase, } unMarkSegmentAsFree(i_pDataBase, i_pSignal, i_pSignal->INDEX); // XXX +skip: + // tant qu'il reste des signaux à re router l_pSignalList = i_pDataBase->RIPUP; while (l_pSignalList) { l_pSignal = (ocrSignal *) l_pSignalList->DATA; + if (l_pSignal->ROUTED == 1) { + l_pSignalList = l_pSignalList->NEXT; + continue; + } // fprintf (stdout, "reRoute : Routage du signal %ld \n", // l_pSignal->INDEX); @@ -444,30 +288,35 @@ reRoute(ocrRoutingDataBase * i_pDataBase, unProtectVC(i_pDataBase, l_pCon->critVC); } } + display(LEVEL, VVERB, "o Rerouting %s\n", l_pSignal->NAME); l_uLength = FINDNPATH(i_pParam, i_pDataBase->GRID, l_pSignal, - i_pDataBase->WINDOWS[i_pSignal->WIN]); + i_pDataBase->WINDOWS[l_pSignal->WIN]); + + l_pSignalList = i_pDataBase->RIPUP; if (l_uLength == OCRNATURALINT_MAX) { l_uReturnValue = 0; - display(LEVEL, VVERB, "o Echec reRoute %ld\n", l_pSignal->INDEX); + display(LEVEL, VVERB, "\n--- failed to reroute %s\n", l_pSignal->NAME); l_pSignal->ROUTED = 2; - deleteEquipotentielle(i_pParam, i_pDataBase->GRID, l_pSignal); + ripUp2 (i_pDataBase, i_pParam, l_pSignal); + //deleteEquipotentielle(i_pParam, i_pDataBase->GRID, l_pSignal); - l_pSignal->SEGMENT = NULL; + //l_pSignal->SEGMENT = NULL; - i_pDataBase->NB_UNROUTED++; + //i_pDataBase->NB_UNROUTED++; l_pSignal->PRIORITY = i_pDataBase->NB_IT+1; - //i_pSignal->PRIORITY = i_pDataBase->NB_IT; -// l_pSignal->PRIORITY ++; } else { i_pDataBase->NB_ROUTED++; l_pSignal->ROUTED = 1; + l_pSignal->HARD ++; + display(LEVEL, VVERB, "+++ %s rerouted\n", l_pSignal->NAME); } unMarkSegmentAsFree(i_pDataBase, l_pSignal, l_pSignal->INDEX); // XXX + countFreeVC(i_pDataBase); - l_pSignalList = l_pSignalList->NEXT; + //l_pSignalList = l_pSignalList->NEXT; } freechain(i_pDataBase->RIPUP); @@ -576,7 +425,7 @@ ripUp2(ocrRoutingDataBase * i_pDataBase, l_pVirCon)-> SIGNAL_INDEX); if (l_pSignal) - if (l_pSignal != i_pSignal) { + if ( (l_pSignal != i_pSignal) && (!(l_pSignal->HARD)) ) { // ajoute le signal dans la liste à re-router. i_pDataBase->RIPUP = addchain(i_pDataBase->RIPUP, (void *) l_pSignal); @@ -1091,6 +940,7 @@ routingWindow(ocrRoutingDataBase * i_pDataBase, phfig_list * i_pPhFig) l_pSignal->ROUTED = 1; i_pDataBase->NB_ROUTED++; display(LEVEL, VVERB, "\t\t\tok\n"); + //return 1; // XXX for debug... } else { @@ -1136,6 +986,7 @@ routingWindow(ocrRoutingDataBase * i_pDataBase, phfig_list * i_pPhFig) // LOOP pour reperer les connecteurs isoles. countFreeVC(i_pDataBase); } + reRoute(i_pDataBase, i_pDataBase->PARAM, NULL); display(LEVEL, VERBOSE, "o It = %ld Sig = %ld Failures : %ld\n", i_pDataBase->NB_IT, diff --git a/alliance/src/ocr/src/seg/ocrWPlaneLabeling.c b/alliance/src/ocr/src/seg/ocrWPlaneLabeling.c index 85778cea..5b79339c 100644 --- a/alliance/src/ocr/src/seg/ocrWPlaneLabeling.c +++ b/alliance/src/ocr/src/seg/ocrWPlaneLabeling.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:22 $ + $Date: 2002/04/25 13:41:33 $ $Log: ocrWPlaneLabeling.c,v $ + Revision 1.2 2002/04/25 13:41:33 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:22 hcl Ca roule. @@ -59,7 +62,7 @@ #define OFFSET(x) ( (ocrNaturalInt) (x)->KEY ) static char *res_id = - "$Id: ocrWPlaneLabeling.c,v 1.1 2002/03/15 14:37:22 hcl Exp $"; + "$Id: ocrWPlaneLabeling.c,v 1.2 2002/04/25 13:41:33 hcl Exp $"; typedef struct ocrSubWSegment { ocrWSegment *SEGMENT; @@ -614,7 +617,9 @@ processNextDeltaAgain(ocrRoutingParameters * param, **/ static inline void labelPlaneProcess(ocrRoutingParameters * param, ocrWRoutingGrid * grid, ocrNaturalInt xtarget, ocrNaturalInt ytarget, rbtree * labeling_status, ocrNaturalInt event_line, ocrNaturalInt labeling_line, // ligne courante du scheduler - ocrNaturalInt delta_sce, ocrNaturalInt delta_dest, ocrNaturalInt plane_dest, // z + ocrNaturalInt delta_sce, + ocrNaturalInt delta_dest, + ocrNaturalInt plane_dest, // z chain_list ** labeled_segment_list, chain_list ** next_delta_sub_segment_list, diff --git a/alliance/src/ocr/src/seg/ocrWRoutingUtil.c b/alliance/src/ocr/src/seg/ocrWRoutingUtil.c index 1888abaa..fb3d9ffa 100644 --- a/alliance/src/ocr/src/seg/ocrWRoutingUtil.c +++ b/alliance/src/ocr/src/seg/ocrWRoutingUtil.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/20 13:25:56 $ + $Date: 2002/04/25 13:41:33 $ $Log: ocrWRoutingUtil.c,v $ + Revision 1.3 2002/04/25 13:41:33 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.2 2002/03/20 13:25:56 hcl SymX bug. @@ -466,16 +469,39 @@ void add_phseg_to_grid(ocrRoutingDataBase * i_pDataBase, ((!(layer % 2) && (i_pDataBase->PARAM->EVEN_LAYERS_DIRECTION == ocrVertical))))) { + ocrNaturalInt j; // Layer Horizontal + for (i = y1; i <= y2; i++) { #ifdef OCR_DEBUG printf("Adding horiz X=%d; Y1=%d; layer=%d\n", x1, i, layer); #endif - seg = getWSegment(i_pDataBase->GRID, x1, i, layer); - seg = - splitWSegment(i_pDataBase->PARAM, i_pDataBase->GRID, seg, - x1, x2, WSEGMENT_OBSTACLE); + if (mode) { // CALU + seg = getWSegment(i_pDataBase->GRID, x1, i, layer); + seg = splitWSegment + ( + i_pDataBase->PARAM, + i_pDataBase->GRID, + seg, x1, x2, + WSEGMENT_OBSTACLE + ) + ; + } else { // TALU + + for (j = x1; j <= x2; j++) { + seg = getWSegment(i_pDataBase->GRID, j, i, layer); + if (seg->SIGNAL_INDEX == WSEGMENT_FREE) + seg = splitWSegment + ( + i_pDataBase->PARAM, + i_pDataBase->GRID, + seg, j, j, + WSEGMENT_OBSTACLE + ) + ; + } + } //if (mode) { // CALU @@ -485,15 +511,24 @@ void add_phseg_to_grid(ocrRoutingDataBase * i_pDataBase, } else { + ocrNaturalInt j; // Layer Vertical for (i = x1; i <= x2; i++) { #ifdef OCR_DEBUG printf("Adding vert X=%d; Y1=%d; layer=%d\n", i, y1, layer); #endif - seg = getWSegment(i_pDataBase->GRID, i, y1, layer); - seg = - splitWSegment(i_pDataBase->PARAM, i_pDataBase->GRID, seg, - y1, y2, WSEGMENT_OBSTACLE); + for (j = y1; j <= y2; j++) { + seg = getWSegment(i_pDataBase->GRID, i, j, layer); + if (seg->SIGNAL_INDEX == WSEGMENT_FREE) + seg = splitWSegment + ( + i_pDataBase->PARAM, + i_pDataBase->GRID, + seg, j, j, + WSEGMENT_OBSTACLE + ) + ; + } //if (mode) { // CALU // setWSegmentName (seg, i_pPhSeg->NAME); @@ -743,7 +778,7 @@ ocrWSegment *createWSegment(ocrNaturalInt offset, // obstacle list //pt->OBSTACLE = NULL; - pt->AUX = NULL; + //pt->AUX = NULL; pt->NEXT = NULL; pt->ROOT = NULL; diff --git a/alliance/src/ocr/src/util/ocrConnectorUtil.c b/alliance/src/ocr/src/util/ocrConnectorUtil.c index 07a7ba42..5f54e3b2 100644 --- a/alliance/src/ocr/src/util/ocrConnectorUtil.c +++ b/alliance/src/ocr/src/util/ocrConnectorUtil.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/20 13:25:57 $ + $Date: 2002/04/25 13:41:34 $ $Log: ocrConnectorUtil.c,v $ + Revision 1.3 2002/04/25 13:41:34 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.2 2002/03/20 13:25:57 hcl SymX bug. @@ -101,6 +104,61 @@ distBetween2VirCon(ocrVirtualConnector * l_pVirCon1, // +void countFreeVC(ocrRoutingDataBase * i_pDataBase) +{ + + ocrNaturalInt i; + ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; + + // tous les sigs + for (i = 0; i < i_pDataBase->NB_SIGNAL; i++) { + ocrConnector *l_pCon; + + if (i_pDataBase->SIGNAL[i]->ROUTED + || i_pDataBase->SIGNAL[i]->NICHT_ZU_ROUTIEREN) + continue; + + // tous les cons + for (l_pCon = i_pDataBase->SIGNAL[i]->CON_LIST; l_pCon; + l_pCon = l_pCon->NEXT) { + ocrVirtualConnector *l_pVirCon; + ocrWSegment *l_pSeg; + if (l_pCon->critVC) { + protectVC(i_pDataBase, l_pCon->critVC); + //continue; + goto fin_lpcon; + } + // tous les vircons + l_pCon->NB_VC = 0; + for (l_pVirCon = l_pCon->VIR_CON_LIST; l_pVirCon; + l_pVirCon = l_pVirCon->NEXT) { + if (l_pVirCon->Z > 0) + goto fin_lpcon; + //continue; + // l_pSeg = getWSegment (l_pGrid, l_pVirCon->X, l_pVirCon->Y, l_pVirCon->Z - 1); + //else + l_pSeg = getWSegmentCV(l_pGrid, l_pVirCon); + if (l_pSeg->SIGNAL_INDEX == WSEGMENT_FREE) { + l_pCon->critVC = l_pVirCon; + (l_pCon->NB_VC)++; + } + } + + if (l_pCon->NB_VC == 1) { + protectVC(i_pDataBase, l_pCon->critVC); + } else { + l_pCon->critVC = NULL; + } + fin_lpcon: + } + } +// maj con->NB_VC + + + return; +} + + /** @@ -451,10 +509,14 @@ chooseInternalConnector(ocrWRoutingGrid * i_pGrid, i_pCon2->CON->TAG++; // printf ("con : %ld con2 : %ld\n", l_uCon, l_uCon2); - if (!l_uCon) + if (!l_uCon) { + display (LEVEL, DEBUG, "\n failed for CON1 : %s\n", i_pCon->NAME); return OCR_BAD_CON1; - if (!l_uCon2) + } + if (!l_uCon2) { + display (LEVEL, DEBUG, "\n failed for CON2 : %s\n", i_pCon2->NAME); return OCR_BAD_CON2; + } return OCR_OK; } @@ -489,11 +551,121 @@ chooseInternalConnector2(ocrWRoutingGrid * i_pGrid, + + +/* protection des connecteurs isoles */ +void +protectVC(ocrRoutingDataBase * i_pDataBase, + ocrVirtualConnector * i_pVirCon) +{ + ocrWSegment *l_pSeg; + ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; + int z = 0; + + //if (i_pVirCon->Z > 0) + // z = i_pVirCon->Z - 1; + z = i_pVirCon->Z; + + //l_pSeg = getWSegmentCV (l_pGrid, i_pVirCon); + + //for (z = i_pVirCon->Z ; z <= i_pDataBase->NB_OF_LAYERS ; z++) { + + l_pSeg = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y, z); + if (l_pSeg->SIGNAL_INDEX != WSEGMENT_FREE) + return; + if (getWSegDirection(i_pDataBase->PARAM, l_pSeg) == ocrHorizontal) + l_pSeg = + splitWSegment(i_pDataBase->PARAM, l_pGrid, l_pSeg, + i_pVirCon->X, i_pVirCon->X, WSEGMENT_OBSTACLE); + else + l_pSeg = + splitWSegment(i_pDataBase->PARAM, l_pGrid, l_pSeg, + i_pVirCon->Y, i_pVirCon->Y, WSEGMENT_OBSTACLE); + + //} + + + return; +} + + +void +unProtectVC(ocrRoutingDataBase * i_pDataBase, + ocrVirtualConnector * i_pVirCon) +{ + ocrWSegment *l_pSeg, *seg1, *seg2; + ocrWRoutingGrid *l_pGrid = i_pDataBase->GRID; + int z = 0, i; + + //if (i_pVirCon->Z > 0) + // z = i_pVirCon->Z - 1; + z = i_pVirCon->Z; + + //for (z = i_pVirCon->Z ; z <= i_pDataBase->NB_OF_LAYERS ; z++) { + //l_pSeg = getWSegmentCV (l_pGrid, i_pVirCon); + l_pSeg = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y, z); + + + if (l_pSeg->SIGNAL_INDEX == WSEGMENT_OBSTACLE) { + //deleteSegment (i_pDataBase->PARAM, l_pGrid, l_pSeg); + l_pSeg->SIGNAL_INDEX = WSEGMENT_FREE; + + // Fusion des segments libres + //mergeWSegment (i_pDataBase, l_pGrid, l_pSeg); + //return; + if (getWSegDirection(i_pDataBase->PARAM, l_pSeg) == ocrHorizontal) { + //printf("deprotect (%ld,%ld,%d):", 5 * i_pVirCon->X, 5 * i_pVirCon->Y, z); + seg1 = getWSegment(l_pGrid, i_pVirCon->X - 1, i_pVirCon->Y, z); + if (seg1->SIGNAL_INDEX == WSEGMENT_FREE) { + l_pSeg->P_MIN = seg1->P_MIN; + //printf ("G%ld;", seg1->P_MIN * 5); + //mbkfree (seg1); + //freeWSegment (seg1); + } + + seg2 = getWSegment(l_pGrid, i_pVirCon->X + 1, i_pVirCon->Y, z); + if (seg2->SIGNAL_INDEX == WSEGMENT_FREE) { + l_pSeg->P_MAX = seg2->P_MAX; + //printf ("D%ld.", seg2->P_MAX * 5); + //freeWSegment (seg2); + //freeWSegment (seg2); + //mbkfree (seg2); + } + for (i = l_pSeg->P_MIN; i <= l_pSeg->P_MAX; i++) + setWGrid(l_pGrid, l_pSeg, i, i_pVirCon->Y, z); + //printf ("\n"); + } else { + seg1 = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y - 1, z); + if (seg1->SIGNAL_INDEX == WSEGMENT_FREE) { + l_pSeg->P_MIN = seg1->P_MIN; + //mbkfree (seg1); + //freeWSegment (seg1); + } + + seg2 = getWSegment(l_pGrid, i_pVirCon->X, i_pVirCon->Y + 1, z); + if (seg2->SIGNAL_INDEX == WSEGMENT_FREE) { + l_pSeg->P_MAX = seg2->P_MAX; + //freeWSegment (seg2); + //mbkfree (seg2); + } + for (i = l_pSeg->P_MIN; i <= l_pSeg->P_MAX; i++) + setWGrid(l_pGrid, l_pSeg, i_pVirCon->X, i, z); + + + } + + + } else { + //printf ("non - de - protection !\n"); + } + //} + + return; +} + + /* Marquage de segments */ -// XXX XXX XXX XXX XXX XXX XXX XXX - - void markSegmentAsFree(ocrRoutingDataBase * i_pDataBase, ocrSignal * i_pSignal, ocrNaturalInt INDEX) diff --git a/alliance/src/ocr/src/util/ocrDataBaseUtil.c b/alliance/src/ocr/src/util/ocrDataBaseUtil.c index dabc171d..35b28bca 100644 --- a/alliance/src/ocr/src/util/ocrDataBaseUtil.c +++ b/alliance/src/ocr/src/util/ocrDataBaseUtil.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:26 $ + $Date: 2002/04/25 13:41:34 $ $Log: ocrDataBaseUtil.c,v $ + Revision 1.2 2002/04/25 13:41:34 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:26 hcl Ca roule. @@ -41,7 +44,7 @@ #include "display.h" static char *res_id = - "$Id: ocrDataBaseUtil.c,v 1.1 2002/03/15 14:37:26 hcl Exp $"; + "$Id: ocrDataBaseUtil.c,v 1.2 2002/04/25 13:41:34 hcl Exp $"; extern ocrOption *g_pOption; #define LEVEL (g_pOption->LEVEL) @@ -299,6 +302,8 @@ ocrSignal *createSignal(losig_list * i_pLoSig) l_pSignal->VIA = NULL; l_pSignal->GLOBAL = NULL; + l_pSignal->HARD = 0; + l_pSignal->WIN = 0; l_pSignal->TYPE = 0; diff --git a/alliance/src/ocr/src/util/ocrSignalUtil.c b/alliance/src/ocr/src/util/ocrSignalUtil.c index d1dda97c..2a341bcb 100644 --- a/alliance/src/ocr/src/util/ocrSignalUtil.c +++ b/alliance/src/ocr/src/util/ocrSignalUtil.c @@ -1,8 +1,11 @@ /* ### -------------------------------------------------- ### $Author: hcl $ - $Date: 2002/03/15 14:37:27 $ + $Date: 2002/04/25 13:41:34 $ $Log: ocrSignalUtil.c,v $ + Revision 1.2 2002/04/25 13:41:34 hcl + New ripup/reroute loop, bug-kill (CALU&TALU). + Revision 1.1 2002/03/15 14:37:27 hcl Ca roule. @@ -44,7 +47,7 @@ #include "ocrConnectorUtil.h" static char *res_id = - "$Id: ocrSignalUtil.c,v 1.1 2002/03/15 14:37:27 hcl Exp $"; + "$Id: ocrSignalUtil.c,v 1.2 2002/04/25 13:41:34 hcl Exp $"; extern ocrOption *g_pOption; @@ -136,11 +139,10 @@ int funcPriorityRandom(const void *a, const void *b) int funcPriorityCon(const void *a, const void *b) { if ((*(ocrSignal **) b)->PRIORITY == (*(ocrSignal **) a)->PRIORITY) - return (*(ocrSignal **) b)->NB_CON - (*(ocrSignal **) a)->NB_CON; - //return (*(ocrSignal **) a)->NB_CON - (*(ocrSignal **) b)->NB_CON; + //return (*(ocrSignal **) b)->NB_CON - (*(ocrSignal **) a)->NB_CON; + return (*(ocrSignal **) a)->NB_CON - (*(ocrSignal **) b)->NB_CON; else - return (*(ocrSignal **) b)->PRIORITY - - (*(ocrSignal **) a)->PRIORITY; + return (*(ocrSignal **) b)->PRIORITY - (*(ocrSignal **) a)->PRIORITY; } /**