From a3963716b10c67a44964b8e74b513b80c8fed4ba Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 13 Sep 2014 17:45:30 +0200 Subject: [PATCH] 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... --- crlcore/etc/CMakeLists.txt | 2 +- crlcore/etc/cmos/alliance.conf | 1 + crlcore/etc/cmos/plugins.conf | 5 + crlcore/etc/scmos_deep_018/alliance.conf | 29 +- crlcore/etc/scmos_deep_018/plugins.conf | 7 +- crlcore/etc/scmos_deep_018/technology.conf | 148 ++++---- .../technology.conf | 0 crlcore/src/ccore/alliance/ap/ApDriver.cpp | 74 ++-- crlcore/src/ccore/alliance/ap/ApParser.cpp | 28 +- crlcore/src/ccore/alliance/vst/VstDriver.cpp | 4 +- crlcore/src/ccore/crlcore/AllianceFramework.h | 12 +- crlcore/src/ccore/crlcore/Environment.h | 6 +- crlcore/src/crlcore/helpers/Alliance.py | 1 + crlcore/src/pyCRL/PyAllianceFramework.cpp | 5 +- crlcore/src/pyCRL/PyRoutingGauge.cpp | 5 +- crlcore/src/pyCRL/PyRoutingLayerGauge.cpp | 4 +- cumulus/src/plugins/ChipPlugin.py | 2 + cumulus/src/plugins/chip/BlockCorona.py | 9 +- cumulus/src/plugins/chip/Configuration.py | 66 +++- cumulus/src/plugins/chip/PadsCorona.py | 31 +- cumulus/src/plugins/clocktree/ClockTree.py | 5 +- cumulus/src/tools/px2mpx.py | 335 ++++++++++++++++++ .../src/hurricane/hurricane/BasicLayer.h | 6 +- hurricane/src/isobar/PyBasicLayer.cpp | 16 + hurricane/src/isobar/PyBox.cpp | 34 +- hurricane/src/isobar/PyBreakpoint.cpp | 4 +- hurricane/src/isobar/PyComponent.cpp | 3 +- hurricane/src/isobar/PyContact.cpp | 12 +- hurricane/src/isobar/PyDbU.cpp | 44 +-- hurricane/src/isobar/PyHorizontal.cpp | 40 +-- hurricane/src/isobar/PyHurricane.cpp | 63 ++-- hurricane/src/isobar/PyInstance.cpp | 4 +- hurricane/src/isobar/PyInterval.cpp | 12 +- hurricane/src/isobar/PyLayer.cpp | 2 +- hurricane/src/isobar/PyLayerMask.cpp | 6 +- hurricane/src/isobar/PyMaterial.cpp | 12 +- hurricane/src/isobar/PyNet.cpp | 8 +- hurricane/src/isobar/PyPin.cpp | 24 +- hurricane/src/isobar/PyPoint.cpp | 6 +- hurricane/src/isobar/PyQueryMask.cpp | 6 +- hurricane/src/isobar/PyReference.cpp | 6 +- hurricane/src/isobar/PyRoutingPad.cpp | 4 +- hurricane/src/isobar/PySegment.cpp | 22 +- hurricane/src/isobar/PyTransformation.cpp | 44 +-- hurricane/src/isobar/PyVertical.cpp | 40 +-- .../src/isobar/hurricane/isobar/PyHurricane.h | 9 +- katabatic/src/LoadGrByNet.cpp | 6 +- kite/src/BuildPowerRails.cpp | 41 ++- kite/src/BuildPreRouteds.cpp | 2 +- kite/src/ProtectRoutingPads.cpp | 6 +- 50 files changed, 859 insertions(+), 402 deletions(-) rename crlcore/etc/{scn6m_deep => scn6m_deep_09}/technology.conf (100%) create mode 100755 cumulus/src/tools/px2mpx.py diff --git a/crlcore/etc/CMakeLists.txt b/crlcore/etc/CMakeLists.txt index 5e98a678..874674ed 100644 --- a/crlcore/etc/CMakeLists.txt +++ b/crlcore/etc/CMakeLists.txt @@ -4,7 +4,7 @@ install ( DIRECTORY cmos DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY vsc200 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY scmos_deep_018 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) - install ( DIRECTORY scn6m_deep DESTINATION ${SYS_CONF_DIR}/coriolis2 ) + install ( DIRECTORY scn6m_deep_09 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( DIRECTORY hcmos9 DESTINATION ${SYS_CONF_DIR}/coriolis2 ) install ( FILES environment.alliance.xml DESTINATION ${SYS_CONF_DIR}/coriolis2 ) diff --git a/crlcore/etc/cmos/alliance.conf b/crlcore/etc/cmos/alliance.conf index 5d957149..41325773 100644 --- a/crlcore/etc/cmos/alliance.conf +++ b/crlcore/etc/cmos/alliance.conf @@ -33,6 +33,7 @@ allianceConfig = \ , ( 'GROUND' , 'vss') , ( 'CLOCK' , '^ck.*') , ( 'BLOCKAGE' , '^blockage[Nn]et*') + , ( 'PAD' , '.*_px$') # The following are only read by the Alliance tool wrappers. , ( 'ALLIANCE_TOP' , allianceTop) , ( 'MBK_TARGET_LIB' , cellsTop+'sxlib') diff --git a/crlcore/etc/cmos/plugins.conf b/crlcore/etc/cmos/plugins.conf index ff8e5b83..8d6928eb 100644 --- a/crlcore/etc/cmos/plugins.conf +++ b/crlcore/etc/cmos/plugins.conf @@ -13,6 +13,11 @@ parametersTable = \ , ("chip.block.rails.vWidth" , TypeInt , 12 ) , ("chip.block.rails.hSpacing" , TypeInt , 6 ) , ("chip.block.rails.vSpacing" , TypeInt , 6 ) + , ('chip.pad.pck' , TypeString, 'pck_px') + , ('chip.pad.pvddick' , TypeString, 'pvddick_px') + , ('chip.pad.pvssick' , TypeString, 'pvssick_px') + , ('chip.pad.pvddeck' , TypeString, 'pvddeck_px') + , ('chip.pad.pvsseck' , TypeString, 'pvsseck_px') , ('clockTree.minimumSide' , TypeInt , 300) , ('clockTree.buffer' , TypeString, 'buf_x2') ) diff --git a/crlcore/etc/scmos_deep_018/alliance.conf b/crlcore/etc/scmos_deep_018/alliance.conf index ddf44a0c..fe718d52 100644 --- a/crlcore/etc/scmos_deep_018/alliance.conf +++ b/crlcore/etc/scmos_deep_018/alliance.conf @@ -5,7 +5,7 @@ from helpers.Alliance import Gauge allianceTop = '/soc/alliance' -cellsTop = allianceTop+'/cells/' +cellsTop = allianceTop+'/cells' allianceConfig = \ @@ -16,8 +16,8 @@ allianceConfig = \ , ( 'DISPLAY' , helpers.sysConfDir +'/display.xml' ) , ( 'CATALOG' , 'CATAL') , ( 'WORKING_LIBRARY' , '.') - , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'vsxlib' , Environment.Append) - , ) ) + , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'/msxlib' , Environment.Append) + , (cellsTop+'/mpxlib' , Environment.Append)) ) , ( 'SCALE_X' , 100) , ( 'IN_LO' , 'vst') , ( 'IN_PH' , 'ap') @@ -27,6 +27,12 @@ allianceConfig = \ , ( 'GROUND' , 'vss') , ( 'CLOCK' , '^ck.*') , ( 'BLOCKAGE' , '^blockage[Nn]et*') + , ( 'PAD' , '.*_mpx$') + # The following are only read by the Alliance tool wrappers. + , ( 'ALLIANCE_TOP' , allianceTop) + , ( 'MBK_TARGET_LIB' , cellsTop+'/msxlib') + , ( 'RDS_TECHNO_NAME' , allianceTop+'/etc/scn6m_deep_09.rds') + , ( 'GRAAL_TECHNO_NAME' , allianceTop+'/etc/graal.rds') ) @@ -36,14 +42,13 @@ allianceConfig = \ routingGaugesTable = {} -routingGaugesTable['vsxlib'] = \ - ( ( 'METAL1', ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 10, 3, 3 ) ) - , ( 'METAL2', ( Gauge.Horizontal, Gauge.Default, 1, 0.0, 0, 10, 3, 3 ) ) - , ( 'METAL3', ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 10, 3, 3 ) ) - , ( 'METAL4', ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 10, 3, 3 ) ) - , ( 'METAL5', ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 10, 4, 4 ) ) - #, ( 'METAL6', ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 10, 4, 2 ) ) - #, ( 'METAL7', ( Gauge.Vertical , Gauge.Default, 6, 0.0, 0, 10, 4, 2 ) ) +routingGaugesTable['msxlib'] = \ + ( ( 'METAL1' , ( Gauge.Vertical , Gauge.PinOnly, 0, 0.0, 0, 10, 2, 2 ) ) + , ( 'METAL2' , ( Gauge.Horizontal, Gauge.Default, 1, 0.0, 0, 10, 3, 2 ) ) + , ( 'METAL3' , ( Gauge.Vertical , Gauge.Default, 2, 0.0, 0, 10, 3, 2 ) ) + , ( 'METAL4' , ( Gauge.Horizontal, Gauge.Default, 3, 0.0, 0, 10, 3, 2 ) ) + , ( 'METAL5' , ( Gauge.Vertical , Gauge.Default, 4, 0.0, 0, 10, 3, 2 ) ) + #, ( 'METAL6' , ( Gauge.Horizontal, Gauge.Default, 5, 0.0, 0, 10, 5, 2 ) ) ) @@ -52,5 +57,5 @@ routingGaugesTable['vsxlib'] = \ # ( METAL_PIN, xy_common_pitch, slice_height, slice_step ) cellGaugesTable = {} -cellGaugesTable['vsxlib'] = ('metal2', 10, 100, 10) +cellGaugesTable['msxlib'] = ('metal2', 10, 100, 10) diff --git a/crlcore/etc/scmos_deep_018/plugins.conf b/crlcore/etc/scmos_deep_018/plugins.conf index e1ff8a4d..745b5dcc 100644 --- a/crlcore/etc/scmos_deep_018/plugins.conf +++ b/crlcore/etc/scmos_deep_018/plugins.conf @@ -16,6 +16,11 @@ parametersTable = \ , ("chip.block.rails.vWidth" , TypeInt , 24 ) , ("chip.block.rails.hSpacing" , TypeInt , 12 ) , ("chip.block.rails.vSpacing" , TypeInt , 12 ) - , ('clockTree.minimumSide' , TypeInt , 600) + , ('chip.pad.pck' , TypeString, 'pck_mpx') + , ('chip.pad.pvddick' , TypeString, 'pvddick_mpx') + , ('chip.pad.pvssick' , TypeString, 'pvssick_mpx') + , ('chip.pad.pvddeck' , TypeString, 'pvddeck_mpx') + , ('chip.pad.pvsseck' , TypeString, 'pvsseck_mpx') + , ('clockTree.minimumSide' , TypeInt , 700) , ('clockTree.buffer' , TypeString, 'bf1_x4') ) diff --git a/crlcore/etc/scmos_deep_018/technology.conf b/crlcore/etc/scmos_deep_018/technology.conf index de0e12fa..c447d50e 100644 --- a/crlcore/etc/scmos_deep_018/technology.conf +++ b/crlcore/etc/scmos_deep_018/technology.conf @@ -27,29 +27,29 @@ symbolicRulesTable = \ , ('NTIE.minimum.width' , 3.0) , ('NTIE.nWell.extention.cap' , 3.0) - , ('NTIE.nWell.extention.width' , 1.0) - , ('NTIE.nImplant.extention.cap' , 3.0) - , ('NTIE.nImplant.extention.width' , 1.0) - , ('NTIE.active.extention.cap' , 2.0) - , ('NTIE.active.extention.width' , 0.0) + , ('NTIE.nWell.extention.width' , 2.0) + , ('NTIE.nImplant.extention.cap' , 2.5) + , ('NTIE.nImplant.extention.width' , 1.5) + , ('NTIE.active.extention.cap' , 0.5) + , ('NTIE.active.extention.width' , -0.5) , ('PTIE.minimum.width' , 3.0) , ('PTIE.pWell.extention.cap' , 3.0) - , ('PTIE.pWell.extention.width' , 1.0) - , ('PTIE.pImplant.extention.cap' , 1.0) - , ('PTIE.pImplant.extention.width' , 1.0) - , ('PTIE.active.extention.cap' , 2.0) - , ('PTIE.active.extention.width' , 0.0) + , ('PTIE.pWell.extention.width' , 2.0) + , ('PTIE.pImplant.extention.cap' , 2.5) + , ('PTIE.pImplant.extention.width' , 1.5) + , ('PTIE.active.extention.cap' , 0.5) + , ('PTIE.active.extention.width' , -0.5) , ('NDIF.minimum.width' , 3.0) - , ('NDIF.nImplant.extention.cap' , 5.0) - , ('NDIF.nImplant.extention.width' , 3.0) + , ('NDIF.nImplant.extention.cap' , 4.0) + , ('NDIF.nImplant.extention.width' , 2.0) , ('NDIF.active.extention.cap' , 2.0) , ('NDIF.active.extention.width' , 0.0) , ('PDIF.minimum.width' , 3.0) - , ('PDIF.pImplant.extention.cap' , 5.0) - , ('PDIF.pImplant.extention.width' , 3.0) + , ('PDIF.pImplant.extention.cap' , 4.0) + , ('PDIF.pImplant.extention.width' , 2.0) , ('PDIF.active.extention.cap' , 2.0) , ('PDIF.active.extention.width' , 0.0) @@ -57,21 +57,21 @@ symbolicRulesTable = \ , ('GATE.poly.extention.cap' , 2.5) , ('NTRANS.minimum.width' , 2.0) - , ('NTRANS.nImplant.extention.cap' , 3.0) - , ('NTRANS.nImplant.extention.width' , 8.0) + , ('NTRANS.nImplant.extention.cap' , 2.0) + , ('NTRANS.nImplant.extention.width' , 7.0) , ('NTRANS.active.extention.cap' , 0.0) - , ('NTRANS.active.extention.width' , 5.0) - , ('NTRANS.poly.extention.cap' , 2.5) + , ('NTRANS.active.extention.width' , 4.0) + , ('NTRANS.poly.extention.cap' , 3.0) , ('NTRANS.poly.extention.width' , 0.0) , ('PTRANS.minimum.width' , 2.0) - , ('PTRANS.nWell.extention.cap' , 3.0) - , ('PTRANS.nWell.extention.width' , 8.0) - , ('PTRANS.pImplant.extention.cap' , 3.0) - , ('PTRANS.pImplant.extention.width' , 8.0) + , ('PTRANS.nWell.extention.cap' , 2.5) + , ('PTRANS.nWell.extention.width' , 7.5) + , ('PTRANS.pImplant.extention.cap' , 2.0) + , ('PTRANS.pImplant.extention.width' , 7.0) , ('PTRANS.active.extention.cap' , 0.0) - , ('PTRANS.active.extention.width' , 5.0) - , ('PTRANS.poly.extention.cap' , 2.5) + , ('PTRANS.active.extention.width' , 4.0) + , ('PTRANS.poly.extention.cap' , 3.0) , ('PTRANS.poly.extention.width' , 0.0) , ('POLY.minimum.width' , 2.0) @@ -80,48 +80,68 @@ symbolicRulesTable = \ , ('POLY2.poly2.extention.cap' , 2.0) # Routing Layers. - , ('METAL1.minimum.width' , 3.0) + , ('METAL1.minimum.width' , 2.0) , ('METAL1.metal1.extention.cap' , 2.0) + , ('METAL1.metal1.extention.width' , 0.5) , ('METAL2.minimum.width' , 3.0) - , ('METAL2.metal2.extention.cap' , 2.0) + , ('METAL2.metal2.extention.cap' , 1.5) , ('METAL3.minimum.width' , 3.0) - , ('METAL3.metal3.extention.cap' , 2.0) + , ('METAL3.metal3.extention.cap' , 1.5) , ('METAL4.minimum.width' , 3.0) - , ('METAL4.metal4.extention.cap' , 2.0) + , ('METAL4.metal4.extention.cap' , 1.5) , ('METAL5.minimum.width' , 3.0) - , ('METAL5.metal5.extention.cap' , 2.0) - , ('METAL6.minimum.width' , 4.0) - , ('METAL6.metal6.extention.cap' , 4.0) - , ('METAL7.minimum.width' , 2.0) - , ('METAL7.metal6.extention.cap' , 4.0) - , ('METAL8.minimum.width' , 2.0) - , ('METAL8.metal6.extention.cap' , 4.0) + , ('METAL5.metal5.extention.cap' , 1.5) + , ('METAL6.minimum.width' , 5.0) + , ('METAL6.metal6.extention.cap' , 2.5) + #, ('METAL7.minimum.width' , 2.0) + #, ('METAL7.metal7.extention.cap' , 2.5) + #, ('METAL8.minimum.width' , 2.0) + #, ('METAL8.metal8.extention.cap' , 2.5) + + # Blockages. + , ('BLOCKAGE1.minimum.width' , 3.0) + , ('BLOCKAGE1.blockage1.extention.cap' , 2.0) + , ('BLOCKAGE1.blockage1.extention.width', 0.5) + , ('BLOCKAGE2.minimum.width' , 3.0) + , ('BLOCKAGE2.blockage2.extention.cap' , 2.0) + , ('BLOCKAGE3.minimum.width' , 3.0) + , ('BLOCKAGE3.blockage3.extention.cap' , 2.0) + , ('BLOCKAGE4.minimum.width' , 3.0) + , ('BLOCKAGE4.blockage4.extention.cap' , 2.0) + , ('BLOCKAGE5.minimum.width' , 3.0) + , ('BLOCKAGE5.blockage5.extention.cap' , 2.0) + , ('BLOCKAGE6.minimum.width' , 4.0) + , ('BLOCKAGE6.blockage6.extention.cap' , 2.5) + #, ('BLOCKAGE7.minimum.width' , 2.0) + #, ('BLOCKAGE7.blockage6.extention.cap' , 4.0) + #, ('BLOCKAGE8.minimum.width' , 2.0) + #, ('BLOCKAGE8.blockage6.extention.cap' , 4.0) # Contacts (i.e. Active <--> Metal). , ('CONT_BODY_N.minimum.side' , 2.0) - , ('CONT_BODY_N.nWell.enclosure' , 3.0) - , ('CONT_BODY_N.nImplant.enclosure' , 3.0) - , ('CONT_BODY_N.active.enclosure' , 1.0) + , ('CONT_BODY_N.nWell.enclosure' , 4.0) + , ('CONT_BODY_N.nImplant.enclosure' , 3.5) + , ('CONT_BODY_N.active.enclosure' , 1.5) , ('CONT_BODY_N.metal1.enclosure' , 1.0) , ('CONT_BODY_P.minimum.side' , 2.0) - , ('CONT_BODY_P.pWell.enclosure' , 3.0) - , ('CONT_BODY_P.pImplant.enclosure' , 3.0) - , ('CONT_BODY_P.active.enclosure' , 1.0) + , ('CONT_BODY_P.pWell.enclosure' , 4.0) + , ('CONT_BODY_P.pImplant.enclosure' , 3.5) + , ('CONT_BODY_P.active.enclosure' , 1.5) , ('CONT_BODY_P.metal1.enclosure' , 1.0) , ('CONT_DIF_N.minimum.side' , 2.0) - , ('CONT_DIF_N.nImplant.enclosure' , 2.0) - , ('CONT_DIF_N.active.enclosure' , 1.0) + , ('CONT_DIF_N.nImplant.enclosure' , 4.0) + , ('CONT_DIF_N.active.enclosure' , 2.0) , ('CONT_DIF_N.metal1.enclosure' , 1.0) , ('CONT_DIF_P.minimum.side' , 2.0) - , ('CONT_DIF_P.pImplant.enclosure' , 2.0) - , ('CONT_DIF_P.active.enclosure' , 1.0) + , ('CONT_DIF_P.pImplant.enclosure' , 4.0) + , ('CONT_DIF_P.active.enclosure' , 2.0) , ('CONT_DIF_P.metal1.enclosure' , 1.0) , ('CONT_POLY.minimum.width' , 2.0) - , ('CONT_POLY.poly.enclosure' , 1.0) + , ('CONT_POLY.poly.enclosure' , 2.0) , ('CONT_POLY.metal1.enclosure' , 1.0) # VIAs (i.e. Metal <--> Metal). @@ -137,31 +157,13 @@ symbolicRulesTable = \ , ('VIA45.minimum.side' , 3.0) , ('VIA45.metal4.enclosure' , 1.0) , ('VIA45.metal5.enclosure' , 1.0) - , ('VIA56.minimum.side' , 4.0) - , ('VIA56.metal5.enclosure' , 3.0) - , ('VIA56.metal6.enclosure' , 3.0) - , ('VIA67.minimum.side' , 2.0) - , ('VIA67.metal6.enclosure' , 3.0) - , ('VIA67.metal7.enclosure' , 3.0) - , ('VIA78.minimum.side' , 2.0) - , ('VIA78.metal7.enclosure' , 3.0) - , ('VIA78.metal8.enclosure' , 3.0) - - # Blockages. - , ('BLOCKAGE1.minimum.width' , 1.0) - , ('BLOCKAGE1.blockage1.extention.cap' , 2.0) - , ('BLOCKAGE2.minimum.width' , 2.0) - , ('BLOCKAGE2.blockage2.extention.cap' , 2.0) - , ('BLOCKAGE3.minimum.width' , 2.0) - , ('BLOCKAGE3.blockage3.extention.cap' , 2.0) - , ('BLOCKAGE4.minimum.width' , 2.0) - , ('BLOCKAGE4.blockage4.extention.cap' , 2.0) - , ('BLOCKAGE5.minimum.width' , 2.0) - , ('BLOCKAGE5.blockage5.extention.cap' , 2.0) - , ('BLOCKAGE6.minimum.width' , 2.0) - , ('BLOCKAGE6.blockage6.extention.cap' , 4.0) - , ('BLOCKAGE7.minimum.width' , 2.0) - , ('BLOCKAGE7.blockage6.extention.cap' , 4.0) - , ('BLOCKAGE8.minimum.width' , 2.0) - , ('BLOCKAGE8.blockage6.extention.cap' , 4.0) + , ('VIA56.minimum.side' , 5.0) + , ('VIA56.metal5.enclosure' , 1.0) + , ('VIA56.metal6.enclosure' , 1.5) + #, ('VIA67.minimum.side' , 2.0) + #, ('VIA67.metal6.enclosure' , 3.0) + #, ('VIA67.metal7.enclosure' , 3.0) + #, ('VIA78.minimum.side' , 2.0) + #, ('VIA78.metal7.enclosure' , 3.0) + #, ('VIA78.metal8.enclosure' , 3.0) ) diff --git a/crlcore/etc/scn6m_deep/technology.conf b/crlcore/etc/scn6m_deep_09/technology.conf similarity index 100% rename from crlcore/etc/scn6m_deep/technology.conf rename to crlcore/etc/scn6m_deep_09/technology.conf diff --git a/crlcore/src/ccore/alliance/ap/ApDriver.cpp b/crlcore/src/ccore/alliance/ap/ApDriver.cpp index 7f1648c3..9b832c63 100644 --- a/crlcore/src/ccore/alliance/ap/ApDriver.cpp +++ b/crlcore/src/ccore/alliance/ap/ApDriver.cpp @@ -191,49 +191,41 @@ void DumpContacts(ofstream& ccell, Cell *cell) { const char* mbkLayer; - for_each_net(net, cell->getNets()) - { - for_each_component(component, net->getComponents()) - { - if (Contact* contact = dynamic_cast(component)) - { - if (dynamic_cast(contact)) - continue; - else - { - if ( (contact->getWidth () <= DbU::lambda(2.0)) - && (contact->getHeight() <= DbU::lambda(2.0))) - { - if (toMBKLayer(mbkLayer,contact->getLayer()->getName(),true)) - ccell << "V " - << toMBKlambda(contact->getX()) << "," - << toMBKlambda(contact->getY()) << "," - << mbkLayer << "," - << toMBKName(contact->getNet()->getName()) - << endl; - } - else - { - DbU::Unit expand = 0; - if ( not dynamic_cast(contact->getLayer()) ) - expand = DbU::lambda(1.0); + forEach ( Net*, inet, cell->getNets() ) + { + forEach ( Component*, icomponent, inet->getComponents()) { + if (Contact* contact = dynamic_cast(*icomponent)) { + if (dynamic_cast(contact)) + continue; + else { + if ( (contact->getWidth () <= contact->getLayer()->getMinimalSize()) + or (contact->getHeight() <= contact->getLayer()->getMinimalSize())) { + if (toMBKLayer(mbkLayer,contact->getLayer()->getName(),true)) + ccell << "V " + << toMBKlambda(contact->getX()) << "," + << toMBKlambda(contact->getY()) << "," + << mbkLayer << "," + << toMBKName(contact->getNet()->getName()) + << endl; + } else { + DbU::Unit expand = 0; + if ( not dynamic_cast(contact->getLayer()) ) + expand = DbU::lambda(1.0); - if (toMBKLayer(mbkLayer,contact->getLayer()->getName(),true)) - ccell << "B " - << toMBKlambda(contact->getX()) << "," - << toMBKlambda(contact->getY()) << "," - << toMBKlambda(contact->getWidth () + expand) << "," - << toMBKlambda(contact->getHeight() + expand) << "," - << mbkLayer << "," - << toMBKName(contact->getNet()->getName()) - << endl; - } - } - } - end_for; + if (toMBKLayer(mbkLayer,contact->getLayer()->getName(),true)) + ccell << "B " + << toMBKlambda(contact->getX()) << "," + << toMBKlambda(contact->getY()) << "," + << toMBKlambda(contact->getWidth () + expand) << "," + << toMBKlambda(contact->getHeight() + expand) << "," + << mbkLayer << "," + << toMBKName(contact->getNet()->getName()) + << endl; + } } - end_for; - } + } + } // forEach( Component* ) + } // forEach( Net* ) } diff --git a/crlcore/src/ccore/alliance/ap/ApParser.cpp b/crlcore/src/ccore/alliance/ap/ApParser.cpp index 9053f9c7..08e4b51c 100644 --- a/crlcore/src/ccore/alliance/ap/ApParser.cpp +++ b/crlcore/src/ccore/alliance/ap/ApParser.cpp @@ -635,20 +635,20 @@ namespace { void ApParser::_parseInstance () { static DbU::Unit XINS, YINS; - static Name masterCellName; - static Name instanceName; - static Name orientName; + static Name masterCellName; + static Name instanceName; + static Name orientName; static Transformation::Orientation - orient = Transformation::Orientation::ID; - static Name NOSYM = "NOSYM"; - static Name SYM_X = "SYM_X"; - static Name SYM_Y = "SYM_Y"; - static Name SYMXY = "SYMXY"; - static Name ROT_P = "ROT_P"; - static Name ROT_M = "ROT_M"; - static Name SY_RM = "SY_RM"; - static Name SY_RP = "SY_RP"; - static Name padreal = "padreal"; + orient = Transformation::Orientation::ID; + static Name NOSYM = "NOSYM"; + static Name SYM_X = "SYM_X"; + static Name SYM_Y = "SYM_Y"; + static Name SYMXY = "SYMXY"; + static Name ROT_P = "ROT_P"; + static Name ROT_M = "ROT_M"; + static Name SY_RM = "SY_RM"; + static Name SY_RP = "SY_RP"; + static string padreal = "padreal"; vector fields = _splitString ( _rawLine+2, ',' ); if ( fields.size() < 5 ) @@ -682,7 +682,7 @@ namespace { ); instance->setPlacementStatus ( Instance::PlacementStatus::FIXED ); } else { - bool ignoreInstance = (masterCellName == padreal); + bool ignoreInstance = (getString(masterCellName).substr(0,7) == padreal); Catalog::State* instanceState = _framework->getCatalog()->getState ( masterCellName ); if ( not ignoreInstance and ( not instanceState or (not instanceState->isFeed()) ) ) { _printError ( false diff --git a/crlcore/src/ccore/alliance/vst/VstDriver.cpp b/crlcore/src/ccore/alliance/vst/VstDriver.cpp index ad477f82..e577bbc0 100644 --- a/crlcore/src/ccore/alliance/vst/VstDriver.cpp +++ b/crlcore/src/ccore/alliance/vst/VstDriver.cpp @@ -484,9 +484,9 @@ void DumpConnectionList(ofstream &ccell, Instance*instance) end_for; } #endif - if ( connectedNetName.empty() ) + if ( connectedNetName.empty() ) { throw Error("No global net " + masterNet->getName()._getString() + " in cell " + instance->getCell()->getName()._getString()); - + } } else { diff --git a/crlcore/src/ccore/crlcore/AllianceFramework.h b/crlcore/src/ccore/crlcore/AllianceFramework.h index 225fdbd5..2692132e 100644 --- a/crlcore/src/ccore/crlcore/AllianceFramework.h +++ b/crlcore/src/ccore/crlcore/AllianceFramework.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -15,9 +15,8 @@ // +-----------------------------------------------------------------+ -#ifndef __CRL_ALLIANCE_FRAMEWORK__ -#define __CRL_ALLIANCE_FRAMEWORK__ - +#ifndef CRL_ALLIANCE_FRAMEWORK_H +#define CRL_ALLIANCE_FRAMEWORK_H #include #include @@ -156,10 +155,9 @@ namespace CRL { inline string AllianceFramework::_getTypeName () const { return "AllianceFramework"; } -} // End of CRL namespace. +} // CRL namespace. INSPECTOR_P_SUPPORT(CRL::AllianceFramework); - -#endif // __CRL_ALLIANCE_FRAMEWORK__ +#endif // CRL_ALLIANCE_FRAMEWORK_H diff --git a/crlcore/src/ccore/crlcore/Environment.h b/crlcore/src/ccore/crlcore/Environment.h index 8adf6e6f..af278736 100644 --- a/crlcore/src/ccore/crlcore/Environment.h +++ b/crlcore/src/ccore/crlcore/Environment.h @@ -14,8 +14,8 @@ // +-----------------------------------------------------------------+ -#ifndef CRL_ENVIRONMENT -#define CRL_ENVIRONMENT +#ifndef CRL_ENVIRONMENT_H +#define CRL_ENVIRONMENT_H #include #include @@ -164,4 +164,4 @@ namespace CRL { INSPECTOR_P_SUPPORT(CRL::Environment); -#endif +#endif // CRL_ENVIRONMENT_H diff --git a/crlcore/src/crlcore/helpers/Alliance.py b/crlcore/src/crlcore/helpers/Alliance.py index bddf3216..c0d38e2f 100644 --- a/crlcore/src/crlcore/helpers/Alliance.py +++ b/crlcore/src/crlcore/helpers/Alliance.py @@ -112,6 +112,7 @@ def _loadAllianceConfig ( af, allianceConfig ): if key == 'GROUND': env.setGROUND(value) if key == 'CLOCK': env.setCLOCK(value) if key == 'BLOCKAGE': env.setBLOCKAGE(value) + if key == 'PAD': env.setPad(value) if key == 'WORKING_LIBRARY': env.setWORKING_LIBRARY(value) if key == 'SYSTEM_LIBRARY': for libraryEntry in value: diff --git a/crlcore/src/pyCRL/PyAllianceFramework.cpp b/crlcore/src/pyCRL/PyAllianceFramework.cpp index eccb3dcc..7e5b984d 100644 --- a/crlcore/src/pyCRL/PyAllianceFramework.cpp +++ b/crlcore/src/pyCRL/PyAllianceFramework.cpp @@ -42,6 +42,7 @@ namespace CRL { using Isobar::ConstructorError; using Isobar::HurricaneError; using Isobar::HurricaneWarning; + using Isobar::PyAny_AsLong; using Isobar::ParseOneArg; using Isobar::ParseTwoArg; using Isobar::PyLibrary; @@ -184,7 +185,7 @@ extern "C" { PyObject* arg0; if ( not ParseOneArg ( "AllianceFramework.getLibrary()", args, INT_ARG, &arg0 ) ) return NULL; - lib = af->getLibrary ( PyInt_AsLong(arg0) ); + lib = af->getLibrary ( PyAny_AsLong(arg0) ); if ( lib == NULL ) Py_RETURN_NONE; HCATCH @@ -229,7 +230,7 @@ extern "C" { if ( not ParseTwoArg ( "AllianceFramework.saveCell", args, CELL_INT_ARG, &arg0, &arg1) ) return NULL; - af->saveCell ( PYCELL_O(arg0),PyInt_AsLong(arg1) ); + af->saveCell ( PYCELL_O(arg0),PyAny_AsLong(arg1) ); HCATCH diff --git a/crlcore/src/pyCRL/PyRoutingGauge.cpp b/crlcore/src/pyCRL/PyRoutingGauge.cpp index 27e550c9..cac5843a 100644 --- a/crlcore/src/pyCRL/PyRoutingGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingGauge.cpp @@ -38,6 +38,7 @@ namespace CRL { using Isobar::ConstructorError; using Isobar::HurricaneError; using Isobar::HurricaneWarning; + using Isobar::PyAny_AsLong; using Isobar::ParseOneArg; using Isobar::ParseTwoArg; using Isobar::__cs; @@ -165,7 +166,7 @@ extern "C" { if ( __cs.getObjectIds() == ":layer" ) rlg = rg->getLayerGauge( PYLAYER_O(arg0) ); else if ( __cs.getObjectIds() == ":int" ) - rlg = rg->getLayerGauge( (size_t)PyInt_AsLong(arg0) ); + rlg = rg->getLayerGauge( (size_t)PyAny_AsLong(arg0) ); else { PyErr_SetString ( ConstructorError, "invalid parameter type for RoutingGauge.getLayerGauge()." ); return NULL; @@ -200,7 +201,7 @@ extern "C" { if ( __cs.getObjectIds() == ":layer" ) direction = rg->getLayerDirection( PYLAYER_O(arg0) ); else if ( __cs.getObjectIds() == ":int" ) - direction = rg->getLayerDirection( (size_t)PyInt_AsLong(arg0) ); + direction = rg->getLayerDirection( (size_t)PyAny_AsLong(arg0) ); else { PyErr_SetString ( ConstructorError, "invalid parameter type for RoutingGauge.getLayerDirection()." ); return NULL; diff --git a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp index f45cced5..348c2422 100644 --- a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp @@ -184,7 +184,7 @@ extern "C" { } HCATCH - return Py_BuildValue("I",trackNumber); + return PyLong_FromLong(trackNumber); } @@ -246,7 +246,7 @@ extern "C" { } HCATCH - return Py_BuildValue("l",(long)trackPosition); + return PyLong_FromLong((long)trackPosition); } diff --git a/cumulus/src/plugins/ChipPlugin.py b/cumulus/src/plugins/ChipPlugin.py index 1c49e314..814916dd 100644 --- a/cumulus/src/plugins/ChipPlugin.py +++ b/cumulus/src/plugins/ChipPlugin.py @@ -113,6 +113,8 @@ class PlaceCore ( chip.Configuration.ChipConfWrapper ): self.cores[0].getMasterCell().setAbutmentBox( self.coreSize ) x = (self.chipSize.getWidth () - self.coreSize.getWidth ()) / 2 y = (self.chipSize.getHeight() - self.coreSize.getHeight()) / 2 + x = x - (x % self.gaugeConf.getSliceHeight()) + y = y - (y % self.gaugeConf.getSliceHeight()) self.cores[0].setTransformation ( Transformation(x,y,Transformation.Orientation.ID) ) self.cores[0].setPlacementStatus( Instance.PlacementStatus.FIXED ) UpdateSession.close() diff --git a/cumulus/src/plugins/chip/BlockCorona.py b/cumulus/src/plugins/chip/BlockCorona.py index 3ccd7e0f..9c151d6b 100644 --- a/cumulus/src/plugins/chip/BlockCorona.py +++ b/cumulus/src/plugins/chip/BlockCorona.py @@ -368,16 +368,17 @@ class Corona ( object ): if not isinstance(block,chip.BlockPower.Block): raise ErrorMessage( 1, 'Attempt to create a Corona on a non-Block object.' ) - self._block = block - self._innerBb = self._block.bb - self._block.path.getTransformation().applyOn( self._innerBb ) - self._railsNb = Cfg.getParamInt('chip.block.rails.count').asInt() self._hRailWidth = DbU.fromLambda( Cfg.getParamInt('chip.block.rails.hWidth' ).asInt() ) self._vRailWidth = DbU.fromLambda( Cfg.getParamInt('chip.block.rails.vWidth' ).asInt() ) self._hRailSpace = DbU.fromLambda( Cfg.getParamInt('chip.block.rails.hSpacing').asInt() ) self._vRailSpace = DbU.fromLambda( Cfg.getParamInt('chip.block.rails.vSpacing').asInt() ) + self._block = block + self._innerBb = self._block.bb + self._block.path.getTransformation().applyOn( self._innerBb ) + self._innerBb.inflate( self._hRailSpace/2, self._vRailSpace/2 ) + self._southSide = SouthSide( self ) self._northSide = NorthSide( self ) self._westSide = WestSide ( self ) diff --git a/cumulus/src/plugins/chip/Configuration.py b/cumulus/src/plugins/chip/Configuration.py index 586bdee2..00959889 100644 --- a/cumulus/src/plugins/chip/Configuration.py +++ b/cumulus/src/plugins/chip/Configuration.py @@ -116,6 +116,7 @@ class GaugeConf ( object ): OffsetBottom1 = 0x0008 def __init__ ( self ): + self._cellGauge = None self._routingGauge = None self._topLayerDepth = 0 self._plugToRp = { } @@ -123,8 +124,11 @@ class GaugeConf ( object ): self._loadRoutingGauge() return + def getSliceHeight ( self ): return self._cellGauge.getSliceHeight() + def getSliceStep ( self ): return self._cellGauge.getSliceStep() def _loadRoutingGauge ( self ): + self._cellGauge = CRL.AllianceFramework.get().getCellGauge() self._routingGauge = CRL.AllianceFramework.get().getRoutingGauge() topLayer = Cfg.getParamString('katabatic.topRoutingLayer').asString() @@ -179,13 +183,17 @@ class GaugeConf ( object ): def _rpAccess ( self, rp, flags ): trace( 550, ',+', '\t_rpAccess() %s\n' % str(rp) ) + hpitch = self._routingGauge.getLayerGauge(self._horizontalDepth).getPitch() + hoffset = self._routingGauge.getLayerGauge(self._horizontalDepth).getOffset() contact1 = Contact.create( rp, self._routingGauge.getContactLayer(0), 0, 0 ) + midSliceY = contact1.getY() - (contact1.getY() % self._cellGauge.getSliceHeight()) \ + + self._cellGauge.getSliceHeight() / 2 + midTrackY = midSliceY - ((midSliceY - hoffset) % hpitch) + dy = midSliceY - contact1.getY() - if flags & GaugeConf.OffsetBottom1: - contact1.setDy( self._routingGauge.getLayerGauge(self._horizontalDepth).getPitch() ) - - if flags & GaugeConf.OffsetTop1: - contact1.setDy( - self._routingGauge.getLayerGauge(self._horizontalDepth).getPitch() ) + if flags & GaugeConf.OffsetBottom1: dy += hpitch + if flags & GaugeConf.OffsetTop1: dy -= hpitch + contact1.setDy( dy ) trace( 550, contact1 ) @@ -386,10 +394,10 @@ class ChipConf ( object ): padList.append( instance ) - if not self._clockPad and instance.getMasterCell().getName() == 'pck_px': + if not self._clockPad and instance.getMasterCell().getName() == self._pckName: self._clockPad = instance - if not self._powerPad and instance.getMasterCell().getName() == 'pvddick_px': + if not self._powerPad and instance.getMasterCell().getName() == self._pvddickName: self._powerPad = instance return padList @@ -413,12 +421,18 @@ class ChipConf ( object ): self._validated = True self._cell = cell # Block Corona parameters. - self._railsNb = DbU.fromLambda( getParameter('chip','chip.block.rails.count' ).asInt() ) - self._hRailWidth = DbU.fromLambda( getParameter('chip','chip.block.rails.hWidth' ).asInt() ) - self._vRailWidth = DbU.fromLambda( getParameter('chip','chip.block.rails.vWidth' ).asInt() ) - self._hRailSpace = DbU.fromLambda( getParameter('chip','chip.block.rails.hSpacing').asInt() ) - self._vRailSpace = DbU.fromLambda( getParameter('chip','chip.block.rails.vSpacing').asInt() ) - # Global net names. + self._railsNb = getParameter('chip','chip.block.rails.count').asInt() + self._hRailWidth = DbU.fromLambda( getParameter('chip','chip.block.rails.hWidth' ).asInt() ) + self._vRailWidth = DbU.fromLambda( getParameter('chip','chip.block.rails.vWidth' ).asInt() ) + self._hRailSpace = DbU.fromLambda( getParameter('chip','chip.block.rails.hSpacing').asInt() ) + self._vRailSpace = DbU.fromLambda( getParameter('chip','chip.block.rails.vSpacing').asInt() ) + # Global Pad names. + self._pckName = getParameter('chip', 'chip.pad.pck' ).asString() + self._pvddickName = getParameter('chip', 'chip.pad.pvddick').asString() + self._pvssickName = getParameter('chip', 'chip.pad.pvssick').asString() + self._pvddeckName = getParameter('chip', 'chip.pad.pvddeck').asString() + self._pvsseckName = getParameter('chip', 'chip.pad.pvsseck').asString() + # Global Net names. self._vddeName = "vdde" self._vddiName = "vddi" self._vsseName = "vsse" @@ -426,7 +440,7 @@ class ChipConf ( object ): self._ckiName = "ck" self._ckoName = "cko" self._ckName = "pad" - # Global net names. + # Global Nets. self._vdde = None self._vddi = None self._vsse = None @@ -444,11 +458,15 @@ class ChipConf ( object ): self._westPads = self._readPads( chipConfigDict, 'pads.west' ) self._coreSize = ChipConf._readCoreSize( chipConfigDict ) self._chipSize = ChipConf._readChipSize( chipConfigDict ) - self._minCorona = DbU.fromLambda( 100 ) self._padWidth = 0 self._padHeight = 0 self._useClockTree = ChipConf._readClockTree( chipConfigDict ) + minHCorona = self._railsNb*(self._hRailWidth + self._hRailSpace) + self._hRailSpace + minVCorona = self._railsNb*(self._vRailWidth + self._vRailSpace) + self._vRailSpace + if minHCorona > minVCorona: self._minCorona = minHCorona*2 + else: self._minCorona = minVCorona*2 + self.checkPads() self.computeChipSize() self.findPowerAndClockNets() @@ -525,7 +543,8 @@ class ChipConf ( object ): def computeChipSize ( self ): if not self._clockPad: - print ErrorMessage( 1, 'There must be at least one pad of model "pck_px" to be used as reference.' ) + print ErrorMessage( 1, 'There must be at least one pad of model "%s" to be used as reference.' \ + % self._pckName ) self._validated = False return False @@ -569,9 +588,24 @@ class ChipConfWrapper ( GaugeConfWrapper ): @property def chipConf ( self ): return self._chipConf + def getSliceHeight ( self ): return self._gaugeConf.getSliceHeight() + def getSliceStep ( self ): return self._gaugeConf.getSliceStep() + @property def cell ( self ): return self._chipConf._cell + # Global Pad names. + @property + def pvddeckName ( self ): return self._chipConf._pvddeckName + @property + def pvsseckName ( self ): return self._chipConf._pvsseckName + @property + def pvddickName ( self ): return self._chipConf._pvddickName + @property + def pvssickName ( self ): return self._chipConf._pvssickName + @property + def pckName ( self ): return self._chipConf._pckName + # Global Net names. @property def vddeName ( self ): return self._chipConf._vddeName diff --git a/cumulus/src/plugins/chip/PadsCorona.py b/cumulus/src/plugins/chip/PadsCorona.py index 03c8c385..ba71a646 100644 --- a/cumulus/src/plugins/chip/PadsCorona.py +++ b/cumulus/src/plugins/chip/PadsCorona.py @@ -14,6 +14,7 @@ # +-----------------------------------------------------------------+ +import sys from operator import itemgetter import Cfg from Hurricane import DbU @@ -52,7 +53,7 @@ class Side ( object ): return - def _toGrid ( self, v ): return v - (v % DbU.fromLambda(5.0)) + def _toGrid ( self, v ): return v - (v % self._corona.getSliceStep()) def getAxis ( self, i ): @@ -76,6 +77,10 @@ class Side ( object ): sideName = 'tall' if checkSize > chipSize: + sliceHeight = self._corona.getSliceHeight() + if checkSize % sliceHeight != 0: + checkSize += sliceHeight - (checkSize % sliceHeight) + print ErrorMessage( 1, [ 'Chip is not %s enought to accomodate the %s,' % (sideName,checkName) , 'needs %dl, but only has %dl.' % ( DbU.toLambda(checkSize), DbU.toLambda(chipSize) ) @@ -118,6 +123,13 @@ class Side ( object ): masterCell = pad.getMasterCell() if net.isGlobal(): trace( 550, '\tLooking for global net %s\n' % net.getName() ) + masterNet = masterCell.getNet( net.getName() ) + if not masterNet: + raise ErrorMessage( 1, [ 'PadsCorona.Side._createPowerContact():' + , 'Pad model <%s> of instance <%s> do not have global net <%s>' % (pad.getName(),masterCell.getName(),net.getName()) + , 'The power/clock nets *names* in the chip must match those of the pads models.' + ] ) + components = masterCell.getNet(net.getName()).getExternalComponents() else: for plug in net.getPlugs(): @@ -126,9 +138,8 @@ class Side ( object ): components = plug.getMasterNet().getExternalComponents() connecteds = False + trace( 550, '\t %s\n' % str(masterCell.getAbutmentBox()) ) for component in components: - trace( 550, '\t- %s\n' % component ) - if component.getBoundingBox().getYMin() > masterCell.getAbutmentBox().getYMin(): continue if self._corona.routingGauge.getLayerDepth(component.getLayer()) != hvDepth: continue if not isinstance(component,Vertical): continue @@ -162,10 +173,10 @@ class Side ( object ): def _createAllPowerContacts ( self ): for pad in self._pads: masterCell = pad.getMasterCell() - if masterCell.getName() != 'pvddick_px' \ - and masterCell.getName() != 'pvssick_px' \ - and masterCell.getName() != 'pvddeck_px' \ - and masterCell.getName() != 'pvsseck_px': + if masterCell.getName() != self._corona.pvddickName \ + and masterCell.getName() != self._corona.pvssickName \ + and masterCell.getName() != self._corona.pvddeckName \ + and masterCell.getName() != self._corona.pvsseckName: continue #print 'Power pad:', pad self._createPowerContacts( pad, self._corona.vddi ) @@ -301,7 +312,8 @@ class Corona ( chip.Configuration.ChipConfWrapper ): def _locatePadRails ( self ): if not self.clockPad: - print ErrorMessage( 1, 'There must be at least one pad of model "pck_px" to guess the pad rails.' ) + print ErrorMessage( 1, 'There must be at least one pad of model "%s" to guess the pad rails.' \ + % self.pckName ) return False for plug in self.clockPad.getPlugs(): @@ -342,7 +354,8 @@ class Corona ( chip.Configuration.ChipConfWrapper ): def _guessPadHvLayers ( self ): if not self.powerPad: - print ErrorMessage( 1, 'There must be at least one pad of model "pvddick_px" to guess the pad power terminals.' ) + print ErrorMessage( 1, 'There must be at least one pad of model "%s" to guess the pad power terminals.' \ + % self.pvddick ) return False availableDepths = set() diff --git a/cumulus/src/plugins/clocktree/ClockTree.py b/cumulus/src/plugins/clocktree/ClockTree.py index dd5222fb..132ed5e2 100755 --- a/cumulus/src/plugins/clocktree/ClockTree.py +++ b/cumulus/src/plugins/clocktree/ClockTree.py @@ -113,7 +113,6 @@ class HTree ( GaugeConfWrapper ): self.cell = cell self.area = area self.childs = [] - #self.bufferCell = self.framework.getCell( 'buf_x2', CRL.Catalog.State.Logical ) self._getBufferIo() self.tieCell = self.framework.getCell( 'tie_x0', CRL.Catalog.State.Views ) self.cellGauge = self.framework.getCellGauge() @@ -468,7 +467,9 @@ class HTreeNode ( object ): leafCk = getPlugByName(leafBuffer,self.topTree.bufferOut).getNet() deepPlug = self.topTree.addDeepPlug( leafCk, plugOccurrence.getPath() ) - plugOccurrence.getEntity().setNet( deepPlug.getMasterNet() ) + if deepPlug: + leafCk = deepPlug.getMasterNet() + plugOccurrence.getEntity().setNet( leafCk ) return diff --git a/cumulus/src/tools/px2mpx.py b/cumulus/src/tools/px2mpx.py new file mode 100755 index 00000000..ed90f33b --- /dev/null +++ b/cumulus/src/tools/px2mpx.py @@ -0,0 +1,335 @@ +#!/usr/bin/env python + +try: + import sys + import traceback + import os.path + import optparse + import math + import Cfg + import Hurricane + from Hurricane import DataBase + from Hurricane import DbU + from Hurricane import Transformation + from Hurricane import Box + from Hurricane import UpdateSession + from Hurricane import Breakpoint + from Hurricane import Net + from Hurricane import NetExternalComponents + from Hurricane import BasicLayer + from Hurricane import ContactLayer + from Hurricane import ViaLayer + from Hurricane import RegularLayer + from Hurricane import TransistorLayer + from Hurricane import DiffusionLayer + from Hurricane import Cell + from Hurricane import Instance + from Hurricane import Net + from Hurricane import Contact + from Hurricane import Horizontal + from Hurricane import Vertical + import Viewer + import CRL + from CRL import RoutingLayerGauge + import helpers + from helpers import trace + from helpers import ErrorMessage +except ImportError, e: + serror = str(e) + if serror.startswith('No module named'): + module = serror.split()[-1] + print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module + print ' Please check the integrity of the package.' + if str(e).find('cannot open shared object file'): + 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) + + +framework = CRL.AllianceFramework.get() + + +def getDeltas ( layer ): + #deltas = { 'L_METAL1' : DbU.fromLambda( -1.0 ) + # , 'L_METAL2' : DbU.fromLambda( 3.0 ) + # , 'L_blockage2': DbU.fromLambda( -1.0 ) + # , 'L_blockage4': DbU.fromLambda( -1.0 ) + # , 'L_xWell' : DbU.fromLambda( 6.0 ) + # , 'L_Trans' : DbU.fromLambda( -3.0 ) + # , 'L_Diff' : DbU.fromLambda( -1.0 ) + # , 'L_Tie' : DbU.fromLambda( 1.2 ) + # , 'W_Diff' : DbU.fromLambda( 0.2 ) + # , 'W_xWell' : DbU.fromLambda( 12.0 ) + # , 'mW_METAL1' : DbU.fromLambda( 4.0 ) + # , 'mW_METAL2' : DbU.fromLambda( 4.0 ) + # } + deltas = { 'L_METAL1' : DbU.fromLambda( -1.0 ) + , 'L_METAL2' : DbU.fromLambda( 3.0 ) + , 'L_blockage2': DbU.fromLambda( -0.5 ) + , 'L_blockage4': DbU.fromLambda( -0.5 ) + , 'L_xWell' : DbU.fromLambda( 6.0 ) + , 'L_Trans' : DbU.fromLambda( -3.0 ) + , 'L_Diff' : DbU.fromLambda( -1.0 ) + , 'L_Tie' : DbU.fromLambda( 1.2 ) + , 'W_Diff' : DbU.fromLambda( 0.2 ) + , 'W_xWell' : DbU.fromLambda( 12.0 ) + , 'W_blockage2': DbU.fromLambda( -1.0 ) + , 'mW_METAL1' : DbU.fromLambda( 4.0 ) + , 'mW_METAL2' : DbU.fromLambda( 4.0 ) + } + + dL = 0 + dW = 0 + mW = 0 + + if isinstance(layer,TransistorLayer): + dL = deltas[ 'L_Trans' ] + elif isinstance(layer,RegularLayer): + if layer.getName() == 'METAL1': + dL = deltas[ 'L_METAL1' ] + mW = deltas[ 'mW_METAL1' ] + elif layer.getName() == 'METAL2' or layer.getName() == 'METAL3': + dL = deltas[ 'L_METAL2' ] + mW = deltas[ 'mW_METAL2' ] + elif layer.getName() == 'BLOCKAGE2': + dL = deltas[ 'L_blockage2' ] + elif layer.getName() == 'BLOCKAGE4': + dL = deltas[ 'L_blockage4' ] + elif layer.getName().endswith('WELL'): + dL = deltas[ 'L_xWell' ] + dW = deltas[ 'W_xWell' ] + elif isinstance(layer,DiffusionLayer): + if layer.getName().endswith('DIF'): + dL = deltas[ 'L_Diff' ] + dW = deltas[ 'W_Diff' ] + elif layer.getName().endswith('TIE'): + dL = deltas[ 'L_Tie' ] + return dL, dW, mW + + +def px2mpx ( editor, pxCell ): + global framework + + if pxCell == None: + raise ErrorMessage( 3, 'px2mpx.px2mpx(): Mandatory pxCell argument is None.' ) + mpxCell = None + + UpdateSession.open() + try: + if pxCell.getName() != 'padreal': + mpxCellName = pxCell.getName()[:-2]+'mpx' + else: + mpxCellName = pxCell.getName()+'_mpx' + mpxCell = framework.createCell( mpxCellName ) + + if editor: + editor.setCell( mpxCell ) + + Left = 0x0001 + Right = 0x0002 + Middle = 0x0000 + AllSpan = Left|Right + + ab = pxCell.getAbutmentBox() + mpxCell.setAbutmentBox( Box( ab.getXMin()*2, ab.getYMin()*2, ab.getXMax()*2, ab.getYMax()*2 ) ) + + for instance in pxCell.getInstances(): + masterCell = instance.getMasterCell() + if masterCell.getName() == 'padreal': + masterCell = framework.getCell( 'padreal_mpx', CRL.Catalog.State.Physical ) + + originTransf = instance.getTransformation() + mpxInstance = Instance.create( mpxCell + , instance.getName() + , masterCell + , Transformation( originTransf.getTx()*2 + , originTransf.getTy()*2 + , originTransf.getOrientation() ) + ) + mpxInstance.setPlacementStatus( Instance.PlacementStatus.PLACED ) + + for net in pxCell.getNets(): + mpxNet = Net.create( mpxCell, net.getName() ) + if net.isExternal(): mpxNet.setExternal( True ) + if net.isGlobal (): mpxNet.setGlobal( True ) + mpxNet.setType ( net.getType () ) + mpxNet.setDirection( net.getDirection() ) + + for component in net.getComponents(): + layer = component.getLayer() + dupComponent = None + + print ' Processing', component + + if isinstance(component,Contact): + dupComponent = Contact.create( mpxNet + , layer + , component.getX ()*2 + , component.getY ()*2 + , component.getWidth ()*2 + , component.getHeight()*2 + ) + elif isinstance(component,Horizontal): + dL, dW, mW = getDeltas( layer ) + dLLeft = dL + dLRight = dL + + bb = component.getBoundingBox() + if component.getSourceX() > component.getTargetX(): component.invert() + if isinstance(layer,RegularLayer): + if layer.getBasicLayer().getMaterial().getCode() == BasicLayer.Material.blockage: + print ' Blockage BB:%s vs. AB:%s' % (bb, ab) + if layer.getName()[-1] == '2' or layer.getName()[-1] == '4': + state = 0 + if bb.getXMin() <= ab.getXMin(): state |= Left + if bb.getXMax() >= ab.getXMax(): state |= Right + + if not (state&Left): + print ' Shrink left.' + dLLeft = dL - DbU.fromLambda( 1.5 ) + if not(state&Right): + print ' Shrink right.' + dLRight = dL - DbU.fromLambda( 1.5 ) + + width = mW + if component.getWidth() > mW: + width = component.getWidth()*2 + dW + + #print DbU.toLambda(bb.getWidth()), DbU.toLambda( dLLeft-dLRight) + if bb.getWidth()*2 > abs(dLLeft+dLRight): + dupComponent = Horizontal.create( mpxNet + , layer + , component.getY ()*2 + , width + , component.getDxSource()*2 - dLLeft + , component.getDxTarget()*2 + dLRight + ) + else: + print ' Horizontal component too small, not converted' + + elif isinstance(component,Vertical): + dL, dW, mW = getDeltas( component.getLayer() ) + dX = 0 + + if component.getSourceY() > component.getTargetY(): component.invert() + if isinstance(layer,RegularLayer): + if layer.getBasicLayer().getMaterial().getCode() == BasicLayer.Material.blockage: + if layer.getName()[-1] == '3' or layer.getName()[-1] == '5': + state = 0 + bb = component.getBoundingBox() + if bb.getXMin() <= ab.getXMin(): state |= Left + if bb.getXMax() >= ab.getXMax(): state |= Right + + if state == Left: + dX = DbU.fromLambda( -2.0 ) + dW += DbU.fromLambda( -2.0 ) + elif state == Right: + dX = DbU.fromLambda( 2.0 ) + dW += DbU.fromLambda( -2.0 ) + elif state == 0: + dX = 0 + dW += DbU.fromLambda( -4.0 ) + + if dW < component.getWidth(): + width = mW + if component.getWidth() > mW: + width = component.getWidth()*2 + dW + + dupComponent = Vertical.create( mpxNet + , layer + , component.getX ()*2 + dX + , width + , component.getDySource()*2 - dL + , component.getDyTarget()*2 + dL + ) + else: + print ' Vertical component too small, not converted' + + else: + print '[WARNING] Unchanged component:', component + + if dupComponent and NetExternalComponents.isExternal( component ): + NetExternalComponents.setExternal( dupComponent ) + + if editor: editor.fit() + + except ErrorMessage, e: + print e; errorCode = e.code + except Exception, e: + print '\n\n', e; errorCode = 1 + traceback.print_tb(sys.exc_info()[2]) + + UpdateSession.close() + return mpxCell + + +def ScriptMain ( **kw ): + global framework + global padrealCell + + helpers.staticInitialization( quiet=True ) + #helpers.setTraceLevel( 550 ) + + pxCell = None + if kw.has_key('cell') and kw['cell']: + pxCell = kw['cell'] + + editor = None + if kw.has_key('editor') and kw['editor']: + editor = kw['editor'] + print ' o Editor detected, running in graphic mode.' + if pxCell == None: pxCell = editor.getCell() + + if pxCell: + mpxCell = px2mpx( editor, pxCell ) + else: + pxlibDir = '/dsk/l1/jpc/alliance/Linux.slsoc6x/install/cells/pxlib' + + if os.path.isdir(pxlibDir): + print ' o <%s> found.' % pxlibDir + for viewFile in os.listdir( pxlibDir ): + if viewFile == 'padreal.ap': + pxCell = framework.getCell( viewFile[:-3], CRL.Catalog.State.Views ) + padrealCell = px2mpx( editor, pxCell ) + framework.saveCell( padrealCell, CRL.Catalog.State.Physical ) + break + + for viewFile in os.listdir( pxlibDir ): + if viewFile == 'padreal.ap': continue + if viewFile.endswith('_sp.ap'): continue + #if viewFile != 'pot_px.ap': continue + if viewFile.endswith('.ap'): + pxCell = framework.getCell( viewFile[:-3], CRL.Catalog.State.Views ) + mpxCell = px2mpx( editor, pxCell ) + framework.saveCell( mpxCell, CRL.Catalog.State.Physical ) + else: + print '[WARNING] <%s> not found.' % pxlibDir + + return 0 + + +if __name__ == '__main__': + parser = optparse.OptionParser() + parser.add_option( '-c', '--cell', type='string', dest='cell' , help='The name of the chip to build, whithout extension.') + parser.add_option( '-v', '--verbose' , action='store_true', dest='verbose' , help='First level of verbosity.') + parser.add_option( '-V', '--very-verbose' , action='store_true', dest='veryVerbose', help='Second level of verbosity.') + (options, args) = parser.parse_args() + + kw = {} + if options.cell: + kw['cell'] = framework.getCell( options.cell, CRL.Catalog.State.Logical ) + if options.verbose: Cfg.getParamBool('misc.verboseLevel1').setBool(True) + if options.veryVerbose: Cfg.getParamBool('misc.verboseLevel2').setBool(True) + + success = ScriptMain( **kw ) + shellSuccess = 0 + if not success: shellSuccess = 1 + + sys.exit( shellSuccess ) diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index 3521c4a0..12becaba 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2009, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2014, All Rights Reserved // // This file is part of Hurricane. // @@ -30,8 +30,8 @@ // +-----------------------------------------------------------------+ -# ifndef __HURRICANE_BASIC_LAYER__ -# define __HURRICANE_BASIC_LAYER__ +# ifndef HURRICANE_BASIC_LAYER_H +# define HURRICANE_BASIC_LAYER_H # include "hurricane/Layer.h" # include "hurricane/BasicLayers.h" diff --git a/hurricane/src/isobar/PyBasicLayer.cpp b/hurricane/src/isobar/PyBasicLayer.cpp index aee67189..b3937b20 100644 --- a/hurricane/src/isobar/PyBasicLayer.cpp +++ b/hurricane/src/isobar/PyBasicLayer.cpp @@ -94,6 +94,20 @@ extern "C" { } + static PyObject* PyBasicLayer_getMaterial ( PyBasicLayer *self ) + { + trace << "PyBasicLayer_getMaterial ()" << endl; + METHOD_HEAD ( "BasicLayer.getMaterial()" ) + + BasicLayer::Material* material = NULL; + HTRY + material = new BasicLayer::Material( basicLayer->getMaterial() ); + HCATCH + + return (PyObject*)PyMaterial_Link( material ); + } + + updatorFromBasicLayer (setBlockageLayer ,PyBasicLayer,BasicLayer) DirectSetLongAttribute (PyBasicLayer_setExtractNumber,setExtractNumber,"BasicLayer.setExtractNumber",PyBasicLayer,BasicLayer) DirectSetCStringAttribute(PyBasicLayer_setRealName ,setRealName ,"BasicLayer.setRealName" ,PyBasicLayer,BasicLayer) @@ -109,6 +123,8 @@ extern "C" { PyMethodDef PyBasicLayer_Methods[] = { { "create" , (PyCFunction)PyBasicLayer_create , METH_VARARGS|METH_STATIC , "Create a new BasicLayer." } + , { "getMaterial" , (PyCFunction)PyBasicLayer_getMaterial , METH_NOARGS + , "Returns the type of Material." } , { "setBlockageLayer" , (PyCFunction)PyBasicLayer_setBlockageLayer , METH_VARARGS , "Sets the blockage layer associated to this one." } , { "setExtractNumber" , (PyCFunction)PyBasicLayer_setExtractNumber , METH_VARARGS diff --git a/hurricane/src/isobar/PyBox.cpp b/hurricane/src/isobar/PyBox.cpp index a1c3a465..9aaafd04 100644 --- a/hurricane/src/isobar/PyBox.cpp +++ b/hurricane/src/isobar/PyBox.cpp @@ -86,9 +86,9 @@ extern "C" { else if ( __cs.getObjectIds() == POINT_ARG ) { box = new Box ( *PYPOINT_O(arg0) ); } else if ( __cs.getObjectIds() == BOX_ARG ) { box = new Box ( *PYBOX_O(arg0) ); } else if ( __cs.getObjectIds() == POINTS2_ARG ) { box = new Box ( *PYPOINT_O(arg0) , *PYPOINT_O(arg1) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { box = new Box ( PyInt_AsLong(arg0) , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { box = new Box ( PyAny_AsLong(arg0) , PyAny_AsLong(arg1) ); } else if ( __cs.getObjectIds() == INTS4_ARG ) { - box = new Box ( PyInt_AsLong(arg0), PyInt_AsLong(arg1), PyInt_AsLong(arg2) , PyInt_AsLong(arg3) ); + box = new Box ( PyAny_AsLong(arg0), PyAny_AsLong(arg1), PyAny_AsLong(arg2) , PyAny_AsLong(arg3) ); } else { PyErr_SetString(ConstructorError, "invalid number of parameters for Box constructor." ); return NULL; @@ -195,8 +195,8 @@ extern "C" { if ( __cs.getObjectIds() == BOX_ARG ) { result = box->contains ( *PYBOX_O(arg0) ); } else if ( __cs.getObjectIds() == POINT_ARG ) { result = box->contains ( *PYPOINT_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { result = box->contains ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { result = box->contains ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.contains constructor." ); return NULL; @@ -304,13 +304,13 @@ extern "C" { if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.inflate",Converter,&arg0,Converter,&arg1,Converter,&arg2,Converter,&arg3) ) return ( NULL ); - if ( __cs.getObjectIds() == INT_ARG ) { box->inflate ( PyInt_AsLong(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { box->inflate ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } - else if ( __cs.getObjectIds() == INTS4_ARG ) { box->inflate ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); } + if ( __cs.getObjectIds() == INT_ARG ) { box->inflate ( PyAny_AsLong(arg0) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { box->inflate ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS4_ARG ) { box->inflate ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.inflate()" ); return ( NULL ); @@ -343,12 +343,12 @@ extern "C" { if ( __cs.getObjectIds() == POINT_ARG ) { box->merge ( *PYPOINT_O(arg0) ); } else if ( __cs.getObjectIds() == BOX_ARG ) { box->merge ( *PYBOX_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { box->merge ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } - else if ( __cs.getObjectIds() == INTS4_ARG ) { box->merge ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { box->merge ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS4_ARG ) { box->merge ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.merge()" ); return ( NULL ); diff --git a/hurricane/src/isobar/PyBreakpoint.cpp b/hurricane/src/isobar/PyBreakpoint.cpp index de20ce4e..47e5f94a 100644 --- a/hurricane/src/isobar/PyBreakpoint.cpp +++ b/hurricane/src/isobar/PyBreakpoint.cpp @@ -59,7 +59,7 @@ extern "C" { PyObject* arg1; if ( not ParseTwoArg ( "Breakpoint::stop()", args, ":int:string", &arg0, &arg1) ) return NULL; - result = Breakpoint::stop( (unsigned int)PyInt_AsLong (arg0) + result = Breakpoint::stop( (unsigned int)PyAny_AsLong (arg0) , PyString_AsString(arg1) ); HCATCH @@ -79,7 +79,7 @@ extern "C" { PyObject* arg0; if ( not ParseOneArg ( "Breakpoint::setStopLevel()", args, ":int", &arg0) ) return NULL; - Breakpoint::setStopLevel ( (unsigned int)PyInt_AsLong(arg0) ); + Breakpoint::setStopLevel ( (unsigned int)PyAny_AsLong(arg0) ); HCATCH diff --git a/hurricane/src/isobar/PyComponent.cpp b/hurricane/src/isobar/PyComponent.cpp index 35227b3e..57909ec3 100644 --- a/hurricane/src/isobar/PyComponent.cpp +++ b/hurricane/src/isobar/PyComponent.cpp @@ -1,8 +1,7 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved +// Copyright (c) UPMC 2008-2014, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | diff --git a/hurricane/src/isobar/PyContact.cpp b/hurricane/src/isobar/PyContact.cpp index f24a0bd4..8780fd14 100644 --- a/hurricane/src/isobar/PyContact.cpp +++ b/hurricane/src/isobar/PyContact.cpp @@ -52,10 +52,12 @@ extern "C" { DirectGetLongAttribute(PyContact_getDx, getDx, PyContact,Contact) DirectGetLongAttribute(PyContact_getDy, getDy, PyContact,Contact) - DirectSetLongAttribute(PyContact_setX ,setX ,"Contact.setX" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setY ,setY ,"Contact.setY" ,PyContact,Contact) - DirectSetLongAttribute(PyContact_setDx,setDx,"Contact.setDx",PyContact,Contact) - DirectSetLongAttribute(PyContact_setDy,setDy,"Contact.setDy",PyContact,Contact) + DirectSetLongAttribute(PyContact_setX ,setX ,"Contact.setX" ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setY ,setY ,"Contact.setY" ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setDx ,setDx ,"Contact.setDx" ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setDy ,setDy ,"Contact.setDy" ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setWidth ,setWidth ,"Contact.setWidth" ,PyContact,Contact) + DirectSetLongAttribute(PyContact_setHeight,setHeight,"Contact.setHeight",PyContact,Contact) accessorHook(getAnchorHook,PyContact,Contact) @@ -131,6 +133,8 @@ extern "C" { , { "setY" , (PyCFunction)PyContact_setY , METH_VARARGS, "Sets the contact Y value." } , { "setDx" , (PyCFunction)PyContact_setDx , METH_VARARGS, "Sets the contact dx value." } , { "setDy" , (PyCFunction)PyContact_setDy , METH_VARARGS, "Sets the contact dy value." } + , { "setWidth" , (PyCFunction)PyContact_setWidth , METH_VARARGS, "Sets the contact width." } + , { "setHeight" , (PyCFunction)PyContact_setHeight , METH_VARARGS, "Sets the contact height." } , {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/hurricane/src/isobar/PyDbU.cpp b/hurricane/src/isobar/PyDbU.cpp index 116068b6..8333d71b 100644 --- a/hurricane/src/isobar/PyDbU.cpp +++ b/hurricane/src/isobar/PyDbU.cpp @@ -61,7 +61,7 @@ extern "C" { static DbU::SnapMode PyInt_AsSnapMode ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case DbU::Inferior : return ( DbU::Inferior ); case DbU::Superior : return ( DbU::Superior ); case DbU::Nearest : return ( DbU::Nearest ); @@ -71,7 +71,7 @@ extern "C" { } static DbU::UnitPower PyInt_AsUnitPower ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case DbU::Pico : return ( DbU::Pico ); case DbU::Nano : return ( DbU::Nano ); case DbU::Micro : return ( DbU::Micro ); @@ -104,14 +104,14 @@ extern "C" { if ( ! PyArg_ParseTuple(args,"|O&:DbU.fromDb",Converter,&arg0) ) return ( NULL ); - if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromDb ( PyInt_AsLong ( arg0 ) ); } + if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromDb ( PyAny_AsLong ( arg0 ) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.fromDb converter." ); return ( NULL ); } HCATCH - return Py_BuildValue("i",result); + return PyLong_FromLong(result); } @@ -126,14 +126,14 @@ extern "C" { return ( NULL ); if ( __cs.getObjectIds() == FLOAT_ARG ) { result = DbU::fromGrid ( PyFloat_AsDouble ( arg0 ) ); } - else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromGrid ( PyInt_AsLong ( arg0 ) ); } + else if ( __cs.getObjectIds() == INT_ARG ) { result = DbU::fromGrid ( PyAny_AsLong ( arg0 ) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters or bad type for DbU.fromGrid converter." ); return ( NULL ); } HCATCH - return Py_BuildValue("i",result); + return PyLong_FromLong(result); } @@ -155,7 +155,7 @@ extern "C" { } HCATCH - return Py_BuildValue ("i",result); + return PyLong_FromLong(result); } @@ -173,7 +173,7 @@ extern "C" { result = DbU::fromPhysical(value,(DbU::UnitPower)power); HCATCH - return Py_BuildValue("l",result); + return PyLong_FromLong(result); } @@ -282,7 +282,7 @@ extern "C" { extern PyObject* PyDbU_getRealSnapGridStep ( PyObject* ) - { return Py_BuildValue("l",DbU::getRealSnapGridStep()); } + { return PyLong_FromLong(DbU::getRealSnapGridStep()); } extern PyObject* PyDbU_getOnRealSnapGrid ( PyObject* , PyObject* args ) @@ -299,7 +299,7 @@ extern "C" { result = DbU::getOnRealSnapGrid(DbU::db(value),(DbU::SnapMode)snap); HCATCH - return Py_BuildValue("l",result); + return PyLong_FromLong(result); } @@ -320,7 +320,7 @@ extern "C" { extern PyObject* PyDbU_getSymbolicSnapGridStep ( PyObject* ) - { return Py_BuildValue("l",DbU::getSymbolicSnapGridStep()); } + { return PyLong_FromLong(DbU::getSymbolicSnapGridStep()); } extern PyObject* PyDbU_getOnSymbolicSnapGrid ( PyObject* , PyObject* args ) @@ -337,7 +337,7 @@ extern "C" { result = DbU::getOnSymbolicSnapGrid(DbU::db(value),(DbU::SnapMode)snap); HCATCH - return Py_BuildValue("l",result); + return PyLong_FromLong(result); } @@ -372,7 +372,7 @@ extern "C" { result = DbU::getOnCustomGrid(DbU::db(value),DbU::db(step),(DbU::SnapMode)snap); HCATCH - return Py_BuildValue("l",result); + return PyLong_FromLong(result); } @@ -390,31 +390,31 @@ extern "C" { result = DbU::getOnPhysicalGrid(DbU::db(value),(DbU::SnapMode)snap); HCATCH - return Py_BuildValue("l",result); + return PyLong_FromLong(result); } extern PyObject* PyDbU_toDb ( PyObject* , PyObject* args ) { PyObject* arg0; - if ( not ParseOneArg( "Dbu.toDb", args,INT_ARG, &arg0 ) ) return NULL; - return Py_BuildValue("i",DbU::toDb(PyInt_AsLong(arg0))); + if ( not ParseOneArg( "DbU.toDb", args,INT_ARG, &arg0 ) ) return NULL; + return PyLong_FromLong(DbU::toDb(PyAny_AsLong(arg0))); } extern PyObject* PyDbU_toGrid ( PyObject* , PyObject* args ) { PyObject* arg0; - if ( not ParseOneArg( "Dbu.toGrid", args,INT_ARG, &arg0 ) ) return NULL; - return Py_BuildValue("d",DbU::toGrid(PyInt_AsLong(arg0))); + if ( not ParseOneArg( "DbU.toGrid", args,INT_ARG, &arg0 ) ) return NULL; + return Py_BuildValue("d",DbU::toGrid(PyAny_AsLong(arg0))); } extern PyObject* PyDbU_toLambda ( PyObject* , PyObject* args ) { PyObject* arg0; - if ( not ParseOneArg( "Dbu.toLambda", args,INT_ARG, &arg0 ) ) return NULL; - return Py_BuildValue("d",DbU::toLambda(PyInt_AsLong(arg0))); + if ( not ParseOneArg( "DbU.toLambda", args,INT_ARG, &arg0 ) ) return NULL; + return Py_BuildValue("d",DbU::toLambda(PyAny_AsLong(arg0))); } @@ -422,8 +422,8 @@ extern "C" { { PyObject* arg0; PyObject* arg1; - if ( not ParseTwoArg( "Dbu.toPhysical", args,INTS2_ARG, &arg0, &arg1 ) ) return NULL; - return Py_BuildValue("d",DbU::toPhysical(PyInt_AsLong(arg0), PyInt_AsUnitPower(arg1))); + if ( not ParseTwoArg( "DbU.toPhysical", args,INTS2_ARG, &arg0, &arg1 ) ) return NULL; + return Py_BuildValue("d",DbU::toPhysical(PyAny_AsLong(arg0), PyInt_AsUnitPower(arg1))); } diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index 60b8bb1a..a0b18bd3 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -92,51 +92,51 @@ extern "C" { if ( __cs.getObjectIds() == NET_LAYER_INT_ARG ) horizontal = Horizontal::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) ); + , PyAny_AsLong(arg2) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS2_ARG ) horizontal = Horizontal::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INT_ARG ) horizontal = Horizontal::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) ); + , PyAny_AsLong(arg3) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS3_ARG ) horizontal = Horizontal::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS2_ARG ) horizontal = Horizontal::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS4_ARG ) horizontal = Horizontal::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS3_ARG ) horizontal = Horizontal::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS4_ARG ) horizontal = Horizontal::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) - , PyInt_AsLong(arg6) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) + , PyAny_AsLong(arg6) ); else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." ); return NULL; diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index eeea8380..82f26d4b 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -129,10 +129,21 @@ using namespace Hurricane; // +-----------------------------------------------------------------+ + long PyAny_AsLong ( PyObject* object ) + { + long value = 0; + + if (PyObject_IsInstance(object,(PyObject*)&PyInt_Type )) value = PyInt_AsLong ( object ); + else if (PyObject_IsInstance(object,(PyObject*)&PyLong_Type)) value = PyLong_AsLong( object ); + return value; + } + + // ------------------------------------------------------------------- // Method : "::ConverterState::ObjectType::PyEqual ()" - bool ConverterState::ObjectType::PyEqual ( PyTypeObject* pyType ) { + bool ConverterState::ObjectType::PyEqual ( PyTypeObject* pyType ) + { if ( _pyType == pyType ) return true; if ( _idBase[0] == '\0' ) return false; return ( __cs.getObject(_idBase)->PyEqual(pyType) ); @@ -180,11 +191,11 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Method : "::ConverterState::addType ()" - void ConverterState::addType ( const char* id + void ConverterState::addType ( const char* id , PyTypeObject* pyType - , const char* name + , const char* name , bool isPythonType - , const char* idBase ) { + , const char* idBase ) { for ( unsigned i=0 ; i < _types.size() ; i++ ) { if ( ! strcmp ( _types[i]->_id, id ) ) { //throw Error ( objectTypeRedefinition ); // 04.09.2009 d2 modification so Pharos can run several scripts during one execution @@ -240,13 +251,17 @@ using namespace Hurricane; const char* ConverterState::getObjectId ( PyObject* object ) const { for ( unsigned i=0 ; i < _types.size() ; i++ ) { - if ( ( ! strcmp ( _types[i]->_id, "function" ) ) && ( PyCallable_Check(object) ) ) - return ( _types[i]->_id ); + if ( ( not strcmp( _types[i]->_id, "function" ) ) and ( PyCallable_Check(object) ) ) + return _types[i]->_id; - if ( ( ! strcmp ( _types[i]->_id, "none" ) ) && ( object == Py_None ) ) - return ( _types[i]->_id ); + if ( (not strcmp( _types[i]->_id, "none")) and (object == Py_None) ) + return _types[i]->_id; - if ( object->ob_type == _types[i]->_pyType ) return ( _types[i]->_id ); + if (object->ob_type == _types[i]->_pyType) return _types[i]->_id; + if (&PyLong_Type == _types[i]->_pyType) { + cerr << "PyLong_Type, now check for PyInt_Type" << endl; + if (object->ob_type == &PyInt_Type) return _types[i]->_id; + } } return ( "unknown" ); // return 'X' @@ -289,45 +304,49 @@ using namespace Hurricane; // ------------------------------------------------------------------- // Function : "Converter ()" - int Converter ( PyObject* object, void** pArg ) { + int Converter ( PyObject* object, void** pArg ) + { ostringstream message; string unboundObject = ""; ConverterState::ObjectType* baseType; for ( unsigned i=0 ; i < __cs.getTypes().size() ; i++ ) { - baseType = __cs.getTypes()[i]->PyBase ( object->ob_type ); - if ( PyCallable_Check(object) || baseType ) { + PyTypeObject* obType = object->ob_type; + if (obType == &PyInt_Type) obType = &PyLong_Type; + + baseType = __cs.getTypes()[i]->PyBase( obType ); + if (PyCallable_Check(object) or baseType) { *pArg = object; i = baseType->_index; - __cs.addId ( baseType->_id ); + __cs.addId( baseType->_id ); - if ( ! __cs.getTypes()[i]->_isPythonType ) { + if (not __cs.getTypes()[i]->_isPythonType) { void** member = ( (void**)( (unsigned long)object + __objectOffset ) ); - if ( *member == NULL ) { + if (*member == NULL) { unboundObject = __cs.getTypes()[i]->_name; break; } } - return ( 1 ); + return 1; } } - if ( unboundObject.size() ) { + if (unboundObject.size()) { message << "Attempt to call " << __cs.getFunction() << "() with an unbound " << unboundObject << " argument"; - PyErr_SetString ( ProxyError, message.str().c_str() ); - return ( 0 ); + PyErr_SetString( ProxyError, message.str().c_str() ); + return 0; } message << "Argument " << __cs.getSize() + 1 << " of call to " << __cs.getFunction() << "() is of unmanaged type " << object->ob_type->tp_name; - PyErr_SetString ( ProxyError, message.str().c_str() ); - return ( 0 ); + PyErr_SetString( ProxyError, message.str().c_str() ); + return 0; } @@ -651,7 +670,7 @@ extern "C" { // Do not change the "none" string. It's hardwired to the None object. __cs.addType ( "none" , Py_None->ob_type , "" , true ); __cs.addType ( "float" , &PyFloat_Type , "" , true ); - __cs.addType ( "int" , &PyInt_Type , "" , true ); + __cs.addType ( "int" , &PyLong_Type , "" , true ); __cs.addType ( "bool" , &PyBool_Type , "" , true ); __cs.addType ( "string" , &PyString_Type , "" , true ); __cs.addType ( "list" , &PyList_Type , "" , true ); diff --git a/hurricane/src/isobar/PyInstance.cpp b/hurricane/src/isobar/PyInstance.cpp index b016dcdc..aef3ae44 100644 --- a/hurricane/src/isobar/PyInstance.cpp +++ b/hurricane/src/isobar/PyInstance.cpp @@ -60,7 +60,7 @@ extern "C" { static Instance::PlacementStatus PyInt_AsPlacementStatus ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Instance::PlacementStatus::UNPLACED : return ( Instance::PlacementStatus(Instance::PlacementStatus::UNPLACED) ); case Instance::PlacementStatus::PLACED : return ( Instance::PlacementStatus(Instance::PlacementStatus::PLACED) ); case Instance::PlacementStatus::FIXED : return ( Instance::PlacementStatus(Instance::PlacementStatus::FIXED) ); @@ -158,7 +158,7 @@ extern "C" { PyObject* pyObject = NULL; HTRY - pyObject = (PyObject*)Py_BuildValue("i",(long)instance->getPlacementStatus().getCode()); + pyObject = (PyObject*)PyLong_FromLong((long)instance->getPlacementStatus().getCode()); HCATCH return pyObject; diff --git a/hurricane/src/isobar/PyInterval.cpp b/hurricane/src/isobar/PyInterval.cpp index b45cd1d1..52fa30d7 100644 --- a/hurricane/src/isobar/PyInterval.cpp +++ b/hurricane/src/isobar/PyInterval.cpp @@ -71,7 +71,7 @@ extern "C" { return NULL; if (__cs.getObjectIds() == NO_ARG ) { interval = new Interval (); } - else if (__cs.getObjectIds() == INTS2_ARG) { interval = new Interval ( PyInt_AsLong(arg0) , PyInt_AsLong(arg1) ); } + else if (__cs.getObjectIds() == INTS2_ARG) { interval = new Interval ( PyAny_AsLong(arg0) , PyAny_AsLong(arg1) ); } else if (__cs.getObjectIds() == INTV_ARG ) { interval = new Interval ( *PYINTERVAL_O(arg0) ); } else { PyErr_SetString(ConstructorError, "invalid number of parameters for Interval constructor." ); @@ -139,7 +139,7 @@ extern "C" { if (not PyArg_ParseTuple(args,"|O&:Interval.contains",Converter,&arg0) ) return NULL; - if (__cs.getObjectIds() == INT_ARG ) { result = interval->contains ( PyInt_AsLong(arg0) ); } + if (__cs.getObjectIds() == INT_ARG ) { result = interval->contains ( PyAny_AsLong(arg0) ); } else if (__cs.getObjectIds() == INTV_ARG) { result = interval->contains ( *PYINTERVAL_O(arg0) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Interval.contains constructor." ); @@ -197,8 +197,8 @@ extern "C" { if (not PyArg_ParseTuple(args,"|O&O&:Interval.inflate",Converter,&arg0,Converter,&arg1)) return NULL; - if (__cs.getObjectIds() == INT_ARG ) { interval->inflate( PyInt_AsLong(arg0) ); } - else if (__cs.getObjectIds() == INTS2_ARG) { interval->inflate( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); } + if (__cs.getObjectIds() == INT_ARG ) { interval->inflate( PyAny_AsLong(arg0) ); } + else if (__cs.getObjectIds() == INTS2_ARG) { interval->inflate( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Interval.inflate()" ); return NULL; @@ -223,7 +223,7 @@ extern "C" { if (not PyArg_ParseTuple(args,"|O&O&:Interval.merge",Converter,&arg0,Converter,&arg1)) return NULL; - if (__cs.getObjectIds() == INT_ARG ) { interval->merge( PyInt_AsLong(arg0) ); } + if (__cs.getObjectIds() == INT_ARG ) { interval->merge( PyAny_AsLong(arg0) ); } else if (__cs.getObjectIds() == INTV_ARG) { interval->merge( *PYINTERVAL_O(arg0) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Interval.merge()" ); @@ -250,7 +250,7 @@ extern "C" { return NULL; if (__cs.getObjectIds() == INTV_ARG ) { interval->intersection( *PYINTERVAL_O(arg0) ); } - else if (__cs.getObjectIds() == INTS2_ARG) { interval->intersection( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); } + else if (__cs.getObjectIds() == INTS2_ARG) { interval->intersection( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Interval.intersection()" ); return NULL; diff --git a/hurricane/src/isobar/PyLayer.cpp b/hurricane/src/isobar/PyLayer.cpp index 76e57527..fc2205c2 100644 --- a/hurricane/src/isobar/PyLayer.cpp +++ b/hurricane/src/isobar/PyLayer.cpp @@ -78,7 +78,7 @@ extern "C" { } \ HCATCH \ \ - return Py_BuildValue("l",rvalue); \ + return PyLong_FromLong(rvalue); \ } diff --git a/hurricane/src/isobar/PyLayerMask.cpp b/hurricane/src/isobar/PyLayerMask.cpp index 5a7951bf..1de221f0 100644 --- a/hurricane/src/isobar/PyLayerMask.cpp +++ b/hurricane/src/isobar/PyLayerMask.cpp @@ -133,7 +133,7 @@ extern "C" { PyObject* PyLayerMask_nthbit ( PyLayerMask* self, PyObject* pyInt ) { Layer::Mask result; - result = self->_object.nthbit(PyInt_AsLong(pyInt)); + result = self->_object.nthbit(PyAny_AsLong(pyInt)); return PyLayerMask_Link(result); } @@ -180,7 +180,7 @@ extern "C" { #define binaryInFunctionMaskInt(FUNC_NAME,OP) \ PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyObject* pyInt ) \ { \ - pyMask0->_object OP= PyInt_AsLong(pyInt); \ + pyMask0->_object OP= PyAny_AsLong(pyInt); \ Py_INCREF(pyMask0); \ return (PyObject*)pyMask0; \ } @@ -199,7 +199,7 @@ extern "C" { PyObject* PyLayerMask_##FUNC_NAME ( PyLayerMask* pyMask0, PyObject* pyInt ) \ { \ Layer::Mask result; \ - result = pyMask0->_object OP PyInt_AsLong(pyInt); \ + result = pyMask0->_object OP PyAny_AsLong(pyInt); \ return PyLayerMask_Link(result); \ } diff --git a/hurricane/src/isobar/PyMaterial.cpp b/hurricane/src/isobar/PyMaterial.cpp index 7ace9e43..d938341a 100644 --- a/hurricane/src/isobar/PyMaterial.cpp +++ b/hurricane/src/isobar/PyMaterial.cpp @@ -129,10 +129,20 @@ extern "C" { // | "PyMaterial" Object Methods | // +-------------------------------------------------------------+ + static int PyMaterial_Cmp ( PyMaterial *self, PyObject* other ) + { + if (not IsPyMaterial(other) ) return -1; + + PyMaterial* otherPyObject = (PyMaterial *)other; + if (self->_object->getCode() == otherPyObject->_object->getCode()) return 0; + if (self->_object->getCode() < otherPyObject->_object->getCode()) return -1; + + return 1; + } + DirectHashMethod (PyMaterial_Hash , PyMaterial) DirectReprMethod (PyMaterial_Repr , PyMaterial, BasicLayer::Material) DirectStrMethod (PyMaterial_Str , PyMaterial, BasicLayer::Material) - DirectStrMethod (PyMaterial_Cmp , PyMaterial, BasicLayer::Material) DirectDeleteMethod(PyMaterial_DeAlloc, PyMaterial) extern void PyMaterial_LinkPyType() { diff --git a/hurricane/src/isobar/PyNet.cpp b/hurricane/src/isobar/PyNet.cpp index 653c7089..fee37245 100644 --- a/hurricane/src/isobar/PyNet.cpp +++ b/hurricane/src/isobar/PyNet.cpp @@ -62,7 +62,7 @@ extern "C" { // Local Function : "PyInt_AsType ()" static Net::Type PyInt_AsType ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Net::Type::UNDEFINED : return ( Net::Type(Net::Type::UNDEFINED) ); case Net::Type::LOGICAL : return ( Net::Type(Net::Type::LOGICAL) ); case Net::Type::CLOCK : return ( Net::Type(Net::Type::CLOCK) ); @@ -80,7 +80,7 @@ extern "C" { static Net::Direction PyInt_AsDirection ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Net::Direction::UNDEFINED : return ( Net::Direction(Net::Direction::UNDEFINED) ); case Net::Direction::IN : return ( Net::Direction(Net::Direction::IN) ); case Net::Direction::OUT : return ( Net::Direction(Net::Direction::OUT) ); @@ -154,7 +154,7 @@ extern "C" { METHOD_HEAD ( "Net.getType()" ) - return ( (PyObject*)Py_BuildValue("i",(long)net->getType().getCode()) ); + return ( (PyObject*)PyLong_FromLong((long)net->getType().getCode()) ); } @@ -168,7 +168,7 @@ extern "C" { METHOD_HEAD ( "Net.getDirection()" ) - return ( (PyObject*)Py_BuildValue("i",(long)net->getDirection().getCode()) ); + return ( (PyObject*)PyLong_FromLong((long)net->getDirection().getCode()) ); } diff --git a/hurricane/src/isobar/PyPin.cpp b/hurricane/src/isobar/PyPin.cpp index 66af029f..c33f98f5 100644 --- a/hurricane/src/isobar/PyPin.cpp +++ b/hurricane/src/isobar/PyPin.cpp @@ -48,7 +48,7 @@ extern "C" { static Pin::PlacementStatus PyInt_AsPlacementStatus ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Pin::PlacementStatus::UNPLACED : return ( Pin::PlacementStatus(Pin::PlacementStatus::UNPLACED) ); case Pin::PlacementStatus::PLACED : return ( Pin::PlacementStatus(Pin::PlacementStatus::PLACED) ); case Pin::PlacementStatus::FIXED : return ( Pin::PlacementStatus(Pin::PlacementStatus::FIXED) ); @@ -59,7 +59,7 @@ extern "C" { static Pin::AccessDirection PyInt_AsAccessDirection ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Pin::AccessDirection::UNDEFINED : return ( Pin::AccessDirection(Pin::AccessDirection::UNDEFINED) ); case Pin::AccessDirection::NORTH : return ( Pin::AccessDirection(Pin::AccessDirection::NORTH) ); case Pin::AccessDirection::SOUTH : return ( Pin::AccessDirection(Pin::AccessDirection::SOUTH) ); @@ -116,10 +116,10 @@ extern "C" { PyInt_AsAccessDirection ( arg2 ), PyInt_AsPlacementStatus ( arg3 ), PYLAYER_O ( arg4 ), - PyInt_AsLong ( arg5 ), - PyInt_AsLong ( arg6 ), - PyInt_AsLong ( arg7 ), - PyInt_AsLong ( arg8 ) ); + PyAny_AsLong ( arg5 ), + PyAny_AsLong ( arg6 ), + PyAny_AsLong ( arg7 ), + PyAny_AsLong ( arg8 ) ); } else if ( __cs.getObjectIds() == pin_arg2 ) { pin = Pin::create ( PYNET_O ( arg0 ), @@ -127,17 +127,17 @@ extern "C" { PyInt_AsAccessDirection ( arg2 ), PyInt_AsPlacementStatus ( arg3 ), PYLAYER_O ( arg4 ), - PyInt_AsLong ( arg5 ), - PyInt_AsLong ( arg6 ), - PyInt_AsLong ( arg7 ) ); + PyAny_AsLong ( arg5 ), + PyAny_AsLong ( arg6 ), + PyAny_AsLong ( arg7 ) ); } else if ( __cs.getObjectIds() == pin_arg3 ) { pin = Pin::create ( PYNET_O ( arg0 ), Name(PyString_AsString(arg1)), PyInt_AsAccessDirection ( arg2 ), PyInt_AsPlacementStatus ( arg3 ), PYLAYER_O ( arg4 ), - PyInt_AsLong ( arg5 ), - PyInt_AsLong ( arg6 ) ); + PyAny_AsLong ( arg5 ), + PyAny_AsLong ( arg6 ) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." ); return NULL; @@ -156,7 +156,7 @@ extern "C" { METHOD_HEAD ( "Net.getAccessDirection()" ) - return (PyObject *)Py_BuildValue("l", pin->getAccessDirection().getCode() ); + return (PyObject *)PyLong_FromLong( pin->getAccessDirection().getCode() ); } diff --git a/hurricane/src/isobar/PyPoint.cpp b/hurricane/src/isobar/PyPoint.cpp index 71590fc2..624d1b9f 100644 --- a/hurricane/src/isobar/PyPoint.cpp +++ b/hurricane/src/isobar/PyPoint.cpp @@ -61,8 +61,8 @@ extern "C" { if ( __cs.getObjectIds() == NO_ARG ) { point = new Point (); } else if ( __cs.getObjectIds() == POINT_ARG ) { point = new Point ( *PYPOINT_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { point = new Point ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { point = new Point ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." ); return NULL; @@ -101,7 +101,7 @@ extern "C" { PyObject* arg1; if ( ! ParseTwoArg ( "Box.Translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL ); - point->translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); + point->translate ( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); HCATCH diff --git a/hurricane/src/isobar/PyQueryMask.cpp b/hurricane/src/isobar/PyQueryMask.cpp index e96d636e..a8c6eb5a 100644 --- a/hurricane/src/isobar/PyQueryMask.cpp +++ b/hurricane/src/isobar/PyQueryMask.cpp @@ -133,7 +133,7 @@ extern "C" { PyObject* PyQueryMask_nthbit ( PyQueryMask* self, PyObject* pyInt ) { Query::Mask result; - result = self->_object.nthbit(PyInt_AsLong(pyInt)); + result = self->_object.nthbit(PyAny_AsLong(pyInt)); return PyQueryMask_Link(result); } @@ -180,7 +180,7 @@ extern "C" { #define binaryInFunctionMaskInt(FUNC_NAME,OP) \ PyObject* PyQueryMask_##FUNC_NAME ( PyQueryMask* pyMask0, PyObject* pyInt ) \ { \ - pyMask0->_object OP= PyInt_AsLong(pyInt); \ + pyMask0->_object OP= PyAny_AsLong(pyInt); \ Py_INCREF(pyMask0); \ return (PyObject*)pyMask0; \ } @@ -199,7 +199,7 @@ extern "C" { PyObject* PyQueryMask_##FUNC_NAME ( PyQueryMask* pyMask0, PyObject* pyInt ) \ { \ Query::Mask result; \ - result = pyMask0->_object OP PyInt_AsLong(pyInt); \ + result = pyMask0->_object OP PyAny_AsLong(pyInt); \ return PyQueryMask_Link(result); \ } diff --git a/hurricane/src/isobar/PyReference.cpp b/hurricane/src/isobar/PyReference.cpp index e622a89b..2ababee2 100644 --- a/hurricane/src/isobar/PyReference.cpp +++ b/hurricane/src/isobar/PyReference.cpp @@ -79,8 +79,8 @@ extern "C" { if ( __cs.getObjectIds() == ":ent:string:int:int" ) reference = Reference::create ( PYCELL_O(arg0) , Name(PyString_AsString(arg1)) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); else if ( __cs.getObjectIds() == ":ent:name:point" ) reference = Reference::create ( PYCELL_O(arg0) , Name(PyString_AsString(arg1)) @@ -149,7 +149,7 @@ extern "C" { if ( ! ParseTwoArg ( "Reference.translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL ); - reference->translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); + reference->translate ( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); HCATCH diff --git a/hurricane/src/isobar/PyRoutingPad.cpp b/hurricane/src/isobar/PyRoutingPad.cpp index 054d3203..8a47051a 100644 --- a/hurricane/src/isobar/PyRoutingPad.cpp +++ b/hurricane/src/isobar/PyRoutingPad.cpp @@ -81,7 +81,7 @@ extern "C" { } if ( __cs.getObjectIds() == ":ent:occur:int" ) - rp = RoutingPad::create( PYNET_O(arg0), *(PYOCCURRENCE_O(arg1)), PyInt_AsLong(arg2) ); + rp = RoutingPad::create( PYNET_O(arg0), *(PYOCCURRENCE_O(arg1)), PyAny_AsLong(arg2) ); else if ( __cs.getObjectIds() == ":pin" ) rp = RoutingPad::create( dynamic_cast(EntityCast(arg0)) ); else { @@ -198,7 +198,7 @@ extern "C" { } if ( __cs.getObjectIds() == ":int:int" ) - rp->setPosition( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); + rp->setPosition( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); else if ( __cs.getObjectIds() == ":point" ) rp->setPosition( *PYPOINT_O(arg0) ); else { diff --git a/hurricane/src/isobar/PySegment.cpp b/hurricane/src/isobar/PySegment.cpp index 3d388415..cdd3efb2 100644 --- a/hurricane/src/isobar/PySegment.cpp +++ b/hurricane/src/isobar/PySegment.cpp @@ -1,21 +1,17 @@ +// -*- C++ -*- // -// $Id: PySegment.cpp,v 1.12 2008/02/07 17:09:42 xtof Exp $ +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2014, All Rights Reserved // -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | I s o b a r - Hurricane / Python Interface | // | | -// | Author : Jean-Paul Chaput | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./PySegment.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x - - +// +-----------------------------------------------------------------+ #include "hurricane/isobar/PyHook.h" @@ -56,6 +52,8 @@ extern "C" { // Standard Accessors (Attributes). DirectGetLongAttribute(PySegment_getSourceX,getSourceX,PySegment,Segment) DirectGetLongAttribute(PySegment_getSourceY,getSourceY,PySegment,Segment) + DirectGetLongAttribute(PySegment_getTargetX,getTargetX,PySegment,Segment) + DirectGetLongAttribute(PySegment_getTargetY,getTargetY,PySegment,Segment) DirectGetLongAttribute(PySegment_getWidth ,getWidth ,PySegment,Segment) DirectSetLongAttribute(PySegment_setWidth ,setWidth ,"Segment.setWidth",PySegment,Segment) DirectVoidMethod(Segment,segment,invert) @@ -170,6 +168,8 @@ extern "C" { , { "getTarget" , (PyCFunction)PySegment_getTarget , METH_NOARGS , "Return the Segment target component (or None)." } , { "getSourceX" , (PyCFunction)PySegment_getSourceX , METH_NOARGS , "Return the Segment source X value." } , { "getSourceY" , (PyCFunction)PySegment_getSourceY , METH_NOARGS , "Return the Segment source Y value." } + , { "getTargetX" , (PyCFunction)PySegment_getTargetX , METH_NOARGS , "Return the Segment source X value." } + , { "getTargetY" , (PyCFunction)PySegment_getTargetY , METH_NOARGS , "Return the Segment source Y value." } , { "getSourcePosition" , (PyCFunction)PySegment_getSourcePosition, METH_NOARGS , "Return the Segment source point value." } , { "getTargetPosition" , (PyCFunction)PySegment_getTargetPosition, METH_NOARGS , "Return the Segment target point value." } , { "getWidth" , (PyCFunction)PySegment_getWidth , METH_NOARGS , "Return the segment width." } diff --git a/hurricane/src/isobar/PyTransformation.cpp b/hurricane/src/isobar/PyTransformation.cpp index c4e4656a..5dc71995 100644 --- a/hurricane/src/isobar/PyTransformation.cpp +++ b/hurricane/src/isobar/PyTransformation.cpp @@ -52,7 +52,7 @@ extern "C" { static Transformation::Orientation PyInt_AsOrientation ( PyObject* object ) { - switch ( PyInt_AsLong(object) ) { + switch ( PyAny_AsLong(object) ) { case Transformation::Orientation::ID : return ( Transformation::Orientation(Transformation::Orientation::ID) ); case Transformation::Orientation::R1 : return ( Transformation::Orientation(Transformation::Orientation::R1) ); case Transformation::Orientation::R2 : return ( Transformation::Orientation(Transformation::Orientation::R2) ); @@ -91,12 +91,12 @@ extern "C" { if ( __cs.getObjectIds() == NO_ARG ) { transf = new Transformation (); } else if ( __cs.getObjectIds() == POINT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) ); } else if ( __cs.getObjectIds() == TRANS_ARG ) { transf = new Transformation ( *PYTRANSFORMATION_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { transf = new Transformation ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { transf = new Transformation ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else if ( __cs.getObjectIds() == POINT_INT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) , PyInt_AsOrientation(arg1) ); } - else if ( __cs.getObjectIds() == INTS3_ARG ) { transf = new Transformation ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) + else if ( __cs.getObjectIds() == INTS3_ARG ) { transf = new Transformation ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) , PyInt_AsOrientation(arg2) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." ); @@ -162,7 +162,7 @@ extern "C" { METHOD_HEAD ( "Translation.getOrientation()" ) - return ( (PyObject*)Py_BuildValue("i",(long)transf->getOrientation().getCode()) ); + return ( (PyObject*)PyLong_FromLong( (long)transf->getOrientation().getCode()) ); } @@ -188,8 +188,8 @@ extern "C" { return ( NULL ); if ( __cs.getObjectIds() == POINT_ARG ) { result = transf->getX ( *PYPOINT_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getX ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getX ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.getX()." ); return ( NULL ); @@ -197,7 +197,7 @@ extern "C" { HCATCH - return ( (PyObject*)Py_BuildValue("i",result) ); + return ( (PyObject*)PyLong_FromLong(result) ); } @@ -223,8 +223,8 @@ extern "C" { return ( NULL ); if ( __cs.getObjectIds() == POINT_ARG ) { result = transf->getY ( *PYPOINT_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getY ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getY ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.getY()." ); return ( NULL ); @@ -232,7 +232,7 @@ extern "C" { HCATCH - return ( (PyObject*)Py_BuildValue("i",result) ); + return ( (PyObject*)PyLong_FromLong(result) ); } @@ -254,11 +254,11 @@ extern "C" { HTRY if ( ! ParseTwoArg ( "Transformation.getDx", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL ); - result = transf->getDx ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); + result = transf->getDx ( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); HCATCH - return ( (PyObject*)Py_BuildValue("i",result) ); + return ( (PyObject*)PyLong_FromLong(result) ); } @@ -280,11 +280,11 @@ extern "C" { HTRY if ( ! ParseTwoArg ( "Transformation.getDy", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL ); - result = transf->getDy ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) ); + result = transf->getDy ( PyAny_AsLong(arg0), PyAny_AsLong(arg1) ); HCATCH - return ( (PyObject*)Py_BuildValue("i",result) ); + return ( (PyObject*)PyLong_FromLong(result) ); } @@ -342,8 +342,8 @@ extern "C" { return ( NULL ); if ( __cs.getObjectIds() == POINT_ARG ) { result = transf->getPoint ( *PYPOINT_O(arg0) ); } - else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getPoint ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) ); } + else if ( __cs.getObjectIds() == INTS2_ARG ) { result = transf->getPoint ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.getPoint()." ); return ( NULL ); @@ -394,10 +394,10 @@ extern "C" { if ( __cs.getObjectIds() == BOX_ARG ) { result = transf->getBox ( *PYBOX_O(arg0) ); } else if ( __cs.getObjectIds() == POINTS2_ARG ) { result = transf->getBox ( *PYPOINT_O(arg0) , *PYPOINT_O(arg1) ); } - else if ( __cs.getObjectIds() == INTS4_ARG ) { result = transf->getBox ( PyInt_AsLong(arg0) - , PyInt_AsLong(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); } + else if ( __cs.getObjectIds() == INTS4_ARG ) { result = transf->getBox ( PyAny_AsLong(arg0) + , PyAny_AsLong(arg1) + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); } else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.getBox()." ); return ( NULL ); diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index cfc54be4..8aa95d78 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -89,51 +89,51 @@ extern "C" { if ( __cs.getObjectIds() == NET_LAYER_INT_ARG ) vertical = Vertical::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) ); + , PyAny_AsLong(arg2) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS2_ARG ) vertical = Vertical::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INT_ARG ) vertical = Vertical::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) ); + , PyAny_AsLong(arg3) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS3_ARG ) vertical = Vertical::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS2_ARG ) vertical = Vertical::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) ); else if ( __cs.getObjectIds() == NET_LAYER_INTS4_ARG ) vertical = Vertical::create ( PYNET_O(arg0) , PYLAYER_O(arg1) - , PyInt_AsLong(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) ); + , PyAny_AsLong(arg2) + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS3_ARG ) vertical = Vertical::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) ); else if ( __cs.getObjectIds() == COMPS2_LAYER_INTS4_ARG ) vertical = Vertical::create ( ComponentCast(arg0) , ComponentCast(arg1) , PYLAYER_O(arg2) - , PyInt_AsLong(arg3) - , PyInt_AsLong(arg4) - , PyInt_AsLong(arg5) - , PyInt_AsLong(arg6) ); + , PyAny_AsLong(arg3) + , PyAny_AsLong(arg4) + , PyAny_AsLong(arg5) + , PyAny_AsLong(arg6) ); else { PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." ); return NULL; diff --git a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h index 1cc3648f..e6ab0628 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyHurricane.h +++ b/hurricane/src/isobar/hurricane/isobar/PyHurricane.h @@ -105,6 +105,9 @@ using namespace std; extern ConverterState __cs; extern int __objectOffset; + long PyAny_AsLong ( PyObject* object ); + + extern "C" { @@ -210,7 +213,7 @@ extern "C" { long result = 1; \ if ( self->ACCESS_OBJECT == NULL ) result = 0; \ \ - return ( Py_BuildValue ("i",result) ); \ + return ( PyLong_FromLong(result) ); \ } @@ -288,7 +291,7 @@ extern "C" { static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \ { \ GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetLongAttribute()") \ - return ( Py_BuildValue ("l",cobject->FUNC_NAME()) ); \ + return ( PyLong_FromLong(cobject->FUNC_NAME()) ); \ } @@ -539,7 +542,7 @@ extern "C" { PyObject* arg0; \ if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \ return ( NULL ); \ - cobject->FUNC_NAME ( PyInt_AsLong(arg0) ); \ + cobject->FUNC_NAME ( Isobar::PyAny_AsLong(arg0) ); \ HCATCH \ \ Py_RETURN_NONE; \ diff --git a/katabatic/src/LoadGrByNet.cpp b/katabatic/src/LoadGrByNet.cpp index 5661218a..65c7318d 100644 --- a/katabatic/src/LoadGrByNet.cpp +++ b/katabatic/src/LoadGrByNet.cpp @@ -1534,14 +1534,14 @@ namespace { ltrace(99) << "| Initial N-E Global RP: " << northEastRp << endl; if (_routingPads.size() > 1) { - unsigned int i=_routingPads.size()-2; - do { + for ( unsigned int i=_routingPads.size()-1; i != 0 ; ) { + i -= 1; if (northEastRp->getBoundingBox().getHeight() >= 4*Session::getPitch(1)) break; if (_routingPads[i]->getBoundingBox().getHeight() > northEastRp->getBoundingBox().getHeight()) { ltrace(99) << "| Better RP: " << northEastRp << endl; northEastRp = _routingPads[i]; } - } while (i != 0); + } } if (_east and not _north) { diff --git a/kite/src/BuildPowerRails.cpp b/kite/src/BuildPowerRails.cpp index d576794d..c9d6221c 100644 --- a/kite/src/BuildPowerRails.cpp +++ b/kite/src/BuildPowerRails.cpp @@ -171,7 +171,8 @@ namespace { hasPad = true; } - if (iinstance->getMasterCell()->getName() == Name("pvddeck_px")) { + string padName = getString( iinstance->getMasterCell()->getName() ); + if (padName.substr(0,8) == "pvddeck_") { cmess1 << " o Reference power pad: " << iinstance->getName() << "(model:" << iinstance->getMasterCell()->getName() << ")." << endl; @@ -196,7 +197,8 @@ namespace { } } - if (iinstance->getMasterCell()->getName() == Name("pck_px")) { + padName = getString( iinstance->getMasterCell()->getName() ); + if (padName.substr(0,4) == "pck_") { cmess1 << " o Reference clock pad: " << iinstance->getName() << "(model:" << iinstance->getMasterCell()->getName() << ")." << endl; @@ -343,41 +345,41 @@ namespace { Net* GlobalNetTable::getRootNet ( const Net* net, Path path ) const { - //ltrace(300) << "getRootNet:" << path << ":" << net << endl; - if ( net == _blockage ) return _blockage; + ltrace(300) << "getRootNet:" << path << ":" << net << endl; + if (net == _blockage) return _blockage; - if ( net->getName() == _vddeName ) return _vdde; - if ( net->getName() == _vsseName ) return _vsse; + if (net->getName() == _vddeName) return _vdde; + if (net->getName() == _vsseName) return _vsse; - if ( net->getType() == Net::Type::POWER ) return _vddi; - if ( net->getType() == Net::Type::GROUND ) return _vssi; - if ( net->getType() != Net::Type::CLOCK ) return NULL; + if (net->getType() == Net::Type::POWER ) return _vddi; + if (net->getType() == Net::Type::GROUND) return _vssi; + if (net->getType() != Net::Type::CLOCK ) return NULL; const Net* upNet = net; - if ( not path.isEmpty() ) { + if (not path.isEmpty()) { Path upPath = path; Instance* instance = NULL; Plug* plug = NULL; while ( true ) { - //cerr << path << "+" << upNet << endl; + ltrace(300) << path << "+" << upNet << endl; - if ( (upNet == NULL) or not upNet->isExternal() ) return _blockage; - if ( path.isEmpty() ) break; + if ((upNet == NULL) or not upNet->isExternal()) return _blockage; + if (path.isEmpty()) break; instance = path.getTailInstance(); - plug = instance->getPlug(net); - if ( plug == NULL ) return NULL; + plug = instance->getPlug(upNet); + if (plug == NULL) return NULL; upNet = plug->getNet(); path = path.getHeadPath(); } } - if ( upNet->getName() == _ckName ) return _ck; - if ( upNet->getName() == _ckiName ) return _cki; - if ( upNet->getName() == _ckoName ) return _cko; + if (upNet->getName() == _ckName ) return _ck; + if (upNet->getName() == _ckiName) return _cki; + if (upNet->getName() == _ckoName) return _cko; return NULL; } @@ -1073,6 +1075,9 @@ namespace { rootNet = _kite->getBlockageNet(); if ( rootNet == NULL ) return; + ltrace(300) << " rootNet " << rootNet << " (" << rootNet->isClock() << ") " + << go->getCell() << " (" << go->getCell()->isTerminal() << ")" << endl; + const Segment* segment = dynamic_cast(component); if ( segment != NULL ) { _goMatchCount++; diff --git a/kite/src/BuildPreRouteds.cpp b/kite/src/BuildPreRouteds.cpp index fde5a603..50728873 100644 --- a/kite/src/BuildPreRouteds.cpp +++ b/kite/src/BuildPreRouteds.cpp @@ -100,7 +100,7 @@ namespace Kite { bool isPreRouted = false; bool isFixed = false; - size_t rpCount = 0; + size_t rpCount = 0; if (inet->isDeepNet()) { rpCount = 2; diff --git a/kite/src/ProtectRoutingPads.cpp b/kite/src/ProtectRoutingPads.cpp index 77d35245..7c0926f0 100644 --- a/kite/src/ProtectRoutingPads.cpp +++ b/kite/src/ProtectRoutingPads.cpp @@ -27,6 +27,7 @@ #include "hurricane/Cell.h" #include "hurricane/NetExternalComponents.h" #include "crlcore/Catalog.h" +#include "katabatic/NetRoutingProperty.h" #include "katabatic/AutoContact.h" #include "katabatic/AutoSegment.h" #include "katabatic/GCell.h" @@ -144,12 +145,12 @@ namespace { namespace Kite { - using Hurricane::DataBase; using Hurricane::Technology; using Hurricane::BasicLayer; using Hurricane::ForEachIterator; using Hurricane::Cell; + using Katabatic::NetRoutingState; void KiteEngine::protectRoutingPads () @@ -159,6 +160,9 @@ namespace Kite { forEach ( Net*, inet, getCell()->getNets() ) { if ( (*inet)->isSupply() ) continue; + NetRoutingState* state = getRoutingState( *inet ); + if (state and state->isFixed()) continue; + vector rps; forEach ( RoutingPad*, irp, (*inet)->getRoutingPads() ) { rps.push_back ( *irp );