Various bugs in the virtual flattening mechanism (part 2).

* Bug: In Hurricane, in Cell_HyperNetRootNetOccurrences::Locator, must
    also check that the current Net is not a DeepNet in the constructor.
    Take the occasion to prune Net that are automatic.
* Change: In Hurricane, in DeepNet::_createRoutingPads(), check for
    already created RoutingPads. That is, the DeepNet must not have
    RoutingPad components or Segments components.
This commit is contained in:
Jean-Paul Chaput 2016-03-15 17:55:48 +01:00
parent b9da9531a7
commit da60370b60
4 changed files with 34 additions and 22 deletions

View File

@ -617,12 +617,14 @@ void Cell::flattenNets(unsigned int flags)
HyperNet hyperNet ( occurrence ); HyperNet hyperNet ( occurrence );
if ( not occurrence.getPath().isEmpty() ) { if ( not occurrence.getPath().isEmpty() ) {
//cerr << "* HyperNet: " << occurrence.getName() << endl;
Net* duplicate = getNet( occurrence.getName() ); Net* duplicate = getNet( occurrence.getName() );
if (not duplicate) { if (not duplicate) {
hyperNets.push_back( HyperNet(occurrence) ); hyperNets.push_back( HyperNet(occurrence) );
} else { } else {
trace << "Found " << duplicate << " in " << duplicate->getCell() << endl; cerr << Warning( "Cell::flattenNets(): Found duplicate: \"%s\" in \"%s\""
, getString(duplicate).c_str()
, getString(duplicate->getCell()->getName()).c_str()
) << endl;
} }
continue; continue;
} }

View File

