Added partial support for Pad (component) in RoutinPad.

* New: In Hurricane::RoutingPad, added support if the supporting component
    is a Pad. The source/target positions are computed according to the
    most likely direction.
      Change the _getEntityAsComponent() function into an inline template
    _getEntityAs<T>().
      Change the flags from an enum to static const uint32_t.
* Change: In Anabatic::Configuration, use _getEntityAs<T>.
* Change: In Anabatic::Dijkstra, use _getEntityAs<T>.
* Change: In Anabatic::NetBuilder, use _getEntityAs<T>.
* Change: In Katabatic::LoadGrByNet, use _getEntityAs<T>.
* Change: In Katana::ProtectRoutingPads, use _getEntityAs<T>.
* Change: In Bora::AnalogDistance, use _getEntityAs<T>.
* Change: In Etesian::EtesianEngine, use _getEntityAs<T>.
This commit is contained in:
Jean-Paul Chaput 2022-10-27 19:42:13 +02:00
parent 118b28b5a7
commit 7c85835c8f
11 changed files with 86 additions and 82 deletions

View File

@ -26,6 +26,7 @@
#include "hurricane/RegularLayer.h" #include "hurricane/RegularLayer.h"
#include "hurricane/RoutingPad.h" #include "hurricane/RoutingPad.h"
#include "hurricane/Pin.h" #include "hurricane/Pin.h"
#include "hurricane/Pad.h"
#include "hurricane/NetExternalComponents.h" #include "hurricane/NetExternalComponents.h"
#include "hurricane/Cell.h" #include "hurricane/Cell.h"
#include "crlcore/Utilities.h" #include "crlcore/Utilities.h"
@ -56,6 +57,7 @@ namespace Anabatic {
using Hurricane::BasicLayer; using Hurricane::BasicLayer;
using Hurricane::RegularLayer; using Hurricane::RegularLayer;
using Hurricane::Segment; using Hurricane::Segment;
using Hurricane::Pad;
using Hurricane::Pin; using Hurricane::Pin;
using Hurricane::Plug; using Hurricane::Plug;
using Hurricane::Path; using Hurricane::Path;
@ -497,10 +499,12 @@ namespace Anabatic {
break; break;
} }
Component* candidate = dynamic_cast<Segment*>(component); Component* candidate = dynamic_cast<Segment*>( component );
if (not candidate if (not candidate
or (candidate->getLayer()->getMask() != metal1->getMask()) ) or (candidate->getLayer()->getMask() != metal1->getMask()) )
candidate = dynamic_cast<Pin*>(component); candidate = dynamic_cast<Pin*>(component);
if (not candidate)
candidate = dynamic_cast<Pad*>( component );
if (not candidate) continue; if (not candidate) continue;
Box bb = transformation.getBox( candidate->getBoundingBox() ); Box bb = transformation.getBox( candidate->getBoundingBox() );

View File

