From 1411739c0b7e86c9f8f96c63e265a41a590ce38e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 4 Dec 2020 12:20:57 +0100 Subject: [PATCH] Make block/chip plugin use the common rsave plugin. * In cumulus/block.configuration, the rsave method was buggy. It did stop it did not save "terminal" master cells (i.e. a cell without instance) instead of "netlistTerminal" (explicitely flagged for standard cells). The result was that some "empty netlist" in the complete "ls180" from LibreSOC went missing. Causing cougar to complain. --- .../src/plugins/alpha/block/configuration.py | 35 ++++++++++--------- .../src/plugins/alpha/core2chip/core2chip.py | 3 +- cumulus/src/plugins/rsave.py | 4 ++- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cumulus/src/plugins/alpha/block/configuration.py b/cumulus/src/plugins/alpha/block/configuration.py index ae5df86d..2f1d7e1e 100644 --- a/cumulus/src/plugins/alpha/block/configuration.py +++ b/cumulus/src/plugins/alpha/block/configuration.py @@ -44,6 +44,7 @@ from helpers.io import WarningMessage from helpers.io import catch from helpers.overlay import CfgCache from plugins import getParameter +from plugins.rsave import rsave from plugins.alpha.utils import getPlugByName @@ -1163,21 +1164,23 @@ class BlockConf ( GaugeConf ): self.cloneds.append( masterCell ) return - def rsave ( self, cell ): - """ - Save the complete cell hierarchy. Saves only the physical view, except - for the ones that has been cloned (their names should end up by "_cts"), - for which logical and physical views are to be saved. They are completely - new cells. - """ - flags = CRL.Catalog.State.Physical - if cell.getName().endswith('_cts'): - flags = flags | CRL.Catalog.State.Logical - self.framework.saveCell( cell, flags ) - for instance in cell.getInstances(): - masterCell = instance.getMasterCell() - if not masterCell.isTerminal(): - self.rsave( masterCell ) + #def rsave ( self, cell, depth ): + # """ + # Save the complete cell hierarchy. Saves only the physical view, except + # for the ones that has been cloned (their names should end up by "_cts"), + # for which logical and physical views are to be saved. They are completely + # new cells. + # """ + # if depth == 0: print( ' o Block Recursive Save-Cell.' ) + # flags = CRL.Catalog.State.Physical + # if cell.getName().endswith('_cts'): flags |= CRL.Catalog.State.Logical + # if cell.isUniquified(): flags |= CRL.Catalog.State.Logical + # self.framework.saveCell( cell, flags ) + # print( ' {}+ {}.'.format(' '*(depth*2), cell.getName() ) ) + # for instance in cell.getInstances(): + # masterCell = instance.getMasterCell() + # if not masterCell.isTerminalNetlist(): + # self.rsave( masterCell, depth+1 ) def save ( self ): """ @@ -1190,5 +1193,5 @@ class BlockConf ( GaugeConf ): cell.setName( cell.getName()+'_cts' ) if self.chip is None: self.cell.setName( self.cell.getName()+'_r' ) - self.rsave( self.cell ) + rsave( self.cell ) return diff --git a/cumulus/src/plugins/alpha/core2chip/core2chip.py b/cumulus/src/plugins/alpha/core2chip/core2chip.py index cbe3efe5..45706a2b 100644 --- a/cumulus/src/plugins/alpha/core2chip/core2chip.py +++ b/cumulus/src/plugins/alpha/core2chip/core2chip.py @@ -52,6 +52,7 @@ from helpers import trace, netDirectionToStr from helpers.overlay import UpdateSession from helpers.io import ErrorMessage, WarningMessage import plugins.chip +from plugins.rsave import rsave from plugins.alpha.utils import getPlugByName from plugins.alpha.block.block import Block from plugins.alpha.block.configuration import BlockConf, IoPadConf, ConstantsConf @@ -662,4 +663,4 @@ class CoreToChip ( object ): ioPad.udata.createPad() self._connectRing() self._connectClocks() - self.conf.rsave( self.chip ) + rsave( self.chip, views=Catalog.State.Logical ) diff --git a/cumulus/src/plugins/rsave.py b/cumulus/src/plugins/rsave.py index 8c66cbe5..3acf1cef 100644 --- a/cumulus/src/plugins/rsave.py +++ b/cumulus/src/plugins/rsave.py @@ -58,7 +58,9 @@ def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ): if sviews: sviews += ',' sviews += 'layout' print( ' {}+ {} ({}).'.format(' '*(depth*2), cell.getName(), sviews) ) - if cell.isUniquified(): views |= CRL.Catalog.State.Logical + if cell.isUniquified(): views |= CRL.Catalog.State.Logical + if cell.getName().endswith('_cts'): views |= CRL.Catalog.State.Logical + if cell.getName().endswith('_r' ): views |= CRL.Catalog.State.Logical framework.saveCell( cell, views ) for instance in cell.getInstances(): #print( ' {}| {}.'.format(' '*(depth*2), instance) )