@ -4704,7 +4704,7 @@ string Cell_HyperNetRootNetOccurrences::_getString() const
// **************************************************************************************************** // ****************************************************************************************************
Cell_HyperNetRootNetOccurrences::Locator::Locator() Cell_HyperNetRootNetOccurrences::Locator::Locator()
// *********************************** // ************************************************
: Inherit(), : Inherit(),
_path(), _path(),
_netLocator(), _netLocator(),
@ -4714,7 +4714,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator()
} }
Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path) Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path)
// ************************************************************** // ***************************************************************************
: Inherit(), : Inherit(),
_path(path), _path(path),
_netLocator(), _netLocator(),
@ -4722,14 +4722,16 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path)
_hyperNetRootNetOccurrenceLocator() _hyperNetRootNetOccurrenceLocator()
{ {
_netLocator = cell->getNets().getLocator(); _netLocator = cell->getNets().getLocator();
_instanceLocator = cell->getInstances().getLocator(); _instanceLocator = cell->getInstances().getLocator();
while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) while ( _netLocator.isValid()
and ( dynamic_cast<DeepNet*>(_netLocator.getElement())
or _netLocator.getElement()->isAutomatic()
or not isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) )
_netLocator.progress(); _netLocator.progress();
if (!_netLocator.isValid()) if (not _netLocator.isValid())
while (!_hyperNetRootNetOccurrenceLocator.isValid() && _instanceLocator.isValid()) while (not _hyperNetRootNetOccurrenceLocator.isValid() and _instanceLocator.isValid())
{ {
Instance* instance = _instanceLocator.getElement(); Instance* instance = _instanceLocator.getElement();
_hyperNetRootNetOccurrenceLocator=Locator(instance->getMasterCell(),Path(_path,instance)); _hyperNetRootNetOccurrenceLocator=Locator(instance->getMasterCell(),Path(_path,instance));
@ -4738,7 +4740,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path)
} }
Cell_HyperNetRootNetOccurrences::Locator::Locator(const Locator& locator) Cell_HyperNetRootNetOccurrences::Locator::Locator(const Locator& locator)
// ********************************************************* // **********************************************************************
: Inherit(), : Inherit(),
_path(locator._path), _path(locator._path),
_netLocator(locator._netLocator), _netLocator(locator._netLocator),
@ -4748,7 +4750,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Locator& locator)
} }
Cell_HyperNetRootNetOccurrences::Locator& Cell_HyperNetRootNetOccurrences::Locator::operator=(const Locator& locator) Cell_HyperNetRootNetOccurrences::Locator& Cell_HyperNetRootNetOccurrences::Locator::operator=(const Locator& locator)
// **************************************************************************************** // ******************************************************************************************************************
{ {
_path = locator._path; _path = locator._path;
_netLocator = locator._netLocator; _netLocator = locator._netLocator;
@ -4758,7 +4760,7 @@ Cell_HyperNetRootNetOccurrences::Locator& Cell_HyperNetRootNetOccurrences::Locat
} }
Occurrence Cell_HyperNetRootNetOccurrences::Locator::getElement() const Occurrence Cell_HyperNetRootNetOccurrences::Locator::getElement() const
// ****************************************************** // ********************************************************************
{ {
if (_netLocator.isValid()) if (_netLocator.isValid())
return Occurrence(_netLocator.getElement(),_path); return Occurrence(_netLocator.getElement(),_path);
@ -4770,25 +4772,26 @@ Occurrence Cell_HyperNetRootNetOccurrences::Locator::getElement() const
} }
Locator<Occurrence>* Cell_HyperNetRootNetOccurrences::Locator::getClone() const Locator<Occurrence>* Cell_HyperNetRootNetOccurrences::Locator::getClone() const
// ************************************************************** // ****************************************************************************
{ {
return new Locator(*this); return new Locator(*this);
} }
bool Cell_HyperNetRootNetOccurrences::Locator::isValid() const bool Cell_HyperNetRootNetOccurrences::Locator::isValid() const
// ********************************************** // ***********************************************************
{ {
return (_netLocator.isValid() || (_hyperNetRootNetOccurrenceLocator.isValid())); return (_netLocator.isValid() || (_hyperNetRootNetOccurrenceLocator.isValid()));
} }
void Cell_HyperNetRootNetOccurrences::Locator::progress() void Cell_HyperNetRootNetOccurrences::Locator::progress()
// ***************************************** // ******************************************************
{ {
if (_netLocator.isValid()) if (_netLocator.isValid())
{ {
_netLocator.progress(); _netLocator.progress();
while ( _netLocator.isValid() ) { while ( _netLocator.isValid() ) {
if ( not dynamic_cast<DeepNet*>(_netLocator.getElement()) if ( not dynamic_cast<DeepNet*>(_netLocator.getElement())
and not _netLocator.getElement()->isAutomatic()
and isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) break; and isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path))) break;
_netLocator.progress(); _netLocator.progress();
@ -4808,7 +4811,7 @@ void Cell_HyperNetRootNetOccurrences::Locator::progress()
} }
string Cell_HyperNetRootNetOccurrences::Locator::_getString() const string Cell_HyperNetRootNetOccurrences::Locator::_getString() const
// *************************************************** // ****************************************************************
{ {
string s = "<" + _TName("Cell::HyperNetRootNetOccurrences::Locator"); string s = "<" + _TName("Cell::HyperNetRootNetOccurrences::Locator");
if (!_path.isEmpty()) if (!_path.isEmpty())

View File

@ -29,6 +29,7 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#include "hurricane/Warning.h"
#include "hurricane/DeepNet.h" #include "hurricane/DeepNet.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "hurricane/Instance.h" #include "hurricane/Instance.h"
@ -64,6 +65,12 @@ namespace Hurricane {
if (not hyperNet.isValid()) if (not hyperNet.isValid())
throw Error ( "Can't create " + _TName("DeepNet") + ": occurence is invalid." ); throw Error ( "Can't create " + _TName("DeepNet") + ": occurence is invalid." );
if (not isHyperNetRootNetOccurrence(hyperNet.getNetOccurrence())) {
cerr << Warning( "DeepNet::create(): Occurrence \"%s\" is not a root one."
, hyperNet.getNetOccurrence().getCompactString().c_str()
) << endl;
}
Occurrence rootNetOccurrence = getHyperNetRootNetOccurrence( hyperNet.getNetOccurrence() ); Occurrence rootNetOccurrence = getHyperNetRootNetOccurrence( hyperNet.getNetOccurrence() );
if (rootNetOccurrence.getMasterCell()->isFlattenLeaf()) return NULL; if (rootNetOccurrence.getMasterCell()->isFlattenLeaf()) return NULL;
@ -84,7 +91,8 @@ namespace Hurricane {
bool createRp = true; bool createRp = true;
for ( Occurrence occurrence : hyperNet.getComponentOccurrences() ) { for ( Occurrence occurrence : hyperNet.getComponentOccurrences() ) {
if ( dynamic_cast<RoutingPad*>(occurrence.getEntity()) ) { createRp = false; break; } RoutingPad* rp = dynamic_cast<RoutingPad*>(occurrence.getEntity());
if ( rp and (rp->getCell() == getCell()) ) { createRp = false; break; }
if ( dynamic_cast<Segment* >(occurrence.getEntity()) ) { createRp = false; break; } if ( dynamic_cast<Segment* >(occurrence.getEntity()) ) { createRp = false; break; }
} }
if (not createRp) return 0; if (not createRp) return 0;
@ -97,9 +105,7 @@ namespace Hurricane {
currentRp->isPlacedOccurrence ( RoutingPad::ShowWarning ); currentRp->isPlacedOccurrence ( RoutingPad::ShowWarning );
if (nbRoutingPads == 1) { if (nbRoutingPads == 1) {
//Net* net =
currentRp->getNet(); currentRp->getNet();
//cerr << "_createRoutingPads on " << net->getName() << " buildRing:" << endl;
} }
} }

View File

@ -84,6 +84,7 @@ bool isHyperNetRootNetOccurrence(Occurrence netoccurrence);
INSPECTOR_P_SUPPORT(Hurricane::HyperNet); INSPECTOR_P_SUPPORT(Hurricane::HyperNet);
IOSTREAM_VALUE_SUPPORT(Hurricane::HyperNet);