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...
This commit is contained in:
Jean-Paul Chaput 2021-11-26 11:29:23 +01:00
parent 966a25181f
commit 7c0f1fcf58
3 changed files with 24 additions and 19 deletions

View File

@ -858,18 +858,19 @@ namespace CRL {
{
size_t gates = 0;
forEach ( Instance*, iinstance, cell->getInstances() ) {
for ( Instance* instance : cell->getInstances() ) {
CatalogProperty *catalogProperty = static_cast<CatalogProperty*>
((*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 );
}
}

View File

@ -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 );

View File

@ -202,6 +202,7 @@ namespace Katana {
//Entity::setMemoryLimit( 1024 ); // 1Gb.
addMeasure<size_t>( "Gates"
, AllianceFramework::getInstancesCount(cell,AllianceFramework::IgnoreFeeds
|AllianceFramework::TerminalNetlist
|AllianceFramework::Recursive) );
}
@ -671,6 +672,8 @@ namespace Katana {
ostringstream result;
bool isSymbolic =
const_cast<KatanaEngine*>(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;