From 9230d52b64b2548610818a980039567ddd43f6db Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 23 Mar 2021 17:06:02 +0100 Subject: [PATCH] Big bug in HyperNet_ComponentOccurrences::Locator::progress(). * Bug: In HyperNet_ComponentOccurrences::Locator::progress(), (Collection locator), the _netOccurrenceLocator (which progess along the various Net occurrences of the HyperNet) was not in synch with the _componentOccurrence locator of the current net. It was pointing to the *next* net occurrence. The result was the generation of a path for the net commponents that was incorrect (it was the path of the *next* net occurrence), and making Occurrence constructor throw an exception. * Change: In Cell::flattenNets(), DeepNet::_createRoutingPads(), Occurrence::Occurrence() and UpdateSession, added even more trace informations. --- hurricane/src/hurricane/Cell.cpp | 8 +++++++- hurricane/src/hurricane/DeepNet.cpp | 21 ++++++++++++++++----- hurricane/src/hurricane/HyperNet.cpp | 13 +++++++++++-- hurricane/src/hurricane/Occurrence.cpp | 6 ++++-- hurricane/src/hurricane/UpdateSession.cpp | 6 +++--- hurricane/src/viewer/ExceptionWidget.cpp | 1 + 6 files changed, 42 insertions(+), 13 deletions(-) diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 43bbe1e1..2a595ee0 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -818,7 +818,7 @@ void Cell::flattenNets (uint64_t flags ) void Cell::flattenNets ( const Instance* instance, uint64_t flags ) // **************************************************************** { - cdebug_log(18,0) << "Cell::flattenNets() flags:0x" << hex << flags << endl; + cdebug_log(18,1) << "Cell::flattenNets() flags:0x" << hex << flags << endl; UpdateSession::open(); @@ -868,8 +868,12 @@ void Cell::flattenNets ( const Instance* instance, uint64_t flags ) for ( size_t i=0 ; i_createRoutingPads( flags ); + cdebug_log(18,0) << "Done: " << deepNet << endl; + cdebug_tabw(18,-1); } + cdebug_log(18,0) << "Non-root HyperNet (DeepNet) done" << endl; unsigned int rpFlags = (flags & Flags::StayOnPlugs) ? 0 : RoutingPad::BiggestArea; @@ -903,7 +907,9 @@ void Cell::flattenNets ( const Instance* instance, uint64_t flags ) DebugSession::close(); } + cdebug_log(18,0) << "Before closing UpdateSession" << endl; UpdateSession::close(); + cdebug_log(18,-1) << "Cell::flattenNets() Done" << endl; } diff --git a/hurricane/src/hurricane/DeepNet.cpp b/hurricane/src/hurricane/DeepNet.cpp index 3905820e..acfef581 100644 --- a/hurricane/src/hurricane/DeepNet.cpp +++ b/hurricane/src/hurricane/DeepNet.cpp @@ -85,6 +85,8 @@ namespace Hurricane { size_t DeepNet::_createRoutingPads ( unsigned int flags ) { + cdebug_log(18,1) << "DeepNet::_createRoutingPads(): " << this << endl; + size_t nbRoutingPads = 0; HyperNet hyperNet ( _netOccurrence ); RoutingPad* currentRp = NULL; @@ -92,24 +94,33 @@ namespace Hurricane { //unsigned int rpFlags = (flags & Cell::Flags::StayOnPlugs) ? 0 : RoutingPad::BiggestArea; for ( Occurrence occurrence : hyperNet.getComponentOccurrences() ) { - RoutingPad* rp = dynamic_cast(occurrence.getEntity()); - if ( rp and (rp->getCell() == getCell()) ) { createRp = false; break; } - if ( dynamic_cast(occurrence.getEntity()) ) { createRp = false; break; } + cdebug_log(18,0) << "| occurrence=" << occurrence << endl; + RoutingPad* rp = dynamic_cast( occurrence.getEntity() ); + cdebug_log(18,0) << "| rp=" << rp << endl; + if (rp and (rp->getCell() == getCell())) { createRp = false; break; } + if (dynamic_cast(occurrence.getEntity())) { createRp = false; break; } + cdebug_log(18,0) << "| dynamic_cast OK createRp=" << createRp << endl; + } + if (not createRp) { + cdebug_log(18,0) << "DeepNet::_createRoutingPads(): No RoutingPad created" << endl; + cdebug_tabw(18,-1); + return 0; } - if (not createRp) return 0; for ( Occurrence occurrence : hyperNet.getTerminalNetlistPlugOccurrences() ) { nbRoutingPads++; currentRp = RoutingPad::create( this, occurrence, RoutingPad::BiggestArea ); if (flags & Cell::Flags::WarnOnUnplacedInstances) - currentRp->isPlacedOccurrence ( RoutingPad::ShowWarning ); + currentRp->isPlacedOccurrence( RoutingPad::ShowWarning ); if (nbRoutingPads == 1) { currentRp->getNet(); } } + cdebug_log(18,0) << "DeepNet::_createRoutingPads(): done on " << this << endl; + cdebug_tabw(18,-1); return nbRoutingPads; } diff --git a/hurricane/src/hurricane/HyperNet.cpp b/hurricane/src/hurricane/HyperNet.cpp index e4b1683a..c3caf0ca 100644 --- a/hurricane/src/hurricane/HyperNet.cpp +++ b/hurricane/src/hurricane/HyperNet.cpp @@ -1224,23 +1224,32 @@ void HyperNet_ComponentOccurrences::Locator::progress() if (_componentLocator.isValid()) { Path path = _netOccurrenceLocator.getElement().getPath(); Component* component = _componentLocator.getElement(); + cdebug_log(18,0) << "| progress component: " << component << endl; + //_componentOccurrence = Occurrence( component, path.getHeadPath() ); + _componentOccurrence = Occurrence( component, path ); + cdebug_log(18,0) << "| component occ OK" << endl; _componentLocator.progress(); - _componentOccurrence = Occurrence( component, path.getHeadPath() ); } else { + _netOccurrenceLocator.progress(); if (_netOccurrenceLocator.isValid()) { Occurrence netOccurrence = _netOccurrenceLocator.getElement(); - _netOccurrenceLocator.progress(); + cdebug_log(18,0) << "| progress net occ: " << _netOccurrenceLocator.getElement() << endl; Net* net = static_cast( netOccurrence.getEntity() ); //if (_withTerminalNetlistCells or not net->getCell()->isTerminal()) { if (not net->getCell()->isTerminalNetlist()) { + cdebug_log(18,0) << "| Non Terminal netlist: " << net->getCell() << endl; + cdebug_log(18,0) << "| set component loc on: " << net << endl; _componentLocator = net->getComponents().getLocator(); + } else { + cdebug_log(18,0) << "| Terminal netlist: " << net->getCell() << endl; } } else break; } } + cdebug_log(18,0) << "| progress done: " << endl; } string HyperNet_ComponentOccurrences::Locator::_getString() const diff --git a/hurricane/src/hurricane/Occurrence.cpp b/hurricane/src/hurricane/Occurrence.cpp index 075667c5..49cb3456 100644 --- a/hurricane/src/hurricane/Occurrence.cpp +++ b/hurricane/src/hurricane/Occurrence.cpp @@ -51,9 +51,11 @@ Occurrence::Occurrence(const Entity* entity, const Path& path) if (_sharedPath) { if (_entity->getCell() != _sharedPath->getMasterCell()) throw Error( "Occurrence::Occurrence(): Entity incompatible with the path.\n" - " * Entity master cell: %s\n" - " * Path master cell: %s" + " * Entity %s, master cell %s\n" + " * Path %s, master cell %s" + , getString(entity).c_str() , getString(entity->getCell()).c_str() + , getString(path).c_str() , getString(_sharedPath->getMasterCell()).c_str() ); } diff --git a/hurricane/src/hurricane/UpdateSession.cpp b/hurricane/src/hurricane/UpdateSession.cpp index 6234d944..231da37c 100644 --- a/hurricane/src/hurricane/UpdateSession.cpp +++ b/hurricane/src/hurricane/UpdateSession.cpp @@ -190,7 +190,7 @@ void Go::invalidate(bool propagateFlag) void UpdateSession::open() // *********************** { - cdebug_log(18,1) << "UpdateSession::open()" << endl; + cdebug_log(18,1) << "UpdateSession::open() [stack=" << (UPDATOR_STACK->size()+1) << "]" << endl; UpdateSession::_create(); } @@ -198,7 +198,7 @@ void UpdateSession::close() // ************************ { cdebug_tabw(18,-1); - cdebug_log(18,1) << "UpdateSession::close() - Start materialization." << endl; + cdebug_log(18,1) << "UpdateSession::close() [stack:" << UPDATOR_STACK->size() << "] Start materialization." << endl; if (!UPDATOR_STACK || UPDATOR_STACK->empty()) throw Error("Can't end update : empty update session stack"); @@ -206,7 +206,7 @@ void UpdateSession::close() UPDATOR_STACK->top()->_destroy(); cdebug_tabw(18,-1); - cdebug_log(18,0) << "UpdateSession::close() - Materialization completed." << endl; + cdebug_log(18,0) << "UpdateSession::close() [stack:" << UPDATOR_STACK->size() << "] Materialization completed." << endl; } void UpdateSession::reset() diff --git a/hurricane/src/viewer/ExceptionWidget.cpp b/hurricane/src/viewer/ExceptionWidget.cpp index ffae5124..c5607daa 100644 --- a/hurricane/src/viewer/ExceptionWidget.cpp +++ b/hurricane/src/viewer/ExceptionWidget.cpp @@ -74,6 +74,7 @@ namespace Hurricane { bool ExceptionWidget::catchAllWrapper ( std::function< void() > method ) { + cdebug_log(18,0) << "ExceptionWidget::catchAllWrapper()" << endl; bool failure = true; try { method();