From 7c0f1fcf58b6795a71c631e71c704c5c866f5436 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 26 Nov 2021 11:29:23 +0100 Subject: [PATCH] Fairly compute the flat numbers of instances in a design. * New: In AllianceFramework::getInstancesCount(), add a flag TerminalNetlist to stop recursion on "terminal for netlist" instance level. This is to avoid counting physical only or non-routed instances inside hard macros, like SRAM blocks. This was leading to an overstimation of the "size" in number of gates of the routing problem. * Change: In KatanaEngine CTOR, call for the terminal for netlist number of gates... --- crlcore/src/ccore/AllianceFramework.cpp | 17 ++++++++------- crlcore/src/ccore/crlcore/AllianceFramework.h | 21 ++++++++++--------- katana/src/KatanaEngine.cpp | 5 ++++- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index cef022c0..80ca8133 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -858,18 +858,19 @@ namespace CRL { { size_t gates = 0; - forEach ( Instance*, iinstance, cell->getInstances() ) { + for ( Instance* instance : cell->getInstances() ) { CatalogProperty *catalogProperty = static_cast - ((*iinstance)->getMasterCell()->getProperty ( CatalogProperty::getPropertyName()) ); + (instance->getMasterCell()->getProperty ( CatalogProperty::getPropertyName()) ); - if ( catalogProperty != NULL ) { - Catalog::State* state = catalogProperty->getState (); - if ( (flags & IgnoreFeeds) and state->isFeed() ) continue; + if (catalogProperty) { + Catalog::State* state = catalogProperty->getState(); + if ((flags & IgnoreFeeds) and state->isFeed()) continue; } - ++gates; + if (not (flags & TerminalNetlist) or instance->getMasterCell()->isTerminalNetlist()) + ++gates; - if ( flags & Recursive ) { - gates += getInstancesCount ( iinstance->getMasterCell(), flags ); + if (flags & Recursive) { + gates += getInstancesCount( instance->getMasterCell(), flags ); } } diff --git a/crlcore/src/ccore/crlcore/AllianceFramework.h b/crlcore/src/ccore/crlcore/AllianceFramework.h index 7c7122e9..47bc4f66 100644 --- a/crlcore/src/ccore/crlcore/AllianceFramework.h +++ b/crlcore/src/ccore/crlcore/AllianceFramework.h @@ -42,19 +42,20 @@ namespace CRL { class AllianceFramework : public DBo { typedef DBo Super; public: - enum FunctionsFlags { NoFlags = 0 - , NoPythonInit = (1<<0) + enum FunctionsFlags { NoFlags = 0 + , NoPythonInit = (1<<0) }; - enum InstancesCountFlags { Recursive = (1<<0) - , IgnoreFeeds = (1<<1) + enum InstancesCountFlags { Recursive = (1<<0) + , IgnoreFeeds = (1<<1) + , TerminalNetlist = (1<<1) }; - enum LibraryFlags { CreateLibrary = (1<<0) - , AppendLibrary = (1<<1) - , HasCatalog = (1<<2) + enum LibraryFlags { CreateLibrary = (1<<0) + , AppendLibrary = (1<<1) + , HasCatalog = (1<<2) }; - enum NotifyFlags { AddedLibrary = (1<<0) - , RemovedLibrary = (1<<1) - , ConfigChanged = (1<<2) + enum NotifyFlags { AddedLibrary = (1<<0) + , RemovedLibrary = (1<<1) + , ConfigChanged = (1<<2) }; public: static AllianceFramework* create ( unsigned long flags=NoFlags ); diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index 14df0a15..07bd3843 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -202,6 +202,7 @@ namespace Katana { //Entity::setMemoryLimit( 1024 ); // 1Gb. addMeasure( "Gates" , AllianceFramework::getInstancesCount(cell,AllianceFramework::IgnoreFeeds + |AllianceFramework::TerminalNetlist |AllianceFramework::Recursive) ); } @@ -671,6 +672,8 @@ namespace Katana { ostringstream result; bool isSymbolic = const_cast(this)->getConfiguration()->getRoutingGauge()->isSymbolic(); + // Max symbolic wire: 100000L, max real wire: 2mm. + uint64_t maxWL = (isSymbolic) ? 100000 : 2000000; AutoSegmentLut::const_iterator ilut = _getAutoSegmentLut().begin(); for ( ; ilut != _getAutoSegmentLut().end() ; ilut++ ) { @@ -682,7 +685,7 @@ namespace Katana { wl = (unsigned long long)DbU::toLambda( segment->getLength() ); else wl = (unsigned long long)DbU::toPhysical( segment->getLength(), DbU::UnitPower::Nano ); - if (wl > 100000) { + if (wl > maxWL) { cerr << Error("KatanaEngine::printCompletion(): Suspiciously long wire: %llu for %p:%s" ,wl,ilut->first,getString(segment).c_str()) << endl; continue;