diff --git a/bootstrap/build.conf b/bootstrap/build.conf index 61acbdd1..2b97f90c 100644 --- a/bootstrap/build.conf +++ b/bootstrap/build.conf @@ -14,10 +14,10 @@ projects = [ #, "nimbus" #, "metis" #, "mauka" + , "katabatic" , "coloquinte" , "etesian" , "knik" - , "katabatic" , "kite" , "equinox" , "solstice" diff --git a/coloquinte/src/coloquinte/rough_legalizers.hxx b/coloquinte/src/coloquinte/rough_legalizers.hxx index 67128513..ce524932 100644 --- a/coloquinte/src/coloquinte/rough_legalizers.hxx +++ b/coloquinte/src/coloquinte/rough_legalizers.hxx @@ -18,6 +18,13 @@ */ namespace coloquinte{ + +struct density_limit{ + box box_; + float_t density_; // from 0.0 for a macro to 1.0 if it does nothing +}; +typedef std::vector density_restrictions; + namespace gp{ class region_distribution{ @@ -38,11 +45,6 @@ class region_distribution{ // Specifies a maximum density of movable cells per usable area // Representing either a macroblock or a routing congestion - struct density_limit{ - box box_; - float_t density_; // from 0.0 for a macro to 1.0 if it does nothing - }; - private: struct region; diff --git a/coloquinte/src/rough_legalizers.cxx b/coloquinte/src/rough_legalizers.cxx index bc5f8aa7..ff6e33da 100644 --- a/coloquinte/src/rough_legalizers.cxx +++ b/coloquinte/src/rough_legalizers.cxx @@ -117,6 +117,7 @@ std::vector region_distribution::prepare_regions(in // The regions' capacities std::vector region_caps(x_cnt * y_cnt, 0); + // Find the limits of the regions std::vector x_reg_lims(x_cnt+1), y_reg_lims(y_cnt+1); for(index_t i=0; i<=x_cnt; ++i){ x_reg_lims[i] = placement_area_.x_min_ + ( ((std::int64_t) (placement_area_.x_max_ - placement_area_.x_min_)) * i ) / x_cnt; diff --git a/etesian/CMakeLists.txt b/etesian/CMakeLists.txt index d71cf930..6c2bdff8 100644 --- a/etesian/CMakeLists.txt +++ b/etesian/CMakeLists.txt @@ -22,6 +22,7 @@ find_package(VLSISAPD REQUIRED) find_package(LEFDEF REQUIRED) find_package(HURRICANE REQUIRED) + find_package(KATABATIC REQUIRED) find_package(CORIOLIS REQUIRED) find_package(COLOQUINTE REQUIRED) find_package(Libexecinfo REQUIRED) diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index 12bc0d32..5a80dedf 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -39,6 +39,8 @@ #include "hurricane/RoutingPad.h" #include "hurricane/UpdateSession.h" #include "hurricane/viewer/CellWidget.h" +#include "katabatic/GCellGrid.h" +#include "katabatic/KatabaticEngine.h" #include "crlcore/Utilities.h" #include "crlcore/Measures.h" #include "crlcore/AllianceFramework.h" @@ -601,6 +603,46 @@ namespace Etesian { _progressReport2(" [--]" ); } + void EtesianEngine::feedRoutingBack(){ + using namespace Katabatic; + /* + * If routing information is present, use it to + * * artificially expand the areas given to coloquinte + * * add placement dentity constraints + */ + DbU::Unit pitch = getPitch(); + const float densityThreshold = 0.9; + + KatabaticEngine* routingEngine = KatabaticEngine::get( getCell() ); + if(routingEngine == NULL) + throw Error("No routing information was found when performing routing-driven placement\n"); + + GCellGrid * grid = routingEngine->getGCellGrid(); + // Get information about the GCells + // Create different densities + + _densityLimits.clear(); + forEach(GCell*, gc, grid->getGCells()){ + float density = (*gc)->getMaxHVDensity(); + if(density >= densityThreshold){ + + coloquinte::density_limit cur; + cur.box_ = coloquinte::box( + (*gc)->getX() / pitch, + (*gc)->getXMax() / pitch, + (*gc)->getY() / pitch, + (*gc)->getYMax() / pitch + ); + cur.density_ = densityThreshold/density; + _densityLimits.push_back(cur); + } + } + + // TODO: Careful to keep the densities high enough + // Will just fail later if the densities are too high + + // Expand areas: TODO + } void EtesianEngine::globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options ){ using namespace coloquinte::gp; @@ -616,8 +658,8 @@ namespace Etesian { do{ // Create a legalizer and bipartition it until we have sufficient precision auto legalizer = (options & ForceUniformDensity) != 0 ? - region_distribution::uniform_density_distribution(_surface, _circuit, _placementLB) - : region_distribution::full_density_distribution(_surface, _circuit, _placementLB); + region_distribution::uniform_density_distribution (_surface, _circuit, _placementLB, _densityLimits) + : region_distribution::full_density_distribution (_surface, _circuit, _placementLB, _densityLimits); // Until there is about 10 standard cells per region for ( int quad_part=0 ; _circuit.cell_cnt() > (index_t)(10 * (1 << (quad_part*2))) ; ++quad_part ) { legalizer.x_bipartition(); diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index 26668954..0fdfee53 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -69,16 +69,24 @@ namespace Etesian { inline double getAspectRatio () const; inline const FeedCells& getFeedCells () const; inline void setCellWidget ( Hurricane::CellWidget* ); + void startMeasures (); void stopMeasures (); void printMeasures ( std::string ) const; + void setDefaultAb (); void resetPlacement (); void toColoquinte (); + void preplace (); + void roughLegalize ( float minDisruption ); + void completeLegalize (); void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 ); void detailedPlace ( int iterations, int effort, unsigned options=0 ); + void feedRoutingBack (); + void place (); + inline void useFeed ( Cell* ); size_t findYSpin (); void addFeeds (); @@ -99,6 +107,7 @@ namespace Etesian { coloquinte::netlist _circuit; coloquinte::placement_t _placementLB; coloquinte::placement_t _placementUB; + coloquinte::density_restrictions _densityLimits; std::unordered_map _cellsToIds; std::vector _idsToInsts; Hurricane::CellWidget* _cellWidget; diff --git a/katabatic/src/GCell.cpp b/katabatic/src/GCell.cpp index 8b5cd1cc..53d44527 100644 --- a/katabatic/src/GCell.cpp +++ b/katabatic/src/GCell.cpp @@ -543,6 +543,33 @@ namespace Katabatic { return (float)( _box.getWidth () / Session::getPitch(2) + 1 ); } + float GCell::getAverageHVDensity () const + { + // Average density of all layers mixeds together. + float density = 0.0; + for ( size_t i=0 ; i<_depth ; i++ ) + density += _densities[i]; + return density / ((float)(_depth-_pinDepth)); + } + + float GCell::getMaxHVDensity () const + { + // Maximum density between all horizontal vs. all vertical layers. + size_t hplanes = 0; + size_t vplanes = 0; + float hdensity = 0.0; + float vdensity = 0.0; + + for ( size_t i=_pinDepth ; i<_depth ; i++ ) { + if ( i%2 ) { hdensity += _densities[i]; ++hplanes; } + else { vdensity += _densities[i]; ++vplanes; } + } + + if (hplanes) hdensity /= hplanes; + if (vplanes) vdensity /= vplanes; + + return std::max(hdensity, vdensity); + } float GCell::getDensity ( unsigned int flags ) const { @@ -551,29 +578,9 @@ namespace Katabatic { float density = 0.0; if (getGCellGrid()->getDensityMode() == GCellGrid::AverageHVDensity) { - // Average density of all layers mixeds together. - for ( size_t i=0 ; i<_depth ; i++ ) - density += _densities[i]; - - //density = roundfp ( density/((float)(_depth-_pinDepth)) ); - density = density/((float)(_depth-_pinDepth)); + density = getAverageHVDensity(); } else if (getGCellGrid()->getDensityMode() == GCellGrid::MaxHVDensity) { - // Maximum density between all horizontal vs. all vertical layers. - size_t hplanes = 0; - size_t vplanes = 0; - float hdensity = 0.0; - float vdensity = 0.0; - - for ( size_t i=_pinDepth ; i<_depth ; i++ ) { - if ( i%2 ) { hdensity += _densities[i]; ++hplanes; } - else { vdensity += _densities[i]; ++vplanes; } - } - - if (hplanes) hdensity /= hplanes; - if (vplanes) vdensity /= vplanes; - - //density = roundfp ( (hdensity > vdensity) ? hdensity : vdensity ); - density = (hdensity > vdensity) ? hdensity : vdensity; + density = getMaxHVDensity(); } else if (getGCellGrid()->getDensityMode() == GCellGrid::AverageHDensity) { // Average density between all horizontal layers. size_t hplanes = 0; diff --git a/katabatic/src/katabatic/GCell.h b/katabatic/src/katabatic/GCell.h index 9797696c..09b462ae 100644 --- a/katabatic/src/katabatic/GCell.h +++ b/katabatic/src/katabatic/GCell.h @@ -140,6 +140,8 @@ namespace Katabatic { float getHCapacity () const; float getVCapacity () const; float getDensity ( unsigned int flags=0 ) const; + float getAverageHVDensity () const; + float getMaxHVDensity () const; inline float getCDensity ( unsigned int flags=0 ) const; inline float getWDensity ( unsigned int depth, unsigned int flags=0 ) const; inline DbU::Unit getBlockage ( unsigned int depth ) const;