@ -265,7 +265,7 @@ namespace Anabatic {
} }
} }
if (rp) { if (rp) {
Vertical* v = dynamic_cast<Vertical*>(rp->_getEntityAsSegment()); Vertical* v = dynamic_cast<Vertical*>(rp->_getEntityAs<Segment>());
if (v) { return true; } if (v) { return true; }
} }
} }
@ -285,7 +285,7 @@ namespace Anabatic {
} }
} }
if (rp) { if (rp) {
Horizontal* h = dynamic_cast<Horizontal*>(rp->_getEntityAsSegment()); Horizontal* h = dynamic_cast<Horizontal*>(rp->_getEntityAs<Segment>());
if (h) { return true; } if (h) { return true; }
} }
} }
@ -2873,8 +2873,8 @@ namespace Anabatic {
{ {
cdebug_log(112,0) << "void Dijkstra::_setSourcesGRAData() : " << seed << endl; cdebug_log(112,0) << "void Dijkstra::_setSourcesGRAData() : " << seed << endl;
GCell* gseed = seed->getGCell(); GCell* gseed = seed->getGCell();
Horizontal* h = dynamic_cast<Horizontal*>(rp->_getEntityAsSegment()); Horizontal* h = dynamic_cast<Horizontal*>(rp->_getEntityAs<Segment>());
Vertical* v = dynamic_cast<Vertical*> (rp->_getEntityAsSegment()); Vertical* v = dynamic_cast<Vertical*> (rp->_getEntityAs<Segment>());
if (h) { if (h) {
cdebug_log(112,0) << "case H " << endl; cdebug_log(112,0) << "case H " << endl;
seed->unsetFlags(Vertex::iHorizontal); seed->unsetFlags(Vertex::iHorizontal);

View File

@ -491,7 +491,7 @@ namespace Anabatic {
cdebug_log(145,0) << "| " << gcell << endl; cdebug_log(145,0) << "| " << gcell << endl;
} }
} else { } else {
if (rp and AllianceFramework::get()->isPad(rp->_getEntityAsComponent()->getCell())) { if (rp and AllianceFramework::get()->isPad(rp->_getEntityAs<Component>()->getCell())) {
_connexity.fields.Pad++; _connexity.fields.Pad++;
} else { } else {
const Layer* layer = anchor->getLayer(); const Layer* layer = anchor->getLayer();

View File

@ -130,8 +130,8 @@ namespace Bora {
if (rp) break; if (rp) break;
} }
if (rp) { if (rp) {
Horizontal* h = dynamic_cast<Horizontal*>( rp->_getEntityAsSegment() ); Horizontal* h = dynamic_cast<Horizontal*>( rp->_getEntityAs<Segment>() );
Vertical* v = dynamic_cast<Vertical* >( rp->_getEntityAsSegment() ); Vertical* v = dynamic_cast<Vertical* >( rp->_getEntityAs<Segment>() );
cdebug_log(112,0) << "Current: isDevice, "; cdebug_log(112,0) << "Current: isDevice, ";
if (h) { if (h) {
cdebug_log(112,0) << " rp: Horizontal and "; cdebug_log(112,0) << " rp: Horizontal and ";
@ -212,8 +212,8 @@ namespace Bora {
} }
if (rp) { if (rp) {
cdebug_log(112,0) << "Case: Next is a Device and "; cdebug_log(112,0) << "Case: Next is a Device and ";
Horizontal* h = dynamic_cast<Horizontal*>( rp->_getEntityAsSegment() ); Horizontal* h = dynamic_cast<Horizontal*>( rp->_getEntityAs<Segment>() );
Vertical* v = dynamic_cast<Vertical* >( rp->_getEntityAsSegment() ); Vertical* v = dynamic_cast<Vertical* >( rp->_getEntityAs<Segment>() );
if (h) { if (h) {
if (gcurr->isNorth(gnext) or gcurr->isSouth(gnext)) { if (gcurr->isNorth(gnext) or gcurr->isSouth(gnext)) {
cdebug_log(112,0) << "COST." << std::endl; cdebug_log(112,0) << "COST." << std::endl;

View File

@ -137,7 +137,7 @@ namespace {
Point extractRpOffset ( const RoutingPad* rp ) Point extractRpOffset ( const RoutingPad* rp )
{ {
Cell* masterCell = rp->getOccurrence().getMasterCell(); Cell* masterCell = rp->getOccurrence().getMasterCell();
Component* component = rp->_getEntityAsComponent(); Component* component = rp->_getEntityAs<Component>();
// TODO: verify that it doesn't assume that the orientation is North // TODO: verify that it doesn't assume that the orientation is North
Box masterBox = masterCell->getAbutmentBox(); Box masterBox = masterCell->getAbutmentBox();

View File

@ -159,72 +159,85 @@ namespace Hurricane {
Box RoutingPad::getBoundingBox () const Box RoutingPad::getBoundingBox () const
{ {
Component* component = _getEntityAsComponent(); Component* component = _getEntityAs<Component>();
if ( component ) if (component)
return _occurrence.getPath().getTransformation().getBox ( component->getBoundingBox() ); return _occurrence.getPath().getTransformation().getBox( component->getBoundingBox() );
return Box( getPosition() );
return Box(getPosition());
} }
Box RoutingPad::getBoundingBox ( const BasicLayer* basicLayer ) const Box RoutingPad::getBoundingBox ( const BasicLayer* basicLayer ) const
{ {
Component* component = _getEntityAsComponent(); Component* component = _getEntityAs<Component>();
if ( component ) { if (component)
return _occurrence.getPath().getTransformation().getBox ( component->getBoundingBox(basicLayer) ); return _occurrence.getPath().getTransformation().getBox( component->getBoundingBox(basicLayer) );
} return Box( getPosition() );
return Box(getPosition());
} }
const Layer* RoutingPad::getLayer () const const Layer* RoutingPad::getLayer () const
{ {
Component* component = _getEntityAsComponent(); Component* component = _getEntityAs<Component>();
if (component) return component->getLayer (); if (not component) return nullptr;
return component->getLayer ();
return NULL;
} }
Point RoutingPad::getPosition () const Point RoutingPad::getPosition () const
{ {
Component* component = _getEntityAsComponent(); Component* component = _getEntityAs<Component>();
if (component) { if (component)
return _occurrence.getPath().getTransformation().getPoint( component->getCenter() ); return _occurrence.getPath().getTransformation().getPoint( component->getCenter() );
}
return Point(); return Point();
} }
Point RoutingPad::getSourcePosition () const Point RoutingPad::getSourcePosition () const
{ {
Segment* segment = _getEntityAsSegment(); Segment* segment = _getEntityAs<Segment>();
if ( segment ) { if (segment)
return _occurrence.getPath().getTransformation().getPoint ( segment->getSourcePosition() ); return _occurrence.getPath().getTransformation().getPoint( segment->getSourcePosition() );
Pad* pad = _getEntityAs<Pad>();
if (pad) {
Box bb = pad->getBoundingBox();
Point position;
if (bb.getWidth() > bb.getHeight())
position = Point( bb.getXMin() + bb.getHeight()/2, bb.getYCenter() );
else
position = Point( bb.getYCenter(), bb.getYMin() + bb.getWidth()/2 );
return _occurrence.getPath().getTransformation().getPoint( position );
} }
return getPosition(); return getPosition();
} }
Point RoutingPad::getTargetPosition() const Point RoutingPad::getTargetPosition() const
{ {
Segment* segment = _getEntityAsSegment(); Segment* segment = _getEntityAs<Segment>();
if ( segment ) if (segment)
return _occurrence.getPath().getTransformation().getPoint ( segment->getTargetPosition() ); return _occurrence.getPath().getTransformation().getPoint( segment->getTargetPosition() );
Pad* pad = _getEntityAs<Pad>();
if (pad) {
Box bb = pad->getBoundingBox();
Point position;
if (bb.getWidth() > bb.getHeight())
position = Point( bb.getXMax() - bb.getHeight()/2, bb.getYCenter() );
else
position = Point( bb.getYCenter(), bb.getYMax() - bb.getWidth()/2 );
return _occurrence.getPath().getTransformation().getPoint( position );
}
return getPosition(); return getPosition();
} }
Point RoutingPad::getCenter() const Point RoutingPad::getCenter() const
{ {
Segment* segment = _getEntityAsSegment(); Segment* segment = _getEntityAs<Segment>();
if ( segment ) if (segment)
return _occurrence.getPath().getTransformation().getPoint ( segment->getCenter() ); return _occurrence.getPath().getTransformation().getPoint( segment->getCenter() );
Pad* pad = _getEntityAs<Pad>();
if (pad)
return _occurrence.getPath().getTransformation().getPoint( pad->getCenter() );
return getPosition(); return getPosition();
} }
@ -275,24 +288,6 @@ namespace Hurricane {
} }
Component* RoutingPad::_getEntityAsComponent () const
{
if ( _occurrence.isValid() )
return dynamic_cast<Component*>( _occurrence.getEntity() );
return NULL;
}
Segment* RoutingPad::_getEntityAsSegment () const
{
if ( _occurrence.isValid() )
return dynamic_cast<Segment*>( _occurrence.getEntity() );
return NULL;
}
void RoutingPad::setExternalComponent ( Component* component ) void RoutingPad::setExternalComponent ( Component* component )
{ {
if (isMaterialized()) invalidate( false ); if (isMaterialized()) invalidate( false );

View File

@ -29,9 +29,7 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#ifndef HURRICANE_ROUTINGPAD_H #pragma once
#define HURRICANE_ROUTINGPAD_H
#include "hurricane/Component.h" #include "hurricane/Component.h"
#include "hurricane/Occurrence.h" #include "hurricane/Occurrence.h"
#include "hurricane/Pin.h" #include "hurricane/Pin.h"
@ -48,18 +46,19 @@ namespace Hurricane {
class RoutingPad : public Component { class RoutingPad : public Component {
public: public:
typedef Component Inherit; typedef Component Inherit;
enum Flags { BiggestArea = (1 << 0) static const uint32_t BiggestArea = (1 << 0);
, HighestLayer = (1 << 1) static const uint32_t HighestLayer = (1 << 1);
, LowestLayer = (1 << 2) static const uint32_t LowestLayer = (1 << 2);
, ComponentSelection= BiggestArea|HighestLayer|LowestLayer static const uint32_t ShowWarning = (1 << 3);
, ShowWarning = (1 << 4) static const uint32_t IsOnSegment = (1 << 4);
}; static const uint32_t IsOnPad = (1 << 5);
static const uint32_t ComponentSelection = BiggestArea|HighestLayer|LowestLayer;
public: public:
static RoutingPad* create ( Net*, Occurrence, unsigned int flags=0 ); static RoutingPad* create ( Net*, Occurrence, uint32_t flags=0 );
static RoutingPad* create ( Pin* ); static RoutingPad* create ( Pin* );
public: public:
// Accessors. // Accessors.
bool isPlacedOccurrence ( unsigned int flags ) const; bool isPlacedOccurrence ( uint32_t flags ) const;
inline bool isAtTopLevel () const; inline bool isAtTopLevel () const;
inline Occurrence getOccurrence () const; inline Occurrence getOccurrence () const;
Occurrence getPlugOccurrence (); Occurrence getPlugOccurrence ();
@ -79,11 +78,11 @@ namespace Hurricane {
// Mutators. // Mutators.
virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy ); virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
void setExternalComponent ( Component* ); void setExternalComponent ( Component* );
Component* setOnBestComponent ( unsigned int flags ); Component* setOnBestComponent ( uint32_t flags );
void restorePlugOccurrence (); void restorePlugOccurrence ();
// Miscellaeous. // Miscellaeous.
Component* _getEntityAsComponent () const; template<typename T>
Segment* _getEntityAsSegment () const; T* _getEntityAs () const;
virtual void _toJson ( JsonWriter* ) const; virtual void _toJson ( JsonWriter* ) const;
virtual std::string _getTypeName () const {return _TName("RoutingPad");}; virtual std::string _getTypeName () const {return _TName("RoutingPad");};
virtual std::string _getString () const; virtual std::string _getString () const;
@ -103,6 +102,14 @@ namespace Hurricane {
inline Occurrence RoutingPad::getOccurrence () const { return _occurrence; }; inline Occurrence RoutingPad::getOccurrence () const { return _occurrence; };
template<typename T>
inline T* RoutingPad::_getEntityAs () const
{
if (not _occurrence.isValid()) return nullptr;
return dynamic_cast<T*>( _occurrence.getEntity() );
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Class : "JsonRoutingPad". // Class : "JsonRoutingPad".
@ -119,5 +126,3 @@ namespace Hurricane {
INSPECTOR_P_SUPPORT(Hurricane::RoutingPad); INSPECTOR_P_SUPPORT(Hurricane::RoutingPad);
#endif // HURRICANE_ROUTINGPAD_H

View File

@ -870,7 +870,7 @@ namespace {
throw Error( mismatchGCell ); throw Error( mismatchGCell );
} }
} else { } else {
if (rp and AllianceFramework::get()->isPad(rp->_getEntityAsComponent()->getCell())) { if (rp and AllianceFramework::get()->isPad(rp->_getEntityAs<Component>()->getCell())) {
_connexity.fields.Pad++; _connexity.fields.Pad++;
} else { } else {
const Layer* layer = anchor->getLayer(); const Layer* layer = anchor->getLayer();

View File

@ -1,14 +1,14 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved // Copyright (c) Sorbonne Université 2008-2022, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | C O R I O L I S | // | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r | // | K a t a n a - D e t a i l e d R o u t e r |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./Manipulator.cpp" | // | C++ Module : "./Manipulator.cpp" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+

View File

@ -76,7 +76,7 @@ namespace {
cdebug_log(145,1) << "::protectRoutingPad() " << rp << endl; cdebug_log(145,1) << "::protectRoutingPad() " << rp << endl;
Name padNetName = "pad"; Name padNetName = "pad";
Component* usedComponent = rp->_getEntityAsComponent(); Component* usedComponent = rp->_getEntityAs<Component>();
Path path = rp->getOccurrence().getPath(); Path path = rp->getOccurrence().getPath();
Net* masterNet = usedComponent->getNet(); Net* masterNet = usedComponent->getNet();
Transformation transformation = path.getTransformation(); Transformation transformation = path.getTransformation();

View File

@ -71,7 +71,7 @@ namespace {
void protectRoutingPad ( RoutingPad* rp ) void protectRoutingPad ( RoutingPad* rp )
{ {
Name padNetName = "pad"; Name padNetName = "pad";
Component* usedComponent = rp->_getEntityAsComponent(); Component* usedComponent = rp->_getEntityAs<Component>();
Path path = rp->getOccurrence().getPath(); Path path = rp->getOccurrence().getPath();
Net* masterNet = usedComponent->getNet(); Net* masterNet = usedComponent->getNet();
Transformation transformation = path.getTransformation(); Transformation transformation = path.getTransformation();