Tweaking Layer & RoutingGauge management. Allow negative track indexes.
* Bug: In Hurricane python module, forgot to add the Segment type. * Change: In Isobar/layer.getEnclosure() wrapper check and cast the Layer argument into BasicLayer. * Change: In CRL::RoutingGauge::getLayerGauge(Layer*), getLayerType() and getLayerDirection() no longer check layer identity based on layer mask instead of just Layer* pointer. To allow a unified call wether the layer is real or symbolic. * Change: In CRL::RoutingLayerGauge::getTrackIndex() and getTrackPositon(), no longer consider negative indexes as invalid and reset them to zero. The check for out of bound index is now left to Anabatic & Katana. * Change: In CRL/RoutingGauge.getRoutingLayer() and getContactLayer(), more detailed error message. * Change: In CRL/RoutingLayerGauge.getTrackIndex() and getTrackPosition(), indexes are now signed long instead of unsigned.
This commit is contained in:
parent
2beee8a25c
commit
43629a6c1c
|
@ -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;
|
||||
|
|
|
@ -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,10 +228,10 @@ 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
|
||||
//throw Error ( negativeIndex
|
||||
// , getString(this).c_str()
|
||||
// , DbU::getValueString(position).c_str()
|
||||
// , DbU::getValueString(start).c_str()
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -290,7 +290,10 @@ extern "C" {
|
|||
if (PyArg_ParseTuple( args, "I:RoutingGauge.getRoutingLayer", &depth)) {
|
||||
layer = const_cast<Layer*>(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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,10 +242,10 @@ extern "C" {
|
|||
METHOD_HEAD("RoutingLayerGauge.getTrackPosition()")
|
||||
|
||||
PyObject* pyStart = NULL;
|
||||
unsigned int depth = 0;
|
||||
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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue