From 8c5fdd12d583000bc4af49c5f9e91aee99bd36ae Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 4 Dec 2010 15:24:43 +0000 Subject: [PATCH] * ./knik: - Change: Restore Inspector support. --- knik/src/Edge.cpp | 10 +++++----- knik/src/Graph.cpp | 25 +++++++++++++------------ knik/src/KnikEngine.cpp | 5 +++-- knik/src/flute-2.4/src/flute.cpp | 5 +++++ knik/src/flute-2.4/src/knik/flute.h | 9 ++------- knik/src/knik/Graph.h | 11 +++++------ knik/src/knik/KnikEngine.h | 1 + 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/knik/src/Edge.cpp b/knik/src/Edge.cpp index 646fd563..2028caf1 100644 --- a/knik/src/Edge.cpp +++ b/knik/src/Edge.cpp @@ -88,13 +88,13 @@ void Edge::increaseCapacity ( int capacity ) else _capacity += capacity; - if ( _capacity < 2 ) _capacity = 0; +//if ( _capacity < 2 ) _capacity = 0; + + // cerr << "Increase Edge Capacity " << _from->getPosition() + // << " to " << _to->getPosition() << ":" << _capacity << endl; if ( _capacity == 0 ) - cinfo << Warning("%s has reached NULL capacity.",getString(this).c_str()) << endl; - -//cerr << "Edge " << _from->getPosition() -// << " to " << _to->getPosition() << ":" << _capacity << endl; + ltrace(300) << Warning("%s has reached NULL capacity.",getString(this).c_str()) << endl; } void Edge::incOccupancy () diff --git a/knik/src/Graph.cpp b/knik/src/Graph.cpp index 272ddd58..ca430531 100644 --- a/knik/src/Graph.cpp +++ b/knik/src/Graph.cpp @@ -1,5 +1,6 @@ #include +#include #include "hurricane/Warning.h" #include "hurricane/Name.h" @@ -1505,14 +1506,14 @@ void Graph::Monotonic() //#endif } -FTree Graph::createFluteTree() -// *************************** +FTree* Graph::createFluteTree() +// **************************** { int accuracy = 3; // accuracy for flute (by default 3) int d = _vertexes_to_route.size(); // degre du net, ie nombre de routingPads int *x = new int [d]; // x coordinates of the vertexes int *y = new int [d]; // y coordinates of the vertexes - FTree flutetree; // the flute Steiner Tree + FTree* flutetree = new FTree; // the flute Steiner Tree //cout << "Net : " << _working_net << endl; // scans _working_net to find x,y coordinates and fill x, y and d @@ -1529,7 +1530,7 @@ FTree Graph::createFluteTree() assert ( d == cpt ); - flutetree = flute ( d, x, y, accuracy ); + *flutetree = flute ( d, x, y, accuracy ); //printtree ( flutetree ); //plottree ( flutetree ); //cout << endl; @@ -1548,16 +1549,16 @@ void Graph::UpdateEstimateCongestion ( bool create ) return; } //cerr << "Running FLUTE for net : " << _working_net << endl; - FTree flutetree = createFluteTree(); + auto_ptr flutetree ( createFluteTree() ); //parcours des branches du FTree pour créer la congestion estimée - for ( int i = 0 ; i < 2*flutetree.deg-2 ; i++ ) { -// int sourceX = flutetree.branch[i].x; -// int sourceY = flutetree.branch[i].y; -// int targetX = flutetree.branch[flutetree.branch[i].n].x; -// int targetY = flutetree.branch[flutetree.branch[i].n].y; - Vertex* source = getVertex ( flutetree.branch[i].x , flutetree.branch[i].y ); - Vertex* target = getVertex ( flutetree.branch[flutetree.branch[i].n].x, flutetree.branch[flutetree.branch[i].n].y ); + for ( int i = 0 ; i < 2*flutetree->deg-2 ; i++ ) { +// int sourceX = flutetree->branch[i].x; +// int sourceY = flutetree->branch[i].y; +// int targetX = flutetree->branch[flutetree->branch[i].n].x; +// int targetY = flutetree->branch[flutetree->branch[i].n].y; + Vertex* source = getVertex ( flutetree->branch[i].x , flutetree->branch[i].y ); + Vertex* target = getVertex ( flutetree->branch[flutetree->branch[i].n].x, flutetree->branch[flutetree->branch[i].n].y ); assert ( source ); assert ( target ); //Si source et target alignée -> ajoute 1 a toutes les edges sur le chemin diff --git a/knik/src/KnikEngine.cpp b/knik/src/KnikEngine.cpp index 72110439..8284bec4 100644 --- a/knik/src/KnikEngine.cpp +++ b/knik/src/KnikEngine.cpp @@ -74,6 +74,7 @@ #include "knik/RoutingGrid.h" #include "knik/NetExtension.h" #include "knik/KnikEngine.h" +#include "knik/flute.h" #define MAX_RUNTIME 86400 #define MAX_ITERATION UINT_MAX @@ -207,7 +208,7 @@ void KnikEngine::initGlobalRouting() if ( !_routingGraph ) { _timer.resetIncrease(); _timer.start(); - cmess2 << " o create routing graph" << endl; + cmess2 << " o Create routing graph." << endl; Cell* cell = getCell(); _routingGraph = Graph::create ( cell, _routingGrid, _benchMode, _useSegments ); cmess2 << " - Graph size: " << _routingGraph->getXSize() @@ -216,7 +217,7 @@ void KnikEngine::initGlobalRouting() printTime(); } else { - cmess2 << "routingGraph already exists !" << endl; + cmess2 << " - Reusing pre-existing graph." << endl; } // 20/02/09 tout ce qui suit dans la fonction etait inclu dans le if(!_routingGraph) on le sépare pour pouvoir diff --git a/knik/src/flute-2.4/src/flute.cpp b/knik/src/flute-2.4/src/flute.cpp index 932e54ee..b9dddf3b 100644 --- a/knik/src/flute-2.4/src/flute.cpp +++ b/knik/src/flute-2.4/src/flute.cpp @@ -17,6 +17,11 @@ using CRL::AllianceFramework; #include #include "knik/flute.h" +#define max(x,y) ((x)>(y)?(x):(y)) +#define min(x,y) ((x)<(y)?(x):(y)) +#define abs(x) ((x)<0?(-x):(x)) +#define ADIFF(x,y) ((x)>(y)?(x-y):(y-x)) // Absolute difference + #if D<=7 #define MGROUP 5040/4 // Max. # of groups, 7! = 5040 #define MPOWV 15 // Max. # of POWVs per group diff --git a/knik/src/flute-2.4/src/knik/flute.h b/knik/src/flute-2.4/src/knik/flute.h index 100d0dda..5de45c5f 100644 --- a/knik/src/flute-2.4/src/knik/flute.h +++ b/knik/src/flute-2.4/src/knik/flute.h @@ -20,12 +20,12 @@ typedef struct int n; // index of neighbor } Branch; -typedef struct +struct FTree { int deg; // degree DTYPE length; // total wirelength Branch *branch; // array of tree branches -} FTree; +}; // Major functions extern void readLUT(); @@ -63,9 +63,4 @@ extern FTree flutes_RDP(int d, DTYPE xs[], DTYPE ys[], int s[], int acc); #define flutes_LMD(d, xs, ys, s, acc) \ (d<=D ? flutes_LD(d, xs, ys, s) : flutes_MD(d, xs, ys, s, acc)) -#define max(x,y) ((x)>(y)?(x):(y)) -#define min(x,y) ((x)<(y)?(x):(y)) -#define abs(x) ((x)<0?(-x):(x)) -#define ADIFF(x,y) ((x)>(y)?(x-y):(y-x)) // Absolute difference - #endif diff --git a/knik/src/knik/Graph.h b/knik/src/knik/Graph.h index 9f39c66b..8abc8b4a 100644 --- a/knik/src/knik/Graph.h +++ b/knik/src/knik/Graph.h @@ -16,7 +16,8 @@ #include "knik/SlicingTree.h" #include "knik/RoutingGrid.h" -#include "knik/flute.h" +//#include "knik/flute.h" +struct FTree; namespace Knik { @@ -137,7 +138,7 @@ namespace Knik { int initRouting ( Net* net ); void Dijkstra (); void Monotonic (); - FTree createFluteTree (); + FTree* createFluteTree (); void CleanRoutingState (); void UpdateEstimateCongestion ( bool create = false ); void UpdateMaxEstimateCongestion (); @@ -208,8 +209,6 @@ namespace Knik { } // namespace Knik +INSPECTOR_P_SUPPORT(Knik::Graph); + #endif - - - - diff --git a/knik/src/knik/KnikEngine.h b/knik/src/knik/KnikEngine.h index e167a18a..a5d3f9c8 100644 --- a/knik/src/knik/KnikEngine.h +++ b/knik/src/knik/KnikEngine.h @@ -187,6 +187,7 @@ typedef vector NetVector; // for ispd07 reload void createRoutingGraph(); void addRoutingPadToGraph ( Hurricane::RoutingPad* routingPad ); + inline Graph* getRoutingGraph() { return _routingGraph; } Vertex* getVertex ( Point ); Vertex* getVertex ( DbU::Unit x, DbU::Unit y ); Edge* getEdge ( unsigned col1, unsigned row1, unsigned col2, unsigned row2 );