From f1304172329c42f2ea240812abe8c274fe4f2eec Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 13 Nov 2019 23:31:51 +0100 Subject: [PATCH] Various bug fixes for Analog P&R. OK for GM/Chamla & OTA/Miller. * Change: In CRL::RoutingLayerGauge::getHorizontalGauge(), when selecting the default gauge, try, if possible to avoid the PinOnly one. Same goes for the vertical one. * Bug: In Katana::TrackCost CTOR, symmetric track axis position was wrong, was using the reference instead of the symmetric. * Bug: In BoraEngine::updatePlacement(), set up the Dijkstra search halo to one pitch so it can use immediately neighboring channels. * New: In BoraEngine, added python startup hook like in Katana. Mainly to setup debug nets. --- bora/CMakeLists.txt | 1 + bora/python/CMakeLists.txt | 2 ++ bora/python/boraInit.py | 29 +++++++++++++++++++++++++ bora/src/BoraEngine.cpp | 34 ++++++++++++++++++++++++++++-- bora/src/BoxSet.cpp | 8 +++---- bora/src/bora/BoraEngine.h | 1 + crlcore/src/ccore/RoutingGauge.cpp | 24 ++++++++++++++------- katana/src/SegmentFsm.cpp | 2 +- katana/src/TrackCost.cpp | 4 +++- 9 files changed, 89 insertions(+), 16 deletions(-) create mode 100644 bora/python/CMakeLists.txt create mode 100644 bora/python/boraInit.py diff --git a/bora/CMakeLists.txt b/bora/CMakeLists.txt index d834b59c..857382bd 100644 --- a/bora/CMakeLists.txt +++ b/bora/CMakeLists.txt @@ -31,5 +31,6 @@ find_package(Doxygen) add_subdirectory(src) + add_subdirectory(python) #add_subdirectory(cmake_modules) #add_subdirectory(doc) diff --git a/bora/python/CMakeLists.txt b/bora/python/CMakeLists.txt new file mode 100644 index 00000000..26104e4d --- /dev/null +++ b/bora/python/CMakeLists.txt @@ -0,0 +1,2 @@ + + install ( FILES boraInit.py DESTINATION ${PYTHON_SITE_PACKAGES}/bora ) diff --git a/bora/python/boraInit.py b/bora/python/boraInit.py new file mode 100644 index 00000000..9ba76a52 --- /dev/null +++ b/bora/python/boraInit.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +try: + import sys + import os.path + import helpers.io + from helpers.io import ErrorMessage + from helpers.io import WarningMessage + import Viewer +except Exception, e: + helpers.io.catch( e ) + sys.exit( 1 ) + + +def boraHook ( **kw ): + bora = None + if kw.has_key('bora'): + bora = kw['bora'] + else: + print ErrorMessage( 3, 'boraHook(): Must be run from a BoraEngine.' ) + return + + try: + userInit = os.path.join( os.getcwd(), 'coriolis2/bora.py' ) + if (os.path.exists(userInit)): + execfile( userInit ) + except Exception, e: + helpers.io.catch( e ) + return diff --git a/bora/src/BoraEngine.cpp b/bora/src/BoraEngine.cpp index e6816644..5dcba10a 100644 --- a/bora/src/BoraEngine.cpp +++ b/bora/src/BoraEngine.cpp @@ -14,6 +14,7 @@ // +-----------------------------------------------------------------+ +#include #include #include #include @@ -30,6 +31,7 @@ #include "hurricane/Library.h" #include "hurricane/viewer/HApplication.h" #include "hurricane/viewer/ExceptionWidget.h" +#include "hurricane/viewer/Script.h" #include "hurricane/UpdateSession.h" #include "hurricane/analog/AnalogCellExtension.h" #include "hurricane/analog/LayoutGenerator.h" @@ -42,12 +44,16 @@ #include "bora/SlicingDataWidget.h" #include "bora/AnalogDistance.h" #include "bora/BoraEngine.h" +#include "bora/PyBoraEngine.h" namespace Bora { using namespace std; + using Hurricane::dbo_ptr; using Hurricane::Error; + using Hurricane::Warning; + using Hurricane::Breakpoint; using Hurricane::DebugSession; using Hurricane::NetRoutingState; using Hurricane::NetRoutingExtension; @@ -58,6 +64,7 @@ namespace Bora { using Hurricane::UpdateSession; using Analog::AnalogCellExtension; using Analog::Device; + using CRL::System; using CRL::GdsDriver; @@ -87,6 +94,7 @@ namespace Bora { void BoraEngine::_postCreate () { Super::_postCreate(); + _runBoraInit(); } @@ -100,6 +108,27 @@ namespace Bora { } + void BoraEngine::_runBoraInit () + { + Utilities::Path pythonSitePackages = System::getPath("pythonSitePackages"); + Utilities::Path systemConfDir = pythonSitePackages / "bora"; + Utilities::Path systemConfFile = systemConfDir / "boraInit.py"; + + if (systemConfFile.exists()) { + Isobar::Script::addPath( systemConfDir.toString() ); + + dbo_ptr script = Isobar::Script::create( systemConfFile.stem().toString() ); + script->addKwArgument( "bora" , (PyObject*)PyBoraEngine_Link(this) ); + script->runFunction ( "boraHook", getCell() ); + + Isobar::Script::removePath( systemConfDir.toString() ); + } else { + cerr << Warning( "Bora system configuration file:\n <%s> not found." + , systemConfFile.toString().c_str() ) << endl; + } + } + + BoraEngine::~BoraEngine () { } @@ -200,7 +229,7 @@ namespace Bora { CRL::RoutingGauge* rg = slicingtree->getRoutingGauge(); DbU::Unit hpitch = rg->getHorizontalPitch(); DbU::Unit vpitch = rg->getVerticalPitch(); - + slicingtree->expandRoutingChannel( hpitch*2, vpitch*2 ); slicingtree->replace(); slicingtree->updateSymNetAxis(); @@ -220,7 +249,8 @@ namespace Bora { Anabatic::Dijkstra* dijkstra = new Anabatic::Dijkstra( katana ); AnalogDistance distance = AnalogDistance( cell, hpitch, vpitch ); - dijkstra->setDistance( distance ); + dijkstra->setDistance ( distance ); + dijkstra->setSearchAreaHalo( std::max(hpitch,vpitch) ); for ( Net* net : cell->getNets() ) { distance.setNet( net ); diff --git a/bora/src/BoxSet.cpp b/bora/src/BoxSet.cpp index f6a312dd..ede29928 100644 --- a/bora/src/BoxSet.cpp +++ b/bora/src/BoxSet.cpp @@ -307,16 +307,16 @@ namespace Bora { if (abHeight % h2pitch) { cerr << Warning( "DBoxSet::create(): The height of device \"%s\" (%s) is not pitched on 2*%s (adjusted)." , getString(cell->getName()).c_str() - , DbU::getValueString(abHeight).c_str() - , DbU::getValueString(h2pitch ).c_str() + , DbU::getValueString(abHeight ).c_str() + , DbU::getValueString(h2pitch/2).c_str() ) << endl; abHeight += h2pitch - (abHeight % h2pitch); } if (abWidth % v2pitch) { cerr << Warning( "DBoxSet::create(): The width of device \"%s\" (%s) is not pitched on 2*%s (adjusted)." , getString(cell->getName()).c_str() - , DbU::getValueString(abWidth).c_str() - , DbU::getValueString(v2pitch).c_str() + , DbU::getValueString(abWidth ).c_str() + , DbU::getValueString(v2pitch/2).c_str() ) << endl; abWidth += v2pitch - (abWidth % v2pitch); } diff --git a/bora/src/bora/BoraEngine.h b/bora/src/bora/BoraEngine.h index a130fa4c..c9c2917f 100644 --- a/bora/src/bora/BoraEngine.h +++ b/bora/src/bora/BoraEngine.h @@ -67,6 +67,7 @@ namespace Bora { virtual ~BoraEngine (); virtual void _postCreate (); virtual void _preDestroy (); + virtual void _runBoraInit (); private: static Hurricane::Name _toolName; diff --git a/crlcore/src/ccore/RoutingGauge.cpp b/crlcore/src/ccore/RoutingGauge.cpp index 97bd201a..1ef5c08f 100644 --- a/crlcore/src/ccore/RoutingGauge.cpp +++ b/crlcore/src/ccore/RoutingGauge.cpp @@ -122,23 +122,31 @@ namespace CRL { RoutingLayerGauge* RoutingGauge::getHorizontalGauge () const { + RoutingLayerGauge* pinOnly = NULL; for ( RoutingLayerGauge* gauge : _layerGauges ) { - //if ( (gauge->getType() != Constant::LayerGaugeType::PinOnly) and gauge->isHorizontal() ) - if (gauge->isHorizontal()) - return gauge; + if (gauge->isHorizontal()) { + if (gauge->getType() != Constant::LayerGaugeType::PinOnly) + return gauge; + else if (not pinOnly) + pinOnly = gauge; + } } - return NULL; + return pinOnly; } RoutingLayerGauge* RoutingGauge::getVerticalGauge () const { + RoutingLayerGauge* pinOnly = NULL; for ( RoutingLayerGauge* gauge : _layerGauges ) { - //if ( (gauge->getType() != Constant::LayerGaugeType::PinOnly) and gauge->isVertical() ) - if (gauge->isVertical()) - return gauge; + if (gauge->isVertical()) { + if (gauge->getType() != Constant::LayerGaugeType::PinOnly) + return gauge; + else if (not pinOnly) + pinOnly = gauge; + } } - return NULL; + return pinOnly; } diff --git a/katana/src/SegmentFsm.cpp b/katana/src/SegmentFsm.cpp index 89ef85f3..7473ba93 100644 --- a/katana/src/SegmentFsm.cpp +++ b/katana/src/SegmentFsm.cpp @@ -779,7 +779,7 @@ namespace Katana { _event2->setEventLevel( 0 ); _event2->setProcessed( true ); - cdebug_log(9000,0) << "Deter| addInsertEvent() @" << getTrack1(i) << endl; + cdebug_log(9000,0) << "Deter| addInsertEvent() @" << getTrack2(i) << endl; Session::addInsertEvent( getSegment2(), getTrack2(i), getCandidateAxis2(i) ); } diff --git a/katana/src/TrackCost.cpp b/katana/src/TrackCost.cpp index 79bd51ee..56f775bf 100644 --- a/katana/src/TrackCost.cpp +++ b/katana/src/TrackCost.cpp @@ -43,7 +43,7 @@ namespace Katana { : _flags ((symSegment) ? Symmetric : NoFlags) , _span (refSegment->getTrackSpan()) , _refCandidateAxis(refCandidateAxis) - , _symCandidateAxis(refCandidateAxis) + , _symCandidateAxis(symCandidateAxis) , _tracks ( _span * ((symSegment) ? 2 : 1) , std::tuple(NULL,Track::npos,Track::npos) ) , _segment1 (refSegment) @@ -83,6 +83,8 @@ namespace Katana { _segment1->addOverlapCost( *this ); if (symTrack) { + cdebug_log(159,0) << " _tracks.size(): " << _tracks.size() << " _span:" << _span << endl; + std::get<0>( _tracks[_span] ) = symTrack; select( 0, Symmetric ); _segment2->addOverlapCost( *this );