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
|
RoutingLayerGauge* RoutingGauge::getLayerGauge ( const Layer* layer ) const
|
||||||
{
|
{
|
||||||
for ( size_t i=0 ; i < _layerGauges.size() ; i++ ) {
|
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 _layerGauges[i];
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -155,7 +155,7 @@ namespace CRL {
|
||||||
unsigned int RoutingGauge::getLayerType ( const Layer* layer ) const
|
unsigned int RoutingGauge::getLayerType ( const Layer* layer ) const
|
||||||
{
|
{
|
||||||
RoutingLayerGauge* layerGauge = getLayerGauge(layer);
|
RoutingLayerGauge* layerGauge = getLayerGauge(layer);
|
||||||
if ( !layerGauge ) return 0;
|
if (not layerGauge) return 0;
|
||||||
|
|
||||||
return layerGauge->getType();
|
return layerGauge->getType();
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ namespace CRL {
|
||||||
unsigned int RoutingGauge::getLayerDirection ( const Layer* layer ) const
|
unsigned int RoutingGauge::getLayerDirection ( const Layer* layer ) const
|
||||||
{
|
{
|
||||||
RoutingLayerGauge* layerGauge = getLayerGauge(layer);
|
RoutingLayerGauge* layerGauge = getLayerGauge(layer);
|
||||||
if ( !layerGauge ) return 0;
|
if (not layerGauge) return 0;
|
||||||
|
|
||||||
return layerGauge->getDirection();
|
return layerGauge->getDirection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
cdebug_log(100,1) << "RoutingLayerGauge::getTrackIndex ( " << position << " )" << endl;
|
||||||
|
|
||||||
|
@ -228,8 +228,8 @@ namespace CRL {
|
||||||
cdebug_log(100,0) << "index := " << index << endl;
|
cdebug_log(100,0) << "index := " << index << endl;
|
||||||
|
|
||||||
if ( index < 0 ) {
|
if ( index < 0 ) {
|
||||||
cdebug_tabw(100,-1);
|
//cdebug_tabw(100,-1);
|
||||||
return 0;
|
//return 0;
|
||||||
|
|
||||||
//throw Error ( negativeIndex
|
//throw Error ( negativeIndex
|
||||||
// , getString(this).c_str()
|
// , getString(this).c_str()
|
||||||
|
@ -248,17 +248,17 @@ namespace CRL {
|
||||||
if ( modulo > _pitch / 2 ) index++;
|
if ( modulo > _pitch / 2 ) index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int tracksNumber = getTrackNumber(start,stop);
|
// unsigned int tracksNumber = getTrackNumber(start,stop);
|
||||||
if ( (unsigned)index > tracksNumber ) {
|
// if ( (unsigned)index > tracksNumber ) {
|
||||||
cdebug_tabw(100,-1);
|
// cdebug_tabw(100,-1);
|
||||||
return (tracksNumber > 0) ? tracksNumber-1 : 0;
|
// return (tracksNumber > 0) ? tracksNumber-1 : 0;
|
||||||
// throw Error ( overflowIndex
|
// // throw Error ( overflowIndex
|
||||||
// , getString(this).c_str()
|
// // , getString(this).c_str()
|
||||||
// , DbU::getValueString(position).c_str()
|
// // , DbU::getValueString(position).c_str()
|
||||||
// , DbU::getValueString(start).c_str()
|
// // , DbU::getValueString(start).c_str()
|
||||||
// , DbU::getValueString(stop).c_str()
|
// // , DbU::getValueString(stop).c_str()
|
||||||
// );
|
// // );
|
||||||
}
|
// }
|
||||||
|
|
||||||
cdebug_tabw(100,-1);
|
cdebug_tabw(100,-1);
|
||||||
|
|
||||||
|
@ -266,8 +266,8 @@ namespace CRL {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DbU::Unit RoutingLayerGauge::getTrackPosition ( DbU::Unit start, unsigned depth ) const
|
DbU::Unit RoutingLayerGauge::getTrackPosition ( DbU::Unit start, long index ) const
|
||||||
{ return depth * _pitch + _offset + start; }
|
{ return index * _pitch + _offset + start; }
|
||||||
|
|
||||||
|
|
||||||
string RoutingLayerGauge::_getTypeName () const
|
string RoutingLayerGauge::_getTypeName () const
|
||||||
|
|
|
@ -108,9 +108,9 @@ namespace CRL {
|
||||||
inline DbU::Unit getObstacleDw () const;
|
inline DbU::Unit getObstacleDw () const;
|
||||||
void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const;
|
void divide ( DbU::Unit dividend, long& quotient, long& modulo ) const;
|
||||||
unsigned int getTrackNumber ( DbU::Unit start, DbU::Unit stop ) 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;
|
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.
|
// Hurricane Managment.
|
||||||
void toJson ( JsonWriter* ) const;
|
void toJson ( JsonWriter* ) const;
|
||||||
virtual string _getTypeName () const;
|
virtual string _getTypeName () const;
|
||||||
|
|
|
@ -290,7 +290,10 @@ extern "C" {
|
||||||
if (PyArg_ParseTuple( args, "I:RoutingGauge.getRoutingLayer", &depth)) {
|
if (PyArg_ParseTuple( args, "I:RoutingGauge.getRoutingLayer", &depth)) {
|
||||||
layer = const_cast<Layer*>(rg->getRoutingLayer( (size_t)depth ));
|
layer = const_cast<Layer*>(rg->getRoutingLayer( (size_t)depth ));
|
||||||
if ( layer == NULL ) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -317,7 +320,10 @@ extern "C" {
|
||||||
if (PyArg_ParseTuple( args, "I:RoutingGauge.getContactLayer", &depth)) {
|
if (PyArg_ParseTuple( args, "I:RoutingGauge.getContactLayer", &depth)) {
|
||||||
layer = rg->getContactLayer( (size_t)depth );
|
layer = rg->getContactLayer( (size_t)depth );
|
||||||
if ( layer == NULL ) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -198,7 +198,7 @@ extern "C" {
|
||||||
{
|
{
|
||||||
cdebug_log(30,0) << "PyRoutingLayerGauge_getTrackIndex()" << endl;
|
cdebug_log(30,0) << "PyRoutingLayerGauge_getTrackIndex()" << endl;
|
||||||
|
|
||||||
unsigned int trackIndex = 0;
|
long trackIndex = 0;
|
||||||
|
|
||||||
HTRY
|
HTRY
|
||||||
METHOD_HEAD("RoutingLayerGauge.getTrackIndex()")
|
METHOD_HEAD("RoutingLayerGauge.getTrackIndex()")
|
||||||
|
@ -228,7 +228,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
HCATCH
|
HCATCH
|
||||||
|
|
||||||
return Py_BuildValue("I",trackIndex);
|
return Py_BuildValue("l",trackIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,10 +242,10 @@ extern "C" {
|
||||||
METHOD_HEAD("RoutingLayerGauge.getTrackPosition()")
|
METHOD_HEAD("RoutingLayerGauge.getTrackPosition()")
|
||||||
|
|
||||||
PyObject* pyStart = NULL;
|
PyObject* pyStart = NULL;
|
||||||
unsigned int depth = 0;
|
long index = 0;
|
||||||
|
|
||||||
if (PyArg_ParseTuple( args, "OI:RoutingLayerGauge.getTrackIndex", &pyStart, &depth)) {
|
if (PyArg_ParseTuple( args, "Ol:RoutingLayerGauge.getTrackIndex", &pyStart, &index)) {
|
||||||
trackPosition = rlg->getTrackPosition( PyAny_AsLong(pyStart), depth);
|
trackPosition = rlg->getTrackPosition( PyAny_AsLong(pyStart), index);
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString ( ConstructorError, "Bad parameters given to RoutingLayerGauge.getTrackPosition()." );
|
PyErr_SetString ( ConstructorError, "Bad parameters given to RoutingLayerGauge.getTrackPosition()." );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -826,6 +826,8 @@ extern "C" {
|
||||||
PyModule_AddObject ( module, "Plug" , (PyObject*)&PyTypePlug );
|
PyModule_AddObject ( module, "Plug" , (PyObject*)&PyTypePlug );
|
||||||
Py_INCREF ( &PyTypeRoutingPad );
|
Py_INCREF ( &PyTypeRoutingPad );
|
||||||
PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad );
|
PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad );
|
||||||
|
Py_INCREF ( &PyTypeSegment );
|
||||||
|
PyModule_AddObject ( module, "Segment" , (PyObject*)&PyTypeSegment );
|
||||||
Py_INCREF ( &PyTypeVertical );
|
Py_INCREF ( &PyTypeVertical );
|
||||||
PyModule_AddObject ( module, "Vertical" , (PyObject*)&PyTypeVertical );
|
PyModule_AddObject ( module, "Vertical" , (PyObject*)&PyTypeVertical );
|
||||||
Py_INCREF ( &PyTypeHorizontal );
|
Py_INCREF ( &PyTypeHorizontal );
|
||||||
|
|
|
@ -256,13 +256,14 @@ extern "C" {
|
||||||
if (PyArg_ParseTuple( args, "O&|O&:Layer.getEnclosure()"
|
if (PyArg_ParseTuple( args, "O&|O&:Layer.getEnclosure()"
|
||||||
, Converter, &arg0
|
, Converter, &arg0
|
||||||
, Converter, &arg1 )) {
|
, 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) );
|
rvalue = layer->getEnclosure( PYBASICLAYER_O(arg0), PyAny_AsLong(arg1) );
|
||||||
else if ( __cs.getObjectIds() == ":int" )
|
else if ( __cs.getObjectIds() == ":int" )
|
||||||
rvalue = layer->getEnclosure( PyAny_AsLong(arg1) );
|
rvalue = layer->getEnclosure( PyAny_AsLong(arg1) );
|
||||||
else {
|
else {
|
||||||
PyErr_SetString ( ConstructorError
|
string message = "invalid parameter type for Layer.getEnclosure() (\""
|
||||||
, "invalid parameter type for Layer.getEnclosure()." );
|
+ __cs.getObjectIds() + "\")";
|
||||||
|
PyErr_SetString ( ConstructorError, message.c_str() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue