def loadGdsLayers ( realLayersTable, confFile ): realFile = confFile technology = DataBase.getDB().getTechnology() entryNo = 0 for entry in realLayersTable: entryNo += 1 try: if len(entry) != 3: raise ErrorMessage(1,['Malformed entry in <realLayersTable>.' ,'Must have exactly three fields: (symb_name,real_name,GDSII_extnb).' ,str(entry) ]) symbName, realName, gdsiiExtractNumber = entry if not isinstance(gdsiiExtractNumber,int): raise ErrorMessage(1,['Incoherency in <realLayersTable> entry.' ,'GDSII exctract number is not of int type (%s).' \ % helpers.stype(gdsiiExtractNumber) ,str(entry) ]) basicLayer = technology.getBasicLayer(symbName) if not basicLayer: raise ErrorMessage(1,['Incoherency in <realLayersTable> entry.' ,'The real layer "%s" associated to the GDSII "%s" do not exists.' \ % (symbName,realName) ,str(entry) ]) basicLayer.setRealName ( realName ) basicLayer.setExtractNumber( gdsiiExtractNumber ) except Exception, e: ErrorMessage.wrapPrint(e,'In %s:<realLayersTable> at index %d.' % (realFile,entryNo))
def loadRoutingGaugesTable(routingGaugesTable, fromFile): global allianceFile allianceFile = fromFile af = AllianceFramework.get() for gaugeName in routingGaugesTable.keys(): gaugeDatas = routingGaugesTable[gaugeName] technology = DataBase.getDB().getTechnology() gauge = RoutingGauge.create(gaugeName) entryNo = 0 for entry in gaugeDatas: entryNo += 1 try: if len(entry) != 2: raise ErrorMessage(1, [ 'Malformed entry in <routingGaugesTable[%s]>.' % gaugeName, 'Must have exactly two fields ("METAL_LAYER", (parameters_list)).', str(entry) ]) if len(entry[1]) != 8: raise ErrorMessage(1, [ 'Malformed entry in <routingGaugesTable[%s]>.' % gaugeName, 'Parameters list must have exactly eight fields:', ' (direction, type, depth, density, offset, pitch, wire_width, via_width)', str(entry) ]) gauge.addLayerGauge( RoutingLayerGauge.create( technology.getLayer(entry[0]), Gauge.toRlGauge(entry[1][0]) # Direction. , Gauge.toRlGauge(entry[1][1]) # Type. , entry[1][2] # Depth. , entry[1][3] # Density. , DbU.fromLambda(entry[1][4]) # Offset. , DbU.fromLambda(entry[1][5]) # Pitch. , DbU.fromLambda(entry[1][6]) # Wire width. , DbU.fromLambda(entry[1][7]) # Via width. )) except Exception, e: ErrorMessage.wrapPrint( e, 'In %s:<routingGaugesTable> at index %d.' % (allianceFile, entryNo)) af.addRoutingGauge(gauge)
def loadSymbolicRules ( symbolicRulesTable, confFile ): global symbolicFile symbolicFile = confFile technology = DataBase.getDB().getTechnology() entryNo = 0 for rule in symbolicRulesTable: entryNo += 1 try: if len(rule) != 2: raise ErrorMessage(1,['Malformed entry in <symbolicRulesTable>.' ,'Must contains exactly two fields: ( rule_path, value ).' ,str(rule) ]) if not isinstance(rule[1],int) and not isinstance(rule[1],float): raise ErrorMessage(1,['Invalid entry in <symbolicRulesTable>.' ,'Rule value must be of integer or float type.' ,str(rule) ]) value = DbU.fromLambda(rule[1]) elements = rule[0].split('.') if len(elements) < 3: raise ErrorMessage(1,['Invalid entry in <symbolicRulesTable>.' ,'Rule name must contains at least three components: \"LAYER.category.dimension\".' ,str(rule) ]) ruleLayer = layersLUT.lookup( elements[0], LayersLUT.Symbolic|LayersLUT.MissingError ) subLayer = layersLUT.lookup( elements[1], LayersLUT.Real ) if subLayer: ruleTag = ".".join(elements[2:]) else: ruleTag = ".".join(elements[1:]) if ruleTag == 'extention.cap': ruleLayer.setExtentionCap ( subLayer, value ) elif ruleTag == 'extention.width': ruleLayer.setExtentionWidth( subLayer, value ) elif ruleTag == 'enclosure': ruleLayer.setEnclosure ( subLayer, value ) elif ruleTag == 'minimum.width': ruleLayer.setMinimalSize ( value ) elif ruleTag == 'minimum.side': ruleLayer.setMinimalSize ( value ) else: raise ErrorMessage(1,['Invalid entry in <symbolicRulesTable>.' ,'Unknown rule kind: \".%s\", should be any of:' % ruleTag ,' * "RULE_HEAD.extention.cap"' ,' * "RULE_HEAD.extention.width"' ,' * "RULE_HEAD.enclosure"' ,' * "RULE_HEAD.minimum.width"' ,' * "RULE_HEAD.minimum.side"' ,str(rule) ]) except Exception as e: ErrorMessage.wrapPrint(e,'In %s:<symbolicRulesTable> at index %d.' % (symbolicFile,entryNo)) return
def loadAllianceConfig(table, fromFile): global allianceFile allianceFile = fromFile af = AllianceFramework.get() db = DataBase.getDB() technology = db.getTechnology() if not technology: technology = Hurricane.Technology.create(db, 'Alliance') _loadAllianceConfig(af, table) env = af.getEnvironment() return
def loadWorkingLayers ( workingLayersTable, confFile ): global symbolicFile symbolicFile = confFile technology = DataBase.getDB().getTechnology() entryNo = 0 for layerName in workingLayersTable: entryNo += 1 try: # This call is just to generate an error if the layer is non-existent. layersLUT.lookup(layerName,LayersLUT.Real|LayersLUT.Symbolic|LayersLUT.MissingError) technology.setWorkingLayer(layerName) except Exception as e: ErrorMessage.wrapPrint(e,'In %s:<symbolicRulesTable> at index %d.' % (symbolicFile,entryNo)) return
def loadTechnoConfig ( technoConfig, confFile ): realFile = confFile technology = DataBase.getDB().getTechnology() gridValue = 1 gridUnit = DbU.UnitPowerMicro for key in [ 'gridUnit', 'gridValue', 'gridsPerLambda' ]: try: if key == 'gridUnit': if key in technoConfig: gridUnit = technoConfig[key] if gridUnit != DbU.UnitPowerPico and \ gridUnit != DbU.UnitPowerNano and \ gridUnit != DbU.UnitPowerMicro and \ gridUnit != DbU.UnitPowerMilli and \ gridUnit != DbU.UnitPowerUnity and \ gridUnit != DbU.UnitPowerKilo: raise ErrorMessage(1,'In <technoConfig>, invalid DbU unit power for gridUnit, reseting to Micro.') else: raise ErrorMessage(1,'<technoConfig> has no <gridUnit> defined, assuming Micro.') elif key == 'gridValue': if 'gridValue' in technoConfig: gridValue = technoConfig['gridValue'] if not isinstance(gridUnit,float) and not isinstance(gridUnit,int): raise ErrorMessage(1,['In <technoConfig>, <gridValue> must be of type float (and not: %s).' % helpers.stype(gridValue) ]) DbU.setPhysicalsPerGrid(gridValue,gridUnit) else: raise ErrorMessage(1,'<technoConfig> has no <gridValue> defined.') elif key == 'gridsPerLambda': if 'gridsPerLambda' in technoConfig: gridsPerLambda = technoConfig['gridsPerLambda'] if not isinstance(gridsPerLambda,int): raise ErrorMessage(1,['In <technoConfig>, <gridsPerLambda> must be of type int (and not: %s).' % helpers.stype(gridsPerLambda) ]) DbU.setGridsPerLambda(gridsPerLambda) except Exception as e: ErrorMessage.wrapPrint(e) return
def loadRealLayers(realLayersTable, confFile): global symbolicFile symbolicFile = confFile technology = DataBase.getDB().getTechnology() entryNo = 0 for entry in realLayersTable: entryNo += 1 try: if len(entry) < 2: raise ErrorMessage(1, [ 'Malformed entry in <realLayersTable>.', 'Less than two fields: missing name and/or material.', str(entry) ]) if len(entry) > 2: if entry[1] != BasicLayer.Material.blockage: raise ErrorMessage(1, [ 'Invalid entry in <realLayersTable>.', 'Only blockage material can have a third field.', str(entry) ]) routingLayer = technology.getBasicLayer(entry[2]) if not routingLayer: raise ErrorMessage(1, [ 'Incoherency in <realLayersTable> entry at.', 'The metal <%s> associated to the blockage doesn\'t exist (yet?).' % entry[2], str(entry) ]) basicLayer = BasicLayer.create(technology, entry[0], BasicLayer.Material(entry[1])) layersLUT.add(basicLayer) if len(entry) > 2: routingLayer.setBlockageLayer(basicLayer) except Exception, e: ErrorMessage.wrapPrint( e, 'In %s:<symbolicLayersTable> at index %d.' % (symbolicFile, entryNo))
def loadSymbolicLayers ( symbolicLayersData, confFile ): global symbolicFile symbolicFile = confFile technology = DataBase.getDB().getTechnology() entryNo = 0 for entry in symbolicLayersData: entryNo += 1 try: if len(entry) != 3: raise ErrorMessage(1,['Malformed entry in <symbolicLayersTable>.' ,'Must contains exactly three fields: ( name, type, (real_layers,) ).' ,str(entry) ]) name, layerType, realLayers = entry if not isinstance(layerType,SymbolicLayerType): raise ErrorMessage(1,['Invalid entry in <symbolicLayersTable>.' ,'The layer type code is not valid, should be any of:' ,' * TypeRegular' ,' * TypeDiffusion' ,' * TypeTransistor' ,' * TypeContact' ,' * TypeVia' ,str(entry) ]) if layerType.realLayerLength() != len(realLayers): raise ErrorMessage(1,['Invalid entry in <symbolicLayersTable>.' ,'Layer of type <%s> contains %d real layers instead of %d.' \ % (layerType,len(realLayers),layerType.realLayerLength()) ,str(entry) ]) realLayersArgs = [] for layerName in realLayers: if layerName: realLayersArgs += [ layersLUT.lookup(layerName ,LayersLUT.Real |LayersLUT.Symbolic |LayersLUT.MissingError) ] else: realLayersArgs += [ None ] symbolicLayer = None if layerType == TypeRegular: symbolicLayer = RegularLayer.create(technology,entry[0]) symbolicLayer.setBasicLayer( *realLayersArgs ) elif layerType == TypeDiffusion: symbolicLayer = DiffusionLayer.create(technology ,entry[0], *realLayersArgs) elif layerType == TypeTransistor: symbolicLayer = TransistorLayer.create(technology ,entry[0], *realLayersArgs) elif layerType == TypeContact: symbolicLayer = ContactLayer.create(technology ,entry[0], *realLayersArgs) elif layerType == TypeVia: symbolicLayer = ViaLayer.create(technology ,entry[0], *realLayersArgs) layersLUT.add( symbolicLayer ) except Exception as e: ErrorMessage.wrapPrint(e,'In %s:<symbolicLayersTable> at index %d.' % (symbolicFile,entryNo)) return