2014-08-03 09:25:26 -05:00
|
|
|
# -*- Mode:Python; explicit-buffer-name: "Alliance.py<crlcore/helpers>" -*-
|
|
|
|
#
|
|
|
|
# This file is part of the Coriolis Software.
|
2016-01-20 17:41:19 -06:00
|
|
|
# Copyright (c) UPMC 2012-2016, All Rights Reserved
|
2014-08-03 09:25:26 -05:00
|
|
|
#
|
|
|
|
# +-----------------------------------------------------------------+
|
|
|
|
# | 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" |
|
|
|
|
# +-----------------------------------------------------------------+
|
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
import Hurricane
|
|
|
|
from Hurricane import DbU
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
from Hurricane import DataBase
|
2012-11-16 06:49:47 -06:00
|
|
|
from Hurricane import Layer
|
|
|
|
import CRL
|
|
|
|
from CRL import Environment
|
|
|
|
from CRL import AllianceFramework
|
|
|
|
from CRL import RoutingGauge
|
|
|
|
from CRL import RoutingLayerGauge
|
|
|
|
from CRL import CellGauge
|
|
|
|
from helpers import ErrorMessage
|
|
|
|
from helpers import Debug
|
|
|
|
import helpers.RealTechnology
|
|
|
|
import helpers.SymbolicTechnology
|
|
|
|
|
|
|
|
|
|
|
|
allianceFile = '<allianceFile has not been set>'
|
|
|
|
|
|
|
|
|
2014-08-03 09:25:26 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
def xmlToConf ( xmlPath ):
|
|
|
|
hasExtention = False
|
|
|
|
components = xmlPath.split(os.sep)
|
|
|
|
filename = components[-1]
|
|
|
|
if filename.endswith('.xml'):
|
|
|
|
hasExtention = True
|
|
|
|
filename = filename[:-4]
|
Added support for multiple symbolic+real technology in configuration.
In CRL Core, the layout of the files under "/coriolis2/etc" changes.
Instead of having them directly under "etc", they are now replicated,
in subdirectories. Each subdirectory having the name of the associated
symbolic or real technology (they are kept separated). We have, for
now:
* etc/cmos/ : symbolic, the Alliance original one.
* etc/vsc200/ : symbolic, for G. Petley vsclib.
* etc/hcmos9/ : real, generic fake (130nm).
To tell which pair (symbolic,real) technologies must be used we create
a *second* (sigh) configuration file "coriolis2_techno.conf", and it's
hidden counterpart in the user's account, to set it up. It needs to be
separate because it is read as early as possible and select which set
of configuration files would be read.
Also add support up to METAL8 and POLY2 in CRL core and it's Alliance
parser/drivers.
2014-05-21 07:50:22 -05:00
|
|
|
if filename.endswith('.conf'):
|
|
|
|
hasExtention = True
|
|
|
|
filename = filename[:-5]
|
2012-11-16 06:49:47 -06:00
|
|
|
filename = filename.replace('.','_')
|
|
|
|
confPath = os.sep.join(components[:-1] + [filename])
|
|
|
|
if hasExtention:
|
|
|
|
confPath += '.conf'
|
|
|
|
return confPath
|
|
|
|
|
|
|
|
|
|
|
|
def _loadAllianceConfig ( af, allianceConfig ):
|
|
|
|
env = af.getEnvironment()
|
|
|
|
|
|
|
|
entryNo = 0
|
|
|
|
for entry in allianceConfig:
|
|
|
|
entryNo += 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
if len(entry) != 2:
|
2012-12-03 02:27:41 -06:00
|
|
|
raise ErrorMessage(1,['Malformed entry in <allianceConfig>.'
|
|
|
|
,'Must have exactly two fields ("key", <value>).'
|
|
|
|
,str(entry)
|
|
|
|
])
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
key, value = entry
|
|
|
|
if key == 'DISPLAY': env.setDISPLAY(value)
|
|
|
|
if key == 'CATALOG': env.setCATALOG(value)
|
|
|
|
if key == 'SCALE_X': env.setSCALE_X(value)
|
|
|
|
if key == 'IN_LO': env.setIN_LO(value)
|
|
|
|
if key == 'IN_PH': env.setIN_PH(value)
|
|
|
|
if key == 'OUT_PH': env.setOUT_PH(value)
|
|
|
|
if key == 'OUT_LO': env.setOUT_LO(value)
|
|
|
|
if key == 'POWER': env.setPOWER(value)
|
|
|
|
if key == 'GROUND': env.setGROUND(value)
|
|
|
|
if key == 'CLOCK': env.setCLOCK(value)
|
|
|
|
if key == 'BLOCKAGE': env.setBLOCKAGE(value)
|
Correction in plugins to support msxlib compatible pads.
* New: In CRL Core, in helpers & alliance.conf, set and read a "PAD"
variable to define the pad model name extension ("px" for "sxlib
and "pxr" for vsxlib, this is provisional).
* New: In CRL Core, in plugin.conf, add parameters to define the name
of used for power & clock supply. We may remove the extention in
the future (to be more coherent with the previous modification).
* New: In Cumulus, in chip.Configuration.GaugeConf._rpAccess(), no
longer place the accessing contact *at the center* of the
RoutingPad. It works under sxlib because buffers & registers all
have same size terminals. But this is not true under vsxlib,
leading to misaligned contacts & wires. Now systematically place
on the slice midlle track (maybe with one pitch above or below).
This is still very weak as we do not check if the terminal
reach were the contact is being put. Has to be strenthened in
the future.
* New: In Cumulus, in chip.Configuration.ChipConf, read the new
clock & power pad parameters.
* Change: In Isobar (and all other Python wrappers), uses PyLong instead
of PyInt for DbU conversions. In PyHurricane argument converter,
automatically check for both PyLong and then PyInt.
* Change: In Cumulus, in chip.PadsCorona, more accurate error message
in case of discrepency in global net connections (i.e. no net
of the same name in instance model and instance model owner.
* Change: In Kite, in BuildPowerRails, when looking up at the pads
model name to find "pck_" or "pvddeck_", do not compare the
extension part. But we still use hard-coded stem pad names,
maybe we shouldn't.
* Bug: In Katabatic, in GCellConfiguration::_do_xG_xM1_xM3(), there
was a loop in the search of the best N/E initial RoutingPad.
* Bug: In Kite, in KiteEngine::protectRoutingPads(), *do not* protect
RoutingPads of fixed nets, they are already through the
BuildPowerRails stage (and it's causing scary overlap warning
messages).
* Bug: In Cumulus, in ClockTree.HTreeNode.addLeaf(), do not create
deep-plug when the core is flat (not sub-modules). All the new
nets are at core level.
* Bug: In Cumulus, in ChipPlugin.PlaceCore.doFloorplan(), ensure
that the core is aligned on the GCell grid (i.e. the slice
grid of the overall chip).
* Bug: In Kite, in GCellTopology::_do_xG_xM1_xM3(), infinite loop
while looking for the bigger N-E RoutingPad. Forgot to decrement
the index...
2014-09-13 10:45:30 -05:00
|
|
|
if key == 'PAD': env.setPad(value)
|
2012-11-16 06:49:47 -06:00
|
|
|
if key == 'WORKING_LIBRARY': env.setWORKING_LIBRARY(value)
|
|
|
|
if key == 'SYSTEM_LIBRARY':
|
|
|
|
for libraryEntry in value:
|
|
|
|
if len(libraryEntry) != 2:
|
2012-12-03 02:27:41 -06:00
|
|
|
raise ErrorMessage(1,['Malformed system library entry in <allianceConfig>.'
|
|
|
|
,'Must have exactly two fields ("path", <mode>).'
|
|
|
|
,str(libraryEntry)
|
|
|
|
])
|
2012-11-16 06:49:47 -06:00
|
|
|
libPath, mode = libraryEntry
|
2014-08-03 09:25:26 -05:00
|
|
|
env.addSYSTEM_LIBRARY(library=libPath,mode=AddMode.toEnvironment(mode))
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
ErrorMessage.wrapPrint(e,'In %s:<Alliance> at index %d.' % (allianceFile,entryNo))
|
|
|
|
try:
|
|
|
|
env.validate()
|
|
|
|
except Exception, e:
|
|
|
|
ErrorMessage.wrapPrint(e,'In %s:<Alliance>.' % (allianceFile))
|
|
|
|
sys.exit(1)
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def loadRoutingGaugesTable ( routingGaugesTable, fromFile ):
|
|
|
|
global allianceFile
|
|
|
|
allianceFile = fromFile
|
|
|
|
|
|
|
|
af = AllianceFramework.get()
|
|
|
|
|
|
|
|
for gaugeName in routingGaugesTable.keys():
|
|
|
|
gaugeDatas = routingGaugesTable[gaugeName]
|
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
technology = DataBase.getDB().getTechnology()
|
2012-11-16 06:49:47 -06:00
|
|
|
gauge = RoutingGauge.create(gaugeName)
|
|
|
|
|
|
|
|
entryNo = 0
|
|
|
|
for entry in gaugeDatas:
|
|
|
|
entryNo += 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
if len(entry) != 2:
|
2012-12-03 02:27:41 -06:00
|
|
|
raise ErrorMessage(1,['Malformed entry in <routingGaugesTable[%s]>.' % gaugeName
|
|
|
|
,'Must have exactly two fields ("METAL_LAYER", (parameters_list)).'
|
|
|
|
,str(entry)
|
|
|
|
])
|
2012-11-16 06:49:47 -06:00
|
|
|
if len(entry[1]) != 8:
|
2012-12-03 02:27:41 -06:00
|
|
|
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)
|
|
|
|
])
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
gauge.addLayerGauge( RoutingLayerGauge.create( technology.getLayer(entry[0])
|
2014-08-03 09:25:26 -05:00
|
|
|
, 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.
|
2012-11-16 06:49:47 -06:00
|
|
|
) )
|
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
ErrorMessage.wrapPrint(e,'In %s:<routingGaugesTable> at index %d.' % (allianceFile,entryNo))
|
|
|
|
|
|
|
|
af.addRoutingGauge(gauge)
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def loadCellGaugesTable ( cellGaugesTable, fromFile ):
|
|
|
|
global allianceFile
|
|
|
|
allianceFile = fromFile
|
|
|
|
|
|
|
|
af = AllianceFramework.get()
|
|
|
|
|
|
|
|
for gaugeName in cellGaugesTable.keys():
|
|
|
|
gaugeDatas = cellGaugesTable[gaugeName]
|
|
|
|
gauge = None
|
|
|
|
|
|
|
|
try:
|
|
|
|
if len(gaugeDatas) != 4:
|
2012-12-03 02:27:41 -06:00
|
|
|
raise ErrorMessage(1,['Malformed gaugeDatas in <cellGaugesTable[%s]>.' % gaugeName
|
2012-11-16 06:49:47 -06:00
|
|
|
,'Parameters list must have exactly four fields:'
|
|
|
|
,' (terminal_metal, xy_common_pitch, slice_height, slice_step)'
|
|
|
|
,str(gaugeDatas)
|
|
|
|
])
|
|
|
|
gauge = CellGauge.create( gaugeName
|
|
|
|
, gaugeDatas[0] # pinLayerName.
|
|
|
|
, DbU.fromLambda(gaugeDatas[1]) # pitch.
|
|
|
|
, DbU.fromLambda(gaugeDatas[2]) # sliceHeight.
|
|
|
|
, DbU.fromLambda(gaugeDatas[3]) # sliceStep.
|
|
|
|
)
|
|
|
|
except Exception, e:
|
|
|
|
ErrorMessage.wrapPrint(e,'In %s:<cellGaugesTable> at index %d.' % (allianceFile,gaugeDatasNo))
|
|
|
|
|
|
|
|
if gauge: af.addCellGauge(gauge)
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def loadAllianceConfig ( table, fromFile ):
|
|
|
|
global allianceFile
|
|
|
|
allianceFile = fromFile
|
|
|
|
|
|
|
|
af = AllianceFramework.get()
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
db = DataBase.getDB()
|
2012-11-16 06:49:47 -06:00
|
|
|
technology = db.getTechnology()
|
|
|
|
if not technology:
|
New coriolis launcher. Configuration files cleanup.
* Change: In CRL Core, simplify the loading sequence. The technology,
both symbolic and real is now loaded directly from coriolisInit.py
and not through the Alliance loader. This was a leftover from the
time configuration was in XML. Remove others traces of XML loading.
Remove SYMB_TECHNO_NAME, REAL_TECHNO_NAME & DISPLAY from the Alliance
environement, as they was no longer used.
Note that technology *still* need to be loader *after* Alliance
framework has been initialized.
Gauge information is moved from <alliance.conf> to <kite.conf>.
* Bug: In Coloquinte, in optimization_subproblems.cxx static variables
must not be inlined. Generate a problem when linking in debug mode
(seems the symbol gets optimised out).
* Bug: In Katabatic, in Grid::getGCell(), when the coordinate is *outside*
the area, do not try to find a GCell, directly return NULL.
* New: In Unicorn, create a generic command launcher named "coriolis" which
automatically take cares of all environement setup, then run a command
by default, it's <cgt>, but it can be anything. For example: <zsh>.
2015-04-13 11:54:09 -05:00
|
|
|
technology = Hurricane.Technology.create(db,'Alliance')
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
_loadAllianceConfig( af, table )
|
|
|
|
env = af.getEnvironment()
|
|
|
|
return
|