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.
This commit is contained in:
Jean-Paul Chaput 2021-03-02 12:17:40 +01:00
parent a6492f6edc
commit 63a03bf11b
7 changed files with 118 additions and 81 deletions

View File

@ -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;

View File

@ -58,6 +58,7 @@ namespace CRL {
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;
@ -68,6 +69,7 @@ namespace CRL {
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;
@ -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; }

View File

@ -14,10 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef CRL_ROUTING_LAYER_GAUGE_H
#define CRL_ROUTING_LAYER_GAUGE_H
#pragma once
#include <map>
#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)
@ -279,6 +277,7 @@ inline std::string getString<const Constant::LayerGaugeType*>
switch ( *layerGaugeType ) {
case Constant::Default: return "Default";
case Constant::PinOnly: return "PinOnly";
case Constant::PowerSupply: return "PowerSupply";
}
return "Unknown Constant::LayerGaugeType";
}
@ -297,6 +296,7 @@ inline std::string getString<const Constant::LayerGaugeType>
switch ( layerGaugeType ) {
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<Constant::LayerGaugeType>
IOSTREAM_POINTER_SUPPORT(Constant::LayerGaugeType);
#endif // CRL_ROUTING_LAYER_GAUGE_H

View File

@ -212,6 +212,7 @@ extern "C" {
PyCatalog_postModuleInit ();
PyEnvironment_postModuleInit ();
PyRoutingGauge_postModuleInit ();
PyRoutingLayerGauge_postModuleInit ();
PyAllianceFramework_postModuleInit ();

View File

@ -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;
@ -494,6 +507,7 @@ extern "C" {
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
@ -528,6 +544,8 @@ extern "C" {
, "Return the default wire width of the given layer." }
, { "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.
// +=================================================================+

View File

@ -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;
@ -351,6 +352,7 @@ extern "C" {
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" );

View File

@ -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__