diff --git a/crlcore/src/ccore/RoutingGauge.cpp b/crlcore/src/ccore/RoutingGauge.cpp index 53166a6c..90ce9e95 100644 --- a/crlcore/src/ccore/RoutingGauge.cpp +++ b/crlcore/src/ccore/RoutingGauge.cpp @@ -145,7 +145,7 @@ namespace CRL { RoutingLayerGauge* RoutingGauge::getLayerGauge ( const Layer* layer ) const { for ( size_t i=0 ; i < _layerGauges.size() ; i++ ) { - if ( _layerGauges[i]->getLayer() == layer ) + if (_layerGauges[i]->getLayer()->getMask() == layer->getMask()) return _layerGauges[i]; } return NULL; @@ -155,7 +155,7 @@ namespace CRL { unsigned int RoutingGauge::getLayerType ( const Layer* layer ) const { RoutingLayerGauge* layerGauge = getLayerGauge(layer); - if ( !layerGauge ) return 0; + if (not layerGauge) return 0; return layerGauge->getType(); } @@ -164,7 +164,7 @@ namespace CRL { unsigned int RoutingGauge::getLayerDirection ( const Layer* layer ) const { RoutingLayerGauge* layerGauge = getLayerGauge(layer); - if ( !layerGauge ) return 0; + if (not layerGauge) return 0; return layerGauge->getDirection(); } @@ -178,7 +178,7 @@ namespace CRL { if (viaLayer) bottomLayer = viaLayer->getBottom(); for ( size_t i=0 ; i < _layerGauges.size() ; i++ ) { - if ( _layerGauges[i]->getLayer()->getMask() == bottomLayer->getMask() ) + if (_layerGauges[i]->getLayer()->getMask() == bottomLayer->getMask()) return i; } return nlayerdepth; @@ -188,7 +188,7 @@ namespace CRL { size_t RoutingGauge::getLayerDepth ( const Layer* layer ) const { for ( size_t i=0 ; i < _layerGauges.size() ; i++ ) { - if ( _layerGauges[i]->getLayer()->getMask() == layer->getMask() ) + if (_layerGauges[i]->getLayer()->getMask() == layer->getMask()) return i; } return nlayerdepth; diff --git a/crlcore/src/ccore/RoutingLayerGauge.cpp b/crlcore/src/ccore/RoutingLayerGauge.cpp index b82b5192..b643800e 100644 --- a/crlcore/src/ccore/RoutingLayerGauge.cpp +++ b/crlcore/src/ccore/RoutingLayerGauge.cpp @@ -217,7 +217,7 @@ namespace CRL { } - unsigned RoutingLayerGauge::getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const + long RoutingLayerGauge::getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const { cdebug_log(100,1) << "RoutingLayerGauge::getTrackIndex ( " << position << " )" << endl; @@ -228,15 +228,15 @@ namespace CRL { cdebug_log(100,0) << "index := " << index << endl; if ( index < 0 ) { - cdebug_tabw(100,-1); - return 0; + //cdebug_tabw(100,-1); + //return 0; - // throw Error ( negativeIndex - // , getString(this).c_str() - // , DbU::getValueString(position).c_str() - // , DbU::getValueString(start).c_str() - // , DbU::getValueString(stop).c_str() - // ); + //throw Error ( negativeIndex + // , getString(this).c_str() + // , DbU::getValueString(position).c_str() + // , DbU::getValueString(start).c_str() + // , DbU::getValueString(stop).c_str() + // ); } if ( ( mode & Constant::Exact ) and ( modulo != 0 ) ) @@ -248,17 +248,17 @@ namespace CRL { if ( modulo > _pitch / 2 ) index++; } - unsigned int tracksNumber = getTrackNumber(start,stop); - if ( (unsigned)index > tracksNumber ) { - cdebug_tabw(100,-1); - return (tracksNumber > 0) ? tracksNumber-1 : 0; - // throw Error ( overflowIndex - // , getString(this).c_str() - // , DbU::getValueString(position).c_str() - // , DbU::getValueString(start).c_str() - // , DbU::getValueString(stop).c_str() - // ); - } + // unsigned int tracksNumber = getTrackNumber(start,stop); + // if ( (unsigned)index > tracksNumber ) { + // cdebug_tabw(100,-1); + // return (tracksNumber > 0) ? tracksNumber-1 : 0; + // // throw Error ( overflowIndex + // // , getString(this).c_str() + // // , DbU::getValueString(position).c_str() + // // , DbU::getValueString(start).c_str() + // // , DbU::getValueString(stop).c_str() + // // ); + // } cdebug_tabw(100,-1); @@ -266,8 +266,8 @@ namespace CRL { } - DbU::Unit RoutingLayerGauge::getTrackPosition ( DbU::Unit start, unsigned depth ) const - { return depth * _pitch + _offset + start; } + DbU::Unit RoutingLayerGauge::getTrackPosition ( DbU::Unit start, long index ) const + { return index * _pitch + _offset + start; } string RoutingLayerGauge::_getTypeName () const diff --git a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h index 5d7b0071..73ad6207 100644 --- a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h @@ -108,9 +108,9 @@ namespace CRL { inline DbU::Unit getObstacleDw () const; void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const; unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) const; - unsigned int getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const; + long getTrackIndex ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const; inline DbU::Unit getTrackPosition ( DbU::Unit start, DbU::Unit stop, DbU::Unit position, unsigned mode ) const; - DbU::Unit getTrackPosition ( DbU::Unit start, unsigned depth ) const; + DbU::Unit getTrackPosition ( DbU::Unit start, long index ) const; // Hurricane Managment. void toJson ( JsonWriter* ) const; virtual string _getTypeName () const; diff --git a/crlcore/src/pyCRL/PyRoutingGauge.cpp b/crlcore/src/pyCRL/PyRoutingGauge.cpp index 4876cb38..bd5231f6 100644 --- a/crlcore/src/pyCRL/PyRoutingGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingGauge.cpp @@ -290,7 +290,10 @@ extern "C" { if (PyArg_ParseTuple( args, "I:RoutingGauge.getRoutingLayer", &depth)) { layer = const_cast(rg->getRoutingLayer( (size_t)depth )); if ( layer == NULL ) { - PyErr_SetString ( ConstructorError, "No layer at the requested depth RoutingGauge.getRoutingLayer()." ); + string message + = "RoutingGauge.getRoutingLayer(): No layer at the requested depth " + getString(depth) + + " (must be < " + getString(rg->getDepth()) + ")."; + PyErr_SetString ( ConstructorError, message.c_str() ); return NULL; } } else { @@ -317,7 +320,10 @@ extern "C" { if (PyArg_ParseTuple( args, "I:RoutingGauge.getContactLayer", &depth)) { layer = rg->getContactLayer( (size_t)depth ); if ( layer == NULL ) { - PyErr_SetString ( ConstructorError, "No layer at the requested depth RoutingGauge.getContactLayer()." ); + string message + = "RoutingGauge.getContactLayer(): No layer at the requested depth " + getString(depth) + + " (must be < " + getString(rg->getDepth()-1) + ")."; + PyErr_SetString ( ConstructorError, message.c_str() ); return NULL; } } else { diff --git a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp index 47abc85c..bf2a9a10 100644 --- a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp @@ -198,7 +198,7 @@ extern "C" { { cdebug_log(30,0) << "PyRoutingLayerGauge_getTrackIndex()" << endl; - unsigned int trackIndex = 0; + long trackIndex = 0; HTRY METHOD_HEAD("RoutingLayerGauge.getTrackIndex()") @@ -228,7 +228,7 @@ extern "C" { } HCATCH - return Py_BuildValue("I",trackIndex); + return Py_BuildValue("l",trackIndex); } @@ -241,11 +241,11 @@ extern "C" { HTRY METHOD_HEAD("RoutingLayerGauge.getTrackPosition()") - PyObject* pyStart = NULL; - unsigned int depth = 0; + PyObject* pyStart = NULL; + long index = 0; - if (PyArg_ParseTuple( args, "OI:RoutingLayerGauge.getTrackIndex", &pyStart, &depth)) { - trackPosition = rlg->getTrackPosition( PyAny_AsLong(pyStart), depth); + if (PyArg_ParseTuple( args, "Ol:RoutingLayerGauge.getTrackIndex", &pyStart, &index)) { + trackPosition = rlg->getTrackPosition( PyAny_AsLong(pyStart), index); } else { PyErr_SetString ( ConstructorError, "Bad parameters given to RoutingLayerGauge.getTrackPosition()." ); return NULL; diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index bc1d1681..3c13f294 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -826,6 +826,8 @@ extern "C" { PyModule_AddObject ( module, "Plug" , (PyObject*)&PyTypePlug ); Py_INCREF ( &PyTypeRoutingPad ); PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad ); + Py_INCREF ( &PyTypeSegment ); + PyModule_AddObject ( module, "Segment" , (PyObject*)&PyTypeSegment ); Py_INCREF ( &PyTypeVertical ); PyModule_AddObject ( module, "Vertical" , (PyObject*)&PyTypeVertical ); Py_INCREF ( &PyTypeHorizontal ); diff --git a/hurricane/src/isobar/PyLayer.cpp b/hurricane/src/isobar/PyLayer.cpp index 7d34d57d..92e71e90 100644 --- a/hurricane/src/isobar/PyLayer.cpp +++ b/hurricane/src/isobar/PyLayer.cpp @@ -256,13 +256,14 @@ extern "C" { if (PyArg_ParseTuple( args, "O&|O&:Layer.getEnclosure()" , Converter, &arg0 , Converter, &arg1 )) { - if (__cs.getObjectIds() == ":basiclayer:int") + if ( (__cs.getObjectIds() == ":layer:int") and (PYBASICLAYER_O(arg0)) ) rvalue = layer->getEnclosure( PYBASICLAYER_O(arg0), PyAny_AsLong(arg1) ); else if ( __cs.getObjectIds() == ":int" ) rvalue = layer->getEnclosure( PyAny_AsLong(arg1) ); else { - PyErr_SetString ( ConstructorError - , "invalid parameter type for Layer.getEnclosure()." ); + string message = "invalid parameter type for Layer.getEnclosure() (\"" + + __cs.getObjectIds() + "\")"; + PyErr_SetString ( ConstructorError, message.c_str() ); return NULL; } } else {