coriolis/anabatic/src/LayerAssign.cpp

1037 lines
32 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./LayerAssign.cpp" |
// +-----------------------------------------------------------------+
#include <cstdlib>
#include <sstream>
#include "hurricane/Bug.h"
#include "hurricane/Warning.h"
#include "hurricane/DebugSession.h"
#include "hurricane/Net.h"
#include "hurricane/NetExternalComponents.h"
#include "hurricane/NetRoutingProperty.h"
#include "hurricane/Layer.h"
#include "hurricane/RoutingPad.h"
#include "hurricane/Pad.h"
#include "hurricane/Plug.h"
#include "hurricane/Instance.h"
#include "hurricane/Vertical.h"
#include "hurricane/Horizontal.h"
#include "hurricane/Cell.h"
#include "crlcore/RoutingGauge.h"
Upgrade of Katana detailed router to support Arlet 6502. * Change: In Hurricane::SharedName, replace the incremental Id by a hash key. This is to ensure better deterministic properties. Between use cases, additional strings may have to be allocated, shitfing the ids. Even if hash can be duplicated, we should be able to ensure that the absolute order in map table should be preserved. Supplemental strings are inserted in a way that keep the previous order. * Change: In CRL/etc/symbolic/cmos/kite.conf, add "katabatic.routingGauge" default parameter value ("sxlib"). * Change: In CRL/etc/common/technology.conf, define minimal spacing for symbolic layers too (added for METAL4 only for now). * Change: In CRL::Histogram, extend support to dynamically sized histograms. Add a text pretty print with table and pseudo-curve. * Change: In Cumulus/plugins/ClockTreePlugin, create blockage under the block corona corners so the global router do not draw wire under them. This was creating deadlock for the detailed router. When the abutment has to be computed, directly use Etesian to do it instead of duplicating the computation in the Python plugin. * New: In Etesian, as Coloquinte seems reluctant to evenly spread the standard cells, we trick it by making them bigger during the placement stage. Furthermore, we do not not uniformely increase the size of the cells but create a "bloating profile" based on cell size, cell name or it's density of terminals. Currently only two profiles are defined, "disabled" which does nothing and "nsxlib" targeted on 4 metal layer technologies (aka AMS 350nm, c35b4). * Bug: In Knik::MatrixVertex, load the default routing gauge using the configuration parameter "katabatic.routingGauge" as the default one may not be the first registered one. * New: In AnabaticEngine::setupNetDatas(), build a dynamic historgram of the nets terminal numbers. * Bug: In Anabatic::AutoContact::Invalidate(), always invalidate the contact cache when topology is invalidated. In case of multiple invalidations, if the first did not invalidate the cache, later one that may need it where not allowed to do so. The end result was correct nonetheless, but it did generate annoying error messages. * Bug: In Anabatic::AutoContactTurn::updateTopology(), bad computation of the contact's depth when delta == 2. * Bug: In Anabatic::Gcell::getCapacity(), was always returning the west edge capacity, even for the westermost GCell, should be the east edge in that case. * New: In Anabatic::AutoSegment, introduce a new measure "distance to terminal". This is the minimal number of segments separating the current one from the nearest RoutingPad. This replace the previous "strong terminal" and "weak terminal" flags. This distance is used by Katana to sort the events, we route the segments *from* the RoutingPads *outward*. The idea being that if we cannot event connect to the RoutingPad, there is no points continuing as thoses segments are the more constraineds. This gives an order close to the simple ascending metals but with better results. * New: In Anabatic::AutoSegment, introduce a new flag "Unbreakable", disable dogleg making on those segments. mainly intended for local segments directly connecteds to RoutingPads (distance == 0). * New: In Anabatic::AutoSegment, more aggressive reducing of segments. Now the only case where a segment cannot be reduced is when it is one horizontal branch in a HTee or a vertical on a VTee. Check if, when not accounted the source & target VIAs are still connex, if so, allow reducing. * New: In Anabatic::AutoContact, new state flags CntVDogleg & CntHDogleg mainly to prevent making doglegs twice on a turn contact. This is to limit over-fragmentation. If one dogleg doesn't solve the problem, making a second one will make things worse only... * Bug: In Anabatic::Configuration::selectRpcomponent(), we were choosing the component with the *smallest* span instead of the *bigger* one. * New: In Anabatic::GCell, introduce a new flag "GoStraight" to tell that no turn go be made inside those GCells. Mainly used underneath a block corona. * New: In AnabaticEngine::layerAssign(), new GCellRps & RpsInRow to manage GCells with too many terminals. Slacken at least one RoutingPad access when there is more than 8 RoutingPad in the GCell (slacken or change a vertical METAL2 (non-preferred) into a METAL3). * Change: In Anabatic::NetBuilderHV, allow the use of terminal connection in non-preferred direction. That is, vertical METAL2 directly connected to the RoutingPad (then a horizontal METAL2). This alllows for short dogleg without clutering the METAL3 layer (critical for AMS c35b4). Done in NetBuilderHV::doRp_Access(), with a new UseNonPref flag. Perform some other tweaking on METAL1 access topologies, to also minimize METAL3 use. * New: In AnabaticEngine::computeNetConstraints(), also compute the distance to RoutingPad for segments. Set the Unbreakable flag, based on the distance and segment length (local, short global or long global). New local function "propagateDistanceFromRp()". * Change: In AnabaticEngine.h, the sorting class for NetData, SparsityOrder, is modificated so net with a degree superior to 10 are sorted first, whatever their sparsity. This is to work in tandem with GlobalRouting. * New: In Katana::TrackSegmentNonPref, introduce a class to manage segment in non-preferred routing direction. Mostly intended for small METAL2 vertical directly connected to RoutingPad. Modifications to manage this new variant all through Katana. * Change: In Katana::GlobalRoute, DigitalDistance honor the GoStraight flag of the GCell. Do not make bend inside thoses GCells. * Change: In KatanaEngine::runGlobalRouter(), high degree nets (>= 10) are routed first and whitout the global routing estimation. There should be few of them so they wont create saturations and we want them as straight as possible. Detour are for long be-points. Set the saerch halo to one GCell in the initial routing stage (before ripup). * Bug: In KatanaEngine & NegociateWindow, call _computeCagedconstraints() inside NegociateWindow::run(), as segments are inserted into tracks only at that point so we cannot make the computation earlier. * Change: In Katana::Manipulator::repackPerpandiculars(), add a flag to select whether to replace the perpandiculars *after* or *before* the current segment. * Change: In Katana::NegociateWindow::NegociateOverlapCost(), when the segment is fully enclosed inside a global, the longest overlap cost is set to the shortest global hoverhang (before or after). When the cost is for a global, set an infinite cost if the overlapping segment has a RP distance less or equal to 1 (this is an access segment). * Bug: In Katana::PowerRailsPlane::Rail::doLayout(), correct computation of the segments extension cap. * New: In Katana::QueryPowerRails::addToPowerRail(), add support for Pad. * Change: In Katana/PreProcess::protectCagedTerminals(), apply the contraints to any turn connected to the first segment of the RoutingPad so the perpandicular constraints got propagated to the perpandicular segment... * Change: In RoutingEvent, cache the "distance to RP" value. * Change: In RoutingEvent::Key::compare(), sort *first* on distance to RoutingPad, then layer depth. If both distance to RoutingPad is null, then sort on segment length. * Change: In RoutingEvent::_processRepair(), try a repack perpandicular with perpandiculars first (then with perpandicular last, then give up). * Change: In SegmentFsm::bindToTrack() and moveToTrack(), set an axis hint when creating the insertion event. * Change: In SegmentFsm::_slackenStrap(), add a step through slacken between minimize and maximum slack (wihch directly end up in unimplemented). * Change: In Session::_addInsertEvent(), add an axis parameter needed when the axis of the segment is not the one of the track (case of wide segments or non-preferred direction). * Bug: In Track::_preDestroy(), bad management of the TrackElement reference count. Destroy the segment only when reaching zero... * Bug: In Track::expandFreeIneterval(), forgotten to manage case when there is a set of overlaping segments at the "end" of the track, the EndIsTrackMax was not set. * Change: In TrackCost::Compare, increase the cost when an overlaping segment is at it's ripup limit. We should try *not* to rip it up if we can. Add a dedicated flag "AtRipupLimit". * Change: In TrackElement, add proxies for isUnbreakable(), new function updateTrackSpan(). * New: In TrackFixedSegment CTOR, when a supply wire of METAL2 or above is found, make the underlying GCells "GoStraight". * New: In TrackElement::canDogleg(GCell*), check for already done perpandicular dogleg on source/target (reject if so).
2019-07-28 16:20:00 -05:00
#include "anabatic/AutoContactTerminal.h"
#include "anabatic/AutoSegment.h"
#include "anabatic/AnabaticEngine.h"
Upgrade of Katana detailed router to support Arlet 6502. * Change: In Hurricane::SharedName, replace the incremental Id by a hash key. This is to ensure better deterministic properties. Between use cases, additional strings may have to be allocated, shitfing the ids. Even if hash can be duplicated, we should be able to ensure that the absolute order in map table should be preserved. Supplemental strings are inserted in a way that keep the previous order. * Change: In CRL/etc/symbolic/cmos/kite.conf, add "katabatic.routingGauge" default parameter value ("sxlib"). * Change: In CRL/etc/common/technology.conf, define minimal spacing for symbolic layers too (added for METAL4 only for now). * Change: In CRL::Histogram, extend support to dynamically sized histograms. Add a text pretty print with table and pseudo-curve. * Change: In Cumulus/plugins/ClockTreePlugin, create blockage under the block corona corners so the global router do not draw wire under them. This was creating deadlock for the detailed router. When the abutment has to be computed, directly use Etesian to do it instead of duplicating the computation in the Python plugin. * New: In Etesian, as Coloquinte seems reluctant to evenly spread the standard cells, we trick it by making them bigger during the placement stage. Furthermore, we do not not uniformely increase the size of the cells but create a "bloating profile" based on cell size, cell name or it's density of terminals. Currently only two profiles are defined, "disabled" which does nothing and "nsxlib" targeted on 4 metal layer technologies (aka AMS 350nm, c35b4). * Bug: In Knik::MatrixVertex, load the default routing gauge using the configuration parameter "katabatic.routingGauge" as the default one may not be the first registered one. * New: In AnabaticEngine::setupNetDatas(), build a dynamic historgram of the nets terminal numbers. * Bug: In Anabatic::AutoContact::Invalidate(), always invalidate the contact cache when topology is invalidated. In case of multiple invalidations, if the first did not invalidate the cache, later one that may need it where not allowed to do so. The end result was correct nonetheless, but it did generate annoying error messages. * Bug: In Anabatic::AutoContactTurn::updateTopology(), bad computation of the contact's depth when delta == 2. * Bug: In Anabatic::Gcell::getCapacity(), was always returning the west edge capacity, even for the westermost GCell, should be the east edge in that case. * New: In Anabatic::AutoSegment, introduce a new measure "distance to terminal". This is the minimal number of segments separating the current one from the nearest RoutingPad. This replace the previous "strong terminal" and "weak terminal" flags. This distance is used by Katana to sort the events, we route the segments *from* the RoutingPads *outward*. The idea being that if we cannot event connect to the RoutingPad, there is no points continuing as thoses segments are the more constraineds. This gives an order close to the simple ascending metals but with better results. * New: In Anabatic::AutoSegment, introduce a new flag "Unbreakable", disable dogleg making on those segments. mainly intended for local segments directly connecteds to RoutingPads (distance == 0). * New: In Anabatic::AutoSegment, more aggressive reducing of segments. Now the only case where a segment cannot be reduced is when it is one horizontal branch in a HTee or a vertical on a VTee. Check if, when not accounted the source & target VIAs are still connex, if so, allow reducing. * New: In Anabatic::AutoContact, new state flags CntVDogleg & CntHDogleg mainly to prevent making doglegs twice on a turn contact. This is to limit over-fragmentation. If one dogleg doesn't solve the problem, making a second one will make things worse only... * Bug: In Anabatic::Configuration::selectRpcomponent(), we were choosing the component with the *smallest* span instead of the *bigger* one. * New: In Anabatic::GCell, introduce a new flag "GoStraight" to tell that no turn go be made inside those GCells. Mainly used underneath a block corona. * New: In AnabaticEngine::layerAssign(), new GCellRps & RpsInRow to manage GCells with too many terminals. Slacken at least one RoutingPad access when there is more than 8 RoutingPad in the GCell (slacken or change a vertical METAL2 (non-preferred) into a METAL3). * Change: In Anabatic::NetBuilderHV, allow the use of terminal connection in non-preferred direction. That is, vertical METAL2 directly connected to the RoutingPad (then a horizontal METAL2). This alllows for short dogleg without clutering the METAL3 layer (critical for AMS c35b4). Done in NetBuilderHV::doRp_Access(), with a new UseNonPref flag. Perform some other tweaking on METAL1 access topologies, to also minimize METAL3 use. * New: In AnabaticEngine::computeNetConstraints(), also compute the distance to RoutingPad for segments. Set the Unbreakable flag, based on the distance and segment length (local, short global or long global). New local function "propagateDistanceFromRp()". * Change: In AnabaticEngine.h, the sorting class for NetData, SparsityOrder, is modificated so net with a degree superior to 10 are sorted first, whatever their sparsity. This is to work in tandem with GlobalRouting. * New: In Katana::TrackSegmentNonPref, introduce a class to manage segment in non-preferred routing direction. Mostly intended for small METAL2 vertical directly connected to RoutingPad. Modifications to manage this new variant all through Katana. * Change: In Katana::GlobalRoute, DigitalDistance honor the GoStraight flag of the GCell. Do not make bend inside thoses GCells. * Change: In KatanaEngine::runGlobalRouter(), high degree nets (>= 10) are routed first and whitout the global routing estimation. There should be few of them so they wont create saturations and we want them as straight as possible. Detour are for long be-points. Set the saerch halo to one GCell in the initial routing stage (before ripup). * Bug: In KatanaEngine & NegociateWindow, call _computeCagedconstraints() inside NegociateWindow::run(), as segments are inserted into tracks only at that point so we cannot make the computation earlier. * Change: In Katana::Manipulator::repackPerpandiculars(), add a flag to select whether to replace the perpandiculars *after* or *before* the current segment. * Change: In Katana::NegociateWindow::NegociateOverlapCost(), when the segment is fully enclosed inside a global, the longest overlap cost is set to the shortest global hoverhang (before or after). When the cost is for a global, set an infinite cost if the overlapping segment has a RP distance less or equal to 1 (this is an access segment). * Bug: In Katana::PowerRailsPlane::Rail::doLayout(), correct computation of the segments extension cap. * New: In Katana::QueryPowerRails::addToPowerRail(), add support for Pad. * Change: In Katana/PreProcess::protectCagedTerminals(), apply the contraints to any turn connected to the first segment of the RoutingPad so the perpandicular constraints got propagated to the perpandicular segment... * Change: In RoutingEvent, cache the "distance to RP" value. * Change: In RoutingEvent::Key::compare(), sort *first* on distance to RoutingPad, then layer depth. If both distance to RoutingPad is null, then sort on segment length. * Change: In RoutingEvent::_processRepair(), try a repack perpandicular with perpandiculars first (then with perpandicular last, then give up). * Change: In SegmentFsm::bindToTrack() and moveToTrack(), set an axis hint when creating the insertion event. * Change: In SegmentFsm::_slackenStrap(), add a step through slacken between minimize and maximum slack (wihch directly end up in unimplemented). * Change: In Session::_addInsertEvent(), add an axis parameter needed when the axis of the segment is not the one of the track (case of wide segments or non-preferred direction). * Bug: In Track::_preDestroy(), bad management of the TrackElement reference count. Destroy the segment only when reaching zero... * Bug: In Track::expandFreeIneterval(), forgotten to manage case when there is a set of overlaping segments at the "end" of the track, the EndIsTrackMax was not set. * Change: In TrackCost::Compare, increase the cost when an overlaping segment is at it's ripup limit. We should try *not* to rip it up if we can. Add a dedicated flag "AtRipupLimit". * Change: In TrackElement, add proxies for isUnbreakable(), new function updateTrackSpan(). * New: In TrackFixedSegment CTOR, when a supply wire of METAL2 or above is found, make the underlying GCells "GoStraight". * New: In TrackElement::canDogleg(GCell*), check for already done perpandicular dogleg on source/target (reject if so).
2019-07-28 16:20:00 -05:00
namespace {
using namespace std;
using namespace CRL;
using namespace Hurricane;
using namespace Anabatic;
class SortRpByX {
public:
inline SortRpByX ();
inline bool operator() ( RoutingPad* rp1, RoutingPad* rp2 );
};
inline SortRpByX::SortRpByX ()
{ }
inline bool SortRpByX::operator() ( RoutingPad* rp1, RoutingPad* rp2 )
{
DbU::Unit x1 = rp1->getCenter().getX();
DbU::Unit x2 = rp2->getCenter().getX();
if (x1 == x2) return false;
return (x1 < x2);
}
// -----------------------------------------------------------------
// Class : "RpsInRow".
class RpsInRow {
public:
class Compare {
public:
bool operator() ( const RpsInRow* lhs, const RpsInRow* rhs ) const;
};
public:
inline RpsInRow ( RoutingPad*, AnabaticEngine* );
inline const vector<RoutingPad*>& getRps () const;
inline size_t getSouth () const;
inline size_t getNorth () const;
inline const Interval& getRpsHSpan () const;
inline const Interval& getRpsVSpan () const;
void slacken ();
private:
void _findTopology ();
inline void _merge ( RoutingPad* );
private:
AnabaticEngine* _anabatic;
vector<RoutingPad*> _rps;
size_t _north;
size_t _south;
Interval _hSpan;
Interval _vSpan;
};
inline RpsInRow::RpsInRow ( RoutingPad* seed, AnabaticEngine* anabatic )
: _anabatic(anabatic)
, _rps ()
, _north (0)
, _south (0)
, _hSpan ()
, _vSpan ( false )
{
_rps.push_back( seed );
_findTopology();
}
inline const vector<RoutingPad*>& RpsInRow::getRps () const { return _rps; }
inline size_t RpsInRow::getSouth () const { return _south; }
inline size_t RpsInRow::getNorth () const { return _north; }
inline const Interval& RpsInRow::getRpsHSpan () const { return _hSpan; }
inline const Interval& RpsInRow::getRpsVSpan () const { return _vSpan; }
bool RpsInRow::Compare::operator() ( const RpsInRow* lhs, const RpsInRow* rhs ) const
{
if ( (lhs->_rps.size() == 2) and (rhs->_rps.size() != 2) ) return true;
if ( (lhs->_rps.size() != 2) and (rhs->_rps.size() == 2) ) return false;
if ( lhs->_rps.size() != rhs->_rps.size() ) return lhs->_rps.size() < rhs->_rps.size();
size_t lhsNs = lhs->_south + lhs->_north;
size_t rhsNs = rhs->_south + rhs->_north;
if (lhsNs != rhsNs) return lhsNs < rhsNs;
if (lhs->_vSpan != rhs->_vSpan) return lhs->_vSpan.getSize() < rhs->_vSpan.getSize();
if (lhs->_hSpan != rhs->_hSpan) return lhs->_hSpan.getSize() < rhs->_hSpan.getSize();
return lhs->_rps[0]->getId() < rhs->_rps[0]->getId();
}
inline void RpsInRow::_merge ( RoutingPad* rp )
{
if (rp != _rps[0]) _rps.push_back( rp );
Box bb ( _rps.back()->getBoundingBox() );
_hSpan.merge( bb.getCenter().getX() );
_vSpan.intersection( bb.getYMin(), bb.getYMax() );
}
void RpsInRow::_findTopology ()
{
cdebug_log(146,1) << "RpsInRow::findTopology() - " << _rps[0] << endl;
_merge( _rps[0] );
AutoSegmentStack stack;
for ( Component* component : _rps[0]->getSlaveComponents() ) {
cdebug_log(146,0) << "slave component: " << component << endl;
AutoContact* rpContact = Session::lookup( dynamic_cast<Contact*>(component) );
if (rpContact) {
cdebug_log(146,0) << "Start rp: " << rpContact << endl;
for ( AutoSegment* segment : rpContact->getAutoSegments() ) {
cdebug_log(146,0) << "Examining: " << segment << endl;
AutoContact* target = segment->getOppositeAnchor(rpContact);
if (target) {
if (segment->isHorizontal()) {
stack.push( target, segment );
} else {
if (segment->isLocal()) {
stack.push( target, segment );
} else {
if (segment->getAutoSource() == rpContact) ++_north;
else ++_south;
}
}
}
}
// Find Rps in same horizontal GCell range.
cdebug_log(146,0) << "Find Rps in same horizontal GCell range" << endl;
while ( not stack.isEmpty() ) {
AutoSegment* from = stack.getAutoSegment();
AutoContact* contact = stack.getAutoContact();
stack.pop();
for ( AutoSegment* segment : contact->getAutoSegments() ) {
if (segment == from) continue;
if (segment->isVertical() and not segment->isLocal()) {
if (segment->getAutoSource() == contact) ++_north;
else ++_south;
continue;
}
AutoContact* target = segment->getOppositeAnchor( contact );
AutoContactTerminal* terminal = dynamic_cast<AutoContactTerminal*>( target );
if (terminal) {
_merge( terminal->getRoutingPad() );
}
stack.push( target, segment );
}
}
}
}
sort( _rps.begin(), _rps.end(), SortRpByX() );
cdebug_log(146,0) << "findHAlignedsRps() - Exit" << endl;
cdebug_tabw(146,-1);
}
void RpsInRow::slacken ()
{
cdebug_log(149,1) << "RpsInRow::slacken()" << endl;
for ( RoutingPad* rp : _rps ) {
cdebug_log(149,0) << "Slacken from: " << rp << endl;
if (rp->getLayer()) {
if (_anabatic->getConfiguration()->getLayerDepth(rp->getLayer()) == 1)
cdebug_log(149,0) << "In METAL2, skiping" << endl;
continue;
}
for ( Component* component : rp->getSlaveComponents() ) {
AutoContact* rpContact = Session::lookup( dynamic_cast<Contact*>(component) );
if (rpContact) {
cdebug_log(149,0) << "+ " << rpContact << endl;
for ( AutoSegment* segment : rpContact->getAutoSegments() ) {
cdebug_log(149,0) << "| " << segment << endl;
if (segment->isVertical()) {
if (segment->getDepth() == 1) {
cdebug_log(149,0) << "| Slacken: " << segment << endl;
segment->changeDepth( 2, Flags::NoFlags );
cdebug_log(149,0) << "| After Slacken: " << segment << endl;
}
} else {
segment->makeDogleg( rpContact->getGCell() );
cdebug_log(149,0) << "| Make dogleg: " << segment << endl;
}
}
}
}
}
cdebug_tabw(149,-1);
}
// -----------------------------------------------------------------
// Class : "GCellRps".
class GCellRps {
public:
class Compare {
public:
bool operator() ( const GCellRps* lhs, const GCellRps* rhs ) const;
};
public:
GCellRps ( GCell*, AnabaticEngine* );
~GCellRps ();
inline GCell* getGCell () const;
inline size_t add ( RoutingPad* );
inline void consolidate ();
inline RpsInRow* getRpsInRow ( size_t i );
inline const vector<RpsInRow*>& getRpsInRows () const;
private:
AnabaticEngine* _anabatic;
GCell* _gcell;
vector<RpsInRow*> _rpsInRows;
};
GCellRps::GCellRps ( GCell* gcell, AnabaticEngine* anabatic )
: _anabatic (anabatic)
, _gcell (gcell)
, _rpsInRows()
{ }
GCellRps::~GCellRps ()
{
for ( RpsInRow* elem : _rpsInRows ) delete elem;
}
inline GCell* GCellRps::getGCell () const { return _gcell; }
inline size_t GCellRps::add ( RoutingPad* rp )
{
_rpsInRows.push_back( new RpsInRow(rp,_anabatic) );
return _rpsInRows.size() - 1;
}
inline void GCellRps::consolidate ()
{
sort( _rpsInRows.begin(), _rpsInRows.end(), RpsInRow::Compare() );
}
inline RpsInRow* GCellRps::getRpsInRow ( size_t i ) { return _rpsInRows[i]; }
inline const vector<RpsInRow*>& GCellRps::getRpsInRows () const { return _rpsInRows; }
bool GCellRps::Compare::operator() ( const GCellRps* lhs, const GCellRps* rhs ) const
{ return lhs->getGCell()->getId() < rhs->getGCell()->getId(); }
} // Anonymous namespace.
namespace Anabatic {
using Hurricane::DebugSession;
using Hurricane::ForEachIterator;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::NetRoutingExtension;
void AnabaticEngine::_desaturate ( unsigned int depth
, set<Net*>& globalNets
, unsigned long& total
, unsigned long& globals )
{
if (depth+2 > Session::getConfiguration()->getAllowedDepth()) {
cerr << Warning("Anabatic::_desaturate(): %s, no remaining upper layers."
,getString(Session::getRoutingGauge()->getRoutingLayer(depth)->getName()).c_str()
) << endl;
return;
}
cmess1 << " o Desaturate layer "
<< Session::getRoutingGauge()->getRoutingLayer(depth)->getName() << endl;
GCellKeyQueue queue;
GCell::Set invalidateds;
for ( GCell* gcell : getGCells() ) queue.push( gcell->cloneKey(depth) );
bool optimized = true;
bool finished = false;
while ( optimized ) {
Session::revalidate ();
optimized = false;
while ( not queue.empty() ) {
GCell::Key* topKey = queue.top();
GCell* gcell = const_cast<GCell*>( topKey->getGCell() );
queue.pop();
if (topKey->isActive()) {
cdebug_log(149,0) << "_desaturate: [" << depth << "]:"
<< gcell->getDensity(depth) << " " << gcell << endl;
if (not gcell->isSaturated(depth)) {
cdebug_log(149,0) << "STOP desaturated: " << gcell << endl;
finished = true;
} else {
if (finished) {
cparanoid << "[ERROR] Still saturated: " << gcell << endl;
}
}
if (not finished) {
optimized = gcell->stepNetDesaturate( depth, globalNets, invalidateds );
if (optimized) {
for ( GCell* gcell : invalidateds ) {
queue.push( gcell->cloneKey(depth) );
}
}
}
}
delete topKey;
}
}
#if OLD_QUEUE_DISABLED
GCellDensitySet queue ( depth, getGCells() );
GCell::Set invalidateds;
bool optimized = true;
while ( optimized ) {
Session::revalidate ();
optimized = false;
queue.requeue ();
std::set<GCell*,GCell::CompareByKey>::const_iterator igcell = queue.getGCells().begin();
size_t i = 0;
for ( ; igcell!=queue.getGCells().end() ; ++igcell, ++i ) {
cdebug_log(149,0) << "_desaturate: [" << depth << "]:"
Added core2chip support for Phenitec80. This commit degrades the run success rate of ARMv2a to 87% (40 iters). * New: In CRLcore/etc/.../kite.conf, add configuration parameters: katana.termSatReservedlocal katana.termSatthreshold for the new edge capacity computation system. * New: In CRLcore/etc/symbolic/phenitec06/, add support for N. Shimizu small I/O pads (supplied in phlib80). Tune various parameters of Anabatic/Katana to increase routing success. * Change: In CRLcore/alliance/ap/ApParser, make Pin external components, so RoutingPad will be build upon in global routing. Do not complain when a I/O pad has a physical instance that did not exists in the netlist. Just create it (appeared in phlib80). When no netlist instance exists in a pad, the pad Cell is still considered as terminal. * New: In Etesian::BloatCells, new profile named "3metals" better suited for two routing metals technologies (i.e. Phenitec). * New: In Anabatic::RawGCellsUnder, new CTOR which take only source & target points instead of a segment. Needed to manage wide segment for which the axis to consider is not that of the segment (one axis for each track it intersect). * New: In Anabatic::GCell, add a RoutingPad count attribute, for Edge reservation computation. * New: In AnabaticEngine::computeEdgeCapacities(), instead of decreasing all edges of a fixed amount (hTrackReservedLocal), guess the GCell cluttering from the number of RoutingPads that it contains. For non-saturated GCells, the four edges are decreased by the number of RoutingPads. We use the maximum from the two neigboring GCells. The hTrackReservedLocal parameter is now used only as a *maximum* that the edge reservation can reach. If a GCell is saturated (more than 8 RoutingPads, the saturation is propagated horizontally to 2 neigboring GCells). * Change: In AutoContactTerminal::getNativeConstraintBox(), use a more flexible gauge name matching for terminal vertical extensions correction. Namely, match all "msxlib*" kind of gauges. * Change: In AutoSegment::setAxis(), add the ability to force the axis position, even if it is a non-canonical segment. Maybe needed in the initialisation steo, before the first canonisation is performed. * New: In NetBuilder, added new methods _do_1G_1PinM1() and _do_2G_1PinM1(), to manage coronas for Phenitec designs. To avoid various side effects from segments being too close from the north / east side of the routing area, make those segments fixeds. * Change: In KatanaEngine::annotateGlobalGraph(), the management of wide wires was wrong. The axis to use to find the underlying GCells is the one of the track, not of the segment. This was creating bad edge capacity computation under the power ring of a block and subsequently routing failures. * New: In Kanata::Manipulator, added method reprocessParallels(), not used though, but keep it anyway, might be of use later... * New: In Kanata::Manipulator, added method avoidBlockage() for terminal METAL2 in non-preferred direction, restrict the terminal and turn constraint box at the current position of the perpandicular, so it doesn't create a deadlock in METAL2. * Change: In SegmentFsm::conflictSolveByPlaceds(), if we cannot break using the whole overlap, try the first atomic overlap. * New: In SegmentFsm::_slackenStrap(), manage conflict between a non-prefered segment and a blockage, this when to call avoidBlockage()... * New: In Katana::Configuration, management of the new edge computation parameters: katana.termSatReservedlocal katana.termSatthreshold * New: In Cumulus/plugins/Core2Chip, support for Phenitec I/O pads.
2019-09-17 10:05:54 -05:00
<< (*igcell)->getDensity(depth) << " " << *igcell << endl;
if (not (*igcell)->isSaturated(depth)) {
cdebug_log(149,0) << "STOP desaturated: @" << i << " " << *igcell << endl;
for ( ; igcell!=queue.getGCells().end() ; ++igcell ) {
if ( (*igcell)->isSaturated( depth ) ) {
cparanoid << "[ERROR] Still saturated: @" << i << " " << *igcell << endl;
break;
}
}
break;
}
optimized = (*igcell)->stepNetDesaturate( depth, globalNets, invalidateds );
if ( optimized ) {
for ( GCell::Set::iterator igcell=invalidateds.begin() ; igcell!=invalidateds.end() ; ++igcell ) {
queue.unqueue( *igcell );
}
break;
}
}
}
#endif
}
void AnabaticEngine::_layerAssignByLength ( Net* net, unsigned long& total, unsigned long& global, set<Net*>& globalNets )
{
DebugSession::open ( net, 140, 150 );
cdebug_log(149,0) << "Anabatic::_layerAssignByLength( " << net << " )" << endl;
cdebug_tabw(145,1);
bool isGlobal = false;
set<AutoContact*> globalContacts;
forEach ( Segment*, isegment, net->getSegments() ) {
total++;
if ( (*isegment)->getLength() > getGlobalThreshold() ) {
if (not isGlobal) {
isGlobal = true;
globalNets.insert( net );
}
global++;
if ((*isegment)->getLayer() == Session::getRoutingLayer(1)) {
(*isegment)->setLayer( Session::getRoutingLayer(3) );
(*isegment)->setWidth( Session::getWireWidth (3) );
}
if ((*isegment)->getLayer() == Session::getRoutingLayer(2)) {
(*isegment)->setLayer( Session::getRoutingLayer(4) );
(*isegment)->setWidth( Session::getWireWidth (4) );
}
}
}
cdebug_tabw(145,-1);
DebugSession::close();
}
void AnabaticEngine::_layerAssignByLength ( unsigned long& total, unsigned long& global, set<Net*>& globalNets )
{
cmess1 << " o Assign Layer (simple wirelength)." << endl;
forEach ( Net* , inet , getCell()->getNets() ) {
if (NetRoutingExtension::get(*inet)->isAutomaticGlobalRoute()) {
_layerAssignByLength ( *inet, total, global, globalNets );
}
} // forEach(Net*)
}
void AnabaticEngine::_layerAssignByTrunk ( Net* net, set<Net*>& globalNets, unsigned long& total, unsigned long& global )
{
DebugSession::open( net, 145, 150 );
cdebug_log(149,0) << "Anabatic::_layerAssignByTrunk ( " << net << " )" << endl;
cdebug_tabw(145,1);
bool isGlobal = false;
unsigned long netGlobal = 0;
unsigned long netTotal = 0;
set<AutoContact*> globalContacts;
forEach ( Segment*, isegment, net->getSegments() ) {
netTotal++;
if ((*isegment)->getLength() > getGlobalThreshold()) {
isGlobal = true;
netTotal = 0;
globalNets.insert( net );
break;
}
}
if (isGlobal) {
forEach ( Segment*, isegment, net->getSegments() ) {
netTotal++;
AutoSegment* autoSegment = Session::lookup( *isegment );
if ( autoSegment and not autoSegment->isStrongTerminal() ) {
netGlobal++;
cdebug_log(145,0) << "Migrate to M4/M5: " << autoSegment << endl;
if (autoSegment->isHorizontal()) {
autoSegment->setLayer( Session::getRoutingLayer(3) );
autoSegment->setWidth( Session::getWireWidth (3) );
}
if (autoSegment->isVertical()) {
autoSegment->setLayer( Session::getRoutingLayer(4) );
autoSegment->setWidth( Session::getWireWidth (4) );
}
}
}
}
total += netTotal;
global += netGlobal;
cdebug_tabw(145,-1);
DebugSession::close();
}
void AnabaticEngine::_layerAssignByTrunk ( unsigned long& total, unsigned long& global, set<Net*>& globalNets )
{
cmess1 << " o Assign Layer (whole net trunk)." << endl;
forEach ( Net* , inet , getCell()->getNets() ) {
if (NetRoutingExtension::get(*inet)->isAutomaticGlobalRoute()) {
_layerAssignByTrunk( *inet, globalNets, total, global );
}
}
}
void AnabaticEngine::_layerAssignNoGlobalM2V ( Net* net, set<Net*>& globalNets, unsigned long& total, unsigned long& global )
{
cdebug_log(149,0) << "Anabatic::_layerAssignNoGlobalM2V ( " << net << " )" << endl;
cdebug_tabw(145,1);
bool isGlobalNet = false;
unsigned long netGlobal = 0;
unsigned long netTotal = 0;
set<AutoContact*> globalContacts;
for ( Segment* baseSegment : net->getSegments() ) {
++netTotal;
AutoSegment* segment = Session::lookup( baseSegment );
if (not segment or segment->isLocal()) continue;
isGlobalNet = true;
netTotal = 0;
globalNets.insert( net );
break;
}
if (isGlobalNet) {
vector<AutoSegment*> horizontals;
for ( Segment* baseSegment : net->getSegments() ) {
AutoSegment* segment = Session::lookup( baseSegment );
if (not segment or not segment->isCanonical()) continue;
if (segment->isHorizontal()) horizontals.push_back( segment );
}
for ( AutoSegment* horizontal : horizontals ) {
vector<AutoSegment*> collapseds;
vector<AutoSegment*> perpandiculars;
vector<AutoSegment*> northBounds;
vector<AutoSegment*> southBounds;
DbU::Unit leftBound;
DbU::Unit rightBound;
Groudwork for routing density driven placement. Compliance with clang 5.0.1. This commit contains two set of features that should have been commited separately. 1. Compliance with clang 5.0.1, tested with the RedHat collection llvm-toolset-7. This allow Coriolis to be compiled under Darwin (MacOS) with Xcode & macports. The bootstrap install system has been modificated accordingly. 2. The basic support for routing density driven placement. Related features are: * Bloat property. Each Occurrence of an Instance can be individually bloated. This property not attached to any tool to allow the placer and router to share it as wanted. Nevertheless, it is defined in Etesian. * BloatProfile in Katana, add individual Bloat properties to Instances occurrences based on the East & North overflowed edges of each GCell. * Support in ToolEngine for a "pass number" of a tool. This pass number is mainly used to make "per pass" measurements. The MeasureSet system is improved accordingly to support multiple values of a same measure. * Embryo of "P&R Conductor" to perform the place & route loop until the design is successfully placed. May be the first brick of a Silicon Compiler. * Change: In boostrap/FindBoostrap.cmake, in setup_boost(), added tag to the python component for macport (ex: python27). * Change: In boostrap/build.conf, put etesian before anabatic for instance occurrence BloatProperty dependency. Added option support for the "llvm-toolset-7" collection to build against clang 5.0.1. * Bug: In Hurricane::getRecord( const pair<T,U>& ), the getSlot<> templates for first & second arguments must be called with <const T> and <const U> as the pair itself is const (and not simply <T> & <U>). * Change: In Hurricane::getSlot() temlate, only use "string" arguments and not const string&, simpler for template argument deduction. * Bug: In Hurricane::AnalogCellExtension, the StandardPrivateProperty<> template has a static member "_name". Clang did show that the template for this static number has to be put inside the namespace where the template *is defined* (i.e. Hurricane) instead of the namespace where it is instanciated (i.e. Analog). * Bug: In Isobar, Matrix_FromListOfList(), PyInt_AsPlacementStatus() must be put outside the C linkage back in the Isobar C++ namespace (clang). * Bug: In Hurricane::DBo::~DBo, and derived add a throw() specification (clang). * Bug: In Hurricane::RegularLayer::getEnclosure() & setEnclosure(), change signature so it matches the one of the base class (clang). * Bug: In Hurricane::CellPrinter, use double brackets for initializer list (clang). * Change: In Hurricane::Breakpoint, reverse the meaning of the error level. Only error level *lesser or equal* than the stop level will be enabled. * Bug: In CRL/python/helpers/__init__.loadUserSettings(), must put the current working directory in the sys.path as in certain configuration it may not be included. * Bug: In CRL::ApDriver, DumpSegments(), no longer generate segments when encountering a RoutingPad on a top-level Pin Occurrence. The segment was generated in the wrong direction, creating DRC violations on the "mips_core_flat" example. * Change: In CRL::Measures, partial re-design of the measurements management. Now, each kind of measure can accept multiple values put in a vector. The index is intented to match a tool run number. * Change: In CRL::Histogram, add support for multiple sets of datas, indexeds with tool run number. * Change: In CRL::ToolEngine, add support for multiple pass number, add addMeasure<> templates for the various data-types. * Change: In CRL::gdsDriver & CRL::gdsParser(), comment out unused GDS record name constants. * New: Etesian::BloatProperty, property to attach to Instance occurrences that contains the extra number of pitch to add to the cell width. * Bug: In AutoSegment::CompareByDepthLength, the segment length comparison was wrong, it was always returning true, which broke the "strick weak ordering" of the comparison. This was producing a core-dump in GCell::updateDensity() when sorting a vector<>. The end() iterator was being dereferenced, leading to the problem. * Bug: In Katana::DataSymmetric::checkPairing(), the test for segments whose axis is perpandicular to the symmetry axis was wrong ("!=" instead of "-"). * New: In Katana/GlobalRoute, new ::selectSegments(), selectOverloadedgcells() and selectBloatedInstances() to automatically select segments from overloaded edges, overloaded GCells and bloated cells. * Change: In KatanaEngine, return a more detailed success state, distinguish between global and detailed. Add support for multiple routing iterations. * New: In cumulus/python/plugins/ConductorPlugin.py, embryo of routing driven placement.
2019-12-08 18:57:44 -06:00
//bool hasNorth = false;
//bool hasSouth = false;
AutoSegment::getTopologicalInfos( horizontal
, collapseds
, perpandiculars
, leftBound
, rightBound
);
for ( AutoSegment* perpandicular : perpandiculars ) {
if (Session::getLayerDepth(perpandicular->getLayer()) > 2) continue;
bool hasGlobal = false;
for ( AutoSegment* aligned : perpandicular->getAligneds(Flags::NoCheckLayer|Flags::WithSelf) ) {
if (aligned->isGlobal()) { hasGlobal = true; break; }
}
if (not hasGlobal) continue;
// if (perpandicular->getSourceY() == horizontal->getAxis()) {
// hasNorth = true;
// if (hasGlobal) northBounds.push_back( perpandicular );
// } else {
// hasSouth = true;
// if (hasGlobal) southBounds.push_back( perpandicular );
// }
if ( perpandicular->getAutoSource()->getGCell()->getNorth()
!= perpandicular->getAutoTarget()->getGCell()) {
perpandicular->changeDepth( 3, Flags::Propagate );
++netGlobal;
continue;
}
}
// if (hasSouth and hasNorth) {
// if (not northBounds.empty()) {
// for ( AutoSegment* perpandicular : northBounds )
// perpandicular->changeDepth( 3, Flags::Propagate );
// } else {
// for ( AutoSegment* perpandicular : southBounds )
// perpandicular->changeDepth( 3, Flags::Propagate );
// }
// }
}
}
total += netTotal;
global += netGlobal;
cdebug_tabw(145,-1);
}
void AnabaticEngine::_layerAssignNoGlobalM2V ( unsigned long& total, unsigned long& global, set<Net*>& globalNets )
{
cmess1 << " o Assign Layer (no global vertical metal2)." << endl;
for ( Net* net : getCell()->getNets() ) {
DebugSession::open( net, 145, 150 );
NetRoutingState* state = NetRoutingExtension::get( net );
if (not state or state->isAutomaticGlobalRoute()) {
_layerAssignNoGlobalM2V( net, globalNets, total, global );
} else {
cdebug_log(145,0) << net << " is not automatic routed, skipped." << endl;
}
DebugSession::close();
}
}
#if THIS_IS_DISABLED
void AnabaticEngine::moveULeft ( AutoSegment* seed, set<Net*>& globalNets, GCell::Set& invalidateds )
{
Net* net = seed->getNet();
DebugSession::open( net, 145, 150 );
cdebug_log(9000,0) << "Deter| Move left: " << seed << endl;
seed->moveULeft();
globalNets.insert( net );
GCell* begin = seed->getAutoSource()->getGCell();
GCell* end = seed->getAutoTarget()->getGCell();
if (seed->isHorizontal()) {
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() )
invalidateds.insert( gcell );
begin = begin->getDown();
end = end ->getDown();
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() )
invalidateds.insert( gcell );
} else {
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getUp() )
invalidateds.insert( gcell );
begin = begin->getLeft();
end = end ->getLeft();
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getUp() )
invalidateds.insert( gcell );
}
DebugSession::close();
}
void AnabaticEngine::moveURight ( AutoSegment* seed, set<Net*>& globalNets, GCell::Set& invalidateds )
{
Net* net = seed->getNet();
DebugSession::open( net, 145, 150 );
cdebug_log(9000,0) << "Deter| Move right: " << seed << endl;
seed->moveURight();
globalNets.insert( net );
GCell* begin = seed->getAutoSource()->getGCell();
GCell* end = seed->getAutoTarget()->getGCell();
if (seed->isHorizontal()) {
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() )
invalidateds.insert( gcell );
begin = begin->getUp();
end = end ->getUp();
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() )
invalidateds.insert( gcell );
} else {
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getUp() )
invalidateds.insert( gcell );
begin = begin->getRight();
end = end ->getRight();
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getUp() )
invalidateds.insert( gcell );
}
DebugSession::close();
}
#endif
bool AnabaticEngine::moveUpNetTrunk ( AutoSegment* seed, set<Net*>& globalNets, GCell::Set& invalidateds )
{
Net* net = seed->getNet();
unsigned int seedDepth = Session::getRoutingGauge()->getLayerDepth(seed->getLayer());
DebugSession::open( net, 145, 150 );
cdebug_log(9000,0) << "Deter| moveUpNetTrunk() depth:" << seedDepth << " " << seed << endl;
if (not seed->canMoveUp( 1.0, Flags::Propagate|Flags::AllowTerminal|Flags::NoCheckLayer) ) {
cdebug_log(9000,0) << "Deter| Reject seed move up, cannot move up." << endl;
DebugSession::close();
return false;
}
cdebug_tabw(149,1);
globalNets.insert( net );
vector< pair<AutoContact*,AutoSegment*> > stack;
vector<AutoSegment*> globals;
vector<AutoSegment*> locals;
stack.push_back( pair<AutoContact*,AutoSegment*>(NULL,seed) );
while ( not stack.empty() ) {
AutoContact* from = stack.back().first;
AutoSegment* segment = stack.back().second;
stack.pop_back();
if (segment->isLocal()) {
if (not segment->isStrongTerminal()) locals.push_back( segment );
continue;
}
if ( (segment->getLength() < 3*Session::getSliceHeight()) and (segment != seed) ) {
locals.push_back( segment );
continue;
}
// Do something here.
if (not segment->canMoveUp( 1.0
, Flags::Propagate
| Flags::AllowTerminal
| Flags::NoCheckLayer
| Flags::CheckLowDensity
) ) continue;
globals.push_back( segment );
AutoContact* source = segment->getAutoSource();
if (source != from) {
for ( AutoSegment* connected : source->getAutoSegments() ) {
if (connected != segment) { stack.push_back( make_pair(source,connected) ); }
}
}
AutoContact* target = segment->getAutoTarget();
if (target != from) {
for ( AutoSegment* connected : target->getAutoSegments() ) {
if (connected != segment) { stack.push_back( make_pair(target,connected) ); }
}
}
}
for ( size_t i=0 ; i<globals.size() ; ++i ) {
//cdebug_log(9000,0) << "Deter| Looking up G:" << globals[i] << endl;
unsigned int depth = Session::getRoutingGauge()->getLayerDepth( globals[i]->getLayer() );
globals[i]->changeDepth( depth+2, Flags::WithNeighbors );
vector<GCell*> gcells;
globals[i]->getGCells( gcells );
for ( size_t j=0 ; j<gcells.size() ; j++ ) {
invalidateds.insert( gcells[j] );
}
}
for ( size_t i=0 ; i<locals.size() ; ++i ) {
//cdebug_log(9000,0) << "Deter| Looking up L:" << locals[i] << endl;
unsigned int depth = Session::getRoutingGauge()->getLayerDepth(locals[i]->getLayer());
if (depth > seedDepth+1) continue;
if (locals[i]->canPivotUp(2.0,Flags::Propagate|Flags::NoCheckLayer)) {
locals[i]->changeDepth( depth+2, Flags::WithNeighbors );
//cdebug_log(9000,0) << "Deter| Trunk move up L:" << locals[i] << endl;
vector<GCell*> gcells;
locals[i]->getGCells( gcells );
for ( size_t j=0 ; j<gcells.size() ; j++ ) {
invalidateds.insert( gcells[j] );
}
}
}
cdebug_tabw(149,-1);
DebugSession::close();
return true;
}
#if THIS_IS_DISABLED
void AnabaticEngine::_balanceGlobalDensity ( unsigned int depth )
{
startMeasures();
Anabatic transient commit 18. Port of Kite (Katana), Yeah, Baby! Yeah! * Bug: In Hurricane, in StaticObservable::getObserver(), if the slot pointer is NULL, do not try to access the owner. Returns NULL, so the caller can be aware of the situation... * Change: In Hurricane, in BreakpointWidget & ExceptionWidget some cosmetic changes (fonts and window sizes). * Bug: In Anabatic, In AutoHorizontal::getConstraints(), take into account the constraints from the source AutoContact, as it holds the constraints transmitted by the RoutingPads and sets up by propageConstraintsFromRp(). It is likely to be a bug affecting the original Katabatic as well. * Change: In Anabatic, in RawGCellsUnder(), check that the segment is not completly oustside the cell abutment box and truncate the coordinates to the part that is inside. Use the "shrink" if we reach the east/north border. * Change: In Anabatic, in Configuration, no more decorator because we will use a true derived relationship. Katana *derives* from *Anabatic* and do not *decorate* it, so the Configuration can do the same. It also implies that we directly create a Katana engine, not an Anabatic one. * Change: In Anabatic, in Session, do not allow the opening of the Session in a standalone fashion (with a static method). Instead it must be opened using the relevant method of the Anabatic/Katana engine. This ensure we are opening the right Session type. * Change: In Anabatic, in AutoSegment_Aligneds() collection the seed segment is not part of the collection by default, but will be included if the Flags::WithSelf is set. * Change: In Configuration, all the flags value are now defined in two steps. Declared in the header and initialized in the module. This is to prevent the fact that on some cases, in relation with the Python "extern C" part modules, we need a true allocated variable. It was causing weird linking problems. A side effect is that they can no longer be used as entry is switches, have to replace them by if/else. * New: In Anabatic, new GCell::getNeighborAt() utility function. * Bug: In Anabatic, in GCell::doGrid(), tag all the GCells of the grid with the grid type... Back annote all the edges capacity (north & east) with the reserved local capacity. * New: Complete portage of Kite over Anabatic. The new engine is christened "Katana" for Kite-Analogic. When it's capabilities and performances will be on a part with Kite, it is to completly replace it (and take back the "Kite" name). Preliminary tests seems to show that, contrary to intuition (because built on a more complex/slower grid), it is even slightly faster than Kite 8-).
2016-08-15 09:30:13 -05:00
openSession();
cmess1 << " o Balance Global Density "
<< Session::getRoutingGauge()->getRoutingLayer(depth)->getName() << endl;
GCellDensitySet queue ( depth, getGCells()) );
GCell::Set invalidateds;
bool optimized = true;
while ( optimized ) {
Session::revalidate();
optimized = false;
queue.requeue();
std::set<GCell*,GCell::CompareByKey>::const_iterator igcell = queue.getGCells().begin();
size_t i = 0;
for ( ; igcell!=queue.getGCells().end() ; ++igcell, ++i ) {
cdebug_log(149,0) << "_balance: [" << depth << "]:"
<< (*igcell)->getDensity(depth) << " " << *igcell << endl;
if (not (*igcell)->isSaturated(depth)) {
cdebug_log(149,0) << "STOP desaturated: @" << i << " " << *igcell << endl;
for ( ; igcell!=queue.getGCells().end() ; ++igcell ) {
if ((*igcell)->isSaturated(depth)) {
cparanoid << Error( "Still saturated: @%d %s", i, getString(*igcell).c_str() ) << endl;
break;
}
}
break;
}
optimized = (*igcell)->stepBalance( depth, invalidateds );
if (optimized) {
for ( GCell::Set::iterator igcell=invalidateds.begin() ; igcell!=invalidateds.end() ; ++igcell ) {
queue.unqueue( *igcell );
}
break;
}
}
}
Session::close();
stopMeasures();
printMeasures( "balance" );
}
void AnabaticEngine::balanceGlobalDensity ()
{
cdebug_log(9000,0) << "Deter| Balance Global Density" << endl;
//_balanceGlobalDensity( 1 ); // metal2
//_balanceGlobalDensity( 2 ); // metal3
set<Net*> globalNets;
GCell::Set invalidateds;
Anabatic transient commit 18. Port of Kite (Katana), Yeah, Baby! Yeah! * Bug: In Hurricane, in StaticObservable::getObserver(), if the slot pointer is NULL, do not try to access the owner. Returns NULL, so the caller can be aware of the situation... * Change: In Hurricane, in BreakpointWidget & ExceptionWidget some cosmetic changes (fonts and window sizes). * Bug: In Anabatic, In AutoHorizontal::getConstraints(), take into account the constraints from the source AutoContact, as it holds the constraints transmitted by the RoutingPads and sets up by propageConstraintsFromRp(). It is likely to be a bug affecting the original Katabatic as well. * Change: In Anabatic, in RawGCellsUnder(), check that the segment is not completly oustside the cell abutment box and truncate the coordinates to the part that is inside. Use the "shrink" if we reach the east/north border. * Change: In Anabatic, in Configuration, no more decorator because we will use a true derived relationship. Katana *derives* from *Anabatic* and do not *decorate* it, so the Configuration can do the same. It also implies that we directly create a Katana engine, not an Anabatic one. * Change: In Anabatic, in Session, do not allow the opening of the Session in a standalone fashion (with a static method). Instead it must be opened using the relevant method of the Anabatic/Katana engine. This ensure we are opening the right Session type. * Change: In Anabatic, in AutoSegment_Aligneds() collection the seed segment is not part of the collection by default, but will be included if the Flags::WithSelf is set. * Change: In Configuration, all the flags value are now defined in two steps. Declared in the header and initialized in the module. This is to prevent the fact that on some cases, in relation with the Python "extern C" part modules, we need a true allocated variable. It was causing weird linking problems. A side effect is that they can no longer be used as entry is switches, have to replace them by if/else. * New: In Anabatic, new GCell::getNeighborAt() utility function. * Bug: In Anabatic, in GCell::doGrid(), tag all the GCells of the grid with the grid type... Back annote all the edges capacity (north & east) with the reserved local capacity. * New: Complete portage of Kite over Anabatic. The new engine is christened "Katana" for Kite-Analogic. When it's capabilities and performances will be on a part with Kite, it is to completly replace it (and take back the "Kite" name). Preliminary tests seems to show that, contrary to intuition (because built on a more complex/slower grid), it is even slightly faster than Kite 8-).
2016-08-15 09:30:13 -05:00
openSession();
vector<AutoSegment*> segments;
AutoSegmentLut::iterator ilut = _autoSegmentLut.begin();
for ( ; ilut!=_autoSegmentLut.end() ; ++ilut ) {
AutoSegment* segment = (*ilut).second;
if (segment->isLocal() or segment->isFixed()) continue;
if (not segment->isCanonical()) continue;
segments.push_back( segment );
}
// Sort on id before moving to ensure determinism.
sort( segments.begin(), segments.end(), AutoSegment::CompareId() );
for ( size_t i=0 ; i<segments.size() ; ++i ) {
// Hard-coded: reserve 3 tracks (1/20 * 3).
if (segments[i]->canMoveULeft(0.10)) {
moveULeft(segments[i],globalNets,invalidateds);
} else if (segments[i]->canMoveURight(0.10)) {
moveURight(segments[i],globalNets,invalidateds);
}
for ( GCell::Set::iterator igcell=invalidateds.begin() ; igcell!=invalidateds.end() ; ++igcell ) {
(*igcell)->updateDensity();
}
invalidateds.clear();
Session::revalidate();
}
Session::close();
}
#endif
void AnabaticEngine::layerAssign ( uint32_t method )
{
//DebugSession::open( 145, 150 );
cdebug_log(9000,0) << "Deter| Layer Assignment" << endl;
set<Net*> globalNets;
unsigned long total = 0;
unsigned long global = 0;
startMeasures();
Anabatic transient commit 18. Port of Kite (Katana), Yeah, Baby! Yeah! * Bug: In Hurricane, in StaticObservable::getObserver(), if the slot pointer is NULL, do not try to access the owner. Returns NULL, so the caller can be aware of the situation... * Change: In Hurricane, in BreakpointWidget & ExceptionWidget some cosmetic changes (fonts and window sizes). * Bug: In Anabatic, In AutoHorizontal::getConstraints(), take into account the constraints from the source AutoContact, as it holds the constraints transmitted by the RoutingPads and sets up by propageConstraintsFromRp(). It is likely to be a bug affecting the original Katabatic as well. * Change: In Anabatic, in RawGCellsUnder(), check that the segment is not completly oustside the cell abutment box and truncate the coordinates to the part that is inside. Use the "shrink" if we reach the east/north border. * Change: In Anabatic, in Configuration, no more decorator because we will use a true derived relationship. Katana *derives* from *Anabatic* and do not *decorate* it, so the Configuration can do the same. It also implies that we directly create a Katana engine, not an Anabatic one. * Change: In Anabatic, in Session, do not allow the opening of the Session in a standalone fashion (with a static method). Instead it must be opened using the relevant method of the Anabatic/Katana engine. This ensure we are opening the right Session type. * Change: In Anabatic, in AutoSegment_Aligneds() collection the seed segment is not part of the collection by default, but will be included if the Flags::WithSelf is set. * Change: In Configuration, all the flags value are now defined in two steps. Declared in the header and initialized in the module. This is to prevent the fact that on some cases, in relation with the Python "extern C" part modules, we need a true allocated variable. It was causing weird linking problems. A side effect is that they can no longer be used as entry is switches, have to replace them by if/else. * New: In Anabatic, new GCell::getNeighborAt() utility function. * Bug: In Anabatic, in GCell::doGrid(), tag all the GCells of the grid with the grid type... Back annote all the edges capacity (north & east) with the reserved local capacity. * New: Complete portage of Kite over Anabatic. The new engine is christened "Katana" for Kite-Analogic. When it's capabilities and performances will be on a part with Kite, it is to completly replace it (and take back the "Kite" name). Preliminary tests seems to show that, contrary to intuition (because built on a more complex/slower grid), it is even slightly faster than Kite 8-).
2016-08-15 09:30:13 -05:00
openSession();
if (Session::getAllowedDepth() >= 3) {
switch ( method ) {
case EngineLayerAssignByLength: _layerAssignByLength ( total, global, globalNets ); break;
case EngineLayerAssignByTrunk: _layerAssignByTrunk ( total, global, globalNets ); break;
case EngineLayerAssignNoGlobalM2V: _layerAssignNoGlobalM2V ( total, global, globalNets ); break;
case EngineNoNetLayerAssign: break;
default:
stopMeasures();
Session::close();
throw Error( badMethod
, "Anabatic::layerAssign()"
, method
, getString(_cell).c_str()
);
}
globalNets.clear();
Session::revalidate();
Improved handling of short nets (fully included in one GCell). The short net mode degrade the routing in some cases. This will be fixed in a next batch of commits. * New: In Hurricane::NetRoutingProperty, added "ShortNet" flag for Nets that are completly inside *one* GCell. * Bug: In CRL::BlifParser::Model::staticInit(), when looking for the output of zero and one cell, also skip the blockage net (as well as automatic and supplies). * New: In Anabatic::AutoSegment, added "ShortNet" flag to know if the segment is part of a short net (fully included in *one* GCell). Also add accessor/mutators for the _analogMode flag (was it ever used before?). * New: In Anabatic::NetBuilder::singleGCell(), if a RoutingPad is vertically small, add a vertical segment to give it some slack. * New: In Anabatic::Dijkstra::_materialize(), detect "short net" as they have only one GCell in their source list... * Bug: In AnabaticEngine::_loadGrbyNet(), reset the AutoSegment "short net" and "analog mode" creation flags between two different nets. * New: In Katana::Configuration, added dedicated ripup for short net segmnts. * New: In Katana: partially implemented support for "short dogleg", that is dogleg that are always kept in same metal because they connect neighboring perpandicular tracks. Not finished neither activated yet. * New: In Katana::TreckElement and derived, export the the *short net* support from AutoSegment. * Bug: In Katana::RoutingEvent::_processRepair(), when a segment is successfully inserted, re-process any perpandicular that is in repair state, as it may have a new chance to be placed. * New: In Katana::SegmentFsm::slackenTopology(), always reject short nets. * Bug: In Katana::Track::check(), correctly handle wide segments instead of issuing false check messages.
2018-07-16 04:16:51 -05:00
if ( (method != EngineLayerAssignNoGlobalM2V)
and (getConfiguration()->getAllowedDepth() > 2) ) {
for ( size_t depth=1 ; depth <= getConfiguration()->getAllowedDepth()-2; ++depth ) {
_desaturate( depth, globalNets, total, global );
if ( (depth > 1) and ((depth-1)%2 == 1) ) Session::revalidate();
}
Improved handling of short nets (fully included in one GCell). The short net mode degrade the routing in some cases. This will be fixed in a next batch of commits. * New: In Hurricane::NetRoutingProperty, added "ShortNet" flag for Nets that are completly inside *one* GCell. * Bug: In CRL::BlifParser::Model::staticInit(), when looking for the output of zero and one cell, also skip the blockage net (as well as automatic and supplies). * New: In Anabatic::AutoSegment, added "ShortNet" flag to know if the segment is part of a short net (fully included in *one* GCell). Also add accessor/mutators for the _analogMode flag (was it ever used before?). * New: In Anabatic::NetBuilder::singleGCell(), if a RoutingPad is vertically small, add a vertical segment to give it some slack. * New: In Anabatic::Dijkstra::_materialize(), detect "short net" as they have only one GCell in their source list... * Bug: In AnabaticEngine::_loadGrbyNet(), reset the AutoSegment "short net" and "analog mode" creation flags between two different nets. * New: In Katana::Configuration, added dedicated ripup for short net segmnts. * New: In Katana: partially implemented support for "short dogleg", that is dogleg that are always kept in same metal because they connect neighboring perpandicular tracks. Not finished neither activated yet. * New: In Katana::TreckElement and derived, export the the *short net* support from AutoSegment. * Bug: In Katana::RoutingEvent::_processRepair(), when a segment is successfully inserted, re-process any perpandicular that is in repair state, as it may have a new chance to be placed. * New: In Katana::SegmentFsm::slackenTopology(), always reject short nets. * Bug: In Katana::Track::check(), correctly handle wide segments instead of issuing false check messages.
2018-07-16 04:16:51 -05:00
globalNets.clear ();
Session::revalidate();
}
#if defined(CHECK_DATABASE)
_check( "after layer assignment" );
#endif
Session::setAnabaticFlags( Flags::WarnOnGCellOverload );
}
Upgrade of Katana detailed router to support Arlet 6502. * Change: In Hurricane::SharedName, replace the incremental Id by a hash key. This is to ensure better deterministic properties. Between use cases, additional strings may have to be allocated, shitfing the ids. Even if hash can be duplicated, we should be able to ensure that the absolute order in map table should be preserved. Supplemental strings are inserted in a way that keep the previous order. * Change: In CRL/etc/symbolic/cmos/kite.conf, add "katabatic.routingGauge" default parameter value ("sxlib"). * Change: In CRL/etc/common/technology.conf, define minimal spacing for symbolic layers too (added for METAL4 only for now). * Change: In CRL::Histogram, extend support to dynamically sized histograms. Add a text pretty print with table and pseudo-curve. * Change: In Cumulus/plugins/ClockTreePlugin, create blockage under the block corona corners so the global router do not draw wire under them. This was creating deadlock for the detailed router. When the abutment has to be computed, directly use Etesian to do it instead of duplicating the computation in the Python plugin. * New: In Etesian, as Coloquinte seems reluctant to evenly spread the standard cells, we trick it by making them bigger during the placement stage. Furthermore, we do not not uniformely increase the size of the cells but create a "bloating profile" based on cell size, cell name or it's density of terminals. Currently only two profiles are defined, "disabled" which does nothing and "nsxlib" targeted on 4 metal layer technologies (aka AMS 350nm, c35b4). * Bug: In Knik::MatrixVertex, load the default routing gauge using the configuration parameter "katabatic.routingGauge" as the default one may not be the first registered one. * New: In AnabaticEngine::setupNetDatas(), build a dynamic historgram of the nets terminal numbers. * Bug: In Anabatic::AutoContact::Invalidate(), always invalidate the contact cache when topology is invalidated. In case of multiple invalidations, if the first did not invalidate the cache, later one that may need it where not allowed to do so. The end result was correct nonetheless, but it did generate annoying error messages. * Bug: In Anabatic::AutoContactTurn::updateTopology(), bad computation of the contact's depth when delta == 2. * Bug: In Anabatic::Gcell::getCapacity(), was always returning the west edge capacity, even for the westermost GCell, should be the east edge in that case. * New: In Anabatic::AutoSegment, introduce a new measure "distance to terminal". This is the minimal number of segments separating the current one from the nearest RoutingPad. This replace the previous "strong terminal" and "weak terminal" flags. This distance is used by Katana to sort the events, we route the segments *from* the RoutingPads *outward*. The idea being that if we cannot event connect to the RoutingPad, there is no points continuing as thoses segments are the more constraineds. This gives an order close to the simple ascending metals but with better results. * New: In Anabatic::AutoSegment, introduce a new flag "Unbreakable", disable dogleg making on those segments. mainly intended for local segments directly connecteds to RoutingPads (distance == 0). * New: In Anabatic::AutoSegment, more aggressive reducing of segments. Now the only case where a segment cannot be reduced is when it is one horizontal branch in a HTee or a vertical on a VTee. Check if, when not accounted the source & target VIAs are still connex, if so, allow reducing. * New: In Anabatic::AutoContact, new state flags CntVDogleg & CntHDogleg mainly to prevent making doglegs twice on a turn contact. This is to limit over-fragmentation. If one dogleg doesn't solve the problem, making a second one will make things worse only... * Bug: In Anabatic::Configuration::selectRpcomponent(), we were choosing the component with the *smallest* span instead of the *bigger* one. * New: In Anabatic::GCell, introduce a new flag "GoStraight" to tell that no turn go be made inside those GCells. Mainly used underneath a block corona. * New: In AnabaticEngine::layerAssign(), new GCellRps & RpsInRow to manage GCells with too many terminals. Slacken at least one RoutingPad access when there is more than 8 RoutingPad in the GCell (slacken or change a vertical METAL2 (non-preferred) into a METAL3). * Change: In Anabatic::NetBuilderHV, allow the use of terminal connection in non-preferred direction. That is, vertical METAL2 directly connected to the RoutingPad (then a horizontal METAL2). This alllows for short dogleg without clutering the METAL3 layer (critical for AMS c35b4). Done in NetBuilderHV::doRp_Access(), with a new UseNonPref flag. Perform some other tweaking on METAL1 access topologies, to also minimize METAL3 use. * New: In AnabaticEngine::computeNetConstraints(), also compute the distance to RoutingPad for segments. Set the Unbreakable flag, based on the distance and segment length (local, short global or long global). New local function "propagateDistanceFromRp()". * Change: In AnabaticEngine.h, the sorting class for NetData, SparsityOrder, is modificated so net with a degree superior to 10 are sorted first, whatever their sparsity. This is to work in tandem with GlobalRouting. * New: In Katana::TrackSegmentNonPref, introduce a class to manage segment in non-preferred routing direction. Mostly intended for small METAL2 vertical directly connected to RoutingPad. Modifications to manage this new variant all through Katana. * Change: In Katana::GlobalRoute, DigitalDistance honor the GoStraight flag of the GCell. Do not make bend inside thoses GCells. * Change: In KatanaEngine::runGlobalRouter(), high degree nets (>= 10) are routed first and whitout the global routing estimation. There should be few of them so they wont create saturations and we want them as straight as possible. Detour are for long be-points. Set the saerch halo to one GCell in the initial routing stage (before ripup). * Bug: In KatanaEngine & NegociateWindow, call _computeCagedconstraints() inside NegociateWindow::run(), as segments are inserted into tracks only at that point so we cannot make the computation earlier. * Change: In Katana::Manipulator::repackPerpandiculars(), add a flag to select whether to replace the perpandiculars *after* or *before* the current segment. * Change: In Katana::NegociateWindow::NegociateOverlapCost(), when the segment is fully enclosed inside a global, the longest overlap cost is set to the shortest global hoverhang (before or after). When the cost is for a global, set an infinite cost if the overlapping segment has a RP distance less or equal to 1 (this is an access segment). * Bug: In Katana::PowerRailsPlane::Rail::doLayout(), correct computation of the segments extension cap. * New: In Katana::QueryPowerRails::addToPowerRail(), add support for Pad. * Change: In Katana/PreProcess::protectCagedTerminals(), apply the contraints to any turn connected to the first segment of the RoutingPad so the perpandicular constraints got propagated to the perpandicular segment... * Change: In RoutingEvent, cache the "distance to RP" value. * Change: In RoutingEvent::Key::compare(), sort *first* on distance to RoutingPad, then layer depth. If both distance to RoutingPad is null, then sort on segment length. * Change: In RoutingEvent::_processRepair(), try a repack perpandicular with perpandiculars first (then with perpandicular last, then give up). * Change: In SegmentFsm::bindToTrack() and moveToTrack(), set an axis hint when creating the insertion event. * Change: In SegmentFsm::_slackenStrap(), add a step through slacken between minimize and maximum slack (wihch directly end up in unimplemented). * Change: In Session::_addInsertEvent(), add an axis parameter needed when the axis of the segment is not the one of the track (case of wide segments or non-preferred direction). * Bug: In Track::_preDestroy(), bad management of the TrackElement reference count. Destroy the segment only when reaching zero... * Bug: In Track::expandFreeIneterval(), forgotten to manage case when there is a set of overlaping segments at the "end" of the track, the EndIsTrackMax was not set. * Change: In TrackCost::Compare, increase the cost when an overlaping segment is at it's ripup limit. We should try *not* to rip it up if we can. Add a dedicated flag "AtRipupLimit". * Change: In TrackElement, add proxies for isUnbreakable(), new function updateTrackSpan(). * New: In TrackFixedSegment CTOR, when a supply wire of METAL2 or above is found, make the underlying GCells "GoStraight". * New: In TrackElement::canDogleg(GCell*), check for already done perpandicular dogleg on source/target (reject if so).
2019-07-28 16:20:00 -05:00
set<GCellRps*,GCellRps::Compare> gcellRpss;
for ( GCell* gcell : getGCells() ) {
set<RoutingPad*,Entity::CompareById> rps;
const vector<AutoContact*> contacts = gcell->getContacts();
for ( AutoContact* contact : contacts ) {
AutoContactTerminal* terminal = dynamic_cast<AutoContactTerminal*>( contact );
if (terminal) {
rps.insert( terminal->getRoutingPad() );
}
}
if (rps.size() > 8) {
GCellRps* gcellRps = new GCellRps ( gcell, this );
gcellRpss.insert( gcellRps );
for ( RoutingPad* rp : rps ) gcellRps->add( rp );
}
}
for ( GCellRps* gcellRps : gcellRpss ) {
gcellRps->consolidate();
const vector<RpsInRow*>& rpsInRows = gcellRps->getRpsInRows();
cdebug_log(149,0) << gcellRps->getGCell() << " has " << rpsInRows.size() << " terminals." << endl;
size_t count = 0;
for ( RpsInRow* rpsInRow : rpsInRows ) {
cdebug_log(149,0) << "North:" << rpsInRow->getNorth() << " South:"
<< rpsInRow->getSouth() << " net:"
<< rpsInRow->getRps()[0]->getNet()->getName() << endl;
cdebug_log(149,0) << "H-Span:" << rpsInRow->getRpsHSpan() << " V-Span:" << rpsInRow->getRpsVSpan() << endl;
for ( RoutingPad* arp : rpsInRow->getRps() ) {
cdebug_log(149,0) << "| " << arp << endl;
}
if (++count < 2) rpsInRow->slacken();
}
for ( AutoSegment* segment : gcellRps->getGCell()->getHSegments() ) {
if (segment->canPivotUp()) {
cdebug_log(149,0) << "Move up horizontal: " << segment << endl;
segment->moveUp( Flags::Propagate );
}
}
delete gcellRps;
}
checkGCellDensities();
Session::close();
stopMeasures();
printMeasures( "assign" );
// cmess2 << " - Total segments : " << total << endl;
// cmess2 << " - Global segments : " << global << endl;
// cmess2 << " - Ratio : "
// << ((float)global/(float)total)*100.0 << "%." << endl;
//DebugSession::close();
}
} // Anabatic namespace.