* ./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(HURRICANE REQUIRED)
FIND_PACKAGE(CORIOLIS REQUIRED) FIND_PACKAGE(CORIOLIS REQUIRED)
FIND_PACKAGE(NIMBUS REQUIRED) FIND_PACKAGE(NIMBUS REQUIRED)
FIND_PACKAGE(METIS REQUIRED)
SET_LIB_LINK_MODE() SET_LIB_LINK_MODE()

View File

@ -71,8 +71,6 @@
#include "hurricane/Net.h" #include "hurricane/Net.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "crlcore/ToolBox.h" #include "crlcore/ToolBox.h"
#include "crlcore/CellGauge.h"
#include "crlcore/AllianceFramework.h"
#include "mauka/MaukaEngine.h" #include "mauka/MaukaEngine.h"
#include "mauka/Surface.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 whiteSpace = subRow->getWidth() - totalInstanceSizeInRow;
DbU::Unit instanceWhiteSpacePitch = (whiteSpace / _subRowInstances.back().size()) / pitch; DbU::Unit instanceWhiteSpacePitch = (whiteSpace / _subRowInstances.back().size()) / pitch;
DbU::Unit whiteSpaceRemain = whiteSpace DbU::Unit whiteSpaceRemain = whiteSpace

View File

@ -37,7 +37,10 @@
add_library ( mauka ${cpps} ${mocCpps} ) 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_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES} ${HURRICANE_GRAPHICAL_LIBRARIES}
${QT_LIBRARIES} ${QT_LIBRARIES}

View File

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

View File

