From 2beee8a25cfeab936d7984083115ecc8d415b433 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 10 May 2019 11:48:33 +0200 Subject: [PATCH] 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. --- .../plugins/{ChipPlugin.py => ChipPlace.py} | 0 hurricane/src/hurricane/Cell.cpp | 36 ++++++++++++------- hurricane/src/hurricane/Instance.cpp | 6 ++++ hurricane/src/hurricane/RoutingPad.cpp | 1 + 4 files changed, 30 insertions(+), 13 deletions(-) rename cumulus/src/plugins/{ChipPlugin.py => ChipPlace.py} (100%) diff --git a/cumulus/src/plugins/ChipPlugin.py b/cumulus/src/plugins/ChipPlace.py similarity index 100% rename from cumulus/src/plugins/ChipPlugin.py rename to cumulus/src/plugins/ChipPlace.py diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index ecd577c9..0918b0b9 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -19,6 +19,7 @@ //#define TEST_INTRUSIVESET +#include "hurricane/DebugSession.h" #include "hurricane/Warning.h" #include "hurricane/SharedName.h" #include "hurricane/DataBase.h" @@ -603,16 +604,14 @@ bool Cell::isLeaf() const return _instanceMap.isEmpty(); } -bool Cell::isCalledBy(Cell* cell) const -// ************************************ +bool Cell::isCalledBy ( Cell* cell ) const { - for_each_instance(instance, cell->getInstances()) { - Cell* masterCell = instance->getMasterCell(); - if (masterCell == this) return true; - if (isCalledBy(masterCell)) return true; - end_for; - } - return false; + for ( Instance* instance : cell->getInstances() ) { + Cell* masterCell = instance->getMasterCell(); + if (masterCell == this) return true; + if (isCalledBy(masterCell)) return true; + } + return false; } 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[i].getNetOccurrence().getEntity()); - for ( Occurrence plugOccurrence : topHyperNets[i].getLeafPlugOccurrences() ) { + DebugSession::open( net, 18, 19 ); + cdebug_log(18,1) << "Flattening top: " << net << endl; + + vector plugOccurrences; + for ( Occurrence plugOccurrence : topHyperNets[i].getLeafPlugOccurrences() ) + plugOccurrences.push_back( plugOccurrence ); + + for ( Occurrence plugOccurrence : plugOccurrences ) { RoutingPad* rp = RoutingPad::create( net, plugOccurrence, rpFlags ); rp->materialize(); @@ -888,12 +894,16 @@ void Cell::flattenNets ( const Instance* instance, uint64_t flags ) rp->isPlacedOccurrence( RoutingPad::ShowWarning ); } + cdebug_log(18,0) << "Processing Pins" << endl; + vector pins; for ( Component* component : net->getComponents() ) { Pin* pin = dynamic_cast( component ); - if (pin) { - RoutingPad::create( pin ); - } + if (pin) pins.push_back( pin ); } + for ( Pin* pin : pins ) RoutingPad::create( pin ); + + cdebug_tabw(18,-1); + DebugSession::close(); } UpdateSession::close(); diff --git a/hurricane/src/hurricane/Instance.cpp b/hurricane/src/hurricane/Instance.cpp index 37f5cbb4..bd5f7c6e 100644 --- a/hurricane/src/hurricane/Instance.cpp +++ b/hurricane/src/hurricane/Instance.cpp @@ -193,6 +193,12 @@ Instance::Instance(Cell* cell, const Name& name, Cell* masterCell, const Transfo if (!_masterCell) 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)) throw Error("Instance::Instance(): Can't create " + _TName("Instance") + ", cyclic construction"); } diff --git a/hurricane/src/hurricane/RoutingPad.cpp b/hurricane/src/hurricane/RoutingPad.cpp index bd0e8937..a03226d3 100644 --- a/hurricane/src/hurricane/RoutingPad.cpp +++ b/hurricane/src/hurricane/RoutingPad.cpp @@ -95,6 +95,7 @@ namespace Hurricane { if (not plug) routingPad->isPlacedOccurrence( flags ); + cdebug_log(18,0) << "RoutingPad::create() " << routingPad << endl; return routingPad; }