Bug: Compopent creation inside a Collection loop In Cell::flattenNets().

* Bug: In Hurricane::Cell::flattenNets(): Same error again, do not create
    components while iterating over the components Collection.
      Now RoutingPad of top nets are create outside the loop as they must.
This commit is contained in:
Jean-Paul Chaput 2019-05-10 11:48:33 +02:00
parent f6c840fd59
commit 2beee8a25c
4 changed files with 30 additions and 13 deletions

View File

@ -19,6 +19,7 @@
//#define TEST_INTRUSIVESET //#define TEST_INTRUSIVESET
#include "hurricane/DebugSession.h"
#include "hurricane/Warning.h" #include "hurricane/Warning.h"
#include "hurricane/SharedName.h" #include "hurricane/SharedName.h"
#include "hurricane/DataBase.h" #include "hurricane/DataBase.h"
@ -603,16 +604,14 @@ bool Cell::isLeaf() const
return _instanceMap.isEmpty(); return _instanceMap.isEmpty();
} }
bool Cell::isCalledBy(Cell* cell) const bool Cell::isCalledBy ( Cell* cell ) const
// ************************************
{ {
for_each_instance(instance, cell->getInstances()) { for ( Instance* instance : cell->getInstances() ) {
Cell* masterCell = instance->getMasterCell(); Cell* masterCell = instance->getMasterCell();
if (masterCell == this) return true; if (masterCell == this) return true;
if (isCalledBy(masterCell)) return true; if (isCalledBy(masterCell)) return true;
end_for; }
} return false;
return false;
} }
bool Cell::isNetAlias ( const Name& name ) const bool Cell::isNetAlias ( const Name& name ) const
@ -880,7 +879,14 @@ void Cell::flattenNets ( const Instance* instance, uint64_t flags )
for ( size_t i=0 ; i<topHyperNets.size() ; ++i ) { for ( size_t i=0 ; i<topHyperNets.size() ; ++i ) {
Net* net = static_cast<Net*>(topHyperNets[i].getNetOccurrence().getEntity()); Net* net = static_cast<Net*>(topHyperNets[i].getNetOccurrence().getEntity());
for ( Occurrence plugOccurrence : topHyperNets[i].getLeafPlugOccurrences() ) { DebugSession::open( net, 18, 19 );
cdebug_log(18,1) << "Flattening top: " << net << endl;
vector<Occurrence> plugOccurrences;
for ( Occurrence plugOccurrence : topHyperNets[i].getLeafPlugOccurrences() )
plugOccurrences.push_back( plugOccurrence );
for ( Occurrence plugOccurrence : plugOccurrences ) {
RoutingPad* rp = RoutingPad::create( net, plugOccurrence, rpFlags ); RoutingPad* rp = RoutingPad::create( net, plugOccurrence, rpFlags );
rp->materialize(); rp->materialize();
@ -888,12 +894,16 @@ void Cell::flattenNets ( const Instance* instance, uint64_t flags )
rp->isPlacedOccurrence( RoutingPad::ShowWarning ); rp->isPlacedOccurrence( RoutingPad::ShowWarning );
} }
cdebug_log(18,0) << "Processing Pins" << endl;
vector<Pin*> pins;
for ( Component* component : net->getComponents() ) { for ( Component* component : net->getComponents() ) {
Pin* pin = dynamic_cast<Pin*>( component ); Pin* pin = dynamic_cast<Pin*>( component );
if (pin) { if (pin) pins.push_back( pin );
RoutingPad::create( pin );
}
} }
for ( Pin* pin : pins ) RoutingPad::create( pin );
cdebug_tabw(18,-1);
DebugSession::close();
} }
UpdateSession::close(); UpdateSession::close();

View File

@ -193,6 +193,12 @@ Instance::Instance(Cell* cell, const Name& name, Cell* masterCell, const Transfo
if (!_masterCell) if (!_masterCell)
throw Error("Instance::Instance(): Can't create " + _TName("Instance") + ", NULL master cell"); throw Error("Instance::Instance(): Can't create " + _TName("Instance") + ", NULL master cell");
if (_masterCell == _cell)
throw Error( "Instance::Instance(): Can't create " + _TName("Instance") + ", immediate cyclic construction\n"
+ " (Instance \"" + getString(name).c_str()
+ "\" in Cell \"" + getString(_cell->getName()).c_str() + "\" uses it's owner as model)"
);
if (secureFlag && _cell->isCalledBy(_masterCell)) if (secureFlag && _cell->isCalledBy(_masterCell))
throw Error("Instance::Instance(): Can't create " + _TName("Instance") + ", cyclic construction"); throw Error("Instance::Instance(): Can't create " + _TName("Instance") + ", cyclic construction");
} }

View File

@ -95,6 +95,7 @@ namespace Hurricane {
if (not plug) if (not plug)
routingPad->isPlacedOccurrence( flags ); routingPad->isPlacedOccurrence( flags );
cdebug_log(18,0) << "RoutingPad::create() " << routingPad << endl;
return routingPad; return routingPad;
} }