Fixes cumulus recursive save plugin.
* Bug: In cumulus/plugins/rsave.py, use "Cell.isTerminalNetlist()" instead of "Cell.isTerminal()" to find the hierarchical stop points. If the root cell to be saved is itself a *terminal netlist* one, save it anyway. The top level *must* be saved regardless to it's status.
This commit is contained in:
parent
b48f9b40b8
commit
f3dd4bcd31
|
@ -14,10 +14,12 @@
|
||||||
# +-----------------------------------------------------------------+
|
# +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
try:
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
try:
|
||||||
import Cfg
|
import Cfg
|
||||||
import CRL
|
import CRL
|
||||||
import helpers
|
import helpers
|
||||||
|
@ -29,19 +31,18 @@ except Exception, e:
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
# Write back layout to disk if everything has gone fine.
|
|
||||||
# Must write all the sub-blocks of the core but *not* the
|
|
||||||
# standard cell (mainly the feed-through).
|
|
||||||
#
|
|
||||||
# If the model has been uniquified, in the case of a merging
|
|
||||||
# of abutment box for placement, the netlist view must also
|
|
||||||
# be saved.
|
|
||||||
|
|
||||||
def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ):
|
def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ):
|
||||||
if cell.isTerminal(): return
|
"""
|
||||||
|
Write back layout to disk if everything has gone fine.
|
||||||
|
Must write all the sub-blocks of the core but *not* the
|
||||||
|
standard cell (mainly the feed-through).
|
||||||
|
|
||||||
|
If the model has been uniquified, in the case of a merging
|
||||||
|
of abutment box for placement, the netlist view must also
|
||||||
|
be saved.
|
||||||
|
"""
|
||||||
framework = CRL.AllianceFramework.get()
|
framework = CRL.AllianceFramework.get()
|
||||||
if depth == 0: print ' o Recursive Save-Cell.'
|
if depth == 0: print( ' o Recursive Save-Cell.' )
|
||||||
|
|
||||||
sviews = ''
|
sviews = ''
|
||||||
if views & CRL.Catalog.State.Logical:
|
if views & CRL.Catalog.State.Logical:
|
||||||
|
@ -51,19 +52,25 @@ def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ):
|
||||||
sviews += ' uses &'
|
sviews += ' uses &'
|
||||||
if views & CRL.Catalog.State.VstNoLowerCase:
|
if views & CRL.Catalog.State.VstNoLowerCase:
|
||||||
if sviews: sviews += ', no lowercase'
|
if sviews: sviews += ', no lowercase'
|
||||||
|
if views & CRL.Catalog.State.VstNoLinkage:
|
||||||
|
if sviews: sviews += ', no linkage'
|
||||||
sviews += ''
|
sviews += ''
|
||||||
if views & CRL.Catalog.State.Physical:
|
if views & CRL.Catalog.State.Physical:
|
||||||
if sviews: sviews += ','
|
if sviews: sviews += ','
|
||||||
sviews += 'layout'
|
sviews += 'layout'
|
||||||
|
|
||||||
print ' %s+ %s (%s).' % ( ' '*(depth*2), cell.getName(), sviews )
|
print( ' {}+ {} ({}).'.format(' '*(depth*2), cell.getName(), sviews) )
|
||||||
if cell.isUniquified(): views |= CRL.Catalog.State.Logical
|
if cell.isUniquified(): views |= CRL.Catalog.State.Logical
|
||||||
framework.saveCell( cell, views )
|
framework.saveCell( cell, views )
|
||||||
|
|
||||||
for instance in cell.getInstances():
|
for instance in cell.getInstances():
|
||||||
|
#print( ' {}| {}.'.format(' '*(depth*2), instance) )
|
||||||
masterCell = instance.getMasterCell()
|
masterCell = instance.getMasterCell()
|
||||||
if not masterCell.isTerminal():
|
|
||||||
|
if not masterCell.isTerminalNetlist():
|
||||||
rsave( masterCell, views, depth+1 )
|
rsave( masterCell, views, depth+1 )
|
||||||
|
#else:
|
||||||
|
# print( ' {}| Master cell is terminal netlist {}.'.format(' '*(depth*2), instance.getMasterCell()) )
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +78,7 @@ def rsave ( cell, views=CRL.Catalog.State.Physical, depth=0 ):
|
||||||
# Plugin hook functions, unicornHook:menus, ScritMain:call
|
# Plugin hook functions, unicornHook:menus, ScritMain:call
|
||||||
|
|
||||||
def unicornHook ( **kw ):
|
def unicornHook ( **kw ):
|
||||||
|
"""Hook up rsave plugin into Unicorn/CGT menu tree."""
|
||||||
plugins.kwUnicornHook( 'tools.rsave'
|
plugins.kwUnicornHook( 'tools.rsave'
|
||||||
, 'Recursive Save (layout)'
|
, 'Recursive Save (layout)'
|
||||||
, 'Recursively save layout of the top cell and it\'s instances'
|
, 'Recursively save layout of the top cell and it\'s instances'
|
||||||
|
@ -81,18 +89,15 @@ def unicornHook ( **kw ):
|
||||||
|
|
||||||
|
|
||||||
def scriptMain ( **kw ):
|
def scriptMain ( **kw ):
|
||||||
|
"""Called when run as a stand alone script through Unicorn/CGT."""
|
||||||
try:
|
try:
|
||||||
#helpers.setTraceLevel( 550 )
|
#helpers.setTraceLevel( 550 )
|
||||||
|
|
||||||
cell, editor = plugins.kwParseMain( **kw )
|
cell, editor = plugins.kwParseMain( **kw )
|
||||||
|
|
||||||
views = CRL.Catalog.State.Physical
|
views = CRL.Catalog.State.Physical
|
||||||
if kw.has_key('views'): views = kw['views']
|
if kw.has_key('views'): views = kw['views']
|
||||||
|
|
||||||
if not cell:
|
if not cell:
|
||||||
print WarningMessage( 'No Cell loaded in the editor (yet), nothing done.' )
|
print( WarningMessage( 'No Cell loaded in the editor (yet), nothing done.' ) )
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
rsave( cell, views )
|
rsave( cell, views )
|
||||||
CRL.destroyAllVHDL()
|
CRL.destroyAllVHDL()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue