diff --git a/crlcore/src/ccore/blif/BlifParser.cpp b/crlcore/src/ccore/blif/BlifParser.cpp index 96a64c1c..528b0fb2 100644 --- a/crlcore/src/ccore/blif/BlifParser.cpp +++ b/crlcore/src/ccore/blif/BlifParser.cpp @@ -339,7 +339,7 @@ namespace { void Model::connectModels () { for ( Model* blifModel : _blifOrder ){ - cmess2 << "Handling model <" << blifModel->getCell()->getName() << ">" << endl; + //cmess2 << "Handling model <" << blifModel->getCell()->getName() << ">" << endl; blifModel->connectSubckts(); } } @@ -648,25 +648,25 @@ namespace CRL { blifModel->mergeAlias( blifLine[1], blifLine[2] ); } else if (tokenize.state() & Tokenize::CoverZero) { cerr << Warning( "Blif::load() Definition of an alias <%s> of VSS in a \".names\". Maybe you should use tie cells?\n" - " File %s.blif at line %u." - , blifLine[1].c_str() - , blifFile.c_str() - , tokenize.lineno() - ) << endl; + " File \"%s.blif\" at line %u." + , blifLine[1].c_str() + , blifFile.c_str() + , tokenize.lineno() + ) << endl; //blifModel->mergeAlias( blifLine[1], "vss" ); blifModel->getCell()->getNet( "vss" )->addAlias( blifLine[1] ); } else if (tokenize.state() & Tokenize::CoverOne ) { cerr << Warning( "Blif::load() Definition of an alias <%s> of VDD in a \".names\". Maybe you should use tie cells?\n" - " File %s.blif at line %u." - , blifLine[1].c_str() - , blifFile.c_str() - , tokenize.lineno() - ) << endl; + " File \"%s.blif\" at line %u." + , blifLine[1].c_str() + , blifFile.c_str() + , tokenize.lineno() + ) << endl; //blifModel->mergeAlias( blifLine[1], "vdd" ); blifModel->getCell()->getNet( "vdd" )->addAlias( blifLine[1] ); } else { cerr << Error( "Blif::load() Unsupported \".names\" cover construct.\n" - " File %s.blif at line %u." + " File \"%s.blif\" at line %u." , blifFile.c_str() , tokenize.lineno() ) << endl; diff --git a/crlcore/src/ccore/toolbox/NamingScheme.cpp b/crlcore/src/ccore/toolbox/NamingScheme.cpp index c55731b5..067ce8ab 100644 --- a/crlcore/src/ccore/toolbox/NamingScheme.cpp +++ b/crlcore/src/ccore/toolbox/NamingScheme.cpp @@ -110,7 +110,9 @@ namespace CRL { vector nets; forEach ( Net*, inet, topCell->getNets() ) nets.push_back( *inet ); - for ( auto net : nets ) net->setName( converter( net->getName() ) ); + for ( auto net : nets ) { + net->setName( converter( net->getName() ) ); + } vector instances; set models; diff --git a/cumulus/src/plugins/RSavePlugin.py b/cumulus/src/plugins/RSavePlugin.py index 55a9bf3f..7056bbf4 100644 --- a/cumulus/src/plugins/RSavePlugin.py +++ b/cumulus/src/plugins/RSavePlugin.py @@ -57,8 +57,11 @@ def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ): framework = CRL.AllianceFramework.get() if depth == 0: print ' o Recursive Save-Cell.' - sviews = 'layout' - if views & CRL.Catalog.State.Logical: sviews += ',netlist' + sviews = '' + if views & CRL.Catalog.State.Logical: sviews += 'netlist' + if views & CRL.Catalog.State.Physical: + if not sviews: sviews += ',' + sviews += 'layout' print ' %s+ %s (%s).' % ( ' '*(depth*2), cell.getName(), sviews ) if cell.isUniquified(): views |= CRL.Catalog.State.Logical @@ -92,7 +95,7 @@ def ScriptMain ( **kw ): cell, editor = plugins.kwParseMain( **kw ) views = CRL.Catalog.State.Physical - if kw.has_key('views'): views |= kw['views'] + if kw.has_key('views'): views = kw['views'] if not cell: print WarningMessage( 'No Cell loaded in the editor (yet), nothing done.' ) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 112ac796..8ec645f5 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -821,6 +821,8 @@ void Cell::flattenNets(unsigned int flags) UpdateSession::open(); + bool reFlatten = _flags.isset(Flags::FlattenedNets); + _flags |= Flags::FlattenedNets; vector hyperNets; @@ -837,10 +839,12 @@ void Cell::flattenNets(unsigned int flags) if (not duplicate) { hyperNets.push_back( HyperNet(occurrence) ); } else { - cerr << Warning( "Cell::flattenNets(): Found duplicate: \"%s\" in \"%s\"" - , getString(duplicate).c_str() - , getString(duplicate->getCell()->getName()).c_str() - ) << endl; + if (not reFlatten) + cerr << Warning( "Cell::flattenNets(): In \"%s\", found duplicate: %s for %s." + , getString(duplicate->getCell()->getName()).c_str() + , getString(duplicate).c_str() + , getString(net).c_str() + ) << endl; } continue; } diff --git a/hurricane/src/hurricane/DeepNet.cpp b/hurricane/src/hurricane/DeepNet.cpp index 8bb83f46..4af595ae 100644 --- a/hurricane/src/hurricane/DeepNet.cpp +++ b/hurricane/src/hurricane/DeepNet.cpp @@ -56,7 +56,7 @@ namespace Hurricane { ) , _netOccurrence(netOccurrence) { - //trace << "DeepNet::DeepNet() " << getCell() << " " << this << endl; + trace << "DeepNet::DeepNet() " << getCell() << " " << this << endl; } diff --git a/hurricane/src/hurricane/Net.cpp b/hurricane/src/hurricane/Net.cpp index ed5db93a..a1cfb773 100644 --- a/hurricane/src/hurricane/Net.cpp +++ b/hurricane/src/hurricane/Net.cpp @@ -427,20 +427,27 @@ NetFilter Net::getIsGroundFilter() return Net_IsGroundFilter(); } -void Net::setName(const Name& name) -// ******************************** +void Net::setName(Name name) +// ************************* { - if (name != _name) { - if (name.isEmpty()) - throw Error("Can't change net name : empty name"); + if (name != _name) { + if (name.isEmpty()) + throw Error( "Net::setName(): Empty name, keep \"%s\"", getString(_name).c_str() ); - if (_cell->getNet(name)) - throw Error("Can't change net name : already exists"); + bool swapAlias = hasAlias( name ); + if (not swapAlias and _cell->getNet(name)) + throw Error( "Net::setName(): On \"%s\", another net named \"%s\" already exists." + , getString(_name).c_str() + , getString( name).c_str() ); - _cell->_getNetMap()._remove(this); - _name = name; - _cell->_getNetMap()._insert(this); - } + if (swapAlias) removeAlias(name); + + _cell->_getNetMap()._remove(this); + std::swap( _name, name ); + _cell->_getNetMap()._insert(this); + + if (swapAlias) addAlias(name); + } } void Net::setArity(const Arity& arity) @@ -507,9 +514,21 @@ void Net::setDirection(const Direction& direction) _direction = direction; } -bool Net::addAlias(const Name& name ) -// ********************************** +bool Net::hasAlias(const Name& name) const +// *************************************** { + if (name == _name) return true; + for ( NetAliasHook* alias : getAliases() ) { + if (alias->getName() == name) return true; + } + return false; +} + +bool Net::addAlias(const Name& name) +// ********************************* +{ + if (hasAlias(name)) return true; + if (getCell()->getNet(name)) { cerr << Warning( "Net::addAlias(): Cannot add alias %s to net %s, already taken." , getString(name).c_str() diff --git a/hurricane/src/hurricane/hurricane/Net.h b/hurricane/src/hurricane/hurricane/Net.h index 6a5df273..7eddc371 100644 --- a/hurricane/src/hurricane/hurricane/Net.h +++ b/hurricane/src/hurricane/hurricane/Net.h @@ -220,11 +220,12 @@ class Net : public Entity { public: bool isPower () const {return (_type == Type::POWER);}; public: bool isGround () const {return (_type == Type::GROUND);}; public: bool isSupply () const {return (isPower() || isGround());}; + public: bool hasAlias (const Name& name) const; // Updators // ******** - public: void setName(const Name& name); + public: void setName(Name name); public: void setArity(const Arity& arity); public: void setGlobal(bool isGlobal); public: void setExternal(bool isExternal);