diff --git a/etesian/src/Placement.cpp b/etesian/src/Placement.cpp index 73fe93e2..cbc06c5e 100644 --- a/etesian/src/Placement.cpp +++ b/etesian/src/Placement.cpp @@ -56,6 +56,7 @@ namespace Etesian { using CRL::AllianceFramework; using CRL::CatalogExtension; using CRL::getTransformation; + using CRL::RoutingLayerGauge; using Etesian::EtesianEngine; @@ -620,10 +621,34 @@ namespace Etesian { size_t SubSlice::getUsedVTracks ( const Tile& tile, set& vtracks ) { - DbU::Unit vpitch = _slice->getArea()->getEtesian()->getSliceStep(); + RoutingGauge* rg = _slice->getArea()->getEtesian()->getGauge(); + DbU::Unit vpitch = _slice->getArea()->getEtesian()->getSliceStep(); Cell* cell = tile.getMasterCell(); for ( Net* net : cell->getNets() ) { - if (not net->isExternal()) continue; + if (not net->isExternal()) { + for ( Component* component : net->getComponents() ) { + if (not component->getLayer()->isBlockage()) continue; + cdebug_log(121,0) << "Looking at " << component << endl; + Vertical* v = dynamic_cast( component ); + if (not v) continue; + + RoutingLayerGauge* rlg = rg->getLayerGauge( v->getLayer()->getRoutingLayer() ); + if (not rlg) continue; + + Box bb = v->getBoundingBox(); + bb.inflate( -rlg->getWireWidth()/2, 0 ); + Transformation transf = tile.getInstance()->getTransformation(); + tile.getOccurrence().getPath().getTransformation().applyOn( transf ); + transf.applyOn( bb ); + cdebug_log(121,0) << "Obstacle bb " << bb << endl; + DbU::Unit xtrack = bb.getXMin() - (bb.getXMin() % vpitch); + for ( ; xtrack <= bb.getXMax() ; xtrack += vpitch ) { + cdebug_log(121,0) << "| add vtrack @" << DbU::getValueString(xtrack) << endl; + vtracks.insert( xtrack ); + } + } + continue; + } if (net->isPower() or net->isGround()) continue; for ( Component* component : NetExternalComponents::get(net) ) { Vertical* v = dynamic_cast( component ); @@ -708,29 +733,31 @@ namespace Etesian { } if (iTile != endTile) { auto nextTile = iTile; - --nextTile; + ++nextTile; maxDxRight = (*nextTile).getXMin() - (*iTile).getXMax(); } + cdebug_log(121,0) << "maxDxLeft =" << DbU::getValueString(maxDxLeft ) << endl; + cdebug_log(121,0) << "maxDxRight=" << DbU::getValueString(maxDxRight) << endl; DbU::Unit xShift = 0; - for ( ; xShift <= maxDxLeft ; xShift += vpitch ) { - cdebug_log(121,0) << "| try left shift " << DbU::getValueString(-xShift) << endl; - if (not usedVTracks.count( xTrack + xShift )) break; + for ( ; xShift >= maxDxLeft ; xShift -= vpitch ) { + cdebug_log(121,0) << "| try left shift " << DbU::getValueString(xShift) << endl; + if (not usedVTracks.count( xTrack - xShift )) break; } - if (xShift > maxDxLeft) { - xShift = - vpitch; - for ( ; xShift > maxDxRight ; xShift -= vpitch ) { - cdebug_log(121,0) << "| try right shift " << DbU::getValueString(-xShift) << endl; - if (not usedVTracks.count( xTrack + xShift )) break; + if (xShift < maxDxLeft) { + xShift = vpitch; + for ( ; xShift <= maxDxRight ; xShift += vpitch ) { + cdebug_log(121,0) << "| try right shift " << DbU::getValueString(xShift) << endl; + if (not usedVTracks.count( xTrack - xShift )) break; } } - if (xShift < maxDxRight) { + if (xShift > maxDxRight) { cerr << Error( "SubSlice::trackAvoid(): Unable to put out of the way %s." , getString(*iTile).c_str() ) << endl; break; } cdebug_log(121,0) << "Shifting " << (*iTile) << " by " << DbU::getValueString(-xShift) << endl; - (*iTile).translate( -xShift ); + (*iTile).translate( xShift ); break; } diff --git a/hurricane/src/hurricane/BasicLayer.cpp b/hurricane/src/hurricane/BasicLayer.cpp index e441677e..f7760ab1 100644 --- a/hurricane/src/hurricane/BasicLayer.cpp +++ b/hurricane/src/hurricane/BasicLayer.cpp @@ -179,6 +179,7 @@ namespace Hurricane { ,_gds2Layer (gds2Layer) ,_gds2Datatype (gds2Datatype) ,_blockageLayer (NULL) + ,_routingLayer (NULL) ,_realName ("") ,_hasGds (false) { } @@ -206,6 +207,10 @@ namespace Hurricane { { return _blockageLayer; } + BasicLayer* BasicLayer::getRoutingLayer () const + { return _routingLayer; } + + BasicLayers BasicLayer::getBasicLayers () const { return BasicLayer_BasicLayers(this); } @@ -279,6 +284,7 @@ namespace Hurricane { record->add(getSlot("_material" , &_material)); record->add(getSlot("_realName" , &_realName)); record->add(getSlot("_blockageLayer", _blockageLayer)); + record->add(getSlot("_routingLayer" , _routingLayer)); record->add(getSlot("_gds2Layer" , _gds2Layer)); record->add(getSlot("_gds2Datatype" , _gds2Datatype)); } diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index 83466dbd..038f83d0 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -75,6 +75,10 @@ namespace Hurricane { { return NULL; } + const Layer* Layer::getRoutingLayer () const + { return NULL; } + + const Layer* Layer::getCut () const { return NULL; } diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index ec0a0848..41271e2c 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -94,11 +94,13 @@ namespace Hurricane { inline uint32_t getGds2Datatype () const; virtual BasicLayers getBasicLayers () const; virtual BasicLayer* getBlockageLayer () const; + virtual BasicLayer* getRoutingLayer () const; virtual const Layer* getTop () const; virtual const Layer* getBottom () const; inline const Name& getRealName () const; // Updators inline void setBlockageLayer ( BasicLayer* layer); + inline void setRoutingLayer ( BasicLayer* layer); inline void setGds2Layer ( uint32_t ); inline void setGds2Datatype ( uint32_t ); inline void setRealName ( const char* realName); @@ -115,6 +117,7 @@ namespace Hurricane { uint32_t _gds2Layer; uint32_t _gds2Datatype; BasicLayer* _blockageLayer; + BasicLayer* _routingLayer; Name _realName; bool _hasGds; @@ -144,11 +147,18 @@ namespace Hurricane { inline uint32_t BasicLayer::getGds2Layer () const { return _gds2Layer; } inline uint32_t BasicLayer::getGds2Datatype () const { return _gds2Datatype; } inline const Name& BasicLayer::getRealName () const { return _realName; } - inline void BasicLayer::setBlockageLayer ( BasicLayer* layer) { _blockageLayer = layer; layer->setBlockage(true); } + inline void BasicLayer::setRoutingLayer ( BasicLayer* layer) { _routingLayer = layer; } inline void BasicLayer::setGds2Layer ( uint32_t number ) { _gds2Layer=number; _hasGds=true; } inline void BasicLayer::setGds2Datatype ( uint32_t number ) { _gds2Datatype=number; } inline void BasicLayer::setRealName ( const char* realName) { _realName = realName; } + inline void BasicLayer::setBlockageLayer ( BasicLayer* layer) + { + _blockageLayer = layer; + layer->setBlockage( true ); + layer->setRoutingLayer( this ); + } + // ------------------------------------------------------------------- // Class : "Hurricane::JsonBasicLayer". diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index 4196399c..1b0a982b 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -1,7 +1,7 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved +// Copyright (c) BULL S.A. 2000-2022, All Rights Reserved // // This file is part of Hurricane. // @@ -30,14 +30,12 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_LAYER_H -#define HURRICANE_LAYER_H - -#include "hurricane/Mask.h" -#include "hurricane/DBo.h" -#include "hurricane/Layers.h" -#include "hurricane/DbU.h" -#include "hurricane/BasicLayers.h" +#pragma once +#include "hurricane/Mask.h" +#include "hurricane/DBo.h" +#include "hurricane/Layers.h" +#include "hurricane/DbU.h" +#include "hurricane/BasicLayers.h" namespace Hurricane { @@ -72,6 +70,7 @@ namespace Hurricane { inline const DbU::Unit& getMinimalSpacing () const; virtual BasicLayers getBasicLayers () const = 0; virtual const Layer* getBlockageLayer () const; + virtual const Layer* getRoutingLayer () const; virtual const Layer* getCut () const; virtual const Layer* getTop () const; virtual const Layer* getBottom () const; @@ -185,6 +184,3 @@ namespace Hurricane { INSPECTOR_P_SUPPORT(Hurricane::Layer); INSPECTOR_PR_SUPPORT(Hurricane::Layer::Mask); - - -#endif // HURRICANE_LAYER_H