* ./mauka:

- New: Insert Feeds after placing (id:"mauka.insertFeeds", default to true).
This commit is contained in:
Jean-Paul Chaput 2010-06-25 08:50:50 +00:00
parent c50c480263
commit 96adbdc538
6 changed files with 222 additions and 57 deletions

View File

@ -68,9 +68,11 @@
***************************************************************************/
#include "hurricane/UpdateSession.h"
#include "hurricane/Interval.h"
#include "hurricane/Net.h"
#include "hurricane/Cell.h"
#include "crlcore/ToolBox.h"
#include "crlcore/AllianceFramework.h"
#include "mauka/MaukaEngine.h"
#include "mauka/Surface.h"
@ -81,7 +83,138 @@
namespace {
using namespace Mauka;
using namespace std;
using namespace Mauka;
using namespace Hurricane;
using namespace CRL;
class RowFeed {
public:
RowFeed ( MaukaEngine*, const Box& bb );
inline const Box& getBox () const;
void mergeInstanceSpan ( DbU::Unit source, DbU::Unit target );
void insertTieChunk ( DbU::Unit xmin
, DbU::Unit xmax
, DbU::Unit y
, const Transformation::Orientation& );
void insertFeeds ( Cell*, const Transformation::Orientation& );
private:
MaukaEngine* _mauka;
Box _boundingBox;
list<Interval> _instanceSpans;
};
RowFeed::RowFeed ( MaukaEngine* mauka, const Box& bb )
: _mauka (mauka)
, _boundingBox (bb)
, _instanceSpans()
{ }
inline const Box& RowFeed::getBox () const { return _boundingBox; }
void RowFeed::mergeInstanceSpan ( DbU::Unit source, DbU::Unit target )
{
Interval spanMerge ( source, target );
list<Interval>::iterator imerge = _instanceSpans.end();
list<Interval>::iterator ispan = _instanceSpans.begin();
while ( ispan != _instanceSpans.end() ) {
if ( spanMerge.getVMax() < (*ispan).getVMin() ) break;
if ( spanMerge.intersect(*ispan) ) {
if ( imerge == _instanceSpans.end() ) {
imerge = ispan;
(*imerge).merge ( spanMerge );
} else {
(*imerge).merge ( *ispan );
ispan = _instanceSpans.erase ( ispan );
continue;
}
}
ispan++;
}
if ( imerge == _instanceSpans.end() ) {
_instanceSpans.insert ( ispan, spanMerge );
}
}
void RowFeed::insertTieChunk ( DbU::Unit xmin
, DbU::Unit xmax
, DbU::Unit y
, const Transformation::Orientation& orientation )
{
Cell* feed = _mauka->getFeedCells().getBiggestFeed();
if ( feed == NULL ) {
cerr << Error("No feed has been registered, ignoring.") << endl;
}
DbU::Unit feedWidth = feed->getAbutmentBox().getWidth();
DbU::Unit xtie = xmin;
while ( true ) {
if ( xtie >= xmax ) break;
if ( xtie+feedWidth > xmax ) {
// Feed is too big, try to find a smaller one.
int pitch = (int)((xmax-xtie) / _mauka->getPitch());
for ( ; pitch > 0 ; --pitch ) {
feed = _mauka->getFeedCells().getFeed ( pitch );
feedWidth = feed->getAbutmentBox().getWidth();
if ( feed != NULL ) break;
}
if ( feed == NULL ) break;
}
// cerr << "Inserted " << feed
// << " " << insName.str() << " @" << DbU::getLambda(xtie)
// << "," << DbU::getLambda(y)
// << " in " << _mauka->getCell() << endl;
Instance::create ( _mauka->getCell()
, _mauka->getFeedCells().getNewFeedName().c_str()
, feed
, getTransformation(feed->getAbutmentBox(),xtie,y,orientation)
, Instance::PlacementStatus::PLACED
);
xtie += feedWidth;
}
}
void RowFeed::insertFeeds ( Cell* cell, const Transformation::Orientation& orientation )
{
list<Interval>::iterator ispan = _instanceSpans.begin();
DbU::Unit minFeed = _boundingBox.getXMin();
DbU::Unit maxFeed;
if ( ispan == _instanceSpans.end() ) {
maxFeed = _boundingBox.getXMax();
insertTieChunk ( minFeed, maxFeed, _boundingBox.getYMin(), orientation );
return;
}
maxFeed = (*ispan).getVMin();
insertTieChunk ( minFeed, maxFeed, _boundingBox.getYMin(), orientation );
while ( ispan != _instanceSpans.end() ) {
minFeed = (*ispan).getVMax();
if ( ++ispan != _instanceSpans.end() )
maxFeed = (*ispan).getVMin();
else
maxFeed = _boundingBox.getXMax();
insertTieChunk ( minFeed, maxFeed, _boundingBox.getYMin(), orientation );
}
}
class CompareInstancePosition
{
@ -225,11 +358,21 @@ BBPlacer::BBPlacer(MaukaEngine* mauka)
void BBPlacer::Save()
{
bool insertFeeds = _mauka->doInsertFeeds();
UpdateSession::open();
bool autoMaterialize = not Go::autoMaterializationIsDisabled();
Go::enableAutoMaterialization();
for (unsigned i = 0; i < _subRowInstances.size(); i++)
{
SubRow* subRow = _subRowVector[i];
bool rowOrientation = subRow->getRow()->getOrientation();
RowFeed rowFeed ( _mauka, subRow->getBox() );
Transformation::Orientation orientation
= (subRow->getRow()->getOrientation()) ? Transformation::Orientation::MY
: Transformation::Orientation::ID;
for (unsigned j = 0; j < _subRowInstances[i].size(); j++)
{
@ -238,19 +381,16 @@ void BBPlacer::Save()
DbU::Unit y = _instanceY[instanceId];
Occurrence instanceOccurrence = _mauka->_instanceOccurrencesVector[instanceId];
Instance* instance = static_cast<Instance*>(instanceOccurrence.getEntity());
Transformation::Orientation orientation;
if (rowOrientation)
orientation = Transformation::Orientation::ID;
else
orientation = Transformation::Orientation::MY;
if ( insertFeeds )
rowFeed.mergeInstanceSpan ( x, x+instance->getAbutmentBox().getWidth() );
Box masterABox = instance->getMasterCell()->getAbutmentBox();
Transformation instanceTransformation = getTransformation(masterABox
, x
, y
, orientation);
Transformation instanceTransformation = getTransformation(masterABox, x, y, orientation);
#if 0
cerr << masterABox.getXMin() << "," << masterABox.getYMin()
<< masterABox.getXMax() << "," << masterABox.getYMax() << endl;
<< masterABox.getXMax() << "," << masterABox.getYMax() << endl;
cerr << x << "," << y << endl;
cerr << instanceTransformation << endl;
cerr << "occ transfo : " << instanceOccurrence.getPath().getTransformation() << endl;
@ -260,8 +400,13 @@ void BBPlacer::Save()
instance->setPlacementStatus(Instance::PlacementStatus::PLACED);
//setPlacementStatusRecursivelyToPlaced(instance);
}
if ( insertFeeds )
rowFeed.insertFeeds ( _mauka->getCell(), orientation );
}
if ( autoMaterialize ) Go::enableAutoMaterialization ();
else Go::disableAutoMaterialization ();
UpdateSession::close();
}

View File

@ -7,6 +7,7 @@
${CONFIGURATION_INCLUDE_DIR}
)
set ( includes mauka/Configuration.h
mauka/FeedCells.h
mauka/BBPlacer.h
mauka/Bin.h
mauka/Container.h
@ -21,6 +22,7 @@
set ( mocIncludes mauka/GraphicMaukaEngine.h )
set ( cpps Configuration.cpp
BBPlacer.cpp
FeedCells.cpp
Bin.cpp
Container.cpp
MaukaBox.cpp

View File

@ -58,6 +58,7 @@ namespace Mauka {
, _standardSimulatedAnnealing(Cfg::getParamBool ("mauka.standardAnnealing",false)->asBool())
, _ignorePins (Cfg::getParamBool ("mauka.ignorePins" ,false)->asBool())
, _plotBins (Cfg::getParamBool ("mauka.plotBins" ,true )->asBool())
, _insertFeeds (Cfg::getParamBool ("mauka.insertFeeds" ,true )->asBool())
, _searchRatio (Cfg::getParamPercentage("mauka.searchRatio" , 50.0)->asDouble())
, _annealingNetMult (Cfg::getParamPercentage("mauka.annealingNetMult" , 90.0)->asDouble())
, _annealingBinMult (Cfg::getParamPercentage("mauka.annealingBinMult" , 5.0)->asDouble())

View File

@ -41,6 +41,7 @@
#include "hurricane/HyperNet.h"
#include "hurricane/Timer.h"
#include "hurricane/DataBase.h"
#include "crlcore/AllianceFramework.h"
#include "nimbus/GCell.h"
#include "nimbus/NimbusEngine.h"
@ -70,6 +71,7 @@ MaukaEngine::MaukaEngine(Cell* cell)
// *********************************
: Inherit(cell)
, _configuration(new Configuration())
, _feedCells(this)
, _instanceOccurrencesVector()
, _instanceOccurrencesMap()
, _instanceWidths()
@ -100,6 +102,10 @@ void MaukaEngine::_postCreate(Box& placementbox)
{
Inherit::_postCreate();
// Ugly. Direct uses of Alliance Framework.
addFeed ( AllianceFramework::get()->getCell("tie_x0" ,Catalog::State::Views) );
addFeed ( AllianceFramework::get()->getCell("rowend_x0",Catalog::State::Views) );
Construct();
//_simAnnealingPlacer = new SimAnnealingPlacer(this, 1, 0.0, 0.0);

View File

@ -60,6 +60,7 @@ namespace Mauka {
inline bool useStandardSimulatedAnnealing () const;
inline bool doIgnorePins () const;
inline bool doPlotBins () const;
inline bool doInsertFeeds () const;
inline RefreshCb_t& getRefreshCb ();
inline double getSearchRatio () const;
inline double getAnnealingNetMult () const;
@ -88,6 +89,7 @@ namespace Mauka {
bool _standardSimulatedAnnealing;
bool _ignorePins;
bool _plotBins; // Plot bins utilisation.
bool _insertFeeds;
double _searchRatio;
double _annealingNetMult;
double _annealingBinMult;
@ -103,6 +105,7 @@ namespace Mauka {
inline bool Configuration::useStandardSimulatedAnnealing () const { return _standardSimulatedAnnealing; }
inline bool Configuration::doIgnorePins () const { return _ignorePins; }
inline bool Configuration::doPlotBins () const { return _plotBins; }
inline bool Configuration::doInsertFeeds () const { return _insertFeeds; }
inline double Configuration::getSearchRatio () const { return _searchRatio; }
inline double Configuration::getAnnealingNetMult () const { return _annealingNetMult; }
inline double Configuration::getAnnealingBinMult () const { return _annealingBinMult; }

View File

@ -32,6 +32,7 @@
#include "nimbus/GCell.h"
#include "mauka/Configuration.h"
#include "mauka/FeedCells.h"
namespace Mauka {
@ -84,42 +85,46 @@ namespace Mauka {
public:
// Constructor.
static void regroupOverloadedGCells ( Cell* );
static MaukaEngine* create ( Cell*, Box placementbox = Box() );
// Accessors
static MaukaEngine* get ( Cell* );
static const Name& staticGetName ();
virtual const Name& getName () const;
inline Configuration* getConfiguration () const;
inline DbU::Unit getPitch () const;
inline DbU::Unit getSliceHeight () const;
inline DbU::Unit getSliceStep () const;
inline bool useStandardSimulatedAnnealing () const;
inline bool doIgnorePins () const;
inline bool doPlotBins () const;
static void regroupOverloadedGCells ( Cell* );
static MaukaEngine* create ( Cell*, Box placementbox = Box() );
// Accessors
static MaukaEngine* get ( Cell* );
static const Name& staticGetName ();
virtual const Name& getName () const;
inline Configuration* getConfiguration () const;
inline const FeedCells& getFeedCells () const;
inline DbU::Unit getPitch () const;
inline DbU::Unit getSliceHeight () const;
inline DbU::Unit getSliceStep () const;
inline bool useStandardSimulatedAnnealing () const;
inline bool doIgnorePins () const;
inline bool doPlotBins () const;
inline bool doInsertFeeds () const;
inline Configuration::RefreshCb_t&
getRefreshCb ();
inline double getSearchRatio () const;
inline double getAnnealingNetMult () const;
inline double getAnnealingBinMult () const;
inline double getAnnealingRowMult () const;
inline void setRefreshCb ( Configuration::RefreshCb_t cb );
inline DbU::Unit getInstanceIdWidth ( unsigned id ) const;
unsigned getRandomInstanceId () const;
virtual std::string _getTypeName () const { return "Mauka::MaukaEngine"; }
virtual Record* _getRecord () const;
// Mutators.
bool Iterate ();
void Run ();
void Test ();
void Save () const;
void PlotBinsStats () const;
void Plot () const;
getRefreshCb ();
inline double getSearchRatio () const;
inline double getAnnealingNetMult () const;
inline double getAnnealingBinMult () const;
inline double getAnnealingRowMult () const;
inline void setRefreshCb ( Configuration::RefreshCb_t cb );
inline DbU::Unit getInstanceIdWidth ( unsigned id ) const;
unsigned getRandomInstanceId () const;
virtual std::string _getTypeName () const { return "Mauka::MaukaEngine"; }
virtual Record* _getRecord () const;
// Mutators.
inline void addFeed ( Cell* );
bool Iterate ();
void Run ();
void Test ();
void Save () const;
void PlotBinsStats () const;
void Plot () const;
private:
// Attributes
static Name _toolName;
Configuration* _configuration;
FeedCells _feedCells;
InstanceOccurrencesVector _instanceOccurrencesVector;
InstanceOccurrencesMap _instanceOccurrencesMap;
UnitVector _instanceWidths;
@ -146,21 +151,24 @@ namespace Mauka {
// Inline Methods.
inline Configuration* MaukaEngine::getConfiguration () const { return _configuration; }
inline DbU::Unit MaukaEngine::getPitch () const { return _configuration->getPitch(); }
inline DbU::Unit MaukaEngine::getSliceHeight () const { return _configuration->getSliceHeight(); }
inline DbU::Unit MaukaEngine::getSliceStep () const { return _configuration->getSliceStep(); }
inline bool MaukaEngine::useStandardSimulatedAnnealing () const { return _configuration->useStandardSimulatedAnnealing(); }
inline bool MaukaEngine::doIgnorePins () const { return _configuration->doIgnorePins(); }
inline bool MaukaEngine::doPlotBins () const { return _configuration->doPlotBins(); }
inline Configuration* MaukaEngine::getConfiguration () const { return _configuration; }
inline const FeedCells& MaukaEngine::getFeedCells () const { return _feedCells; }
inline DbU::Unit MaukaEngine::getPitch () const { return _configuration->getPitch(); }
inline DbU::Unit MaukaEngine::getSliceHeight () const { return _configuration->getSliceHeight(); }
inline DbU::Unit MaukaEngine::getSliceStep () const { return _configuration->getSliceStep(); }
inline bool MaukaEngine::useStandardSimulatedAnnealing () const { return _configuration->useStandardSimulatedAnnealing(); }
inline bool MaukaEngine::doIgnorePins () const { return _configuration->doIgnorePins(); }
inline bool MaukaEngine::doPlotBins () const { return _configuration->doPlotBins(); }
inline bool MaukaEngine::doInsertFeeds () const { return _configuration->doInsertFeeds(); }
inline Configuration::RefreshCb_t&
MaukaEngine::getRefreshCb () { return _configuration->getRefreshCb(); }
inline double MaukaEngine::getSearchRatio () const { return _configuration->getSearchRatio(); }
inline double MaukaEngine::getAnnealingNetMult () const { return _configuration->getAnnealingNetMult(); }
inline double MaukaEngine::getAnnealingBinMult () const { return _configuration->getAnnealingBinMult(); }
inline double MaukaEngine::getAnnealingRowMult () const { return _configuration->getAnnealingRowMult(); }
inline void MaukaEngine::setRefreshCb ( Configuration::RefreshCb_t cb ) { _configuration->setRefreshCb(cb); }
inline DbU::Unit MaukaEngine::getInstanceIdWidth ( unsigned id ) const { return _instanceWidths[id]; }
MaukaEngine::getRefreshCb () { return _configuration->getRefreshCb(); }
inline double MaukaEngine::getSearchRatio () const { return _configuration->getSearchRatio(); }
inline double MaukaEngine::getAnnealingNetMult () const { return _configuration->getAnnealingNetMult(); }
inline double MaukaEngine::getAnnealingBinMult () const { return _configuration->getAnnealingBinMult(); }
inline double MaukaEngine::getAnnealingRowMult () const { return _configuration->getAnnealingRowMult(); }
inline void MaukaEngine::setRefreshCb ( Configuration::RefreshCb_t cb ) { _configuration->setRefreshCb(cb); }
inline DbU::Unit MaukaEngine::getInstanceIdWidth ( unsigned id ) const { return _instanceWidths[id]; }
inline void MaukaEngine::addFeed ( Cell* cell ) { _feedCells.addFeed(cell); }
void setPlacementStatusRecursivelyToPlaced(Instance* instance);