Introduce flags for placement callbacks in Etesian

This commit is contained in:
Gabriel Gouvine 2023-11-02 20:02:43 +01:00 committed by Gabriel Gouvine
parent d27cc8b956
commit 339ed4f9ff
6 changed files with 47 additions and 23 deletions

View File

@ -40,6 +40,7 @@ namespace Katana {
const Hurricane::BaseFlags Flags::ShowOverloadedGCells = (1L << 36); const Hurricane::BaseFlags Flags::ShowOverloadedGCells = (1L << 36);
const Hurricane::BaseFlags Flags::ShowBloatedInstances = (1L << 37); const Hurricane::BaseFlags Flags::ShowBloatedInstances = (1L << 37);
const Hurricane::BaseFlags Flags::ProtectSelf = (1L << 38); const Hurricane::BaseFlags Flags::ProtectSelf = (1L << 38);
const Hurricane::BaseFlags Flags::PlacementCallback = (1L << 39);
} // Anabatic namespace. } // Anabatic namespace.

View File

@ -380,12 +380,15 @@ namespace Katana {
} }
void KatanaEngine::setupGlobalGraph ( uint32_t mode ) void KatanaEngine::setupGlobalGraph ( Flags flags )
{ {
Cell* cell = getCell(); Cell* cell = getCell();
cell->flattenNets( Cell::Flags::BuildRings|Cell::Flags::WarnOnUnplacedInstances ); cell->flattenNets( Cell::Flags::BuildRings|Cell::Flags::WarnOnUnplacedInstances );
if (!(flags & Flags::PlacementCallback)) {
cell->createRoutingPadRings( Cell::Flags::BuildRings ); cell->createRoutingPadRings( Cell::Flags::BuildRings );
}
startMeasures(); startMeasures();
@ -500,6 +503,15 @@ namespace Katana {
if (flags & Flags::ShowBloatedInstances) selectBloatedInstances( this ); if (flags & Flags::ShowBloatedInstances) selectBloatedInstances( this );
Breakpoint::stop( 100, "Bloated cells from previous placement iteration." ); Breakpoint::stop( 100, "Bloated cells from previous placement iteration." );
if (not isChannelStyle()) {
if (!(flags & Flags::PlacementCallback)) {
setupPowerRails();
Flags protectFlags = (getConfiguration()->getNetBuilderStyle() == "VH,2RL")
? Flags::ProtectSelf : Flags::NoFlags;
protectRoutingPads( protectFlags );
}
}
startMeasures(); startMeasures();
cmess1 << " o Running global routing." << endl; cmess1 << " o Running global routing." << endl;
@ -708,9 +720,12 @@ namespace Katana {
Session::close(); Session::close();
if (isChannelStyle()) { if (isChannelStyle()) {
setupRoutingPlanes(); setupRoutingPlanes();
if (!(flags & Flags::PlacementCallback)) {
setupPowerRails(); setupPowerRails();
protectRoutingPads(); protectRoutingPads();
} }
}
setState( EngineState::EngineGlobalLoaded ); setState( EngineState::EngineGlobalLoaded );
setGlobalRoutingSuccess( ovEdges.empty() ); setGlobalRoutingSuccess( ovEdges.empty() );

View File

@ -240,7 +240,7 @@ namespace Katana {
} }
void KatanaEngine::digitalInit () void KatanaEngine::digitalInit ( Flags flags )
{ {
cdebug_log(155,1) << "KatanaEngine::_initDataBase()" << endl; cdebug_log(155,1) << "KatanaEngine::_initDataBase()" << endl;
_runKatanaInit(); _runKatanaInit();
@ -250,7 +250,7 @@ namespace Katana {
Super::chipPrep(); Super::chipPrep();
setupChannelMode(); setupChannelMode();
setupGlobalGraph( 0 ); setupGlobalGraph( flags );
if (not isChannelStyle()) { if (not isChannelStyle()) {
setupRoutingPlanes(); setupRoutingPlanes();
} }
@ -258,15 +258,16 @@ namespace Katana {
if (not setupPreRouteds()) { if (not setupPreRouteds()) {
setState( Anabatic::EngineDriving ); setState( Anabatic::EngineDriving );
throw Error( "KatanaEngine::digitalInit(): All nets are already routed, doing nothing." ); throw Error( "KatanaEngine::digitalInit(): All nets are already routed, doing nothing." );
} else {
if (not isChannelStyle()) {
setupPowerRails();
Flags flags = (getConfiguration()->getNetBuilderStyle() == "VH,2RL")
? Flags::ProtectSelf : Flags::NoFlags;
protectRoutingPads( flags );
}
} }
if (not isChannelStyle()) {
if (!(flags & Flags::PlacementCallback)) {
setupPowerRails();
Flags protectFlags = (getConfiguration()->getNetBuilderStyle() == "VH,2RL")
? Flags::ProtectSelf : Flags::NoFlags;
protectRoutingPads( protectFlags );
}
}
cdebug_tabw(155,-1); cdebug_tabw(155,-1);
} }

View File

@ -153,19 +153,25 @@ extern "C" {
} }
PyObject* PyKatanaEngine_digitalInit ( PyKatanaEngine* self ) PyObject* PyKatanaEngine_digitalInit ( PyKatanaEngine* self, PyObject* args )
{ {
cdebug_log(40,0) << "PyKatanaEngine_digitalInit()" << endl; cdebug_log(40,0) << "PyKatanaEngine_digitalInit()" << endl;
HTRY HTRY
METHOD_HEAD("KatanaEngine.digitalInit()") METHOD_HEAD("KatanaEngine.digitalInit()")
uint64_t flags = 0;
if (PyArg_ParseTuple(args,"|L:KatanaEngine.digitalInit", &flags)) {
if (katana->getViewer()) { if (katana->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::digitalInit,katana) )) { if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::digitalInit,katana, flags) )) {
PyErr_SetString( HurricaneError, "KatanaEngine::digitalInit() has thrown an exception (C++)." ); PyErr_SetString( HurricaneError, "KatanaEngine::digitalInit() has thrown an exception (C++)." );
return NULL; return NULL;
} }
} else { } else {
katana->digitalInit(); katana->digitalInit( flags );
}
} else {
PyErr_SetString(ConstructorError, "KatanaEngine.digitalInit(): Invalid number/bad type of parameter.");
return NULL;
} }
HCATCH HCATCH
@ -203,7 +209,7 @@ extern "C" {
HTRY HTRY
METHOD_HEAD("KatanaEngine.runGlobalRouter()") METHOD_HEAD("KatanaEngine.runGlobalRouter()")
uint64_t flags = 0; uint64_t flags = 0;
if (PyArg_ParseTuple(args,"L:KatanaEngine.runGlobalRouter", &flags)) { if (PyArg_ParseTuple(args,"|L:KatanaEngine.runGlobalRouter", &flags)) {
if (katana->getViewer()) { if (katana->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::runGlobalRouter,katana,flags) )) { if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::runGlobalRouter,katana,flags) )) {
PyErr_SetString( HurricaneError, "KatanaEngine::runGlobalrouter() has thrown an exception (C++)." ); PyErr_SetString( HurricaneError, "KatanaEngine::runGlobalrouter() has thrown an exception (C++)." );
@ -344,7 +350,7 @@ extern "C" {
, "Create a Katana engine on this cell." } , "Create a Katana engine on this cell." }
, { "setViewer" , (PyCFunction)PyKatanaEngine_setViewer , METH_VARARGS , { "setViewer" , (PyCFunction)PyKatanaEngine_setViewer , METH_VARARGS
, "Associate a Viewer to this KatanaEngine." } , "Associate a Viewer to this KatanaEngine." }
, { "digitalInit" , (PyCFunction)PyKatanaEngine_digitalInit , METH_NOARGS , { "digitalInit" , (PyCFunction)PyKatanaEngine_digitalInit , METH_VARARGS
, "Setup Katana for digital routing." } , "Setup Katana for digital routing." }
, { "exclude" , (PyCFunction)PyKatanaEngine_exclude , METH_VARARGS , { "exclude" , (PyCFunction)PyKatanaEngine_exclude , METH_VARARGS
, "Exclude a net from routing." } , "Exclude a net from routing." }