@ -30,12 +30,15 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox>
#include <QLineEdit> #include <QLineEdit>
#include <QIntValidator> #include <QIntValidator>
#include <QDoubleValidator> #include <QDoubleValidator>
#include "hurricane/viewer/Graphics.h" #include "hurricane/viewer/Graphics.h"
#include "nimbus/Configuration.h" #include "nimbus/Configuration.h"
#include "metis/Configuration.h"
#include "metis/MetisEngine.h"
#include "mauka/Configuration.h" #include "mauka/Configuration.h"
#include "mauka/ConfigurationWidget.h" #include "mauka/ConfigurationWidget.h"
@ -43,6 +46,7 @@
namespace Mauka { namespace Mauka {
using Hurricane::Graphics; using Hurricane::Graphics;
using Metis::MetisEngine;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -51,106 +55,212 @@ namespace Mauka {
ConfigurationWidget::ConfigurationWidget ( QWidget* parent ) ConfigurationWidget::ConfigurationWidget ( QWidget* parent )
: QWidget(parent) : QWidget(parent)
, _nimbusConfiguration (NULL) , _nimbusConfiguration (NULL)
, _maukaConfiguration (NULL) , _metisConfiguration (NULL)
, _standardAnnealingState(new QCheckBox()) , _maukaConfiguration (NULL)
, _ignorePinsState (new QCheckBox()) , _partOrKWayHMetisState (new QCheckBox())
, _plotBinsState (new QCheckBox()) , _standardAnnealingState (new QCheckBox())
, _pinsPlacementState (new QCheckBox()) , _ignorePinsState (new QCheckBox())
, _searchRatioEdit (new QLineEdit()) , _plotBinsState (new QCheckBox())
, _annealingNetMultEdit (new QLineEdit()) , _pinsPlacementState (new QCheckBox())
, _annealingBinMultEdit (new QLineEdit()) , _hmetisCustomOptionsState (new QCheckBox())
, _annealingRowMultEdit (new QLineEdit()) , _hmetisNRunsEdit (new QLineEdit())
, _aspectRatioEdit (new QLineEdit()) , _hmetisCTypeCombo (new QComboBox())
, _marginEdit (new QLineEdit()) , _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 ); setAttribute ( Qt::WA_QuitOnClose, false );
QVBoxLayout* vLayout = new QVBoxLayout (); QVBoxLayout* vLayout = new QVBoxLayout ();
QGridLayout* gLayout = new QGridLayout (); QGridLayout* gLayout = new QGridLayout ();
// Metis configuration.
const int metisRow = 0;
QLabel* label = new QLabel(); QLabel* label = new QLabel();
label->setFont ( Graphics::getNormalFont(true) ); label->setFont ( Graphics::getNormalFont(true) );
label->setText ( "Mauka - Placer" ); label->setText ( "hMETIS - Partionner" );
gLayout->addWidget ( label, 0, 0, 1, 4, Qt::AlignLeft ); 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. // 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 = new QLabel();
label->setText ( "Pins Placement" ); label->setText ( "Pins Placement" );
_pinsPlacementState->setEnabled ( false ); _pinsPlacementState->setEnabled ( false );
gLayout->addWidget ( label , 1, 0, Qt::AlignRight ); gLayout->addWidget ( label , nimbusRow+1, 0, Qt::AlignRight );
gLayout->addWidget ( _pinsPlacementState, 1, 1, Qt::AlignLeft ); gLayout->addWidget ( _pinsPlacementState, nimbusRow+1, 1, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Aspect Ratio: X/Y (%)" ); label->setText ( "Aspect Ratio: X/Y (%)" );
_aspectRatioEdit->setValidator ( new QDoubleValidator(this) ); _aspectRatioEdit->setValidator ( new QDoubleValidator(this) );
_aspectRatioEdit->setEnabled ( false ); _aspectRatioEdit->setEnabled ( false );
gLayout->addWidget ( label , 1, 2, Qt::AlignRight ); gLayout->addWidget ( label , nimbusRow+1, 2, Qt::AlignRight );
gLayout->addWidget ( _aspectRatioEdit, 1, 3, Qt::AlignLeft ); gLayout->addWidget ( _aspectRatioEdit, nimbusRow+1, 3, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Space Margin (%)" ); label->setText ( "Space Margin (%)" );
_marginEdit->setValidator ( new QDoubleValidator(this) ); _marginEdit->setValidator ( new QDoubleValidator(this) );
_marginEdit->setEnabled ( false ); _marginEdit->setEnabled ( false );
gLayout->addWidget ( label , 2, 2, Qt::AlignRight ); gLayout->addWidget ( label , nimbusRow+2, 2, Qt::AlignRight );
gLayout->addWidget ( _marginEdit, 2, 3, Qt::AlignLeft ); gLayout->addWidget ( _marginEdit, nimbusRow+2, 3, Qt::AlignLeft );
QFrame* separator = new QFrame (); separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine ); separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken ); separator->setFrameShadow ( QFrame::Sunken );
gLayout->addWidget ( separator, 3, 0, 1, 4 ); gLayout->addWidget ( separator, nimbusRow+3, 0, 1, 4 );
// Mauka configuration. // Mauka configuration.
const int maukaRow = nimbusRow+4;
label = new QLabel(); label = new QLabel();
label->setText ( "Standard Annealing" ); label->setText ( "Standard Annealing" );
_standardAnnealingState->setEnabled ( false ); _standardAnnealingState->setEnabled ( false );
gLayout->addWidget ( label , 4, 0, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+0, 0, Qt::AlignRight );
gLayout->addWidget ( _standardAnnealingState, 4, 1, Qt::AlignLeft ); gLayout->addWidget ( _standardAnnealingState, maukaRow+0, 1, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Ignore Pins" ); label->setText ( "Ignore Pins" );
_ignorePinsState->setEnabled ( false ); _ignorePinsState->setEnabled ( false );
gLayout->addWidget ( label , 5, 0, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+1, 0, Qt::AlignRight );
gLayout->addWidget ( _ignorePinsState, 5, 1, Qt::AlignLeft ); gLayout->addWidget ( _ignorePinsState, maukaRow+1, 1, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Plot Bins" ); label->setText ( "Plot Bins" );
_plotBinsState->setEnabled ( false ); _plotBinsState->setEnabled ( false );
gLayout->addWidget ( label , 6, 0, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+2, 0, Qt::AlignRight );
gLayout->addWidget ( _plotBinsState, 6, 1, Qt::AlignLeft ); gLayout->addWidget ( _plotBinsState, maukaRow+2, 1, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Search Ratio (%)" ); label->setText ( "Search Ratio (%)" );
_searchRatioEdit->setValidator ( new QDoubleValidator(this) ); _searchRatioEdit->setValidator ( new QDoubleValidator(this) );
_searchRatioEdit->setEnabled ( false ); _searchRatioEdit->setEnabled ( false );
gLayout->addWidget ( label , 4, 2, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+0, 2, Qt::AlignRight );
gLayout->addWidget ( _searchRatioEdit, 4, 3, Qt::AlignLeft ); gLayout->addWidget ( _searchRatioEdit, maukaRow+0, 3, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Annealing Net Mult (%)" ); label->setText ( "Annealing Net Mult (%)" );
_annealingNetMultEdit->setValidator ( new QDoubleValidator(this) ); _annealingNetMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingNetMultEdit->setEnabled ( false ); _annealingNetMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 5, 2, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+1, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingNetMultEdit, 5, 3, Qt::AlignLeft ); gLayout->addWidget ( _annealingNetMultEdit, maukaRow+1, 3, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Annealing Bin Mult (%)" ); label->setText ( "Annealing Bin Mult (%)" );
_annealingBinMultEdit->setValidator ( new QDoubleValidator(this) ); _annealingBinMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingBinMultEdit->setEnabled ( false ); _annealingBinMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 6, 2, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+2, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingBinMultEdit, 6, 3, Qt::AlignLeft ); gLayout->addWidget ( _annealingBinMultEdit, maukaRow+2, 3, Qt::AlignLeft );
label = new QLabel(); label = new QLabel();
label->setText ( "Annealing Row Mult (%)" ); label->setText ( "Annealing Row Mult (%)" );
_annealingRowMultEdit->setValidator ( new QDoubleValidator(this) ); _annealingRowMultEdit->setValidator ( new QDoubleValidator(this) );
_annealingRowMultEdit->setEnabled ( false ); _annealingRowMultEdit->setEnabled ( false );
gLayout->addWidget ( label , 7, 2, Qt::AlignRight ); gLayout->addWidget ( label , maukaRow+3, 2, Qt::AlignRight );
gLayout->addWidget ( _annealingRowMultEdit, 7, 3, Qt::AlignLeft ); gLayout->addWidget ( _annealingRowMultEdit, maukaRow+3, 3, Qt::AlignLeft );
separator = new QFrame (); separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine ); separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken ); separator->setFrameShadow ( QFrame::Sunken );
gLayout->addWidget ( separator, 8, 0, 1, 4 ); gLayout->addWidget ( separator, maukaRow+4, 0, 1, 4 );
vLayout->addLayout ( gLayout ); vLayout->addLayout ( gLayout );
@ -168,12 +278,18 @@ namespace Mauka {
setLayout ( vLayout ); setLayout ( vLayout );
connect ( apply, SIGNAL(clicked()), this, SLOT(_applySettings()) ); connect ( apply, SIGNAL(clicked()), this, SLOT(_applySettings()) );
connect ( _hmetisCustomOptionsState, SIGNAL(stateChanged(int)), this, SLOT(_enableHMetisOptions(int)) );
} }
void ConfigurationWidget::setConfiguration ( Nimbus::Configuration* nimbusConfig void ConfigurationWidget::setConfiguration ( Nimbus::Configuration* nimbusConfig
, Metis::Configuration* metisConfig
, Configuration* maukaConfig ) , Configuration* maukaConfig )
{ {
_nimbusConfiguration = nimbusConfig;
_metisConfiguration = metisConfig;
_maukaConfiguration = maukaConfig;
if ( maukaConfig != NULL ) { if ( maukaConfig != NULL ) {
_searchRatioEdit ->setText ( QString("%1").arg(maukaConfig ->getSearchRatio()) ); _searchRatioEdit ->setText ( QString("%1").arg(maukaConfig ->getSearchRatio()) );
_annealingNetMultEdit->setText ( QString("%1").arg(maukaConfig ->getAnnealingNetMult()) ); _annealingNetMultEdit->setText ( QString("%1").arg(maukaConfig ->getAnnealingNetMult()) );
@ -197,6 +313,29 @@ namespace Mauka {
_ignorePinsState ->setEnabled ( true ); _ignorePinsState ->setEnabled ( true );
_plotBinsState ->setEnabled ( true ); _plotBinsState ->setEnabled ( true );
_pinsPlacementState ->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 { } else {
_searchRatioEdit ->setEnabled ( false ); _searchRatioEdit ->setEnabled ( false );
_annealingNetMultEdit ->setEnabled ( false ); _annealingNetMultEdit ->setEnabled ( false );
@ -204,16 +343,33 @@ namespace Mauka {
_annealingRowMultEdit ->setEnabled ( false ); _annealingRowMultEdit ->setEnabled ( false );
_marginEdit ->setEnabled ( false ); _marginEdit ->setEnabled ( false );
_standardAnnealingState->setEnabled ( false ); _standardAnnealingState->setEnabled ( false );
_standardAnnealingState->setEnabled ( false );
_ignorePinsState ->setEnabled ( false ); _ignorePinsState ->setEnabled ( false );
_plotBinsState ->setEnabled ( false ); _plotBinsState ->setEnabled ( false );
_pinsPlacementState ->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; _nimbusConfiguration = NULL;
_metisConfiguration = NULL;
_maukaConfiguration = 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; if ( _maukaConfiguration == NULL ) return;
_updatePartOrKWayHMetis ();
_updateNumberOfInstancesStopCriterion ();
_updateGlobalConnectionsWeightRatio ();
_updateUbFactor ();
_updateHMetisCustomOptions ();
_updateHMetisCType ();
_updateHMetisRType ();
_updateHMetisVCycle ();
_updateHMetisReconst ();
_updateStandardAnnealingState (); _updateStandardAnnealingState ();
_updateIgnorePinsState (); _updateIgnorePinsState ();
_updatePlotBinsState (); _updatePlotBinsState ();
@ -231,6 +397,19 @@ namespace Mauka {
_updateAnnealingRowMult (); _updateAnnealingRowMult ();
_updateAspectRatio (); _updateAspectRatio ();
_updateMargin (); _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. } // End of Mauka namespace.

View File

@ -45,6 +45,7 @@
#include <crlcore/Utilities.h> #include <crlcore/Utilities.h>
#include <crlcore/AllianceFramework.h> #include <crlcore/AllianceFramework.h>
#include <nimbus/NimbusEngine.h> #include <nimbus/NimbusEngine.h>
#include <metis/MetisEngine.h>
#include <mauka/Container.h> #include <mauka/Container.h>
#include <mauka/GraphicMaukaEngine.h> #include <mauka/GraphicMaukaEngine.h>
#include <mauka/ConfigurationWidget.h> #include <mauka/ConfigurationWidget.h>
@ -66,6 +67,7 @@ namespace Mauka {
using CRL::Catalog; using CRL::Catalog;
using CRL::AllianceFramework; using CRL::AllianceFramework;
using Nimbus::NimbusEngine; using Nimbus::NimbusEngine;
using Metis::MetisEngine;
size_t GraphicMaukaEngine::_references = 0; 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 () MaukaEngine* GraphicMaukaEngine::createEngine ()
{ {
Cell* cell = getCell (); Cell* cell = getCell ();
MaukaEngine* mauka = MaukaEngine::get ( cell ); MaukaEngine* mauka = MaukaEngine::get ( cell );
if ( mauka == NULL ) { 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 ); mauka = MaukaEngine::create ( cell );
if ( cmess1.enabled() )
mauka->getConfiguration()->print( cell );
} else } else
cerr << Warning("%s already has a Mauka engine.",getString(cell).c_str()) << endl; 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 () void GraphicMaukaEngine::run ()
{ {
MaukaEngine* mauka = createEngine (); MaukaEngine* mauka = createEngine ();
if ( mauka == NULL ) { if ( mauka == NULL ) {
throw Error("MaukaEngine not created yet, run the global router first."); throw Error("MaukaEngine not created yet, run the global router first.");
} }
mauka->setRefreshCb ( boost::bind(&GraphicMaukaEngine::refreshViewer,this) );
emit cellPreModificated (); emit cellPreModificated ();
_viewer->clearToolInterrupt (); _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 ) void GraphicMaukaEngine::addToMenu ( CellViewer* viewer )
{ {
assert ( _viewer == NULL ); assert ( _viewer == NULL );
@ -202,13 +250,20 @@ namespace Mauka {
if ( placeAction != NULL ) if ( placeAction != NULL )
cerr << Warning("GraphicMaukaEngine::addToMenu() - Mauka placer already hooked in.") << endl; cerr << Warning("GraphicMaukaEngine::addToMenu() - Mauka placer already hooked in.") << endl;
else { 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 ); QAction* placeAction = new QAction ( tr("Mauka - &Place"), _viewer );
placeAction->setObjectName ( "viewer.menuBar.placeAndRoute.maukaPlace" ); placeAction->setObjectName ( "viewer.menuBar.placeAndRoute.maukaPlace" );
placeAction->setStatusTip ( tr("Run the <b>Mauka</b> placer") ); placeAction->setStatusTip ( tr("Run the <b>Mauka</b> placer") );
placeAction->setVisible ( true ); placeAction->setVisible ( true );
prMenu->addAction ( placeAction ); 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 ()) ); connect ( this, SIGNAL(cellPreModificated ()), _viewer->getCellWidget(), SLOT(cellPreModificate ()) );
@ -221,7 +276,10 @@ namespace Mauka {
if ( setting == NULL ) { if ( setting == NULL ) {
setting = new ConfigurationWidget (); setting = new ConfigurationWidget ();
setting->setObjectName ( "controller.tabSettings.setting.mauka" ); 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" ); controller->addSetting ( setting, "Mauka" );
} }
} }

View File

@ -34,12 +34,14 @@
// //
// Authors-Tag // Authors-Tag
#include <queue>
#include "hurricane/Warning.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "hurricane/HyperNet.h" #include "hurricane/HyperNet.h"
#include "hurricane/Timer.h" #include "hurricane/Timer.h"
#include "hurricane/DataBase.h" #include "hurricane/DataBase.h"
#include "crlcore/CellGauge.h" #include "nimbus/GCell.h"
#include "crlcore/AllianceFramework.h" #include "nimbus/NimbusEngine.h"
#include "mauka/Surface.h" #include "mauka/Surface.h"
#include "mauka/Row.h" #include "mauka/Row.h"
@ -49,6 +51,8 @@
namespace Mauka { namespace Mauka {
using Hurricane::ForEachIterator;
using Hurricane::Warning;
using Hurricane::Plug; using Hurricane::Plug;
using Hurricane::Path; using Hurricane::Path;
using Hurricane::OccurrenceLocator; using Hurricane::OccurrenceLocator;
@ -56,6 +60,7 @@ using Hurricane::PlugLocator;
using Hurricane::HyperNet; using Hurricane::HyperNet;
using Hurricane::Timer; using Hurricane::Timer;
using namespace CRL; using namespace CRL;
using namespace Nimbus;
Name MaukaEngine::_toolName = "Mauka"; Name MaukaEngine::_toolName = "Mauka";
@ -460,9 +465,8 @@ namespace {
bool TestMaukaConstruction(Cell* cell, GCell* gcell) bool TestMaukaConstruction(Cell* cell, GCell* gcell)
// ************************************************* // *************************************************
{ {
CellGauge* gauge = AllianceFramework::get()->getCellGauge(); DbU::Unit pitch = Configuration::getDefault()->getPitch();
DbU::Unit pitch = gauge->getPitch(); DbU::Unit sliceHeight = Configuration::getDefault()->getSliceHeight();
DbU::Unit sliceHeight = gauge->getSliceHeight();
const Box& box = gcell->getBox(); const Box& box = gcell->getBox();
@ -666,4 +670,44 @@ unsigned MaukaEngine::getRandomInstanceId() const {
return instanceId; 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; cmess1 << " o Beginning global placement" << endl;
cmess2 << Dots::asSizet (" - Number of nodes to place",_mauka->_instanceOccurrencesVector.size()) << 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 RowCost" ,_rowCost) << endl;
cmess2 << Dots::asDouble(" - Initial BinCost" ,_binCost) << endl; cmess2 << Dots::asDouble(" - Initial BinCost" ,_binCost) << endl;
@ -287,6 +287,9 @@ bool SimAnnealingPlacer::Iterate()
cout << "NetCost = " << _netCost << endl << endl; cout << "NetCost = " << _netCost << endl << endl;
// assert ((netCost - 1.0 <= debug) && (debug <= netCost + 1.0)); // assert ((netCost - 1.0 <= debug) && (debug <= netCost + 1.0));
} }
if ( _mauka->getRefreshCb() != NULL ) _mauka->getRefreshCb() ();
return ((_temperature != 0.0) return ((_temperature != 0.0)
&& ((sucRatio > 0.15) || (stdDev > (0.0001 / getCost())))); && ((sucRatio > 0.15) || (stdDev > (0.0001 / getCost()))));
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,41 +1,31 @@
// This file is part of the Coriolis Project. // -*- C++ -*-
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// //
// Main contributors : // This file is part of the Coriolis Software.
// Christophe Alexandre <Christophe.Alexandre@lip6.fr> // Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
// 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, // $Id$
// 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 // x-----------------------------------------------------------------x
// along with the Coriolis Project; if not, write to the Free Software // | |
// Foundation, inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // | C O R I O L I S |
// // | M a u k a - P l a c e r |
// // | |
// License-Tag // | Author : Christophe Alexandre |
// // | E-mail : Christophe.Alexandre@lip6.fr |
// Date : 19/07/2006 // | Date : 19/07/2006 |
// Author : Christophe Alexandre <Christophe.Alexandre@lip6.fr> // | =============================================================== |
// // | C++ Header : "./MaukaEngine.h" |
// Authors-Tag // | *************************************************************** |
// | 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 "hurricane/Instance.h"
#include "crlcore/ToolEngine.h" #include "crlcore/ToolEngine.h"
@ -46,113 +36,137 @@
namespace Mauka { namespace Mauka {
using Hurricane::Record; using Hurricane::Record;
using Hurricane::Name; using Hurricane::Name;
using Hurricane::DbU; using Hurricane::DbU;
using Hurricane::Box; using Hurricane::Box;
using Hurricane::Net; using Hurricane::Net;
using Hurricane::Cell; using Hurricane::Cell;
using Hurricane::Instance; using Hurricane::Instance;
using Hurricane::Occurrence; using Hurricane::Occurrence;
using CRL::ToolEngine; using CRL::ToolEngine;
using Nimbus::GCell; using Nimbus::GCell;
class Surface; class Surface;
class SimAnnealingPlacer; class SimAnnealingPlacer;
class BBPlacer; 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;
// 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;
// Constructor // -------------------------------------------------------------------
// *********** // Class : "Mauka::MaukaEngine".
private: MaukaEngine(Cell* cell); //
public: static MaukaEngine* create(Cell* cell, Box placementbox = Box()); // Mauka, a cool, light, Hawaiian wind descending from the montains.
// Accessors class MaukaEngine: public ToolEngine
// ********* {
public: friend class Surface;
static MaukaEngine* get (Cell*); friend class SimAnnealingPlacer;
static const Name& staticGetName (); friend class Move;
virtual const Name& getName () const; friend class Bin;
inline Configuration* getConfiguration () const { return _configuration; } friend class SubRow;
inline bool useStandardSimulatedAnnealing () const { return _configuration->useStandardSimulatedAnnealing(); } friend class BBPlacer;
inline bool doIgnorePins () const { return _configuration->doIgnorePins(); } public:
inline bool doPlotBins () const { return _configuration->doPlotBins(); } // Types.
inline double getSearchRatio () const { return _configuration->getSearchRatio(); } typedef ToolEngine Inherit;
inline double getAnnealingNetMult () const { return _configuration->getAnnealingNetMult(); } typedef std::vector<Occurrence> InstanceOccurrencesVector;
inline double getAnnealingBinMult () const { return _configuration->getAnnealingBinMult(); } typedef std::map<Occurrence, unsigned> InstanceOccurrencesMap;
inline double getAnnealingRowMult () const { return _configuration->getAnnealingRowMult(); } typedef std::vector<unsigned> UVector;
DbU::Unit getInstanceIdWidth (unsigned id) const { return _instanceWidths[id]; } typedef std::list<unsigned> UList;
unsigned getRandomInstanceId () const; typedef std::vector<UVector> UTable;
private: typedef std::vector<bool> BVector;
inline Surface* _getSurface () const { return _surface; } 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;
// Others public:
// ****** // Constructor.
private: void _postCreate(Box& placementbox); static void regroupOverloadedGCells ( Cell* );
private: void _preDestroy(); static MaukaEngine* create ( Cell*, Box placementbox = Box() );
public: static MaukaEngine* get ( const Cell* ); // Accessors
//public: void ReInit(); static MaukaEngine* get ( Cell* );
public: bool Iterate(); static const Name& staticGetName ();
public: void Run(); virtual const Name& getName () const;
public: void Test(); inline Configuration* getConfiguration () const;
public: virtual std::string _getTypeName() const {return "MaukaEngine";}; inline DbU::Unit getPitch () const;
public: virtual Record* _getRecord() const; inline DbU::Unit getSliceHeight () const;
public: void Save() const; inline DbU::Unit getSliceStep () const;
public: void PlotBinsStats() const; inline bool useStandardSimulatedAnnealing () const;
public: void Plot() const; inline bool doIgnorePins () const;
private: Box PlotFixedPointsLabels(std::ofstream& out) const; inline bool doPlotBins () const;
private: void Construct(); 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;
private:
// Internals.
MaukaEngine ( Cell* );
void _postCreate ( Box& placementbox );
void _preDestroy ();
inline Surface* _getSurface () const { return _surface; }
Box PlotFixedPointsLabels ( std::ofstream& ) const;
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. } // 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: Bin* getBinInSurface(Bin* srcbin, double dist);
public: double getBinCost() const; public: double getBinCost() const;
public: double getRowCost() const; public: double getRowCost() const;
public: DbU::Unit getBinsSize() const; public: double getBinsSize() const;
public: DbU::Unit getBinsCapa() const; public: double getBinsCapa() const;
public: DbU::Unit getSubRowsCapa() const; public: double getSubRowsCapa() const;
public: double getMargin() const { return _margin; }; public: double getMargin() const { return _margin; };
public: MaukaEngine* getMauka() { return _mauka; }; public: MaukaEngine* getMauka() { return _mauka; };