From 0a64f3b83de3589fddaa3941dee4a91fad84daba Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 12 May 2022 17:51:56 +0200 Subject: [PATCH] Create and connect dummy signals for unconnected *outputs* in BLIF parser. --- crlcore/src/ccore/blif/BlifParser.cpp | 47 +++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/crlcore/src/ccore/blif/BlifParser.cpp b/crlcore/src/ccore/blif/BlifParser.cpp index 405add5d..16d01f24 100644 --- a/crlcore/src/ccore/blif/BlifParser.cpp +++ b/crlcore/src/ccore/blif/BlifParser.cpp @@ -280,13 +280,15 @@ namespace { void connectSubckts (); Net* mergeNet ( string name, bool isExternal, unsigned int ); Net* mergeAlias ( string name1, string name2 ); + Net* newDummyNet (); private: - Cell* _cell; - Subckts _subckts; - size_t _depth; - size_t _supplyCount; - Instance* _oneInstance; - Instance* _zeroInstance; + Cell* _cell; + Subckts _subckts; + size_t _depth; + size_t _supplyCount; + Instance* _oneInstance; + Instance* _zeroInstance; + vector _dummyOutputs; }; @@ -482,6 +484,7 @@ namespace { , _supplyCount (0) , _oneInstance (NULL) , _zeroInstance(NULL) + , _dummyOutputs() { if (not _staticInit) staticInit(); @@ -546,6 +549,15 @@ namespace { } + Net* Model::newDummyNet () + { + ostringstream name; + name << "blif_dummy_output_" << _dummyOutputs.size(); + _dummyOutputs.push_back( Net::create( _cell, name.str().c_str() ) ); + return _dummyOutputs.back(); + } + + Net* Model::mergeNet ( string name, bool isExternal, unsigned int direction ) { bool isClock = AllianceFramework::get()->isCLOCK( name ); @@ -766,6 +778,29 @@ namespace { if (not message.str().empty()) cerr << Warning( message.str() ) << endl; } } + + for ( Plug* plug : instance->getPlugs()) { + if (plug->getMasterNet()->isSupply()) continue; + Net* connectedNet = plug->getNet(); + if (not connectedNet) { + if (plug->getMasterNet()->getDirection() & Net::Direction::DirIn) { + ostringstream message; + message << "In " << instance << "\n " + << "*input* Terminal \"" << plug->getMasterNet()->getName() + << "\" is *not* connected."; + cerr << Error( message.str() ) << endl; + } else { + Net* dummyNet = newDummyNet(); + plug->setNet( dummyNet ); + ostringstream message; + message << "In " << instance << "\n " + << "*output* Terminal \"" << plug->getMasterNet()->getName() + << "\" is *not* connected, generating dummy net \"" + << dummyNet->getName() << "\"."; + cerr << Warning( message.str() ) << endl; + } + } + } } }