Improved Hurricane/Python database reset.
* Change: In CRL/helpers/__init__.py, to ensure a complete restart of the database the __init__.py must be called again, but it's not the case with reload() (see Python doc). So helpers.resetCoriolis() must explicitly removes the Coriolis related Python modules from sys.modules (calling "del sys.modules[moduleName]"). That list of Coriolis Python modules is built by calling helpers.tagConfModules(), it will tag all modules added to sys.modules since startup. It will remove (much) more than Coriolis modules, but that should be ok. * Change: In CRL/etc/{node*,symbolic}/TECH/__init__.py, add a call to helpers.tagConfModules() for the techno modules to be erased on reset.
This commit is contained in:
parent
010fc79f4f
commit
e4041d5e26
|
@ -39,3 +39,5 @@ import node180.scn6m_deep_09.devices
|
|||
import node180.scn6m_deep_09.dtr_scn6m_deep_09
|
||||
|
||||
Cfg.Configuration.popDefaultPriority()
|
||||
|
||||
helpers.tagConfModules()
|
||||
|
|
|
@ -38,3 +38,5 @@ import node45.freepdk45.stratus1
|
|||
import node45.freepdk45.devices
|
||||
|
||||
Cfg.Configuration.popDefaultPriority()
|
||||
|
||||
helpers.tagConfModules()
|
||||
|
|
|
@ -38,3 +38,5 @@ import node600.phenitec.stratus1
|
|||
import node600.phenitec.devices
|
||||
|
||||
Cfg.Configuration.popDefaultPriority()
|
||||
|
||||
helpers.tagConfModules()
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
|
||||
import Cfg
|
||||
import helpers
|
||||
import helpers.io
|
||||
helpers.io.vprint( 1, ' o Loading "symbolic.cmos" technology.' )
|
||||
helpers.io.vprint( 2, ' - "%s".' % helpers.truncPath(__file__) )
|
||||
|
@ -37,3 +38,5 @@ import symbolic.cmos.plugins
|
|||
import symbolic.cmos.stratus1
|
||||
|
||||
Cfg.Configuration.popDefaultPriority()
|
||||
|
||||
helpers.tagConfModules()
|
||||
|
|
|
@ -27,3 +27,4 @@ Cfg.getParamInt ( "chip.block.rails.vSpacing" ).setInt ( l( 6) )
|
|||
Cfg.getParamInt ( 'clockTree.minimumSide' ).setInt ( l(600) )
|
||||
Cfg.getParamString( 'clockTree.buffer' ).setString( 'buf_x2')
|
||||
Cfg.getParamString( 'clockTree.placerEngine' ).setString( 'Etesian')
|
||||
Cfg.getParamInt ( 'block.spareSide' ).setInt ( 10 )
|
||||
|
|
|
@ -37,3 +37,5 @@ import symbolic.cmos45.plugins
|
|||
import symbolic.cmos45.stratus1
|
||||
|
||||
Cfg.Configuration.popDefaultPriority()
|
||||
|
||||
helpers.tagConfModules()
|
||||
|
|
|
@ -10,23 +10,20 @@
|
|||
# | Author : Jean-Paul Chaput |
|
||||
# | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
# | =============================================================== |
|
||||
# | Python : "./crlcore/__init__.py" |
|
||||
# | Python : "./crlcore/helpers/__init__.py" |
|
||||
# +-----------------------------------------------------------------+
|
||||
#
|
||||
# This is file is mandatory to tell python that 'helpers' is a module
|
||||
# rather than an ordinary directory, thus enabling the uses of the
|
||||
# 'dot' notation in import.
|
||||
|
||||
#print 'helpers.__init__()'
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import traceback
|
||||
import Hurricane
|
||||
import Viewer
|
||||
import CRL
|
||||
import helpers.io
|
||||
|
||||
quiet = False
|
||||
sysConfDir = None
|
||||
|
@ -35,7 +32,17 @@ ndaDir = None
|
|||
techno = 'symbolic/cmos'
|
||||
technoDir = None
|
||||
moduleGlobals = globals()
|
||||
confModules = [ ]
|
||||
sysModules = set()
|
||||
confModules = set()
|
||||
|
||||
if not sysModules:
|
||||
for moduleName in sys.modules.keys():
|
||||
sysModules.add( moduleName )
|
||||
|
||||
import Hurricane
|
||||
import Viewer
|
||||
import CRL
|
||||
import helpers.io
|
||||
|
||||
|
||||
def stype ( o ): return str(type(o)).split("'")[1]
|
||||
|
@ -348,10 +355,10 @@ def setSysConfDir ( quiet=False ):
|
|||
if sysConfDir != None:
|
||||
#if not quiet: print ' o helpers.staticInitialization() Already run, exit.'
|
||||
return
|
||||
|
||||
|
||||
reSysConfDir = re.compile(r'.*etc\/coriolis2')
|
||||
if not quiet: print ' o Locating configuration directory:'
|
||||
|
||||
|
||||
for path in sys.path:
|
||||
if reSysConfDir.match(path):
|
||||
sysConfDir = path
|
||||
|
@ -397,9 +404,10 @@ setSysConfDir( False )
|
|||
|
||||
|
||||
def unloadUserSettings ():
|
||||
global confModules
|
||||
|
||||
print ' o Unloading Python user\'s modules.'
|
||||
|
||||
global confModules
|
||||
for moduleName in confModules:
|
||||
refcount = sys.getrefcount( sys.modules[moduleName] )
|
||||
warning = ''
|
||||
|
@ -411,16 +419,12 @@ def unloadUserSettings ():
|
|||
# ] )
|
||||
print ' - %-34s %-35s' % ('"%s".'%moduleName, warning)
|
||||
del sys.modules[ moduleName ]
|
||||
confModules = []
|
||||
confModules = set()
|
||||
return
|
||||
|
||||
|
||||
def loadUserSettings ():
|
||||
global confModules
|
||||
|
||||
rvalue = False
|
||||
beforeModules = set()
|
||||
for moduleName in sys.modules.keys(): beforeModules.add( moduleName )
|
||||
|
||||
if os.path.isfile('./coriolis2/settings.py'):
|
||||
if os.path.isfile('./coriolis2/__init__.py'):
|
||||
|
@ -434,17 +438,24 @@ def loadUserSettings ():
|
|||
else:
|
||||
import symbolic.cmos
|
||||
|
||||
tagConfModules()
|
||||
|
||||
return rvalue
|
||||
|
||||
|
||||
def tagConfModules ():
|
||||
global sysModules
|
||||
global confModules
|
||||
|
||||
confModules = set()
|
||||
for moduleName in sys.modules.keys():
|
||||
if not (moduleName in beforeModules):
|
||||
if not (moduleName in sysModules):
|
||||
confModules.add( moduleName )
|
||||
|
||||
#print 'Configuration modules:'
|
||||
#for moduleName in confModules:
|
||||
# print '-', moduleName
|
||||
|
||||
return rvalue
|
||||
|
||||
|
||||
def resetCoriolis ():
|
||||
print ' o Full reset of Coriolis/Hurricane databases.'
|
||||
|
|
Loading…
Reference in New Issue