Create and connect dummy signals for unconnected *outputs* in BLIF parser.

This commit is contained in:
Jean-Paul Chaput 2022-05-12 17:51:56 +02:00
parent 921c519bd3
commit 0a64f3b83d
1 changed files with 41 additions and 6 deletions

View File

@ -280,6 +280,7 @@ namespace {
void connectSubckts (); void connectSubckts ();
Net* mergeNet ( string name, bool isExternal, unsigned int ); Net* mergeNet ( string name, bool isExternal, unsigned int );
Net* mergeAlias ( string name1, string name2 ); Net* mergeAlias ( string name1, string name2 );
Net* newDummyNet ();
private: private:
Cell* _cell; Cell* _cell;
Subckts _subckts; Subckts _subckts;
@ -287,6 +288,7 @@ namespace {
size_t _supplyCount; size_t _supplyCount;
Instance* _oneInstance; Instance* _oneInstance;
Instance* _zeroInstance; Instance* _zeroInstance;
vector<Net*> _dummyOutputs;
}; };
@ -482,6 +484,7 @@ namespace {
, _supplyCount (0) , _supplyCount (0)
, _oneInstance (NULL) , _oneInstance (NULL)
, _zeroInstance(NULL) , _zeroInstance(NULL)
, _dummyOutputs()
{ {
if (not _staticInit) staticInit(); 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 ) Net* Model::mergeNet ( string name, bool isExternal, unsigned int direction )
{ {
bool isClock = AllianceFramework::get()->isCLOCK( name ); bool isClock = AllianceFramework::get()->isCLOCK( name );
@ -766,6 +778,29 @@ namespace {
if (not message.str().empty()) cerr << Warning( message.str() ) << endl; 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;
}
}
}
} }
} }