From 63a03bf11b63aec4f11797c606ffd56c2982460d Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 2 Mar 2021 12:17:40 +0100 Subject: [PATCH] Add a new RoutingLayerGauge type "PowerSupply". * New: In CRL::RoutingLayerGauge, add a new kind of gauge "PowerSupply" to flag a layer which is dedicated to routing power supplies. * New: In AllianceFramework, add management of PowerSupply gauge kind. Exported in the Python interface. --- crlcore/src/ccore/RoutingGauge.cpp | 13 +++ crlcore/src/ccore/crlcore/RoutingGauge.h | 99 ++++++++++--------- crlcore/src/ccore/crlcore/RoutingLayerGauge.h | 19 ++-- crlcore/src/pyCRL/PyCRL.cpp | 1 + crlcore/src/pyCRL/PyRoutingGauge.cpp | 40 ++++++-- crlcore/src/pyCRL/PyRoutingLayerGauge.cpp | 20 ++-- crlcore/src/pyCRL/crlcore/PyRoutingGauge.h | 7 +- 7 files changed, 118 insertions(+), 81 deletions(-) diff --git a/crlcore/src/ccore/RoutingGauge.cpp b/crlcore/src/ccore/RoutingGauge.cpp index 17f97d15..07eb5e83 100644 --- a/crlcore/src/ccore/RoutingGauge.cpp +++ b/crlcore/src/ccore/RoutingGauge.cpp @@ -126,6 +126,19 @@ namespace CRL { { return (getLayerGauge(layer) != NULL) or (getViaDepth(layer) != nlayerdepth); } + RoutingLayerGauge* RoutingGauge::getPowerSupplyGauge () const + { + size_t i = _layerGauges.size(); + if (i == 0) return NULL; + do { + --i; + if (_layerGauges[i]->getType() == Constant::PowerSupply) + return _layerGauges[i]; + } while ( i > 0); + return NULL; + } + + RoutingLayerGauge* RoutingGauge::getHorizontalGauge () const { RoutingLayerGauge* pinOnly = NULL; diff --git a/crlcore/src/ccore/crlcore/RoutingGauge.h b/crlcore/src/ccore/crlcore/RoutingGauge.h index 9cbe42ef..caf04eaf 100644 --- a/crlcore/src/ccore/crlcore/RoutingGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingGauge.h @@ -51,54 +51,56 @@ namespace CRL { // Constants. static const size_t nlayerdepth; // Constructors & Destructors. - static RoutingGauge* create ( const char* name ); - virtual void destroy (); - // Predicates. - inline bool isSymbolic () const; - inline bool isTwoMetals () const; - inline bool isHV () const; - inline bool isVH () const; - bool hasLayer ( const Layer* ) const; - // Accessors. - RoutingGauge* getClone () const; - inline const Name getName () const; - inline Technology* getTechnology () const; - inline size_t getDepth () const; - inline DbU::Unit getHorizontalPitch () const; - inline DbU::Unit getVerticalPitch () const; - RoutingLayerGauge* getHorizontalGauge () const; - RoutingLayerGauge* getVerticalGauge () const; - RoutingLayerGauge* getLayerGauge ( const Layer* ) const; - size_t getViaDepth ( const Layer* ) const; - size_t getLayerDepth ( const Layer* ) const; - unsigned int getLayerType ( const Layer* ) const; - unsigned int getLayerDirection ( const Layer* ) const; - DbU::Unit getPitch ( const Layer* ) const; - DbU::Unit getOffset ( const Layer* ) const; - DbU::Unit getWireWidth ( const Layer* ) const; - DbU::Unit getPWireWidth ( const Layer* ) const; - DbU::Unit getViaWidth ( const Layer* ) const; - RoutingLayerGauge* getLayerGauge ( size_t depth ) const; - inline unsigned int getLayerDirection ( size_t depth ) const; - inline unsigned int getLayerType ( size_t depth ) const; - inline DbU::Unit getLayerPitch ( size_t depth ) const; - inline DbU::Unit getLayerOffset ( size_t depth ) const; - inline DbU::Unit getLayerWireWidth ( size_t depth ) const; - inline DbU::Unit getLayerPWireWidth ( size_t depth ) const; - inline DbU::Unit getViaWidth ( size_t depth ) const; - const Layer* getRoutingLayer ( size_t depth ) const; - Layer* getContactLayer ( size_t depth ) const; - const vector& - getLayerGauges () const; - // Methods. - void addLayerGauge ( RoutingLayerGauge* layerGauge ); - void checkConnexity () const; - inline void setSymbolic ( bool ); - // Hurricane Managment. - void toJson ( JsonWriter* ) const; - virtual Record* _getRecord ( Record* record=NULL ) const; - virtual string _getString () const; - virtual string _getTypeName () const; + static RoutingGauge* create ( const char* name ); + virtual void destroy (); + // Predicates. + inline bool isSymbolic () const; + inline bool isTwoMetals () const; + inline bool isHV () const; + inline bool isVH () const; + inline bool hasPowerSupply () const; + bool hasLayer ( const Layer* ) const; + // Accessors. + RoutingGauge* getClone () const; + inline const Name getName () const; + inline Technology* getTechnology () const; + inline size_t getDepth () const; + inline DbU::Unit getHorizontalPitch () const; + inline DbU::Unit getVerticalPitch () const; + RoutingLayerGauge* getHorizontalGauge () const; + RoutingLayerGauge* getVerticalGauge () const; + RoutingLayerGauge* getPowerSupplyGauge () const; + RoutingLayerGauge* getLayerGauge ( const Layer* ) const; + size_t getViaDepth ( const Layer* ) const; + size_t getLayerDepth ( const Layer* ) const; + unsigned int getLayerType ( const Layer* ) const; + unsigned int getLayerDirection ( const Layer* ) const; + DbU::Unit getPitch ( const Layer* ) const; + DbU::Unit getOffset ( const Layer* ) const; + DbU::Unit getWireWidth ( const Layer* ) const; + DbU::Unit getPWireWidth ( const Layer* ) const; + DbU::Unit getViaWidth ( const Layer* ) const; + RoutingLayerGauge* getLayerGauge ( size_t depth ) const; + inline unsigned int getLayerDirection ( size_t depth ) const; + inline unsigned int getLayerType ( size_t depth ) const; + inline DbU::Unit getLayerPitch ( size_t depth ) const; + inline DbU::Unit getLayerOffset ( size_t depth ) const; + inline DbU::Unit getLayerWireWidth ( size_t depth ) const; + inline DbU::Unit getLayerPWireWidth ( size_t depth ) const; + inline DbU::Unit getViaWidth ( size_t depth ) const; + const Layer* getRoutingLayer ( size_t depth ) const; + Layer* getContactLayer ( size_t depth ) const; + const vector& + getLayerGauges () const; + // Methods. + void addLayerGauge ( RoutingLayerGauge* layerGauge ); + void checkConnexity () const; + inline void setSymbolic ( bool ); + // Hurricane Managment. + void toJson ( JsonWriter* ) const; + virtual Record* _getRecord ( Record* record=NULL ) const; + virtual string _getString () const; + virtual string _getTypeName () const; protected: // Internal - Attributes. @@ -121,6 +123,7 @@ namespace CRL { inline bool RoutingGauge::isTwoMetals () const { return (getDepth() < 3); } inline bool RoutingGauge::isHV () const { return not isTwoMetals() and (getLayerGauge(1)->isHorizontal()); } inline bool RoutingGauge::isVH () const { return not isTwoMetals() and (getLayerGauge(1)->isVertical()); } + inline bool RoutingGauge::hasPowerSupply () const { return (getPowerSupplyGauge() != NULL); } inline const Name RoutingGauge::getName () const { return _name; } inline size_t RoutingGauge::getDepth () const { return _layerGauges.size(); } inline Technology* RoutingGauge::getTechnology () const { return _technology; } diff --git a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h index b58bf6e8..0caab67a 100644 --- a/crlcore/src/ccore/crlcore/RoutingLayerGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingLayerGauge.h @@ -14,10 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef CRL_ROUTING_LAYER_GAUGE_H -#define CRL_ROUTING_LAYER_GAUGE_H - - +#pragma once #include #include "hurricane/Commons.h" #include "hurricane/Error.h" @@ -39,6 +36,7 @@ namespace Constant { enum LayerGaugeType { Default = (1<<0) , PinOnly = (1<<1) + , PowerSupply = (1<<2) }; enum Round { Superior = (1<<2) @@ -277,8 +275,9 @@ inline std::string getString ( const Constant::LayerGaugeType* layerGaugeType ) { switch ( *layerGaugeType ) { - case Constant::Default: return "Default"; - case Constant::PinOnly: return "PinOnly"; + case Constant::Default: return "Default"; + case Constant::PinOnly: return "PinOnly"; + case Constant::PowerSupply: return "PowerSupply"; } return "Unknown Constant::LayerGaugeType"; } @@ -295,8 +294,9 @@ inline std::string getString ( const Constant::LayerGaugeType layerGaugeType ) { switch ( layerGaugeType ) { - case Constant::Default: return "Default"; - case Constant::PinOnly: return "PinOnly"; + case Constant::Default: return "Default"; + case Constant::PinOnly: return "PinOnly"; + case Constant::PowerSupply: return "PowerSupply"; } return "Unknown Constant::LayerGaugeType"; } @@ -309,6 +309,3 @@ inline std::string getString IOSTREAM_POINTER_SUPPORT(Constant::LayerGaugeType); - - -#endif // CRL_ROUTING_LAYER_GAUGE_H diff --git a/crlcore/src/pyCRL/PyCRL.cpp b/crlcore/src/pyCRL/PyCRL.cpp index 4d5691cb..b9fc7c1c 100644 --- a/crlcore/src/pyCRL/PyCRL.cpp +++ b/crlcore/src/pyCRL/PyCRL.cpp @@ -212,6 +212,7 @@ extern "C" { PyCatalog_postModuleInit (); PyEnvironment_postModuleInit (); + PyRoutingGauge_postModuleInit (); PyRoutingLayerGauge_postModuleInit (); PyAllianceFramework_postModuleInit (); diff --git a/crlcore/src/pyCRL/PyRoutingGauge.cpp b/crlcore/src/pyCRL/PyRoutingGauge.cpp index a1bd4761..b31b5d8f 100644 --- a/crlcore/src/pyCRL/PyRoutingGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingGauge.cpp @@ -402,6 +402,19 @@ extern "C" { } + static PyObject* PyRoutingGauge_getPowerSupplyGauge ( PyRoutingGauge* self ) + { + cdebug_log(30,0) << "PyRoutingGauge_getPowerSupplyGauge()" << endl; + RoutingLayerGauge* rlg = NULL; + HTRY + METHOD_HEAD("RoutingGauge.getPowerSupplyGauge()") + rlg = rg->getPowerSupplyGauge(); + if (not rlg) Py_RETURN_NONE; + HCATCH + return PyRoutingLayerGauge_Link( rlg ); + } + + static PyObject* PyRoutingGauge_getRoutingLayer ( PyRoutingGauge* self, PyObject* args ) { cdebug_log(30,0) << "PyRoutingGauge_getRoutingLayer()" << endl; @@ -490,10 +503,11 @@ extern "C" { // Standard Attributes. GetNameMethod(RoutingGauge,rg) accessorVectorFromVoid(getLayerGauges,PyRoutingGauge,RoutingGauge,RoutingLayerGauge) - DirectGetBoolAttribute(PyRoutingGauge_isSymbolic ,isSymbolic ,PyRoutingGauge,RoutingGauge) - DirectSetBoolAttribute(PyRoutingGauge_setSymbolic,setSymbolic,PyRoutingGauge,RoutingGauge) - DirectGetBoolAttribute(PyRoutingGauge_isHV ,isHV ,PyRoutingGauge,RoutingGauge) - DirectGetBoolAttribute(PyRoutingGauge_isVH ,isVH ,PyRoutingGauge,RoutingGauge) + DirectGetBoolAttribute(PyRoutingGauge_isSymbolic ,isSymbolic ,PyRoutingGauge,RoutingGauge) + DirectSetBoolAttribute(PyRoutingGauge_setSymbolic ,setSymbolic ,PyRoutingGauge,RoutingGauge) + DirectGetBoolAttribute(PyRoutingGauge_isHV ,isHV ,PyRoutingGauge,RoutingGauge) + DirectGetBoolAttribute(PyRoutingGauge_isVH ,isVH ,PyRoutingGauge,RoutingGauge) + DirectGetBoolAttribute(PyRoutingGauge_hasPowerSupply,hasPowerSupply,PyRoutingGauge,RoutingGauge) // Standart Destroy (Attribute). @@ -508,6 +522,8 @@ extern "C" { , "The first routing layer (metal2) is horizontal." } , { "isVH" , (PyCFunction)PyRoutingGauge_isVH , METH_NOARGS , "The first routing layer (metal2) is vertical." } + , { "hasPowerSupply" , (PyCFunction)PyRoutingGauge_hasPowerSupply , METH_NOARGS + , "Is there a dedicated layer for power supplies." } , { "getName" , (PyCFunction)PyRoutingGauge_getName , METH_NOARGS , "Return the maximum depth of the RoutingGauge." } , { "getTechnology" , (PyCFunction)PyRoutingGauge_getTechnology , METH_NOARGS @@ -522,12 +538,14 @@ extern "C" { , "Return the depth of the given layer." } , { "getPitch" , (PyCFunction)PyRoutingGauge_getPitch , METH_VARARGS , "Return the routing pitch of the given layer." } - , { "getOffset" , (PyCFunction)PyRoutingGauge_getOffset , METH_VARARGS + , { "getOffset" , (PyCFunction)PyRoutingGauge_getOffset , METH_VARARGS , "Return the offset of the first track of the given layer." } - , { "getWireWidth" , (PyCFunction)PyRoutingGauge_getWireWidth , METH_VARARGS + , { "getWireWidth" , (PyCFunction)PyRoutingGauge_getWireWidth , METH_VARARGS , "Return the default wire width of the given layer." } - , { "getViaWidth" , (PyCFunction)PyRoutingGauge_getViaWidth , METH_VARARGS + , { "getViaWidth" , (PyCFunction)PyRoutingGauge_getViaWidth , METH_VARARGS , "Return the default via width of the given layer." } + , { "getPowerSupplyGauge" , (PyCFunction)PyRoutingGauge_getPowerSupplyGauge, METH_NOARGS + , "Return the power supply gauge (None if there isn't)." } , { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS , "Return the RoutingLayerGauge of the given layer/depth." } , { "getLayerDirection" , (PyCFunction)PyRoutingGauge_getLayerDirection , METH_VARARGS @@ -558,6 +576,14 @@ extern "C" { VectorMethods (RoutingLayerGauge) + extern void PyRoutingGauge_postModuleInit () + { + PyObject* constant; + + LoadObjectConstant(PyTypeRoutingGauge.tp_dict,RoutingGauge::nlayerdepth,"nlayerdepth"); + } + + #else // End of Python Module Code Part. // +=================================================================+ diff --git a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp index 190dc3a7..434af99a 100644 --- a/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingLayerGauge.cpp @@ -108,7 +108,8 @@ extern "C" { } switch( type ) { case Constant::Default: - case Constant::PinOnly: break; + case Constant::PinOnly: + case Constant::PowerSupply: break; default: PyErr_SetString ( ConstructorError, "Bad value for type argument of RoutingLayerGauge.create()." ); return NULL; @@ -347,14 +348,15 @@ extern "C" { { PyObject* constant; - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Horizontal ,"Horizontal"); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Vertical ,"Vertical" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Default ,"Default" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::PinOnly ,"PinOnly" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Superior ,"Superior" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Inferior ,"Inferior" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Nearest ,"Nearest" ); - LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Exact ,"Exact" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Horizontal ,"Horizontal" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Vertical ,"Vertical" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Default ,"Default" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::PinOnly ,"PinOnly" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::PowerSupply,"PowerSupply" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Superior ,"Superior" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Inferior ,"Inferior" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Nearest ,"Nearest" ); + LoadObjectConstant(PyTypeRoutingLayerGauge.tp_dict,Constant::Exact ,"Exact" ); } diff --git a/crlcore/src/pyCRL/crlcore/PyRoutingGauge.h b/crlcore/src/pyCRL/crlcore/PyRoutingGauge.h index 34b6228b..80573d17 100644 --- a/crlcore/src/pyCRL/crlcore/PyRoutingGauge.h +++ b/crlcore/src/pyCRL/crlcore/PyRoutingGauge.h @@ -15,9 +15,7 @@ // +-----------------------------------------------------------------+ -#ifndef __CRL_PY_ROUTINGGAUGE__ -#define __CRL_PY_ROUTINGGAUGE__ - +#pragma once #include "hurricane/isobar/PyHurricane.h" #include "crlcore/RoutingGauge.h" @@ -63,6 +61,3 @@ declareVectorObject(RoutingLayerGauge); } // Hurricane namespace. - - -#endif // __CRL_PY_ROUTINGGAUGE__