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

View File

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

View File

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

View File

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

View File

@ -137,7 +137,7 @@ namespace {
Point extractRpOffset ( const RoutingPad* rp )
{
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
Box masterBox = masterCell->getAbutmentBox();

View File

@ -159,72 +159,85 @@ namespace Hurricane {
Box RoutingPad::getBoundingBox () const
{
Component* component = _getEntityAsComponent();
if ( component )
return _occurrence.getPath().getTransformation().getBox ( component->getBoundingBox() );
return Box(getPosition());
Component* component = _getEntityAs<Component>();
if (component)
return _occurrence.getPath().getTransformation().getBox( component->getBoundingBox() );
return Box( getPosition() );
}
Box RoutingPad::getBoundingBox ( const BasicLayer* basicLayer ) const
{
Component* component = _getEntityAsComponent();
if ( component ) {
return _occurrence.getPath().getTransformation().getBox ( component->getBoundingBox(basicLayer) );
}
return Box(getPosition());
Component* component = _getEntityAs<Component>();
if (component)
return _occurrence.getPath().getTransformation().getBox( component->getBoundingBox(basicLayer) );
return Box( getPosition() );
}
const Layer* RoutingPad::getLayer () const
{
Component* component = _getEntityAsComponent();
if (component) return component->getLayer ();
return NULL;
Component* component = _getEntityAs<Component>();
if (not component) return nullptr;
return component->getLayer ();
}
Point RoutingPad::getPosition () const
{
Component* component = _getEntityAsComponent();
if (component) {
Component* component = _getEntityAs<Component>();
if (component)
return _occurrence.getPath().getTransformation().getPoint( component->getCenter() );
}
return Point();
}
Point RoutingPad::getSourcePosition () const
{
Segment* segment = _getEntityAsSegment();
if ( segment ) {
return _occurrence.getPath().getTransformation().getPoint ( segment->getSourcePosition() );
Segment* segment = _getEntityAs<Segment>();
if (segment)
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();
}
Point RoutingPad::getTargetPosition() const
{
Segment* segment = _getEntityAsSegment();
if ( segment )
return _occurrence.getPath().getTransformation().getPoint ( segment->getTargetPosition() );
Segment* segment = _getEntityAs<Segment>();
if (segment)
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();
}
Point RoutingPad::getCenter() const
{
Segment* segment = _getEntityAsSegment();
if ( segment )
return _occurrence.getPath().getTransformation().getPoint ( segment->getCenter() );
Segment* segment = _getEntityAs<Segment>();
if (segment)
return _occurrence.getPath().getTransformation().getPoint( segment->getCenter() );
Pad* pad = _getEntityAs<Pad>();
if (pad)
return _occurrence.getPath().getTransformation().getPoint( pad->getCenter() );
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 )
{
if (isMaterialized()) invalidate( false );

View File

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

View File

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

View File

@ -1,14 +1,14 @@
// -*- C++ -*-
//
// 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 |
// | 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 |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./Manipulator.cpp" |
// +-----------------------------------------------------------------+

View File

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

View File

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