coriolis/crlcore/python/coriolisInit.py

220 lines
9.8 KiB
Python
Raw Normal View History

try:
import sys
import os
import os.path
import copy
import Cfg
import Hurricane
import Viewer
import CRL
from CRL import Environment
from CRL import RoutingLayerGauge
from helpers import Configuration
Support for mixing real pads & symbolic core. Wrapper around s2r. * Change: In Hurricane::Error constructors disable the backtrace generation. (*very* slow). * Change: In Hurricane::Library::getHierarchicalname(), more compact naming. Remove the name of the root library. * New: In Hurricane::Net, new type "FUSED", for component with no net. More efficient than having one net for each. * Change: In CellViewer, BreakpointWidget, use Angry Birds icons. * Change: In CellWidget::State, use the hierarchical name (cached) as key to the state. This allow to load two cells with the same name but from different libraries in the widget history. * Change: In PyGraphics, export "isEnabled()" and "isHighDpi()" functions. * Change: In CRL/etc/symbolic/cmos/plugin.conf, and CRL/etc/common/plugin.conf use the physical dimensions converters. * Change: In CRL/etc/symbolic/cmos/technology.conf, make the GDS layer table coherent with the default Alliance cmos.rds. * New: CRL/python/helpers/io.py, put ErrorMessage new implementation here, along with a new ErrorWidget written in PyQt4. It seems finally that PyQt4 can be used alongside Coriolis Qt widgets. New ErrorMessage.catch() static function to manage all exceptions in except clauses. * Change: In CRL/python/helpers/, no longer use ErrorMessage.wrapPrint(), directly print it. Rewrite the utilities to display Python stack traces "textStacktrace()" and "showStacktrace()". * Change: In CRL::AllianceFramework, shorten the names of the libraries. * Change: In CRL::ApParser & CRL::ApDriver, more accurate translation between Alliance connectors (C record) and Hurricane::Pin objects. Pin are no longer made square but thin and oriented in the connecting direction. Use the new fused net for unnamed components. * New: In CRL::GdsParser, implementation of SREF parsing, i.e. instances. Due to the unordered nature of the GDS stream, instances creation are delayed until the whole stream has been parsed and only then are they created. For the sake of reading back Alliance s2r GDS, we assume that any TEXT following a boundary is the Net name the boundary (component) belongs to. Create abutment box for Cells, computed from the bounding box, so the Hurricane QuadTree could work properly. Make use of the fused net for unnamed components. * New: In Cumulus/plugins/chip, complete rewrite of the I/O pad management. Now we can mix real (foundry) pads and a symbolic core. To cleanly support the de-coupling between the real part and the symbolic one we introduce a new intermediary hierarchical level, the corona. We have now: Chip --> Pads + Corona --> Core. At chip level (and if we are using real pads) the layout is fully real (excepting the corona). The Corona contains everything that is symbolic. It has symbolic wires extending outward the abutment box to make contact with the real wires coming from the pads. In the pad ring we can use corners instances (or not), pad spacers or directly draw wires between connectors ring pads. Provide two flavors: placement only or full place & route. WARNING: If routing in a second step, *do not route* the *Chip* but the *Corona*. * Change: In Cumulus/plugins/clocktree, give the modified Cell an additional extension of "_cts" (Clock Tree Synthesis) instead of "_clocked", to follow the common convention. * New: In cumulus/plugins/S2R.py, encapsulate call to Alliance S2R and reload the translated Cell in the editor. * New: In cumulus/plugins/core2chip, provide an utility to automatically create a chip from a core. To work this plugins must have a basic understanding of the pad functionalities which may differs from foundry to foundry. So a base class CoreToChip is created, then for each supported pad foundry a derived class is added. Currently we support AMS c35b4 and Alliance symbolic cmos. * Bug: In Anabatic::Configuration, read the right configuration parameter "anabatic.topRoutinglayer" (Katana), and not the one for Katabatic... * Change: In Unicorn/cgt.py, process the plugins in alphabetical order to ensure a reproductible ordering of the menus...
2019-05-22 07:34:32 -05:00
from helpers.io import ErrorMessage
from helpers.io import WarningMessage
#from helpers import Devices
from helpers.Configuration import TypeBool
from helpers.Configuration import TypeInt
from helpers.Configuration import TypeEnumerate
from helpers.Configuration import TypePercentage
from helpers.Configuration import TypeDouble
from helpers.Configuration import TypeString
from helpers.Configuration import TypeTab
from helpers.Configuration import TypeTitle
from helpers.Configuration import TypeSection
from helpers.Configuration import TypeRule
from helpers.Configuration import TypeOption
from helpers import Patterns
from helpers import Display
from helpers.Display import Style
from helpers.Display import Inherit
from helpers.Display import Darkening
from helpers.Display import Group
from helpers.Display import Drawing
from helpers import Alliance
from helpers import Technology
from helpers import AnalogTechno
from helpers import Devices
import helpers.Display
except ImportError, e:
serror = str(e)
if serror.startswith('No module named') \
or serror.startswith('cannot import name') :
module = serror.split()[-1]
print '[ERROR] The "%s" python module or symbol cannot be loaded.' % module
print ' Please check the integrity of the Coriolis package.'
if serror.find('cannot open shared object file') != -1:
library = serror.split(':')[0]
print '[ERROR] The "%s" shared library cannot be loaded.' % library
print ' Under RHEL 6, you must be under devtoolset-2.'
print ' (scl enable devtoolset-2 bash)'
sys.exit(1)
except Exception, e:
print '[ERROR] A strange exception occurred while loading the basic Coriolis/Python'
print ' modules. Something may be wrong at Python/C API level.\n'
print ' %s' % e
sys.exit(2)
helpers.staticInitialization()
moduleGlobals = globals()
SystemFile = 0x0001
AllianceHelper = 0x0002
TechnologyHelper = 0x0004
PatternsHelper = 0x0010
DisplayHelper = 0x0020
ConfigurationHelper = 0x0040
KiteHelper = 0x0080
HelpersMask = AllianceHelper \
| TechnologyHelper \
| PatternsHelper \
| DisplayHelper \
| ConfigurationHelper \
| KiteHelper
SystemMandatory = 0x0100
def coriolisConfigure():
confHelpers = ( ('allianceConfig' , Alliance.loadAllianceConfig , SystemMandatory|AllianceHelper)
, ('routingGaugesTable' , Alliance.loadRoutingGaugesTable, SystemMandatory|KiteHelper)
, ('cellGaugesTable' , Alliance.loadCellGaugesTable , SystemMandatory|KiteHelper)
, ('realLayersTable' , Technology.loadRealLayers , SystemMandatory|TechnologyHelper)
, ('compositeLayersTable' , Technology.loadCompositeLayers , SystemMandatory|TechnologyHelper)
, ('symbolicLayersTable' , Technology.tagSymbolicLayers , SystemMandatory|TechnologyHelper)
, ('layersExtensionsTable', Technology.loadLayersExtensions, SystemMandatory|TechnologyHelper)
, ('gdsLayersTable' , Technology.loadGdsLayers , SystemMandatory|TechnologyHelper)
, ('patternsTable' , Patterns.loadPatterns , SystemMandatory|PatternsHelper)
, ('stylesTable' , Display.loadStyles , SystemMandatory|DisplayHelper)
, ('defaultStyle' , Display.loadDefaultStyle , SystemMandatory|DisplayHelper)
, ('parametersTable' , Configuration.loadParameters , ConfigurationHelper)
, ('layoutTable' , Configuration.loadLayout , ConfigurationHelper)
)
# ('technoConfig' , Technology.loadTechnoConfig , SystemMandatory|TechnologyHelper)
Support for separated NDA tree. Big cleanup of the Python init system. * Change: In Hurricane::Script, when running a script, no longer do it inside a Python sun-interpreter, use the current one. This way we no longer have our modules initialized twice or more, which was starting to be unmanageable (with the NDA support). The settings were re-read multiple time to the same value, so it was working, but still... I hope I didn't left some dangling Python objects now. * Bug: In Hurricane::LayoutGenerator::drawLayout(), get the device abutment box though a Pyhon object *before* finalizing which removes that objet. * New: In cumulus/plugins/__init__.py, add a "loadPlugins()" and static initialisation to preload plugins modules. We use that pre-loading step to append to the module __path__ attribute the alternate directory where a NDA covered may be found. This assume that the directory tree under the NDA root is identical to the one under the public root. * New: In cumulus/plugins/chip/__init__.py, small utility function importContants() to import the constants inside another module namespace, to have more consise notations. * Change: In cumulus/plugins/, in the various plugins sub-modules import use the full path from plugins, that is, for example: from plugins.core2chip.CoreToChip import IoPad * Change: In Unicorn/python/unicornInit.py, no longer directly load the plugins modules, this is now done by cumulus/plugins/__init__.py. Instead, iterate through sys.modules for the ones starting by "plugins/" and try to execute a Unicorn hook, if present. * Change: In Karakaze/python/AnalogDesign.py, update for the new Instance.create() prototype (added placement parameter).
2019-10-11 10:36:54 -05:00
print ' o Running configuration hook: coriolisConfigure().'
#print ' - sysConfDir: <%s>' % helpers.sysConfDir
Cfg.Configuration.pushDefaultPriority ( Cfg.Parameter.Priority.ConfigurationFile )
confFiles = [ (helpers.technoDir+'/technology.conf', SystemFile|TechnologyHelper)
, (helpers.technoDir+'/alliance.conf' , SystemFile|AllianceHelper)
, (helpers.technoDir+'/patterns.conf' , SystemFile|PatternsHelper)
, (helpers.technoDir+'/display.conf' , SystemFile|DisplayHelper)
, (helpers.technoDir+'/misc.conf' , SystemFile|ConfigurationHelper)
, (helpers.technoDir+'/etesian.conf' , SystemFile|ConfigurationHelper)
, (helpers.technoDir+'/kite.conf' , SystemFile|ConfigurationHelper|KiteHelper)
, (helpers.technoDir+'/stratus1.conf' , SystemFile|ConfigurationHelper)
, (helpers.technoDir+'/plugins.conf' , SystemFile|ConfigurationHelper)
, (helpers.technoDir+'/analog.conf' , SystemFile|ConfigurationHelper)
]
if os.getenv('HOME'):
confFiles += [ (os.getenv('HOME')+'/.coriolis2/settings.py', 0) ]
else:
w = WarningMessage(['The "HOME" environment variable is not defined, this is most unusual.'
,'It prevents the loading of ${HOME}/.coriolis2/settings.py'])
print w
confFiles += [ (os.getcwd()+'/.coriolis2/settings.py', 0) ]
for confFile, confFlags in confFiles:
if confFile.endswith('settings.py'):
Cfg.Configuration.pushDefaultPriority ( Cfg.Parameter.Priority.UserFile )
try:
if not os.path.isfile(confFile):
if confFlags & SystemFile:
print '[ERROR] Missing mandatory Coriolis2 system file:'
print ' "%s"' % helpers.truncPath(confFile)
print ' Your installation may be broken. Trying to continue anyway...'
continue
Support for separated NDA tree. Big cleanup of the Python init system. * Change: In Hurricane::Script, when running a script, no longer do it inside a Python sun-interpreter, use the current one. This way we no longer have our modules initialized twice or more, which was starting to be unmanageable (with the NDA support). The settings were re-read multiple time to the same value, so it was working, but still... I hope I didn't left some dangling Python objects now. * Bug: In Hurricane::LayoutGenerator::drawLayout(), get the device abutment box though a Pyhon object *before* finalizing which removes that objet. * New: In cumulus/plugins/__init__.py, add a "loadPlugins()" and static initialisation to preload plugins modules. We use that pre-loading step to append to the module __path__ attribute the alternate directory where a NDA covered may be found. This assume that the directory tree under the NDA root is identical to the one under the public root. * New: In cumulus/plugins/chip/__init__.py, small utility function importContants() to import the constants inside another module namespace, to have more consise notations. * Change: In cumulus/plugins/, in the various plugins sub-modules import use the full path from plugins, that is, for example: from plugins.core2chip.CoreToChip import IoPad * Change: In Unicorn/python/unicornInit.py, no longer directly load the plugins modules, this is now done by cumulus/plugins/__init__.py. Instead, iterate through sys.modules for the ones starting by "plugins/" and try to execute a Unicorn hook, if present. * Change: In Karakaze/python/AnalogDesign.py, update for the new Instance.create() prototype (added placement parameter).
2019-10-11 10:36:54 -05:00
print ' - Loading "%s".' % helpers.truncPath(confFile)
execfile(confFile,moduleGlobals)
except Exception, e:
helpers.showPythonTrace( confFile, e )
for symbol, loader, loaderFlags in confHelpers:
if moduleGlobals.has_key(symbol):
loader( moduleGlobals[symbol], confFile )
del moduleGlobals[symbol]
else:
if confFlags & loaderFlags & HelpersMask:
if confFlags & SystemFile and loaderFlags & SystemMandatory:
print '[ERROR] Mandatory symbol "%s" is missing in system configuration file:' % symbol
print ' "%s"' % helpers.truncPath(confFile)
print ' Trying to continue anyway...'
if confFile.endswith('settings.py'):
Cfg.Configuration.popDefaultPriority ()
Cfg.Configuration.popDefaultPriority ()
#sys.stdout.write(CRL.AllianceFramework.get().getEnvironment().getPrint())
if not Cfg.getParamString('stratus1.mappingName').asString():
vendorTech = helpers.techno.split('/')[-1]
mappingFile = os.path.join( helpers.technoDir, 'stratus.xml' )
if not os.path.isfile(mappingFile):
mappingFile = os.path.join( helpers.sysConfDir, 'stratus2sxlib.xml' )
parameter = Cfg.getParamString('stratus1.mappingName')
parameter.setString( mappingFile )
parameter.flags = Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist
confFile = None
if Cfg.hasParameter('analog.techno'):
confFile = Cfg.getParamString('analog.techno').asString()
if confFile == 'Analog_technology_has_not_been_set': confFile = None
if confFile == 'Analog_technology_is_disabled': return
if not confFile:
vendorTech = helpers.techno.split('/')[-1]
confFile = os.path.join( helpers.technoDir, 'dtr_%s.py'%vendorTech )
Cfg.getParamString('analog.techno').setString( confFile )
if not os.path.isfile(confFile):
print '[WARNING] Analog technology file (aka DTR) has not been found:'
print ' "%s"' % helpers.truncPath(confFile)
print ' Use of Coriolis analog is disabled.'
return
try:
Support for separated NDA tree. Big cleanup of the Python init system. * Change: In Hurricane::Script, when running a script, no longer do it inside a Python sun-interpreter, use the current one. This way we no longer have our modules initialized twice or more, which was starting to be unmanageable (with the NDA support). The settings were re-read multiple time to the same value, so it was working, but still... I hope I didn't left some dangling Python objects now. * Bug: In Hurricane::LayoutGenerator::drawLayout(), get the device abutment box though a Pyhon object *before* finalizing which removes that objet. * New: In cumulus/plugins/__init__.py, add a "loadPlugins()" and static initialisation to preload plugins modules. We use that pre-loading step to append to the module __path__ attribute the alternate directory where a NDA covered may be found. This assume that the directory tree under the NDA root is identical to the one under the public root. * New: In cumulus/plugins/chip/__init__.py, small utility function importContants() to import the constants inside another module namespace, to have more consise notations. * Change: In cumulus/plugins/, in the various plugins sub-modules import use the full path from plugins, that is, for example: from plugins.core2chip.CoreToChip import IoPad * Change: In Unicorn/python/unicornInit.py, no longer directly load the plugins modules, this is now done by cumulus/plugins/__init__.py. Instead, iterate through sys.modules for the ones starting by "plugins/" and try to execute a Unicorn hook, if present. * Change: In Karakaze/python/AnalogDesign.py, update for the new Instance.create() prototype (added placement parameter).
2019-10-11 10:36:54 -05:00
if not helpers.quiet: print ' - Loading \"%s\".' % helpers.truncPath(confFile)
execfile(confFile,moduleGlobals)
except Exception, e:
showPythonTrace( confFile, e )
if moduleGlobals.has_key('analogTechnologyTable'):
AnalogTechno.loadAnalogTechno( moduleGlobals['analogTechnologyTable'], confFile )
del moduleGlobals['analogTechnologyTable']
else:
print '[ERROR] Mandatory symbol <%s> is missing in technology configuration file:' % 'analogTechnologyTable'
print ' "%s"' % helpers.truncPath(confFile)
sys.exit( 1 )
confFile = Cfg.getParamString('analog.devices').asString()
if not os.path.isfile(confFile):
print '[ERROR] Missing mandatory analog devices description file:'
print ' "%s"' % helpers.truncPath(confFile)
print ' Please look for the "analog.devices" parameter in configuration files.'
sys.exit( 1 )
try:
Support for separated NDA tree. Big cleanup of the Python init system. * Change: In Hurricane::Script, when running a script, no longer do it inside a Python sun-interpreter, use the current one. This way we no longer have our modules initialized twice or more, which was starting to be unmanageable (with the NDA support). The settings were re-read multiple time to the same value, so it was working, but still... I hope I didn't left some dangling Python objects now. * Bug: In Hurricane::LayoutGenerator::drawLayout(), get the device abutment box though a Pyhon object *before* finalizing which removes that objet. * New: In cumulus/plugins/__init__.py, add a "loadPlugins()" and static initialisation to preload plugins modules. We use that pre-loading step to append to the module __path__ attribute the alternate directory where a NDA covered may be found. This assume that the directory tree under the NDA root is identical to the one under the public root. * New: In cumulus/plugins/chip/__init__.py, small utility function importContants() to import the constants inside another module namespace, to have more consise notations. * Change: In cumulus/plugins/, in the various plugins sub-modules import use the full path from plugins, that is, for example: from plugins.core2chip.CoreToChip import IoPad * Change: In Unicorn/python/unicornInit.py, no longer directly load the plugins modules, this is now done by cumulus/plugins/__init__.py. Instead, iterate through sys.modules for the ones starting by "plugins/" and try to execute a Unicorn hook, if present. * Change: In Karakaze/python/AnalogDesign.py, update for the new Instance.create() prototype (added placement parameter).
2019-10-11 10:36:54 -05:00
if not helpers.quiet: print ' - Loading \"%s\".' % helpers.truncPath(confFile)
execfile(confFile,moduleGlobals)
except Exception, e:
showPythonTrace( confFile, e )
if moduleGlobals.has_key('devicesTable'):
Devices.loadDevices( moduleGlobals['devicesTable'], confFile )
del moduleGlobals['devicesTable']
else:
print '[ERROR] Mandatory symbol "%s" is missing in technology configuration file:' % 'devicesTable'
print ' "%s"' % helpers.truncPath(confFile)
sys.exit( 1 )
return