* ./mauka:

- New: In ConfigurationWidget, add support for hMETIS partitionner.
    - New: Static method doQuadriPart() to perform recursive quadri-partionning
        of the circuit. Down to the instanceStopCriterion and with metis/nimbus.
        Ported from pycoriolis.
    - New: MaukaEngine::regroupOverloadedGCells() also imported from pycoriolis.
    - New: hMETIS support.
    - Change: In Configuration, now CellGauge characteristics are supplied only
        through Configuration.
    - Change: In SubRow, change the way bin widths are computed.
    - Bug: In Surface & MaukaEngine, lengthes that are "proportional" to areas
        are now coded with double instead of DbU::Unit, because of capacity
        overflow.
This commit is contained in:
Jean-Paul Chaput 2010-06-13 21:02:45 +00:00
parent e5533ad76f
commit 25ce4db617
16 changed files with 1007 additions and 375 deletions

View File

@ -45,6 +45,7 @@ FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
FIND_PACKAGE(HURRICANE REQUIRED)
FIND_PACKAGE(CORIOLIS REQUIRED)
FIND_PACKAGE(NIMBUS REQUIRED)
FIND_PACKAGE(METIS REQUIRED)
SET_LIB_LINK_MODE()

View File

@ -71,8 +71,6 @@
#include "hurricane/Net.h"
#include "hurricane/Cell.h"
#include "crlcore/ToolBox.h"
#include "crlcore/CellGauge.h"
#include "crlcore/AllianceFramework.h"
#include "mauka/MaukaEngine.h"
#include "mauka/Surface.h"
@ -184,7 +182,7 @@ BBPlacer::BBPlacer(MaukaEngine* mauka)
}
}
DbU::Unit pitch = AllianceFramework::get()->getCellGauge()->getPitch();
DbU::Unit pitch = _mauka->getPitch();
DbU::Unit whiteSpace = subRow->getWidth() - totalInstanceSizeInRow;
DbU::Unit instanceWhiteSpacePitch = (whiteSpace / _subRowInstances.back().size()) / pitch;
DbU::Unit whiteSpaceRemain = whiteSpace

View File

