No longer directly use C++ exported symbols in configuration files.

* Change: In CRL Core, in Alliance.py, no longer requires the
    configuration file to uses symbols from CRL.Environment or
    CRL.RoutingLayerGauge. This way the <alliance.conf> file can be
    parsed by a different parser.
      In <alliance.conf>, for the various technologies, make uses
    of the new C++ independent constants.
* New: In CRL Core, in helpers/__init__.py, provide a "Dots" class
    (rewrite the C++ one in pure Python).
This commit is contained in:
Jean-Paul Chaput 2014-08-03 16:25:26 +02:00
parent b081d07bfc
commit 206309ddd9
4 changed files with 118 additions and 35 deletions

View File

@ -1,5 +1,8 @@
# -*- Mode:Python; explicit-buffer-name: "alliance.conf<cmos>" -*-
from helpers.Alliance import AddMode
from helpers.Alliance import Gauge
allianceTop = '/soc/alliance'
cellsTop = allianceTop+'/cells/'
@ -13,13 +16,14 @@ allianceConfig = \
, ( 'DISPLAY' , helpers.sysConfDir +'/display.xml' )
, ( 'CATALOG' , 'CATAL')
, ( 'WORKING_LIBRARY' , '.')
, ( 'SYSTEM_LIBRARY' , ( (cellsTop+'sxlib' , Environment.Append)
, (cellsTop+'dp_sxlib', Environment.Append)
, (cellsTop+'ramlib' , Environment.Append)
, (cellsTop+'romlib' , Environment.Append)
, (cellsTop+'rflib' , Environment.Append)
, (cellsTop+'rf2lib' , Environment.Append)
, (cellsTop+'pxlib' , Environment.Append) ) )
, ( 'SYSTEM_LIBRARY' , ( (cellsTop+'sxlib' , AddMode.Append)
, (cellsTop+'dp_sxlib', AddMode.Append)
, (cellsTop+'ramlib' , AddMode.Append)
, (cellsTop+'romlib' , AddMode.Append)
, (cellsTop+'rflib' , AddMode.Append)
, (cellsTop+'rf2lib' , AddMode.Append)
, (cellsTop+'pxlib' , AddMode.Append)
, (cellsTop+'padlib' , AddMode.Append) ) )
, ( 'SCALE_X' , 100)
, ( 'IN_LO' , 'vst')
, ( 'IN_PH' , 'ap')
@ -30,9 +34,10 @@ allianceConfig = \
, ( 'CLOCK' , '^ck.*')
, ( 'BLOCKAGE' , '^blockage[Nn]et*')
# The following are only read by the Alliance tool wrappers.
, ( 'ALLIANCE_TOP' , allianceTop)
, ( 'MBK_TARGET_LIB' , cellsTop+'sxlib')
, ( 'RDS_TECHNO_NAME' , allianceTop+'/cmos.rds')
, ( 'GRAAL_TECHNO_NAME' , allianceTop+'/graal.rds')
, ( 'RDS_TECHNO_NAME' , allianceTop+'/etc/cmos.rds')
, ( 'GRAAL_TECHNO_NAME' , allianceTop+'/etc/graal.rds')
)
@ -43,13 +48,13 @@ allianceConfig = \
routingGaugesTable = {}
routingGaugesTable['sxlib'] = \
( ( 'METAL1', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.PinOnly, 0, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL2', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 1, 7.0, 0, 5, 2, 2 ) )
, ( 'METAL3', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 2, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL4', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 3, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL5', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 4, 0.0, 0, 5, 2, 2 ) )
#, ( 'METAL6', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 5, 0.0, 0, 5, 2, 2 ) )
#, ( 'METAL7', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 6, 0.0, 0, 5, 2, 2 ) )
( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 5, 2, 2 ) )
, ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 5, 2, 2 ) )
, ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 5, 2, 2 ) )
#, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 5, 2, 2 ) )
#, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 5, 2, 2 ) )
)

View File

