coriolis/crlcore/python/helpers/Configuration.py

207 lines
8.1 KiB
Python
Raw Normal View History

# -*- Mode:Python -*-
import os
import os.path
import sys
import Cfg
import helpers
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 import Debug
confFile = '<confFile has not been set>'
class ParameterType ( object ):
Bool = 1
Int = 2
Enumerate = 3
Percentage = 4
Double = 5
String = 6
Tab = 10
Title = 11
Section = 12
Rule = 13
Option = 14
def __init__ ( self, code ):
self._code = code
return
def __int__ ( self ):
return self._code
def __str__ ( self ):
if self._code == ParameterType.Bool: return 'TypeBool'
if self._code == ParameterType.Int: return 'TypeInt'
if self._code == ParameterType.Enumerate: return 'TypeEnumerate'
if self._code == ParameterType.Percentage: return 'TypePercentage'
if self._code == ParameterType.Double: return 'TypeDouble'
if self._code == ParameterType.String: return 'TypeString'
if self._code == ParameterType.Tab: return 'TypeTab'
if self._code == ParameterType.Title: return 'TypeTitle'
if self._code == ParameterType.Section: return 'TypeSection'
if self._code == ParameterType.Rule: return 'TypeRule'
if self._code == ParameterType.Option: return 'TypeOption'
return 'TypeUnknown (%d)', self._code
def __repr__ ( self ):
return str(self)
TypeBool = ParameterType(ParameterType.Bool)
TypeInt = ParameterType(ParameterType.Int)
TypeEnumerate = ParameterType(ParameterType.Enumerate)
TypePercentage = ParameterType(ParameterType.Percentage)
TypeDouble = ParameterType(ParameterType.Double)
TypeString = ParameterType(ParameterType.String)
TypeTab = ParameterType(ParameterType.Tab)
TypeTitle = ParameterType(ParameterType.Title)
TypeSection = ParameterType(ParameterType.Section)
TypeRule = ParameterType(ParameterType.Rule)
TypeOption = ParameterType(ParameterType.Option)
def loadParameters ( parametersData, fromFile ):
global confFile
confFile = fromFile
entryNo = 0
for entry in parametersData:
entryNo += 1
try:
if len(entry) < 3:
raise ErrorMessage(1,['Malformed entry in <parametersTable>.'
,'Less than three fields: (path_name, Type, default_value [,options]).'
,str(entry)
])
if len(entry) == 3:
pathName, paramType, value = entry
options = None
elif len(entry) == 4:
pathName, paramType, value, options = entry
else:
raise ErrorMessage(1,['Malformed entry in <parametersTable>.'
,'More than four fields: (path_name, Type, default_value [,options]).'
,str(entry)
])
if paramType == TypeBool:
param = Cfg.getParamBool(pathName)
param.setBool(value)
if paramType == TypeInt:
param = Cfg.getParamInt(pathName)
param.setInt(value)
if paramType == TypeEnumerate:
param = Cfg.getParamEnumerate(pathName)
param.setInt(value)
if paramType == TypePercentage:
param = Cfg.getParamPercentage(pathName)
param.setPercentage(value)
if paramType == TypeDouble:
param = Cfg.getParamDouble(pathName)
param.setDouble(value)
if paramType == TypeString:
param = Cfg.getParamString(pathName)
param.setString(value)
if options and param:
for key in options.keys():
if key == 'min': param.setMin(options[key])
elif key == 'max': param.setMax(options[key])
elif key == 'values':
for name, value in options[key]:
param.addValue(name, value)
elif key == 'slaves':
for slave in options[key]:
param.addSlave(slave)
elif key == 'flags':
param.flags = options[key]
except Exception, e:
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
e = ErrorMessage( e )
e.addMessage( 'In %s:<parametersTable> at index %d.' % (confFile,entryNo) )
print e
return
def loadLayout ( layoutData, fromFile ):
global confFile
confFile = fromFile
layout = Cfg.Configuration.get().getLayout()
tabName = None
entryNo = 0
for entry in layoutData:
entryNo += 1
try:
if not isinstance(entry,tuple):
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Not a tuple (a, b, c, ...) or (a,).'
,str(entry)
])
if entry[0] == TypeTab:
if len(entry) != 3:
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Tab must have exactly three fields: (TypeTab, tab_name, tag).'
,str(entry)
])
layoutType, tabName, tagName = entry
layout.addTab ( tabName, tagName )
if not tabName:
raise ErrorMessage(1,['Bad entry order in <layoutTable>.'
,'First entry must be of Tab type.'
])
if entry[0] == TypeTitle:
if len(entry) != 2:
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Title must have exactly two fields: (TypeTitle, title).'
,str(entry)
])
layoutType, title = entry
layout.addTitle ( tabName, title )
elif entry[0] == TypeSection:
if len(entry) != 3:
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Section must have exactly three fields: (TypeSection, section, column).'
,str(entry)
])
layoutType, section, column = entry
layout.addSection ( tabName, section, column )
elif entry[0] == TypeRule:
if len(entry) != 1:
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Rule must have exactly one fields: (TypeRule,).'
,str(entry)
])
layout.addRule ( tabName )
elif entry[0] == TypeOption:
if len(entry) < 4:
raise ErrorMessage(1,['Malformed entry in <layoutTable>.'
,'Option must have at least four fields: (TypeOption,path_name,text,column[,span,flags]).'
,str(entry)
])
if len(entry) == 4:
layoutType, pathName, text, column = entry
layout.addParameter ( tabName, pathName, text, column )
elif len(entry) == 5:
layoutType, pathName, text, column, span = entry
layout.addParameter ( tabName, pathName, text, column, span )
elif len(entry) == 6:
layoutType, pathName, text, column, span, flags = entry
layout.addParameter ( tabName, pathName, text, column, span, flags )
except Exception, e:
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
e = ErrorMessage( e )
e.addMessage( 'In %s:<layoutTable> at index %d.' % (confFile,entryNo) )
print e
return