@ -37,7 +37,10 @@
add_library ( mauka ${cpps} ${mocCpps} )
target_link_libraries ( mauka ${CORIOLIS_LIBRARIES}
target_link_libraries ( mauka ${METIS_LIBRARIES}
${HMETIS_LIBRARIES}
${NIMBUS_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${QT_LIBRARIES}

View File

@ -28,6 +28,7 @@
#include "hurricane/Cell.h"
#include "crlcore/Utilities.h"
#include "crlcore/AllianceFramework.h"
#include "mauka/Configuration.h"
@ -43,6 +44,7 @@ namespace Mauka {
using std::string;
using Hurricane::tab;
using Hurricane::inltrace;
using CRL::AllianceFramework;
// -------------------------------------------------------------------
@ -55,25 +57,31 @@ namespace Mauka {
Configuration* Configuration::getDefault ()
{
if ( _default == NULL ) {
_default = new Configuration ();
_default = new Configuration ( AllianceFramework::get()->getCellGauge() );
}
return _default;
}
Configuration::Configuration ()
: _standardSimulatedAnnealing(false)
Configuration::Configuration ( CellGauge* cg )
: _cellGauge (NULL)
, _refreshCb ()
, _standardSimulatedAnnealing(false)
, _ignorePins (false)
, _plotBins (true)
, _searchRatio (0.50)
, _annealingNetMult (0.90)
, _annealingBinMult (0.05)
, _annealingRowMult (0.05)
{ }
{
_cellGauge = cg->getClone();
}
Configuration::Configuration ( const Configuration& other )
: _standardSimulatedAnnealing(other._standardSimulatedAnnealing)
: _cellGauge (other._cellGauge->getClone())
, _refreshCb (other._refreshCb)
, _standardSimulatedAnnealing(other._standardSimulatedAnnealing)
, _ignorePins (other._ignorePins)
, _plotBins (other._plotBins)
, _searchRatio (other._searchRatio)
@ -94,6 +102,7 @@ namespace Mauka {
void Configuration::print ( Cell* cell ) const
{
cout << " o Configuration of ToolEngine<Mauka> for Cell <" << cell->getName() << ">" << endl;
cout << Dots::asIdentifier(" - Cell Gauge" ,getString(_cellGauge->getName())) << endl;
cout << Dots::asBool (" - Use standard simulated annealing" ,_standardSimulatedAnnealing) << endl;
cout << Dots::asBool (" - Ignore Pins" ,_ignorePins) << endl;
cout << Dots::asBool (" - Plot Bins" ,_plotBins) << endl;
@ -120,6 +129,7 @@ namespace Mauka {
Record* Configuration::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add ( getSlot( "_cellGauge" , _cellGauge ) );
record->add ( getSlot( "_standardSimulatedAnnealing", _standardSimulatedAnnealing) );
record->add ( getSlot( "_ignorePins" , _ignorePins ) );
record->add ( getSlot( "_plotBins" , _plotBins ) );

View File

@ -30,12 +30,15 @@
#include <QVBoxLayout>
#include <QGridLayout>
#include <QCheckBox>
#include <QComboBox>
#include <QLineEdit>
#include <QIntValidator>
#include <QDoubleValidator>
#include "hurricane/viewer/Graphics.h"
#include "nimbus/Configuration.h"
#include "metis/Configuration.h"
#include "metis/MetisEngine.h"
#include "mauka/Configuration.h"
#include "mauka/ConfigurationWidget.h"
@ -43,6 +46,7 @@
namespace Mauka {
using Hurricane::Graphics;
using Metis::MetisEngine;
// -------------------------------------------------------------------
@ -51,106 +55,212 @@ namespace Mauka {
ConfigurationWidget::ConfigurationWidget ( QWidget* parent )
: QWidget(parent)
, _nimbusConfiguration (NULL)
, _maukaConfiguration (NULL)
, _standardAnnealingState(new QCheckBox())
, _ignorePinsState (new QCheckBox())
, _plotBinsState (new QCheckBox())
, _pinsPlacementState (new QCheckBox())
, _searchRatioEdit (new QLineEdit())
, _annealingNetMultEdit (new QLineEdit())
, _annealingBinMultEdit (new QLineEdit())
, _annealingRowMultEdit (new QLineEdit())
, _aspectRatioEdit (new QLineEdit())
, _marginEdit (new QLineEdit())
, _nimbusConfiguration (NULL)
, _metisConfiguration (NULL)
, _maukaConfiguration (NULL)
, _partOrKWayHMetisState (new QCheckBox())
, _standardAnnealingState (new QCheckBox())
, _ignorePinsState (new QCheckBox())
, _plotBinsState (new QCheckBox())
, _pinsPlacementState (new QCheckBox())
, _hmetisCustomOptionsState (new QCheckBox())
, _hmetisNRunsEdit (new QLineEdit())
, _hmetisCTypeCombo (new QComboBox())
, _hmetisRTypeCombo (new QComboBox())
, _hmetisVCycleCombo (new QComboBox())
, _hmetisReconstCombo (new QComboBox())
, _numberOfInstancesStopCriterionEdit(new QLineEdit())
, _globalConnectionsWeightRatioEdit (new QLineEdit())
, _ubFactorEdit (new QLineEdit())
, _searchRatioEdit (new QLineEdit())
, _annealingNetMultEdit (new QLineEdit())
, _annealingBinMultEdit (new QLineEdit())
, _annealingRowMultEdit (new QLineEdit())
, _aspectRatioEdit (new QLineEdit())
, _marginEdit (new QLineEdit())
{
setAttribute ( Qt::WA_QuitOnClose, false );
QVBoxLayout* vLayout = new QVBoxLayout ();
QGridLayout* gLayout = new QGridLayout ();
// Metis configuration.
const int metisRow = 0;
QLabel* label = new QLabel();
label->setFont ( Graphics::getNormalFont(true) );
label->setText ( "Mauka - Placer" );
gLayout->addWidget ( label, 0, 0, 1, 4, Qt::AlignLeft );
label->setText ( "hMETIS - Partionner" );
gLayout->addWidget ( label, metisRow+0, 0, 1, 4, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Recursive 2-parts (vs. K-Way)" );
_partOrKWayHMetisState->setEnabled ( false );
gLayout->addWidget ( label , metisRow+1, 0, Qt::AlignRight );
gLayout->addWidget ( _partOrKWayHMetisState, metisRow+1, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Partition Size Stop" );
_numberOfInstancesStopCriterionEdit->setValidator ( new QIntValidator(this) );
_numberOfInstancesStopCriterionEdit->setEnabled ( false );
gLayout->addWidget ( label , metisRow+2, 0, Qt::AlignRight );
gLayout->addWidget ( _numberOfInstancesStopCriterionEdit, metisRow+2, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Global Connections Weight" );
_globalConnectionsWeightRatioEdit->setValidator ( new QIntValidator(this) );
_globalConnectionsWeightRatioEdit->setEnabled ( false );
gLayout->addWidget ( label , metisRow+3, 0, Qt::AlignRight );
gLayout->addWidget ( _globalConnectionsWeightRatioEdit, metisRow+3, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "UB Factor" );
_ubFactorEdit->setValidator ( new QIntValidator(this) );
_ubFactorEdit->setEnabled ( false );
gLayout->addWidget ( label , metisRow+4, 0, Qt::AlignRight );
gLayout->addWidget ( _ubFactorEdit, metisRow+4, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Tune hMETIS parameters" );
_hmetisCustomOptionsState->setEnabled ( false );
gLayout->addWidget ( label , metisRow+1, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisCustomOptionsState, metisRow+1, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "# of tried bisections" );
_hmetisNRunsEdit->setValidator ( new QIntValidator(this) );
_hmetisNRunsEdit->setEnabled ( false );
gLayout->addWidget ( label , metisRow+2, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisNRunsEdit, metisRow+2, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "CType" );
_hmetisCTypeCombo->setEnabled ( false );
_hmetisCTypeCombo->addItem ( "Hybrid First Choice", Metis::Configuration::CTypeHFC );
_hmetisCTypeCombo->addItem ( "First Choice" , Metis::Configuration::CTypeFC );
_hmetisCTypeCombo->addItem ( "Greedy First Choice", Metis::Configuration::CTypeGFC );
_hmetisCTypeCombo->addItem ( "Hyper Edge" , Metis::Configuration::CTypeHyperEdge );
_hmetisCTypeCombo->addItem ( "Edge" , Metis::Configuration::CTypeEdge );
gLayout->addWidget ( label , metisRow+3, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisCTypeCombo, metisRow+3, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "RType" );
_hmetisRTypeCombo->setEnabled ( false );
_hmetisRTypeCombo->addItem ( "Fiduccia-Mattheyses", Metis::Configuration::RTypeFM );
_hmetisRTypeCombo->addItem ( "One Way FM" , Metis::Configuration::RTypeOneWayFM );
_hmetisRTypeCombo->addItem ( "Early Exit FM" , Metis::Configuration::RTypeEarlyExitFM );
gLayout->addWidget ( label , metisRow+4, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisRTypeCombo, metisRow+4, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "V-Cycle" );
_hmetisVCycleCombo->setEnabled ( false );
_hmetisVCycleCombo->addItem ( "No V-Cycle Refinement" , Metis::Configuration::VCycleDisable );
_hmetisVCycleCombo->addItem ( "On Each Final Bisections" , Metis::Configuration::VCycleFinal );
_hmetisVCycleCombo->addItem ( "On Best Itermediate Solutions", Metis::Configuration::VCycleBestIntermed );
_hmetisVCycleCombo->addItem ( "On All Intermediate Solutions", Metis::Configuration::VCycleAllIntermed );
gLayout->addWidget ( label , metisRow+5, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisVCycleCombo, metisRow+5, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Reconst" );
_hmetisReconstCombo->setEnabled ( false );
_hmetisReconstCombo->addItem ( "Ignore cut hyperedges" , Metis::Configuration::ReconstRemoveCutHE );
_hmetisReconstCombo->addItem ( "Keep parts of cuts hyperedges", Metis::Configuration::ReconstKeepCutHE );
gLayout->addWidget ( label , metisRow+6, 2, Qt::AlignRight );
gLayout->addWidget ( _hmetisReconstCombo, metisRow+6, 3, Qt::AlignLeft );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
gLayout->addWidget ( separator, metisRow+7, 0, 1, 4 );
// Nimbus configuration.
const int nimbusRow = metisRow+8;
label = new QLabel();
label->setFont ( Graphics::getNormalFont(true) );
label->setText ( "Mauka - Placer" );
gLayout->addWidget ( label, nimbusRow+0, 0, 1, 4, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Pins Placement" );
_pinsPlacementState->setEnabled ( false );
gLayout->addWidget ( label , 1, 0, Qt::AlignRight );
gLayout->addWidget ( _pinsPlacementState, 1, 1, Qt::AlignLeft );
gLayout->addWidget ( label , nimbusRow+1, 0, Qt::AlignRight );
gLayout->addWidget ( _pinsPlacementState, nimbusRow+1, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Aspect Ratio: X/Y (%)" );
_aspectRatioEdit->setValidator ( new QDoubleValidator(this) );
_aspectRatioEdit->setEnabled ( false );
gLayout->addWidget ( label , 1, 2, Qt::AlignRight );
gLayout->addWidget ( _aspectRatioEdit, 1, 3, Qt::AlignLeft );
gLayout->addWidget ( label , nimbusRow+1, 2, Qt::AlignRight );
gLayout->addWidget ( _aspectRatioEdit, nimbusRow+1, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Space Margin (%)" );
_marginEdit->setValidator ( new QDoubleValidator(this) );
_marginEdit->setEnabled ( false );
gLayout->addWidget ( label , 2, 2, Qt::AlignRight );
gLayout->addWidget ( _marginEdit, 2, 3, Qt::AlignLeft );
gLayout->addWidget ( label , nimbusRow+2, 2, Qt::AlignRight );
gLayout->addWidget ( _marginEdit, nimbusRow+2, 3, Qt::AlignLeft );
QFrame* separator = new QFrame ();
separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
gLayout->addWidget ( separator, 3, 0, 1, 4 );
gLayout->addWidget ( separator, nimbusRow+3, 0, 1, 4 );
// Mauka configuration.
const int maukaRow = nimbusRow+4;
label = new QLabel();
label->setText ( "Standard Annealing" );
_standardAnnealingState->setEnabled ( false );
gLayout->addWidget ( label , 4, 0, Qt::AlignRight );
gLayout->addWidget ( _standardAnnealingState, 4, 1, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+0, 0, Qt::AlignRight );
gLayout->addWidget ( _standardAnnealingState, maukaRow+0, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Ignore Pins" );
_ignorePinsState->setEnabled ( false );
gLayout->addWidget ( label , 5, 0, Qt::AlignRight );
gLayout->addWidget ( _ignorePinsState, 5, 1, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+1, 0, Qt::AlignRight );
gLayout->addWidget ( _ignorePinsState, maukaRow+1, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Plot Bins" );
_plotBinsState->setEnabled ( false );
gLayout->addWidget ( label , 6, 0, Qt::AlignRight );
gLayout->addWidget ( _plotBinsState, 6, 1, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+2, 0, Qt::AlignRight );
gLayout->addWidget ( _plotBinsState, maukaRow+2, 1, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Search Ratio (%)" );
_searchRatioEdit->setValidator ( new QDoubleValidator(this) );
_searchRatioEdit->setEnabled ( false );
gLayout->addWidget ( label , 4, 2, Qt::AlignRight );
gLayout->addWidget ( _searchRatioEdit, 4, 3, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+0, 2, Qt::AlignRight );
gLayout->addWidget ( _searchRatioEdit, maukaRow+0, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Annealing Net Mult (%)" );
_annealingNetMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingNetMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 5, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingNetMultEdit, 5, 3, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+1, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingNetMultEdit, maukaRow+1, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Annealing Bin Mult (%)" );
_annealingBinMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingBinMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 6, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingBinMultEdit, 6, 3, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+2, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingBinMultEdit, maukaRow+2, 3, Qt::AlignLeft );
label = new QLabel();
label->setText ( "Annealing Row Mult (%)" );
_annealingRowMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingRowMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 7, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingRowMultEdit, 7, 3, Qt::AlignLeft );
gLayout->addWidget ( label , maukaRow+3, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingRowMultEdit, maukaRow+3, 3, Qt::AlignLeft );
separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
gLayout->addWidget ( separator, 8, 0, 1, 4 );
gLayout->addWidget ( separator, maukaRow+4, 0, 1, 4 );
vLayout->addLayout ( gLayout );
@ -168,12 +278,18 @@ namespace Mauka {
setLayout ( vLayout );
connect ( apply, SIGNAL(clicked()), this, SLOT(_applySettings()) );
connect ( _hmetisCustomOptionsState, SIGNAL(stateChanged(int)), this, SLOT(_enableHMetisOptions(int)) );
}
void ConfigurationWidget::setConfiguration ( Nimbus::Configuration* nimbusConfig
, Metis::Configuration* metisConfig
, Configuration* maukaConfig )
{
_nimbusConfiguration = nimbusConfig;
_metisConfiguration = metisConfig;
_maukaConfiguration = maukaConfig;
if ( maukaConfig != NULL ) {
_searchRatioEdit ->setText ( QString("%1").arg(maukaConfig ->getSearchRatio()) );
_annealingNetMultEdit->setText ( QString("%1").arg(maukaConfig ->getAnnealingNetMult()) );
@ -197,6 +313,29 @@ namespace Mauka {
_ignorePinsState ->setEnabled ( true );
_plotBinsState ->setEnabled ( true );
_pinsPlacementState ->setEnabled ( true );
if ( MetisEngine::isHMetisCapable() ) {
_partOrKWayHMetisState ->setChecked ( metisConfig->getPartOrKWayHMetis() );
_hmetisCustomOptionsState->setChecked ( (metisConfig->getHMetisOption(Metis::Configuration::CustomOptions) == 1) );
_hmetisCTypeCombo ->setCurrentIndex ( _hmetisCTypeToIndex () );
_hmetisRTypeCombo ->setCurrentIndex ( _hmetisRTypeToIndex () );
_hmetisVCycleCombo ->setCurrentIndex ( _hmetisVCycleToIndex() );
_hmetisReconstCombo->setCurrentIndex ( _hmetisReconstToIndex() );
_numberOfInstancesStopCriterionEdit->setText ( QString("%1").arg(metisConfig->getNumberOfInstancesStopCriterion()) );
_globalConnectionsWeightRatioEdit ->setText ( QString("%1").arg(metisConfig->getGlobalConnectionsWeightRatio()) );
_ubFactorEdit ->setText ( QString("%1").arg(metisConfig->getUbFactor()) );
_hmetisNRunsEdit ->setText ( QString("%1").arg(metisConfig->getHMetisOption(Metis::Configuration::HMetisNRuns)) );
_partOrKWayHMetisState ->setEnabled ( true );
_numberOfInstancesStopCriterionEdit->setEnabled ( true );
_globalConnectionsWeightRatioEdit ->setEnabled ( true );
_ubFactorEdit ->setEnabled ( true );
_hmetisCustomOptionsState ->setEnabled ( true );
_enableHMetisOptions ( _hmetisCustomOptionsState->checkState() );
}
} else {
_searchRatioEdit ->setEnabled ( false );
_annealingNetMultEdit ->setEnabled ( false );
@ -204,16 +343,33 @@ namespace Mauka {
_annealingRowMultEdit ->setEnabled ( false );
_marginEdit ->setEnabled ( false );
_standardAnnealingState->setEnabled ( false );
_standardAnnealingState->setEnabled ( false );
_ignorePinsState ->setEnabled ( false );
_plotBinsState ->setEnabled ( false );
_pinsPlacementState ->setEnabled ( false );
_partOrKWayHMetisState ->setEnabled ( false );
_numberOfInstancesStopCriterionEdit->setEnabled ( false );
_globalConnectionsWeightRatioEdit ->setEnabled ( false );
_ubFactorEdit ->setEnabled ( false );
_hmetisCustomOptionsState ->setEnabled ( false );
_enableHMetisOptions ( Qt::Unchecked );
_nimbusConfiguration = NULL;
_metisConfiguration = NULL;
_maukaConfiguration = NULL;
}
_nimbusConfiguration = nimbusConfig;
_maukaConfiguration = maukaConfig;
}
void ConfigurationWidget::_enableHMetisOptions ( int state )
{
bool enable = (state != Qt::Unchecked);
_hmetisNRunsEdit ->setEnabled ( enable );
_hmetisCTypeCombo ->setEnabled ( enable );
_hmetisRTypeCombo ->setEnabled ( enable );
_hmetisVCycleCombo ->setEnabled ( enable );
_hmetisReconstCombo->setEnabled ( enable );
}
@ -221,6 +377,16 @@ namespace Mauka {
{
if ( _maukaConfiguration == NULL ) return;
_updatePartOrKWayHMetis ();
_updateNumberOfInstancesStopCriterion ();
_updateGlobalConnectionsWeightRatio ();
_updateUbFactor ();
_updateHMetisCustomOptions ();
_updateHMetisCType ();
_updateHMetisRType ();
_updateHMetisVCycle ();
_updateHMetisReconst ();
_updateStandardAnnealingState ();
_updateIgnorePinsState ();
_updatePlotBinsState ();
@ -231,6 +397,19 @@ namespace Mauka {
_updateAnnealingRowMult ();
_updateAspectRatio ();
_updateMargin ();
if ( MetisEngine::isHMetisCapable() ) {
_updatePartOrKWayHMetis ();
_updateNumberOfInstancesStopCriterion ();
_updateGlobalConnectionsWeightRatio ();
_updateUbFactor ();
_updateHMetisCustomOptions ();
_updateHMetisNRuns ();
_updateHMetisCType ();
_updateHMetisRType ();
_updateHMetisVCycle ();
_updateHMetisReconst ();
}
}
@ -368,4 +547,196 @@ namespace Mauka {
}
void ConfigurationWidget::_updatePartOrKWayHMetis ()
{
if ( _metisConfiguration == NULL ) return;
_metisConfiguration->setPartOrKWayHMetis ( _partOrKWayHMetisState->isChecked() );
}
void ConfigurationWidget::_updateHMetisCustomOptions ()
{
if ( _metisConfiguration == NULL ) return;
_metisConfiguration->setHMetisOption ( Metis::Configuration::CustomOptions
, (_hmetisCustomOptionsState->isChecked() ? 1 : 0) );
}
void ConfigurationWidget::_updateNumberOfInstancesStopCriterion ()
{
if ( _metisConfiguration == NULL ) return;
bool success = false;
unsigned int limit = _numberOfInstancesStopCriterionEdit->displayText().toUInt ( &success );
if ( success ) {
_metisConfiguration->setNumberOfInstancesStopCriterion ( limit );
success = (_metisConfiguration->getNumberOfInstancesStopCriterion() == limit);
}
if ( not success )
_numberOfInstancesStopCriterionEdit->setText
( QString("%1").arg(_metisConfiguration->getNumberOfInstancesStopCriterion()) );
}
void ConfigurationWidget::_updateGlobalConnectionsWeightRatio ()
{
if ( _metisConfiguration == NULL ) return;
bool success = false;
int weight = _globalConnectionsWeightRatioEdit->displayText().toInt ( &success );
if ( success ) {
_metisConfiguration->setGlobalConnectionsWeightRatio ( weight );
success = (_metisConfiguration->getGlobalConnectionsWeightRatio() == weight);
}
if ( not success )
_globalConnectionsWeightRatioEdit->setText
( QString("%1").arg(_metisConfiguration->getGlobalConnectionsWeightRatio()) );
}
void ConfigurationWidget::_updateUbFactor ()
{
if ( _metisConfiguration == NULL ) return;
bool success = false;
int limit = _ubFactorEdit->displayText().toUInt ( &success );
if ( success ) {
_metisConfiguration->setUbFactor ( limit );
success = (_metisConfiguration->getUbFactor() == limit);
}
if ( not success )
_ubFactorEdit->setText ( QString("%1").arg(_metisConfiguration->getUbFactor()) );
}
void ConfigurationWidget::_updateHMetisNRuns ()
{
if ( _metisConfiguration == NULL ) return;
bool success = false;
int value = _hmetisNRunsEdit->displayText().toInt ( &success );
if ( success ) {
_metisConfiguration->setHMetisOption ( Metis::Configuration::HMetisNRuns, value );
success = (_metisConfiguration->getHMetisOption(Metis::Configuration::HMetisNRuns) == value);
}
if ( not success )
_numberOfInstancesStopCriterionEdit->setText
( QString("%1").arg(_metisConfiguration->getHMetisOption(Metis::Configuration::HMetisNRuns)) );
}
int ConfigurationWidget::_hmetisCTypeToIndex ()
{
if ( _metisConfiguration != NULL ) {
int value = _metisConfiguration->getHMetisOption ( Metis::Configuration::HMetisCType );
for ( int i=0 ; i<_hmetisCTypeCombo->count() ; ++i ) {
if ( value == _hmetisCTypeCombo->itemData(i).toInt() ) {
return i;
}
}
}
return 0;
}
void ConfigurationWidget::_updateHMetisCType ()
{
if ( _metisConfiguration == NULL ) return;
int value = _hmetisCTypeCombo->itemData ( _hmetisCTypeCombo->currentIndex() ).toInt();
_metisConfiguration->setHMetisOption ( Metis::Configuration::HMetisCType, value );
}
int ConfigurationWidget::_hmetisRTypeToIndex ()
{
if ( _metisConfiguration != NULL ) {
int value = _metisConfiguration->getHMetisOption ( Metis::Configuration::HMetisRType );
for ( int i=0 ; i<_hmetisRTypeCombo->count() ; ++i ) {
if ( value == _hmetisRTypeCombo->itemData(i).toInt() ) {
return i;
}
}
}
return 0;
}
void ConfigurationWidget::_updateHMetisRType ()
{
if ( _metisConfiguration == NULL ) return;
int value = _hmetisRTypeCombo->itemData ( _hmetisRTypeCombo->currentIndex() ).toInt();
_metisConfiguration->setHMetisOption ( Metis::Configuration::HMetisRType, value );
}
int ConfigurationWidget::_hmetisVCycleToIndex ()
{
if ( _metisConfiguration != NULL ) {
int value = _metisConfiguration->getHMetisOption ( Metis::Configuration::HMetisVCycle );
for ( int i=0 ; i<_hmetisVCycleCombo->count() ; ++i ) {
if ( value == _hmetisVCycleCombo->itemData(i).toInt() ) {
return i;
}
}
}
return 0;
}
void ConfigurationWidget::_updateHMetisVCycle ()
{
if ( _metisConfiguration == NULL ) return;
int value = _hmetisVCycleCombo->itemData ( _hmetisVCycleCombo->currentIndex() ).toInt();
_metisConfiguration->setHMetisOption ( Metis::Configuration::HMetisVCycle, value );
}
int ConfigurationWidget::_hmetisReconstToIndex ()
{
if ( _metisConfiguration != NULL ) {
int value = _metisConfiguration->getHMetisOption ( Metis::Configuration::HMetisReconst );
for ( int i=0 ; i<_hmetisReconstCombo->count() ; ++i ) {
if ( value == _hmetisReconstCombo->itemData(i).toInt() ) {
return i;
}
}
}
return 0;
}
void ConfigurationWidget::_updateHMetisReconst ()
{
if ( _metisConfiguration == NULL ) return;
int value = _hmetisReconstCombo->itemData ( _hmetisReconstCombo->currentIndex() ).toInt();
_metisConfiguration->setHMetisOption ( Metis::Configuration::HMetisReconst, value );
}
} // End of Mauka namespace.

View File

@ -45,6 +45,7 @@
#include <crlcore/Utilities.h>
#include <crlcore/AllianceFramework.h>
#include <nimbus/NimbusEngine.h>
#include <metis/MetisEngine.h>
#include <mauka/Container.h>
#include <mauka/GraphicMaukaEngine.h>
#include <mauka/ConfigurationWidget.h>
@ -66,6 +67,7 @@ namespace Mauka {
using CRL::Catalog;
using CRL::AllianceFramework;
using Nimbus::NimbusEngine;
using Metis::MetisEngine;
size_t GraphicMaukaEngine::_references = 0;
@ -93,14 +95,42 @@ namespace Mauka {
}
void GraphicMaukaEngine::refreshViewer ()
{
//static unsigned int count = 0;
//if ( not (count++ % 500) ) {
//UpdateSession::close ();
_viewer->getCellWidget()->fitToContents ();
_viewer->getCellWidget()->refresh ();
QApplication::processEvents ();
//UpdateSession::open ();
// if ( _viewer->isToolInterrupted() ) {
// KiteEngine* kite = KiteEngine::get ( getCell() );
// if ( kite ) kite->setInterrupt ( true );
// _viewer->clearToolInterrupt ();
// }
//}
}
MaukaEngine* GraphicMaukaEngine::createEngine ()
{
Cell* cell = getCell ();
MaukaEngine* mauka = MaukaEngine::get ( cell );
if ( mauka == NULL ) {
NimbusEngine* nimbus = NimbusEngine::create ( cell, AllianceFramework::get()->getLibrary(1) );
NimbusEngine* nimbus = NimbusEngine::get ( cell );
if ( nimbus == NULL )
NimbusEngine::create ( cell );
mauka = MaukaEngine::create ( cell );
if ( cmess1.enabled() )
mauka->getConfiguration()->print( cell );
} else
cerr << Warning("%s already has a Mauka engine.",getString(cell).c_str()) << endl;
@ -122,12 +152,52 @@ namespace Mauka {
}
void GraphicMaukaEngine::doQuadriPart ()
{
Cell* cell = getCell ();
emit cellPreModificated ();
NimbusEngine* nimbus = NimbusEngine::get ( cell );
if ( nimbus == NULL ) {
nimbus = NimbusEngine::create ( cell );
if ( cmess1.enabled() )
nimbus->getConfiguration()->print( cell );
}
MetisEngine* metis = MetisEngine::get ( cell );
if ( metis == NULL ) {
metis = MetisEngine ::create ( cell );
if ( cmess1.enabled() )
metis->getConfiguration()->print( cell );
}
metis->setRefreshCb ( boost::bind(&GraphicMaukaEngine::refreshViewer,this) );
MetisEngine::doQuadriPart ( cell );
MaukaEngine* mauka = MaukaEngine::get ( cell );
if ( mauka != NULL )
throw Warning("GraphicMaukaEngine::doQuadriPart(): Placement already done on <%s>"
,getString(cell->getName()).c_str());
mauka = createEngine();
MaukaEngine::regroupOverloadedGCells ( cell );
_viewer->clearToolInterrupt ();
_viewer->getCellWidget()->fitToContents ();
//mauka->Run ();
emit cellPostModificated ();
}
void GraphicMaukaEngine::run ()
{
MaukaEngine* mauka = createEngine ();
if ( mauka == NULL ) {
throw Error("MaukaEngine not created yet, run the global router first.");
}
mauka->setRefreshCb ( boost::bind(&GraphicMaukaEngine::refreshViewer,this) );
emit cellPreModificated ();
_viewer->clearToolInterrupt ();
@ -153,28 +223,6 @@ namespace Mauka {
}
void GraphicMaukaEngine::postEvent ()
{
static unsigned int count = 0;
if ( not (count++ % 500) ) {
//UpdateSession::close ();
//_viewer->getCellWidget()->refresh ();
QApplication::processEvents ();
//UpdateSession::open ();
if ( _viewer->isToolInterrupted() ) {
//MaukaEngine* mauka = MaukaEngine::get ( getCell() );
//if ( mauka ) mauka->setInterrupt ( true );
_viewer->clearToolInterrupt ();
}
}
}
void GraphicMaukaEngine::addToMenu ( CellViewer* viewer )
{
assert ( _viewer == NULL );
@ -202,13 +250,20 @@ namespace Mauka {
if ( placeAction != NULL )
cerr << Warning("GraphicMaukaEngine::addToMenu() - Mauka placer already hooked in.") << endl;
else {
QAction* quadriPartAction = new QAction ( tr("Mauka - &QuadriPartition"), _viewer );
quadriPartAction->setObjectName ( "viewer.menuBar.quadriPartAndRoute.maukaQuadriPartition" );
quadriPartAction->setStatusTip ( tr("Run the <b>hMETIS</b> quadri-partitioner") );
quadriPartAction->setVisible ( true );
prMenu->addAction ( quadriPartAction );
QAction* placeAction = new QAction ( tr("Mauka - &Place"), _viewer );
placeAction->setObjectName ( "viewer.menuBar.placeAndRoute.maukaPlace" );
placeAction->setStatusTip ( tr("Run the <b>Mauka</b> placer") );
placeAction->setVisible ( true );
prMenu->addAction ( placeAction );
connect ( placeAction, SIGNAL(triggered()), this, SLOT(run()) );
connect ( placeAction , SIGNAL(triggered()), this, SLOT(run()) );
connect ( quadriPartAction, SIGNAL(triggered()), this, SLOT(doQuadriPart()) );
}
connect ( this, SIGNAL(cellPreModificated ()), _viewer->getCellWidget(), SLOT(cellPreModificate ()) );
@ -221,7 +276,10 @@ namespace Mauka {
if ( setting == NULL ) {
setting = new ConfigurationWidget ();
setting->setObjectName ( "controller.tabSettings.setting.mauka" );
setting->setConfiguration ( Nimbus::Configuration::getDefault(), Configuration::getDefault() );
setting->setConfiguration ( Nimbus::Configuration::getDefault()
, Metis::Configuration::getDefault()
, Configuration::getDefault()
);
controller->addSetting ( setting, "Mauka" );
}
}

View File

@ -34,12 +34,14 @@
//
// Authors-Tag
#include <queue>
#include "hurricane/Warning.h"
#include "hurricane/Cell.h"
#include "hurricane/HyperNet.h"
#include "hurricane/Timer.h"
#include "hurricane/DataBase.h"
#include "crlcore/CellGauge.h"
#include "crlcore/AllianceFramework.h"
#include "nimbus/GCell.h"
#include "nimbus/NimbusEngine.h"
#include "mauka/Surface.h"
#include "mauka/Row.h"
@ -49,6 +51,8 @@
namespace Mauka {
using Hurricane::ForEachIterator;
using Hurricane::Warning;
using Hurricane::Plug;
using Hurricane::Path;
using Hurricane::OccurrenceLocator;
@ -56,6 +60,7 @@ using Hurricane::PlugLocator;
using Hurricane::HyperNet;
using Hurricane::Timer;
using namespace CRL;
using namespace Nimbus;
Name MaukaEngine::_toolName = "Mauka";
@ -460,9 +465,8 @@ namespace {
bool TestMaukaConstruction(Cell* cell, GCell* gcell)
// *************************************************
{
CellGauge* gauge = AllianceFramework::get()->getCellGauge();
DbU::Unit pitch = gauge->getPitch();
DbU::Unit sliceHeight = gauge->getSliceHeight();
DbU::Unit pitch = Configuration::getDefault()->getPitch();
DbU::Unit sliceHeight = Configuration::getDefault()->getSliceHeight();
const Box& box = gcell->getBox();
@ -665,5 +669,45 @@ unsigned MaukaEngine::getRandomInstanceId() const {
unsigned instanceId = (unsigned)((double)_instanceOccurrencesVector.size() * rand() / (RAND_MAX + 1.0));
return instanceId;
}
void MaukaEngine::regroupOverloadedGCells ( Cell* cell )
{
NimbusEngine* nimbus = NimbusEngine::get ( cell );
if ( nimbus == NULL )
throw Error ("Mauka::regroupOverloadedGCells(): Nimbus doesn't exists on <%s>"
,getString(cell->getName()).c_str());
queue<GCell*> toProcess;
set <GCell*> containers;
forEach ( GCell*, igcell, nimbus->getPlacementLeaves() ) {
toProcess.push ( *igcell );
}
while ( not toProcess.empty() ) {
GCell* container = toProcess.front();
GCell* parent = container->getContainer();
toProcess.pop ();
if ( containers.find(parent) != containers.end() ) continue;
containers.insert ( container );
if ( not TestMaukaConstruction(cell,container) ) {
cerr << Warning("Not enough margin on %s",getString(container).c_str()) << endl;
if ( parent == NULL )
throw Error("Not enough margin on the whole Cell");
parent->setAsPlacementLeaf ();
toProcess.push ( parent );
cmess2 << " - Sets as placement leaf " << parent << endl;
}
}
nimbus->regroup ();
}
}
} // End of Mauka namespace.

View File

@ -145,7 +145,7 @@ void SimAnnealingPlacer::init()
cmess1 << " o Beginning global placement" << endl;
cmess2 << Dots::asSizet (" - Number of nodes to place",_mauka->_instanceOccurrencesVector.size()) << endl;
cmess2 << Dots::asPercentage(" - Margin" ,100.0 * surface->getMargin()) << endl;
cmess2 << Dots::asPercentage(" - Margin" ,surface->getMargin()) << endl;
cmess2 << Dots::asDouble(" - Initial RowCost" ,_rowCost) << endl;
cmess2 << Dots::asDouble(" - Initial BinCost" ,_binCost) << endl;
@ -287,6 +287,9 @@ bool SimAnnealingPlacer::Iterate()
cout << "NetCost = " << _netCost << endl << endl;
// assert ((netCost - 1.0 <= debug) && (debug <= netCost + 1.0));
}
if ( _mauka->getRefreshCb() != NULL ) _mauka->getRefreshCb() ();
return ((_temperature != 0.0)
&& ((sucRatio > 0.15) || (stdDev > (0.0001 / getCost()))));
}

View File

@ -33,9 +33,6 @@
//
// Authors-Tag
#include "crlcore/CellGauge.h"
#include "crlcore/AllianceFramework.h"
#include "mauka/Bin.h"
#include "mauka/Row.h"
#include "mauka/Surface.h"
@ -46,7 +43,6 @@ namespace Mauka {
using namespace std;
using Hurricane::Error;
using CRL::AllianceFramework;
SubRow::SubRow(Cell* cell, Surface* surface, const Box& box)
:Inherit(cell, box)
@ -64,57 +60,89 @@ SubRow* SubRow::create(Cell* cell, Surface* surface, const Box& box, bool orient
return subRow;
}
void SubRow::_postCreate(bool orientation)
{
void SubRow::_postCreate(bool orientation)
{
_row = _surface->InsertSubRowInRow(this, orientation);
unsigned nBins = 0;
if (getWidth() % _surface->_binWidthMax)
nBins = getWidth() / _surface->_binWidthMax + 1;
else
nBins = getWidth() / _surface->_binWidthMax;
#if BINS_WITH_BALANCED_WIDTH
unsigned nBins
= nBins = getWidth() / _surface->_binWidthMax + ((getWidth() % _surface->_binWidthMax) ? 1 : 0);
if (nBins == 0)
{
assert (getWidth() >= _surface->_binWidthMin);
nBins = 1;
if ( nBins == 0 ) {
assert (getWidth() >= _surface->_binWidthMin);
nBins = 1;
}
DbU::Unit pitch = AllianceFramework::get()->getCellGauge()->getPitch();
DbU::Unit pitch = _surface->_mauka->getPitch();
DbU::Unit binsWidth = ((getWidth() / pitch) / nBins) * pitch;
if (getWidth() % pitch)
throw Error("Subrow Width: " + getString(getWidth()) + " is not a multiple of pitch");
if (binsWidth % pitch)
throw Error("Bins Width not a multiple of pitch");
if ( getWidth() % _surface->_mauka->getPitch() )
throw Error("Subrow::_postCreate(): SubRow width %s is not a multiple of pitch."
,DbU::getValueString(getWidth()).c_str());
DbU::Unit totalBinsWidth = binsWidth * nBins;
if ( binsWidth % _surface->_mauka->getPitch() )
throw Error("Subrow::_postCreate(): SubRow Bin width %s is not a multiple of pitch."
,DbU::getValueString(binsWidth).c_str());
DbU::Unit totalBinsWidth = binsWidth * nBins;
DbU::Unit binsWidthRemain = getWidth() - totalBinsWidth;
if (binsWidthRemain % pitch)
throw Error("Bins Width not a multiple of pitch");
throw Error("Subrow::_postCreate(): SubRow Bin width remainder %s is not a multiple of pitch."
,DbU::getValueString(binsWidthRemain).c_str());
unsigned binsWidthRemainPitch = binsWidthRemain / pitch;
DbU::Unit xMin = getXMin();
DbU::Unit xMax = xMin;
for (unsigned binId = 0; binId < nBins; binId++)
{
if (binsWidthRemainPitch > 0)
{
xMax += binsWidth + pitch;
binsWidthRemainPitch--;
}
else
xMax += binsWidth;
Bin* bin = Bin::create(getCell(), this, Box(xMin, getYMin(), xMax, getYMax()));
_binVector.push_back(bin);
unsigned binIdx = _binVector.size() - 1;
_binXMax[bin->getXMax()] = binIdx;
xMin = xMax;
for ( unsigned binId = 0; binId < nBins; ++binId ) {
if ( binsWidthRemainPitch > 0 ) {
xMax += binsWidth + pitch;
--binsWidthRemainPitch;
} else
xMax += binsWidth;
Bin* bin = Bin::create(getCell(), this, Box(xMin, getYMin(), xMax, getYMax()));
_binVector.push_back(bin);
_binXMax[bin->getXMax()] = _binVector.size() - 1;
xMin = xMax;
}
#else // BINS_WITH_BALANCED_WIDTH
// All bins are 2*biggest cell width, the lastest also include the remainder.
unsigned nBins = getWidth() / _surface->_binWidthMax;
if ( nBins == 0 ) {
assert ( getWidth() >= _surface->_binWidthMin );
nBins = 1;
}
DbU::Unit binsWidth = _surface->_binWidthMax;
DbU::Unit binsWidthRemain = getWidth() - nBins*binsWidth; // Could be negative.
if ( getWidth() % _surface->_mauka->getPitch() )
throw Error("Subrow::_postCreate(): SubRow width %s is not a multiple of pitch."
,DbU::getValueString(getWidth()).c_str());
if ( binsWidth % _surface->_mauka->getPitch() )
throw Error("Subrow::_postCreate(): SubRow Bin width %s is not a multiple of pitch."
,DbU::getValueString(binsWidth).c_str());
DbU::Unit xMin = getXMin();
DbU::Unit xMax = xMin;
for ( unsigned int binId=0 ; binId < nBins ; ++binId ) {
xMax += binsWidth;
if ( binId == 0 ) xMax += binsWidthRemain;
Bin* bin = Bin::create ( getCell(), this, Box(xMin,getYMin(),xMax,getYMax()) );
_binVector.push_back(bin);
_binXMax[bin->getXMax()] = _binVector.size() - 1;
xMin = xMax;
}
#endif // BINS_WITH_BALANCED_WIDTH
Inherit::_postCreate();
}

View File

@ -36,8 +36,6 @@
#include "hurricane/Warning.h"
#include "hurricane/Cell.h"
#include "crlcore/CellGauge.h"
#include "crlcore/AllianceFramework.h"
#include "nimbus/NimbusEngine.h"
#include "mauka/MaukaEngine.h"
@ -106,7 +104,6 @@ void DisplayNonLeafInstances(Cell* cell, Box area)
namespace Mauka {
using CRL::AllianceFramework;
using Nimbus::NimbusEngine;
using Nimbus::GCellLocator;
@ -183,32 +180,24 @@ typedef list<PlacementProblem*> PlacementProblemList;
Inherit::_postCreate();
NimbusEngine* nimbus = NULL;
bool partitionned = false;
NimbusEngine* nimbus = NULL;
if (_box.isEmpty()) {
nimbus = NimbusEngine::get ( getCell() );
if (nimbus == NULL) {
throw Error("Can't create Mauka::Surface, no Box and no Nimbus");
}
_box = nimbus->getGrid()->getRoot()->getBox();
partitionned = (nimbus->getDepth() > 1);
if ( partitionned )
cmess2 << " - Design is partionned (depth:" << nimbus->getDepth() << ")" << endl;
}
PlacementVerification ( getCell(), _box );
DbU::Unit sliceHeight = DbU::lambda(1);
DbU::Unit pitch = DbU::lambda(1);
AllianceFramework* af = AllianceFramework::get();
if (af != NULL) {
sliceHeight = af->getCellGauge()->getSliceHeight();
pitch = af->getCellGauge()->getPitch();
} else {
// For the moment very stupid method: take the first instantiated Cell.
forEach ( Instance*, iinstance, getCell()->getInstances() ) {
Cell* masterCell = iinstance->getMasterCell();
sliceHeight = masterCell->getAbutmentBox().getHeight();
break;
}
}
DbU::Unit sliceHeight = _mauka->getSliceHeight();
DbU::Unit pitch = _mauka->getPitch();
if ( _box.isEmpty() or _box.isPonctual() or _box.isFlat())
throw Error("Wrong Box for Area: %s",getString(_box).c_str());
@ -219,11 +208,11 @@ typedef list<PlacementProblem*> PlacementProblemList;
,DbU::getValueString(sliceHeight).c_str());
DbU::Unit instanceToPlaceWidthMax = 0;
DbU::Unit instanceToPlaceWidthSum = 0;
double instanceToPlaceWidthSum = 0.0;
for ( unsigned int id = 0; id < _mauka->_instanceWidths.size(); ++id ) {
DbU::Unit instanceWidth = _mauka->_instanceWidths[id];
instanceToPlaceWidthSum += instanceWidth;
instanceToPlaceWidthSum += (double)instanceWidth;
if ( instanceWidth % pitch )
throw Error("Width of %s (%s) is not a multiple of pitch (%s)."
@ -235,14 +224,19 @@ typedef list<PlacementProblem*> PlacementProblemList;
instanceToPlaceWidthMax = instanceWidth;
}
_binWidthMax = DbU::lambda
((unsigned)( 2.0 * DbU::getLambda(instanceToPlaceWidthMax) / DbU::getLambda(pitch))
* DbU::getLambda(pitch));
// _binWidthMax = DbU::lambda
// ((unsigned)( 3.0 * DbU::getLambda(instanceToPlaceWidthMax) / DbU::getLambda(pitch))
// * DbU::getLambda(pitch));
// _binWidthMin = DbU::lambda
// ((unsigned)(DbU::getLambda(_binWidthMax) / (DbU::getLambda(pitch) * 2)) * DbU::getLambda(pitch));
_binWidthMin = DbU::lambda
((unsigned)(DbU::getLambda(_binWidthMax) / (DbU::getLambda(pitch) * 2)) * DbU::getLambda(pitch));
_binWidthMax = 2 * (instanceToPlaceWidthMax / pitch) * pitch;
_binWidthMin = (_binWidthMax / (pitch * 2)) * pitch;
DbU::Unit surfaceTotalWidth = 0;
// cerr << "_binWidthMax:" << DbU::getValueString(_binWidthMax) << endl;
// cerr << "_binWidthMin:" << DbU::getValueString(_binWidthMin) << endl;
double surfaceTotalWidth = 0.0;
PlacementProblemList placementProblemList;
OccurrenceSet verifyInstanceOccurrencesSet;
@ -272,19 +266,22 @@ typedef list<PlacementProblem*> PlacementProblemList;
}
}
forEach(Occurrence, ioccurrence, _mauka->getCell()->getLeafInstanceOccurrences()) {
Instance* instance = static_cast<Instance*>((*ioccurrence).getEntity());
if ( instance->isFixed() ) continue;
// Special case: no Nimbus run, Instances are *not* in the quadtree yet.
if ( not partitionned ) {
forEach(Occurrence, ioccurrence, _mauka->getCell()->getLeafInstanceOccurrences() ) {
Instance* instance = static_cast<Instance*>((*ioccurrence).getEntity());
if ( instance->isFixed() ) continue;
MaukaEngine::InstanceOccurrencesMap::const_iterator iomit
= _mauka->_instanceOccurrencesMap.find(*ioccurrence);
MaukaEngine::InstanceOccurrencesMap::const_iterator iomit
= _mauka->_instanceOccurrencesMap.find(*ioccurrence);
if (iomit == _mauka->_instanceOccurrencesMap.end())
throw Error("Instance occurrence unexpectedly appeared:\n"
" %s",getString(*ioccurrence).c_str());
if (iomit == _mauka->_instanceOccurrencesMap.end())
throw Error("Instance occurrence unexpectedly appeared:\n"
" %s",getString(*ioccurrence).c_str());
placementProblem->_toPlaceInstanceOccurrencesUVector.push_back(iomit->second);
verifyInstanceOccurrencesSet.insert(*ioccurrence);
placementProblem->_toPlaceInstanceOccurrencesUVector.push_back(iomit->second);
verifyInstanceOccurrencesSet.insert(*ioccurrence);
}
}
DbU::Unit searchWidth = DbU::lambda(_mauka->getSearchRatio() * DbU::getLambda(igcell->getWidth()));
@ -419,9 +416,10 @@ typedef list<PlacementProblem*> PlacementProblemList;
_searchHeight = getHeight();
_searchWidth = getWidth();
bool rowOrientation = false;
unsigned nRows = getHeight() / sliceHeight;
surfaceTotalWidth = getWidth() * nRows;
bool rowOrientation = false;
unsigned int nRows = getHeight() / sliceHeight;
surfaceTotalWidth = ((double)getWidth()) * nRows;
for ( DbU::Unit ymin = getYMin(); ymin <= getYMax() - sliceHeight; ymin += sliceHeight ) {
SubRow* subRow = SubRow::create ( getCell()
@ -438,11 +436,17 @@ typedef list<PlacementProblem*> PlacementProblemList;
throw Error("MaukaEngine needs NimbusEngine");
}
_computeCapacity();
linefill output (" ",cmess2);
for (PlacementProblemList::iterator pplit = placementProblemList.begin();
pplit != placementProblemList.end(); pplit++) {
//cmess2 << " - Initial placement of " << (*pplit)->_gcell->getBox() << endl;
output << (*pplit)->_gcell->getBox();
_DisplayInstances((*pplit)->_toPlaceInstanceOccurrencesUVector, (*pplit)->_subRowList);
delete *pplit;
}
output << endl;
placementProblemList.clear ();
@ -468,13 +472,13 @@ typedef list<PlacementProblem*> PlacementProblemList;
}
for ( RowVector::const_iterator rvit = _rowVector.begin(); rvit != _rowVector.end(); rvit++ ) {
surfaceTotalWidth += (*rvit)->getSubRowsWidth();
surfaceTotalWidth += (double)((*rvit)->getSubRowsWidth());
}
_computeRowsAndSubRows();
_margin = 1.0 - DbU::getLambda(instanceToPlaceWidthSum) / DbU::getLambda(surfaceTotalWidth);
if ( _margin < 0 ) {
_margin = 1.0 - instanceToPlaceWidthSum / surfaceTotalWidth;
if ( _margin < 0.0 ) {
throw Error("There is not enough free space to place the circuit %s < %s"
,DbU::getValueString(surfaceTotalWidth).c_str()
,DbU::getValueString(instanceToPlaceWidthSum).c_str()
@ -624,34 +628,34 @@ double Surface::getRowCost() const
return rowCost;
}
DbU::Unit Surface::getBinsSize() const
double Surface::getBinsSize() const
{
DbU::Unit totalBinsSize = 0;
double totalBinsSize = 0.0;
for (RowVector::const_iterator rvit = _rowVector.begin();
rvit != _rowVector.end();
rvit++)
totalBinsSize += (*rvit)->getBinsSize();
totalBinsSize += (double)(*rvit)->getBinsSize();
return totalBinsSize;
}
DbU::Unit Surface::getBinsCapa() const
double Surface::getBinsCapa() const
{
DbU::Unit totalBinsCapa = 0;
double totalBinsCapa = 0.0;
for (RowVector::const_iterator rvit = _rowVector.begin();
rvit != _rowVector.end();
rvit++)
totalBinsCapa += (*rvit)->getBinsCapa();
totalBinsCapa += (double)(*rvit)->getBinsCapa();
return totalBinsCapa;
}
DbU::Unit Surface::getSubRowsCapa() const
double Surface::getSubRowsCapa() const
{
DbU::Unit totalSubRowsCapa = 0;
double totalSubRowsCapa = 0.0;
for (RowVector::const_iterator rvit = _rowVector.begin();
rvit != _rowVector.end();
rvit++)
{
totalSubRowsCapa += (*rvit)->getSubRowsCapa();
totalSubRowsCapa += (double)(*rvit)->getSubRowsCapa();
}
return totalSubRowsCapa;
}
@ -682,26 +686,35 @@ void Surface::_DisplayInstances(MaukaEngine::UVector& instanceids, SubRowList& s
SubRowList::iterator srlit = subrowlist.begin();
MaukaEngine::UVector::const_iterator insIterator = instanceids.begin();
MaukaEngine::UVector::const_iterator lastLoopInsertedInsIterator = insIterator;
size_t nbInstancesPlaced = 0;
// First instance.
// if ( insIterator != instanceids.end() ) {
// Cell* master = (static_cast<Instance*>(_mauka->_instanceOccurrencesVector[*insIterator].getEntity()))->getMasterCell();
// DbU::Unit instanceWidth = _mauka->_instanceWidths[*insIterator];
// cerr << " Trying to add #0 id:" << *insIterator
// << " w:" << DbU::getValueString(instanceWidth)<< " " << master << endl;
// }
while(true)
while (true)
{
if (insIterator == instanceids.end())
{
cmess1 << " o Initial placement computing ... done. " << endl;
break;
// end of insertion
}
if (srlit == subrowlist.end())
{
cerr << Error("Mauka::_DisplayInstances(): Last row reached, but not last instance.") << endl;
srlit = subrowlist.begin();
if (lastLoopInsertedInsIterator != insIterator)
lastLoopInsertedInsIterator = insIterator;
else
{
// insertion of instances with respect of Bins margin
// did not succed, inserting what's left.
// did not succeed, inserting what's left.
while (insIterator != instanceids.end())
{
for (SubRow::BinVector::iterator bvit = (*srlit)->_binVector.begin();
@ -745,9 +758,11 @@ void Surface::_DisplayInstances(MaukaEngine::UVector& instanceids, SubRowList& s
unsigned nbInstancesToPlace = 0;
while (insIterator++ != instanceids.end())
++nbInstancesToPlace;
throw Error("Not enough free space to place all the instances.\n"
"Please increase the abutment box: %s (%d instances remains to place)"
//cerr << "Box: " << getBoundingBox() << endl;
throw Error("Not enough free space to place all the instances.<br>\n"
"Please increase the abutment box: %s %d placeds (%d instances remains to place)"
,getString(getBoundingBox()).c_str()
,nbInstancesPlaced
,nbInstancesToPlace
);
}
@ -767,16 +782,43 @@ void Surface::_DisplayInstances(MaukaEngine::UVector& instanceids, SubRowList& s
bvit++)
{
Bin* bin = *bvit;
if (insIterator == instanceids.end())
break;
// cerr << " Bin: " << bin->getBoundingBox()
// << " capa:" << DbU::getValueString(bin->getCapa())
// << " size:" << DbU::getValueString(bin->getSize())
// << " SubRow:"
// << " capa:" << DbU::getValueString(subRow->getCapa())
// << " size:" << DbU::getValueString(subRow->getSize())
// << endl;
if (insIterator == instanceids.end()) break;
unsigned instanceId = *insIterator;
DbU::Unit instanceWidth = _mauka->_instanceWidths[instanceId];
if (instanceWidth > subRow->getCapaVsSize())
break;
if (bin->TryAddInstance(instanceId))
++insIterator;
if (instanceWidth > subRow->getCapaVsSize()) {
// cerr << " SubRow capacity exceeded" << endl;
break;
}
if (bin->TryAddInstance(instanceId)) {
srlit = subrowlist.begin();
++nbInstancesPlaced;
++insIterator;
// if ( insIterator != instanceids.end() ) {
// Instance* instance = static_cast<Instance*>(_mauka->_instanceOccurrencesVector[instanceId].getEntity());
// instanceWidth = _mauka->_instanceWidths[instanceId];
// cerr << " Trying to add #" << nbInstancesPlaced
// << " id:" << *insIterator
// << " w:" << DbU::getValueString(instanceWidth)<< " " << instance << endl;
// cerr << " " << _mauka->_instanceOccurrencesVector[instanceId]<< endl;
// }
break;
}
}
++srlit;
// if ( srlit != subrowlist.end() ) {
// cerr << " SubRow capaVsSize: " << DbU::getValueString((*srlit)->getCapaVsSize()) << endl;
// }
}
}
}

View File

@ -69,14 +69,14 @@ class Bin : public Container {
// Attributes
// **********
private: static const Name _goName;
private: SubRow* _subRow;
private: MaukaEngine* _mauka;
private: MaukaEngine::UList _instanceOccurrenceIds;
private: DbU::Unit _size; // sum of the contained instances width
private: DbU::Unit _capa; // ideal occupation of the bin
private: unsigned _sourceHits;
private: unsigned _targetHits;
private: static const Name _goName;
private: SubRow* _subRow;
private: MaukaEngine* _mauka;
private: MaukaEngine::UList _instanceOccurrenceIds;
private: DbU::Unit _size; // sum of the contained instances width
private: DbU::Unit _capa; // ideal occupation of the bin
private: unsigned _sourceHits;
private: unsigned _targetHits;
// Constructors
// ************

View File

@ -27,6 +27,8 @@
#define __MAUKA_CONFIGURATION__
#include <string>
#include <boost/function.hpp>
#include "crlcore/CellGauge.h"
namespace Hurricane {
class Record;
@ -36,45 +38,57 @@ namespace Hurricane {
namespace Mauka {
using Hurricane::DbU;
using Hurricane::Cell;
using Hurricane::Record;
using CRL::CellGauge;
// -------------------------------------------------------------------
// Class : "Katabatic::Configuration".
// Class : "Mauka::Configuration".
class Configuration {
public:
typedef boost::function< void(void) > RefreshCb_t;
public:
static Configuration* getDefault ();
public:
// Constructor & Destructor.
Configuration ();
~Configuration ();
Configuration* clone () const;
Configuration ( CellGauge* );
~Configuration ();
Configuration* clone () const;
// Methods.
inline bool useStandardSimulatedAnnealing () const;
inline bool doIgnorePins () const;
inline bool doPlotBins () const;
inline double getSearchRatio () const;
inline double getAnnealingNetMult () const;
inline double getAnnealingBinMult () const;
inline double getAnnealingRowMult () const;
void print ( Cell* ) const;
inline void setStandardSimulatedAnnealing ( bool );
inline void setIgnorePins ( bool );
inline void setPlotBins ( bool );
inline void setSearchRatio ( double );
inline void setAnnealingNetMult ( double );
inline void setAnnealingBinMult ( double );
inline void setAnnealingRowMult ( double );
inline static double _normPercentage ( double ratio, double min=0.0, double max=1.0 );
Record* _getRecord () const;
std::string _getString () const;
std::string _getTypeName () const;
inline const CellGauge* getCellGauge () const;
inline bool useStandardSimulatedAnnealing () const;
inline bool doIgnorePins () const;
inline bool doPlotBins () const;
inline RefreshCb_t& getRefreshCb ();
inline double getSearchRatio () const;
inline double getAnnealingNetMult () const;
inline double getAnnealingBinMult () const;
inline double getAnnealingRowMult () const;
inline DbU::Unit getPitch () const;
inline DbU::Unit getSliceHeight () const;
inline DbU::Unit getSliceStep () const;
void print ( Cell* ) const;
inline void setRefreshCb ( RefreshCb_t );
inline void setStandardSimulatedAnnealing ( bool );
inline void setIgnorePins ( bool );
inline void setPlotBins ( bool );
inline void setSearchRatio ( double );
inline void setAnnealingNetMult ( double );
inline void setAnnealingBinMult ( double );
inline void setAnnealingRowMult ( double );
inline static double _normPercentage ( double ratio, double min=0.0, double max=1.0 );
Record* _getRecord () const;
std::string _getString () const;
std::string _getTypeName () const;
private:
// Attributes.
static Configuration* _default;
CellGauge* _cellGauge;
RefreshCb_t _refreshCb;
bool _standardSimulatedAnnealing;
bool _ignorePins;
bool _plotBins; // Plot bins utilisation.
@ -89,20 +103,27 @@ namespace Mauka {
// Inline Methods.
inline bool Configuration::useStandardSimulatedAnnealing () const { return _standardSimulatedAnnealing; }
inline bool Configuration::doIgnorePins () const { return _ignorePins; }
inline bool Configuration::doPlotBins () const { return _plotBins; }
inline double Configuration::getSearchRatio () const { return _searchRatio; }
inline double Configuration::getAnnealingNetMult () const { return _annealingNetMult; }
inline double Configuration::getAnnealingBinMult () const { return _annealingBinMult; }
inline double Configuration::getAnnealingRowMult () const { return _annealingRowMult; }
inline void Configuration::setStandardSimulatedAnnealing ( bool state ) { _standardSimulatedAnnealing=state; }
inline void Configuration::setIgnorePins ( bool state ) { _ignorePins=state; }
inline void Configuration::setPlotBins ( bool state ) { _plotBins=state; }
inline void Configuration::setSearchRatio ( double ratio ) { _searchRatio=_normPercentage(ratio,0.1); }
inline void Configuration::setAnnealingNetMult ( double mult ) { _annealingNetMult=_normPercentage(mult); }
inline void Configuration::setAnnealingBinMult ( double mult ) { _annealingBinMult=_normPercentage(mult); }
inline void Configuration::setAnnealingRowMult ( double mult ) { _annealingRowMult=_normPercentage(mult); }
inline const CellGauge* Configuration::getCellGauge () const { return _cellGauge; }
inline bool Configuration::useStandardSimulatedAnnealing () const { return _standardSimulatedAnnealing; }
inline bool Configuration::doIgnorePins () const { return _ignorePins; }
inline bool Configuration::doPlotBins () const { return _plotBins; }
inline double Configuration::getSearchRatio () const { return _searchRatio; }
inline double Configuration::getAnnealingNetMult () const { return _annealingNetMult; }
inline double Configuration::getAnnealingBinMult () const { return _annealingBinMult; }
inline double Configuration::getAnnealingRowMult () const { return _annealingRowMult; }
inline DbU::Unit Configuration::getPitch () const { return _cellGauge->getPitch(); }
inline DbU::Unit Configuration::getSliceHeight () const { return _cellGauge->getSliceHeight(); }
inline DbU::Unit Configuration::getSliceStep () const { return _cellGauge->getSliceStep(); }
inline void Configuration::setStandardSimulatedAnnealing ( bool state ) { _standardSimulatedAnnealing=state; }
inline void Configuration::setIgnorePins ( bool state ) { _ignorePins=state; }
inline void Configuration::setPlotBins ( bool state ) { _plotBins=state; }
inline void Configuration::setSearchRatio ( double ratio ) { _searchRatio=_normPercentage(ratio,0.1); }
inline void Configuration::setAnnealingNetMult ( double mult ) { _annealingNetMult=_normPercentage(mult); }
inline void Configuration::setAnnealingBinMult ( double mult ) { _annealingBinMult=_normPercentage(mult); }
inline void Configuration::setAnnealingRowMult ( double mult ) { _annealingRowMult=_normPercentage(mult); }
inline void Configuration::setRefreshCb ( Configuration::RefreshCb_t cb ) { _refreshCb=cb; }
inline Configuration::RefreshCb_t&
Configuration::getRefreshCb () { return _refreshCb; }
inline double Configuration::_normPercentage ( double ratio, double min, double max ) {
if ( ratio < min ) return min;

View File

@ -30,11 +30,16 @@
#include <QWidget>
class QLineEdit;
class QCheckBox;
class QComboBox;
namespace Nimbus {
class Configuration;
}
namespace Metis {
class Configuration;
}
namespace Mauka {
class Configuration;
@ -47,27 +52,60 @@ namespace Mauka {
class ConfigurationWidget : public QWidget {
Q_OBJECT;
public:
ConfigurationWidget ( QWidget* parent=NULL );
public slots:
void setConfiguration ( Nimbus::Configuration*, Configuration* );
void _applySettings ();
void _updateStandardAnnealingState ();
void _updateIgnorePinsState ();
void _updatePlotBinsState ();
void _updatePinsPlacementState ();
void _updateSearchRatio ();
void _updateAnnealingNetMult ();
void _updateAnnealingBinMult ();
void _updateAnnealingRowMult ();
void _updateAspectRatio ();
void _updateMargin ();
ConfigurationWidget ( QWidget* parent=NULL );
public slots:
void setConfiguration ( Nimbus::Configuration*
, Metis::Configuration*
, Configuration*
);
void _applySettings ();
// Metis relateds.
void _updatePartOrKWayHMetis ();
void _updateNumberOfInstancesStopCriterion ();
void _updateGlobalConnectionsWeightRatio ();
void _updateUbFactor ();
void _updateHMetisCustomOptions ();
void _updateHMetisNRuns ();
void _updateHMetisCType ();
void _updateHMetisRType ();
void _updateHMetisVCycle ();
void _updateHMetisReconst ();
// Nimbus/Mauka relateds.
void _updateStandardAnnealingState ();
void _updateIgnorePinsState ();
void _updatePlotBinsState ();
void _updatePinsPlacementState ();
void _updateSearchRatio ();
void _updateAnnealingNetMult ();
void _updateAnnealingBinMult ();
void _updateAnnealingRowMult ();
void _updateAspectRatio ();
void _updateMargin ();
private slots:
void _enableHMetisOptions ( int );
private:
int _hmetisCTypeToIndex ();
int _hmetisRTypeToIndex ();
int _hmetisVCycleToIndex ();
int _hmetisReconstToIndex ();
private:
Nimbus::Configuration* _nimbusConfiguration;
Metis::Configuration* _metisConfiguration;
Configuration* _maukaConfiguration;
QCheckBox* _partOrKWayHMetisState;
QCheckBox* _standardAnnealingState;
QCheckBox* _ignorePinsState;
QCheckBox* _plotBinsState;
QCheckBox* _pinsPlacementState;
QCheckBox* _hmetisCustomOptionsState;
QLineEdit* _hmetisNRunsEdit;
QComboBox* _hmetisCTypeCombo;
QComboBox* _hmetisRTypeCombo;
QComboBox* _hmetisVCycleCombo;
QComboBox* _hmetisReconstCombo;
QLineEdit* _numberOfInstancesStopCriterionEdit;
QLineEdit* _globalConnectionsWeightRatioEdit;
QLineEdit* _ubFactorEdit;
QLineEdit* _searchRatioEdit;
QLineEdit* _annealingNetMultEdit;
QLineEdit* _annealingBinMultEdit;

View File

@ -75,8 +75,9 @@ namespace Mauka {
Cell* getCell ();
virtual size_t release ();
virtual void addToMenu ( CellViewer* );
void postEvent ();
void refreshViewer ();
public slots:
void doQuadriPart ();
void run ();
void save ();

View File

@ -1,41 +1,31 @@
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// -*- C++ -*-
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
// License-Tag
// $Id$
//
// Date : 19/07/2006
// Author : Christophe Alexandre <Christophe.Alexandre@lip6.fr>
//
// Authors-Tag
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | M a u k a - P l a c e r |
// | |
// | Author : Christophe Alexandre |
// | E-mail : Christophe.Alexandre@lip6.fr |
// | Date : 19/07/2006 |
// | =============================================================== |
// | C++ Header : "./MaukaEngine.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __MAUKA_H
#define __MAUKA_H
#ifndef __MAUKA_ENGINE_H
#define __MAUKA_ENGINE_H
#include "hurricane/Instance.h"
#include "crlcore/ToolEngine.h"
@ -46,113 +36,137 @@
namespace Mauka {
using Hurricane::Record;
using Hurricane::Name;
using Hurricane::DbU;
using Hurricane::Box;
using Hurricane::Net;
using Hurricane::Cell;
using Hurricane::Instance;
using Hurricane::Occurrence;
using CRL::ToolEngine;
using Nimbus::GCell;
using Hurricane::Record;
using Hurricane::Name;
using Hurricane::DbU;
using Hurricane::Box;
using Hurricane::Net;
using Hurricane::Cell;
using Hurricane::Instance;
using Hurricane::Occurrence;
using CRL::ToolEngine;
using Nimbus::GCell;
class Surface;
class SimAnnealingPlacer;
class BBPlacer;
class MaukaEngine: public ToolEngine
// *********************************
{
//Mauka: a cool, light, Hawaiian wind descending from the montains.
friend class Surface;
friend class SimAnnealingPlacer;
friend class Move;
friend class Bin;
friend class SubRow;
friend class BBPlacer;
// Types
// *****
public: typedef ToolEngine Inherit;
public: typedef std::vector<Occurrence> InstanceOccurrencesVector;
public: typedef std::map<Occurrence, unsigned> InstanceOccurrencesMap;
public: typedef std::vector<unsigned> UVector;
public: typedef std::list<unsigned> UList;
public: typedef std::vector<UVector> UTable;
public: typedef std::vector<bool> BVector;
public: typedef std::vector<DbU::Unit> UnitVector;
public: typedef std::vector<Net*> NetVector;
public: typedef std::vector<Box> BoxVector;
public: typedef std::vector<BoxVector> BBoxes;
public: typedef std::vector< std::vector<double> > Costs;
public: typedef std::vector<bool> PrePlaceRow;
public: typedef std::vector<PrePlaceRow> PrePlaceTab;
class Surface;
class SimAnnealingPlacer;
class BBPlacer;
// Attributes
// **********
private: static Name _toolName;
private: Configuration* _configuration;
private: InstanceOccurrencesVector _instanceOccurrencesVector;
private: InstanceOccurrencesMap _instanceOccurrencesMap;
private: UnitVector _instanceWidths;
private: UTable _instanceNets;
private: NetVector _nets;
private: UTable _netInstances;
private: UVector _netInitX;
private: UVector _netInitY;
private: BVector _hasInitX;
private: BVector _hasInitY;
private: Surface* _surface;
private: SimAnnealingPlacer* _simAnnealingPlacer;
private: BBPlacer* _bbPlacer;
// -------------------------------------------------------------------
// Class : "Mauka::MaukaEngine".
//
// Mauka, a cool, light, Hawaiian wind descending from the montains.
class MaukaEngine: public ToolEngine
{
friend class Surface;
friend class SimAnnealingPlacer;
friend class Move;
friend class Bin;
friend class SubRow;
friend class BBPlacer;
public:
// Types.
typedef ToolEngine Inherit;
typedef std::vector<Occurrence> InstanceOccurrencesVector;
typedef std::map<Occurrence, unsigned> InstanceOccurrencesMap;
typedef std::vector<unsigned> UVector;
typedef std::list<unsigned> UList;
typedef std::vector<UVector> UTable;
typedef std::vector<bool> BVector;
typedef std::vector<DbU::Unit> UnitVector;
typedef std::vector<Net*> NetVector;
typedef std::vector<Box> BoxVector;
typedef std::vector<BoxVector> BBoxes;
typedef std::vector< std::vector<double> > Costs;
typedef std::vector<bool> PrePlaceRow;
typedef std::vector<PrePlaceRow> PrePlaceTab;
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;
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;
private:
// Attributes
static Name _toolName;
Configuration* _configuration;
InstanceOccurrencesVector _instanceOccurrencesVector;
InstanceOccurrencesMap _instanceOccurrencesMap;
UnitVector _instanceWidths;
UTable _instanceNets;
NetVector _nets;
UTable _netInstances;
UVector _netInitX;
UVector _netInitY;
BVector _hasInitX;
BVector _hasInitY;
Surface* _surface;
SimAnnealingPlacer* _simAnnealingPlacer;
BBPlacer* _bbPlacer;
// Constructor
// ***********
private: MaukaEngine(Cell* cell);
public: static MaukaEngine* create(Cell* cell, Box placementbox = Box());
// Accessors
// *********
public:
static MaukaEngine* get (Cell*);
static const Name& staticGetName ();
virtual const Name& getName () const;
inline Configuration* getConfiguration () const { return _configuration; }
inline bool useStandardSimulatedAnnealing () const { return _configuration->useStandardSimulatedAnnealing(); }
inline bool doIgnorePins () const { return _configuration->doIgnorePins(); }
inline bool doPlotBins () const { return _configuration->doPlotBins(); }
inline double getSearchRatio () const { return _configuration->getSearchRatio(); }
inline double getAnnealingNetMult () const { return _configuration->getAnnealingNetMult(); }
inline double getAnnealingBinMult () const { return _configuration->getAnnealingBinMult(); }
inline double getAnnealingRowMult () const { return _configuration->getAnnealingRowMult(); }
DbU::Unit getInstanceIdWidth (unsigned id) const { return _instanceWidths[id]; }
unsigned getRandomInstanceId () const;
private:
inline Surface* _getSurface () const { return _surface; }
private:
// Internals.
MaukaEngine ( Cell* );
void _postCreate ( Box& placementbox );
void _preDestroy ();
inline Surface* _getSurface () const { return _surface; }
Box PlotFixedPointsLabels ( std::ofstream& ) const;
void Construct ();
};
// Others
// ******
private: void _postCreate(Box& placementbox);
private: void _preDestroy();
public: static MaukaEngine* get ( const Cell* );
//public: void ReInit();
public: bool Iterate();
public: void Run();
public: void Test();
public: virtual std::string _getTypeName() const {return "MaukaEngine";};
public: virtual Record* _getRecord() const;
public: void Save() const;
public: void PlotBinsStats() const;
public: void Plot() const;
private: Box PlotFixedPointsLabels(std::ofstream& out) const;
private: void Construct();
};
// 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::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]; }
void setPlacementStatusRecursivelyToPlaced(Instance* instance);
bool TestMaukaConstruction(Cell* cell, GCell* gcell);
void setPlacementStatusRecursivelyToPlaced(Instance* instance);
bool TestMaukaConstruction(Cell* cell, GCell* gcell);
} // Enf of Mauka namespace.
#endif /* __MAUKA_H */
#endif // __MAUKA_ENGINE_H

View File

@ -92,9 +92,9 @@ class Surface: public Container {
public: Bin* getBinInSurface(Bin* srcbin, double dist);
public: double getBinCost() const;
public: double getRowCost() const;
public: DbU::Unit getBinsSize() const;
public: DbU::Unit getBinsCapa() const;
public: DbU::Unit getSubRowsCapa() const;
public: double getBinsSize() const;
public: double getBinsCapa() const;
public: double getSubRowsCapa() const;
public: double getMargin() const { return _margin; };
public: MaukaEngine* getMauka() { return _mauka; };