View File

@ -49,6 +49,7 @@ namespace Katana {
static const Hurricane::BaseFlags ShowOverloadedGCells; static const Hurricane::BaseFlags ShowOverloadedGCells;
static const Hurricane::BaseFlags ShowBloatedInstances; static const Hurricane::BaseFlags ShowBloatedInstances;
static const Hurricane::BaseFlags ProtectSelf; static const Hurricane::BaseFlags ProtectSelf;
static const Hurricane::BaseFlags PlacementCallback;
public: public:
inline Flags ( uint64_t ); inline Flags ( uint64_t );
inline Flags ( const Super& ); inline Flags ( const Super& );

View File

@ -126,10 +126,10 @@ namespace Katana {
void setInterrupt ( bool ); void setInterrupt ( bool );
void createChannels (); void createChannels ();
void setupRoutingPlanes (); void setupRoutingPlanes ();
void setupGlobalGraph ( uint32_t mode ); void setupGlobalGraph ( Flags flags=Flags::NoFlags );
void annotateGlobalGraph (); void annotateGlobalGraph ();
void setFixedPreRouted (); void setFixedPreRouted ();
void digitalInit (); void digitalInit ( Flags flags=Flags::NoFlags );
void analogInit (); void analogInit ();
void pairSymmetrics (); void pairSymmetrics ();
void updateEstimateDensity ( NetData*, double weight ); void updateEstimateDensity ( NetData*, double weight );