Suppress warnings when flatening a Cell twice.

* In Hurricane, in Cell::flattenedNets(), if the cell has already been
    flattened, do not issue warnings about duplictated flattened nets.
* In Hurricane, in Net, allow Net::setName() to switch the main name
    for an alias without complaining about an already used name.
* In Cumulus, in RSavePlugin.py, when "views" is supplied in keywords
    (kw) arguments, override the default instead of merging with it.
    This is to allow scripts to save exactly what views they want.
This commit is contained in:
Jean-Paul Chaput 2016-04-02 14:47:10 +02:00
parent 6ad644fac2
commit d641f236a3
7 changed files with 64 additions and 35 deletions

View File

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

View File

@ -110,7 +110,9 @@ namespace CRL {
vector<Net*> 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<Instance*> instances;
set<Cell*> models;

View File

@ -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.' )

View File

@ -821,6 +821,8 @@ void Cell::flattenNets(unsigned int flags)
UpdateSession::open();
bool reFlatten = _flags.isset(Flags::FlattenedNets);
_flags |= Flags::FlattenedNets;
vector<HyperNet> 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;
}

View File

@ -56,7 +56,7 @@ namespace Hurricane {
)
, _netOccurrence(netOccurrence)
{
//trace << "DeepNet::DeepNet() " << getCell() << " " << this << endl;
trace << "DeepNet::DeepNet() " << getCell() << " " << this << endl;
}

View File

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

View File

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