From 28c8af27be6e6000bea6e0d7bbf6fafd7b4edd85 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 11 May 2021 14:11:43 +0200 Subject: [PATCH] Fix memory corruption due to the deletion of unused spare buffers. * In cumulus/plugins.block.Block.{place,doPnr}(), reorder the feed insertion and spare buffer deletion call. Formerly, we were : 1. Creating spare buffersa (Python). 2. Placing (C++) 3. Adding feeds (EtesianEngine::toHurricane() call) (C++). 4. Removing unused spare buffers (Python). So, step 4 was *not* informing the C++ placement data-structure created at step 3 of the change. Resulting in occurrences using deleted Entities (Instance). Now we swap step 3. and 4. so toHurricane() is called *after* any Python managed change is done. Ideally, what we should implement is a way for Python to inform the C++ data-structure. No real problem here, but time... --- cumulus/src/plugins/alpha/block/block.py | 5 +++-- cumulus/src/plugins/alpha/block/spares.py | 4 +++- cumulus/src/plugins/clocktree.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cumulus/src/plugins/alpha/block/block.py b/cumulus/src/plugins/alpha/block/block.py index cc7637d2..afd877f3 100644 --- a/cumulus/src/plugins/alpha/block/block.py +++ b/cumulus/src/plugins/alpha/block/block.py @@ -580,7 +580,6 @@ class Block ( object ): self.etesian.getCell().flattenNets( None, Cell.Flags_NoClockFlatten ) if self.conf.useHFNS: self.etesian.doHFNS() self.etesian.place() - self.etesian.flattenPower() Breakpoint.stop( 100, 'Placement done.' ) self.etesian.clearColoquinte() @@ -744,8 +743,10 @@ class Block ( object ): #if self.conf.useHFNS: self.findHfnTrees() break if self.conf.useClockTree: self.splitClocks() - if self.conf.isCoreBlock: self.doConnectCore() self.spares.removeUnusedBuffers() + self.etesian.toHurricane() + self.etesian.flattenPower() + if self.conf.isCoreBlock: self.doConnectCore() status = self.route() if not self.conf.isCoreBlock: self.addBlockages() diff --git a/cumulus/src/plugins/alpha/block/spares.py b/cumulus/src/plugins/alpha/block/spares.py index e3a98a29..d1f4e9d7 100644 --- a/cumulus/src/plugins/alpha/block/spares.py +++ b/cumulus/src/plugins/alpha/block/spares.py @@ -774,7 +774,9 @@ class QuadTree ( object ): netBuff = self.bOutputPlug.getNet() trace( 540, '\tBuffer: {}\n'.format(self.buffer) ) trace( 540, '\tBuffer output: {}\n'.format(netBuff) ) - if not self.plugs: return + if not self.plugs: + trace( 540, '-' ) + return for plug in self.plugs: trace( 540, '\t| Leaf: {}\n'.format(plug) ) trace( 540, '\t| netBuff: {}\n'.format(netBuff) ) diff --git a/cumulus/src/plugins/clocktree.py b/cumulus/src/plugins/clocktree.py index f5c8c9dd..3e575509 100644 --- a/cumulus/src/plugins/clocktree.py +++ b/cumulus/src/plugins/clocktree.py @@ -87,10 +87,11 @@ def scriptMain ( **kw ): if editor: editor.refresh() etesian = Etesian.EtesianEngine.create( cell ) etesian.place() - etesian.destroy() ht.connectLeaf() #ht.prune() ht.route() + etesian.toHurricane() + etesian.destroy() ht.save( cell ) except Exception, e: helpers.io.catch( e )