@ -1,5 +1,8 @@
# -*- Mode:Python; explicit-buffer-name: "alliance.conf<vsc200>" -*-
from helpers.Alliance import AddMode
from helpers.Alliance import Gauge
cellsTop = '/usr/share/pharosc/alliance/cells/'
@ -12,7 +15,7 @@ allianceConfig = \
, ( 'DISPLAY' , helpers.sysConfDir +'/display.xml' )
, ( 'CATALOG' , 'CATAL')
, ( 'WORKING_LIBRARY' , '.')
, ( 'SYSTEM_LIBRARY' , ( (cellsTop+'vsclib' , Environment.Append)
, ( 'SYSTEM_LIBRARY' , ( (cellsTop+'vsclib' , AddMode.Append)
, ) )
, ( 'SCALE_X' , 100)
, ( 'IN_LO' , 'vst')
@ -33,13 +36,13 @@ allianceConfig = \
routingGaugesTable = {}
routingGaugesTable['vsclib'] = \
( ( 'METAL1', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.PinOnly, 0, 0.0, 4, 8, 3, 2 ) )
, ( 'METAL2', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 1, 7.0, 0, 8, 4, 2 ) )
, ( 'METAL3', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 2, 0.0, 4, 8, 4, 2 ) )
, ( 'METAL4', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 3, 0.0, 0, 8, 4, 2 ) )
, ( 'METAL5', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 4, 0.0, 4, 8, 4, 2 ) )
#, ( 'METAL6', ( RoutingLayerGauge.Horizontal, RoutingLayerGauge.Default, 5, 0.0, 0, 8, 4, 2 ) )
#, ( 'METAL7', ( RoutingLayerGauge.Vertical , RoutingLayerGauge.Default, 6, 0.0, 4, 8, 4, 2 ) )
( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 4, 8, 3, 2 ) )
, ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 7.0, 0, 8, 4, 2 ) )
, ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 4, 8, 4, 2 ) )
, ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 8, 4, 2 ) )
, ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 4, 8, 4, 2 ) )
#, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 8, 4, 2 ) )
#, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 4, 8, 4, 2 ) )
)

View File

@ -1,3 +1,18 @@
# -*- Mode:Python; explicit-buffer-name: "Alliance.py<crlcore/helpers>" -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2012-2014, All Rights Reserved
#
# +-----------------------------------------------------------------+
# | C O R I O L I S |
# | Alliance / Hurricane Interface |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | =============================================================== |
# | Python : "./crlcore/helpers/Alliance.py" |
# +-----------------------------------------------------------------+
import os
import os.path
@ -21,6 +36,35 @@ import helpers.SymbolicTechnology
allianceFile = '<allianceFile has not been set>'
class AddMode ( object ):
Append = 1
Prepend = 2
Replace = 3
@staticmethod
def toEnvironment ( mode ):
if mode == AddMode.Prepend: return Environment.Prepend
if mode == AddMode.Replace: return Environment.Replace
return Environment.Append
class Gauge ( object ):
Vertical = 1
Horizontal = 2
PinOnly = 3
Default = 4
@staticmethod
def toRlGauge ( value ):
if value == Gauge.Vertical: return RoutingLayerGauge.Vertical
if value == Gauge.Horizontal: return RoutingLayerGauge.Horizontal
if value == Gauge.PinOnly: return RoutingLayerGauge.PinOnly
if value == Gauge.Default: return RoutingLayerGauge.Default
return None
def xmlToConf ( xmlPath ):
hasExtention = False
components = xmlPath.split(os.sep)
@ -77,7 +121,7 @@ def _loadAllianceConfig ( af, allianceConfig ):
,str(libraryEntry)
])
libPath, mode = libraryEntry
env.addSYSTEM_LIBRARY(library=libPath,mode=mode)
env.addSYSTEM_LIBRARY(library=libPath,mode=AddMode.toEnvironment(mode))
except Exception, e:
ErrorMessage.wrapPrint(e,'In %s:<Alliance> at index %d.' % (allianceFile,entryNo))
@ -119,8 +163,8 @@ def loadRoutingGaugesTable ( routingGaugesTable, fromFile ):
])
gauge.addLayerGauge( RoutingLayerGauge.create( technology.getLayer(entry[0])
, entry[1][0] # Direction.
, entry[1][1] # Type.
, 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.

View File

@ -1,4 +1,4 @@
# -*- mode:Python -*-
# -*- mode:Python; explicit-buffer-name: "__init__.py<crlcore/helpers>" -*-
#
# This file is part of the Coriolis Software.
# Copyright (c) UPMC 2012-2014, All Rights Reserved
@ -10,7 +10,7 @@
# | Author : Jean-Paul Chaput |
# | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
# | =============================================================== |
# | Python : "./builder/__init__.py" |
# | Python : "./crlcore/__init__.py" |
# +-----------------------------------------------------------------+
#
# This is file is mandatory to tell python that 'helpers' is a module
@ -137,6 +137,37 @@ class WarningMessage ( Exception ):
return formatted
class Dots ( object ):
def __init__ (self, header="", width=73):
self._header = header
self._width = width - len(self._header)
self._count = 0
return
def dot (self):
if self._count == 0:
sys.stdout.write(self._header)
else:
if not (self._count % self._width):
sys.stdout.write("\n%s"%self._header)
sys.stdout.write(".")
sys.stdout.flush()
self._count += 1
return
def flush (self):
sys.stdout.write("\n")
sys.stdout.flush()
return
def reset (self):
self._count = 0
self.flush()
return
def staticInitialization ():
global sysConfDir
global symbolicDir