2016-07-18 07:48:37 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
|
|
|
// Copyright (c) UPMC 2008-2016, 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 : "./AutoHorizontal.cpp" |
|
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include "hurricane/Bug.h"
|
|
|
|
#include "hurricane/Error.h"
|
|
|
|
#include "hurricane/DebugSession.h"
|
|
|
|
#include "hurricane/RoutingPad.h"
|
|
|
|
#include "crlcore/RoutingGauge.h"
|
|
|
|
#include "anabatic/Configuration.h"
|
|
|
|
#include "anabatic/AutoContactTerminal.h"
|
|
|
|
#include "anabatic/AutoContactTurn.h"
|
|
|
|
#include "anabatic/AutoHorizontal.h"
|
|
|
|
#include "anabatic/AutoVertical.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Anabatic {
|
|
|
|
|
|
|
|
|
|
|
|
using std::min;
|
|
|
|
using std::max;
|
|
|
|
using Hurricane::Error;
|
|
|
|
using Hurricane::Bug;
|
|
|
|
using Hurricane::DebugSession;
|
|
|
|
using Hurricane::RoutingPad;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "Anabatic::AutoHorizontal".
|
|
|
|
|
|
|
|
|
|
|
|
Segment* AutoHorizontal::base () { return _horizontal; }
|
|
|
|
Segment* AutoHorizontal::base () const { return _horizontal; }
|
|
|
|
Horizontal* AutoHorizontal::getHorizontal () { return _horizontal; }
|
|
|
|
DbU::Unit AutoHorizontal::getSourceU () const { return _horizontal->getSourceX(); }
|
|
|
|
DbU::Unit AutoHorizontal::getTargetU () const { return _horizontal->getTargetX(); }
|
|
|
|
DbU::Unit AutoHorizontal::getDuSource () const { return _horizontal->getDxSource(); }
|
|
|
|
DbU::Unit AutoHorizontal::getDuTarget () const { return _horizontal->getDxTarget(); }
|
|
|
|
Interval AutoHorizontal::getSpanU () const { return Interval(_horizontal->getSourceX(),_horizontal->getTargetX()); }
|
|
|
|
void AutoHorizontal::setDuSource ( DbU::Unit du ) { _horizontal->setDxSource(du); }
|
|
|
|
void AutoHorizontal::setDuTarget ( DbU::Unit du ) { _horizontal->setDxTarget(du); }
|
|
|
|
string AutoHorizontal::_getTypeName () const { return "AutoHorizontal"; }
|
|
|
|
|
|
|
|
|
|
|
|
AutoHorizontal::AutoHorizontal ( Horizontal* horizontal )
|
|
|
|
: AutoSegment(horizontal)
|
|
|
|
, _horizontal(horizontal)
|
|
|
|
{
|
|
|
|
cdebug_log(145,0) << "CTOR AutoHorizontal " << this << endl;
|
|
|
|
cdebug_log(145,0) << " over " << horizontal << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::_postCreate ()
|
|
|
|
{
|
|
|
|
AutoSegment::_postCreate ();
|
|
|
|
|
|
|
|
AutoContact* source = getAutoSource();
|
|
|
|
if (source->isTerminal()) source->setY( _horizontal->getY() );
|
|
|
|
|
|
|
|
AutoContact* target = getAutoTarget();
|
|
|
|
if (target->isTerminal()) target->setY( _horizontal->getY() );
|
|
|
|
|
|
|
|
_gcell = source->getGCell();
|
|
|
|
|
|
|
|
setOptimalMax( getGCell()->getYMax() );
|
2016-08-30 09:05:15 -05:00
|
|
|
resetNativeConstraints( getGCell()->getYMin(), getGCell()->getConstraintYMax() );
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
if (getGCell() != target->getGCell()) {
|
|
|
|
setFlags( SegGlobal );
|
|
|
|
|
|
|
|
vector<GCell*> gcells;
|
|
|
|
getGCells( gcells );
|
|
|
|
for ( GCell* gcell : gcells ) {
|
|
|
|
if ( (gcell != getGCell()) and (gcell != target->getGCell()) )
|
|
|
|
gcell->addHSegment( this );
|
|
|
|
mergeNativeMin( gcell->getYMin() );
|
2016-08-30 09:05:15 -05:00
|
|
|
mergeNativeMax( gcell->getConstraintYMax() );
|
2016-07-18 07:48:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::_preDestroy ()
|
|
|
|
{
|
|
|
|
cdebug_log(149,0) << "AutoHorizontal::_preDestroy() - <id:" << getId() << "> " << endl;
|
|
|
|
cdebug_log(149,0) << " " << _getString() << endl;
|
|
|
|
cdebug_tabw(145,1);
|
|
|
|
|
|
|
|
if (not Session::doDestroyTool()) {
|
|
|
|
vector<GCell*> gcells;
|
|
|
|
getGCells( gcells );
|
|
|
|
for ( GCell* gcell : gcells ) gcell->removeHSegment( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoSegment::_preDestroy ();
|
|
|
|
cdebug_tabw(145,-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AutoHorizontal::~AutoHorizontal ()
|
|
|
|
{
|
|
|
|
if ( Session::doDestroyBaseSegment() and not Session::doDestroyTool() ) {
|
|
|
|
cdebug_log(149,0) << "~AutoHorizontal() - " << endl;
|
|
|
|
_horizontal->destroy ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Interval AutoHorizontal::getSourceConstraints ( Flags flags ) const
|
2016-07-18 07:48:37 -05:00
|
|
|
{
|
|
|
|
if (flags & Flags::NativeConstraints) {
|
|
|
|
Box nativeBox ( getAutoSource()->getNativeConstraintBox() );
|
|
|
|
return Interval ( nativeBox.getYMin(), nativeBox.getYMax() );
|
|
|
|
}
|
|
|
|
return Interval ( getAutoSource()->getCBYMin(), getAutoSource()->getCBYMax() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Interval AutoHorizontal::getTargetConstraints ( Flags flags ) const
|
2016-07-18 07:48:37 -05:00
|
|
|
{
|
|
|
|
if (flags & Flags::NativeConstraints) {
|
|
|
|
Box nativeBox ( getAutoTarget()->getNativeConstraintBox() );
|
|
|
|
return Interval ( nativeBox.getYMin(), nativeBox.getYMax() );
|
|
|
|
}
|
|
|
|
return Interval ( getAutoTarget()->getCBYMin(), getAutoTarget()->getCBYMax() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::getConstraints ( DbU::Unit& constraintMin, DbU::Unit& constraintMax ) const
|
|
|
|
{
|
|
|
|
constraintMin = getNativeMin();
|
|
|
|
constraintMax = getNativeMax();
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "Native constraints: ["
|
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
|
|
|
<< DbU::getValueString(constraintMin) << ":"
|
|
|
|
<< DbU::getValueString(constraintMax) << "]"
|
|
|
|
<< endl;
|
|
|
|
|
|
|
|
constraintMin = std::max ( constraintMin, getAutoSource()->getCBYMin() );
|
|
|
|
constraintMax = std::min ( constraintMax, getAutoSource()->getCBYMax() );
|
|
|
|
cdebug_log(149,0) << "Merge with source constraints: ["
|
|
|
|
<< DbU::getValueString(getAutoSource()->getCBYMin()) << ":"
|
|
|
|
<< DbU::getValueString(getAutoSource()->getCBYMax()) << "]"
|
|
|
|
<< endl;
|
|
|
|
|
|
|
|
constraintMin = std::max ( constraintMin, getUserConstraints().getVMin() );
|
|
|
|
constraintMax = std::min ( constraintMax, getUserConstraints().getVMax() );
|
|
|
|
cdebug_log(149,0) << "Merge with user constraints: ["
|
|
|
|
<< DbU::getValueString(getUserConstraints().getVMin()) << ":"
|
|
|
|
<< DbU::getValueString(getUserConstraints().getVMax()) << "]"
|
|
|
|
<< endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
cdebug_log(149,0) << "Resulting constraints: " << " ["
|
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
|
|
|
<< DbU::getValueString(constraintMin) << ":"
|
|
|
|
<< DbU::getValueString(constraintMax) << "]"
|
|
|
|
<< endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
Flags AutoHorizontal::getDirection () const
|
2016-07-18 07:48:37 -05:00
|
|
|
{ return Flags::Horizontal; }
|
|
|
|
|
|
|
|
|
|
|
|
size_t AutoHorizontal::getGCells ( vector<GCell*>& gcells ) const
|
|
|
|
{
|
|
|
|
vector<GCell*>().swap( gcells );
|
|
|
|
|
2016-09-22 11:52:53 -05:00
|
|
|
DbU::Unit yprobe = getY();
|
2016-07-18 07:48:37 -05:00
|
|
|
GCell* gcell = getAutoSource()->getGCell();
|
|
|
|
GCell* end = getAutoTarget()->getGCell();
|
|
|
|
|
2016-09-22 11:52:53 -05:00
|
|
|
cdebug_log(149,0) << "yprobe: " << DbU::getValueString(yprobe) << endl;
|
|
|
|
|
2016-07-18 07:48:37 -05:00
|
|
|
if (gcell->getXMin() > end->getXMin()) std::swap( gcell, end );
|
2016-09-22 09:59:24 -05:00
|
|
|
if (yprobe == gcell->getConstraintYMax()) yprobe--;
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
gcells.push_back( gcell );
|
|
|
|
|
|
|
|
while ( gcell != end ) {
|
|
|
|
gcell = gcell->getEast( yprobe );
|
|
|
|
if (not gcell) {
|
|
|
|
cerr << Error( "AutoHorizontal::getGCells() : NULL GCell under %s\n"
|
|
|
|
" begin:%s\n"
|
|
|
|
" end: %s"
|
|
|
|
, getString(this).c_str()
|
|
|
|
, getString(getAutoSource()->getGCell()).c_str()
|
|
|
|
, getString(getAutoTarget()->getGCell()).c_str()
|
|
|
|
) << endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gcells.push_back( gcell );
|
|
|
|
}
|
|
|
|
|
|
|
|
return gcells.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::_canSlacken () const
|
|
|
|
{
|
|
|
|
cdebug_tabw(149,1);
|
|
|
|
|
|
|
|
Interval sourceSide = getAutoSource()->getGCell()->getSide( Flags::Vertical );
|
|
|
|
Interval targetSide = getAutoTarget()->getGCell()->getSide( Flags::Vertical );
|
|
|
|
Interval sourceConstraints = Interval(getAutoSource()->getCBYMin(),getAutoSource()->getCBYMax());
|
|
|
|
Interval targetConstraints = Interval(getAutoTarget()->getCBYMin(),getAutoTarget()->getCBYMax());
|
|
|
|
|
|
|
|
// Expand by a tiny amount for the "contains" to work for sure.
|
|
|
|
sourceConstraints.inflate( 1 );
|
|
|
|
targetConstraints.inflate( 1 );
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "source " << getAutoSource() << endl;
|
|
|
|
cdebug_log(149,0) << "source constraints: " << sourceConstraints
|
|
|
|
<< " " << DbU::getValueString(sourceConstraints.getSize()) << endl;
|
|
|
|
cdebug_log(149,0) << "target " << getAutoTarget() << endl;
|
|
|
|
cdebug_log(149,0) << "target constraints: " << targetConstraints
|
|
|
|
<< " " << DbU::getValueString(targetConstraints.getSize()) << endl;
|
|
|
|
|
|
|
|
if (not sourceConstraints.contains(sourceSide)) { cdebug_tabw(149,-1); return true; }
|
|
|
|
if (not targetConstraints.contains(targetSide)) { cdebug_tabw(149,-1); return true; }
|
|
|
|
|
|
|
|
cdebug_tabw(149,-1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
bool AutoHorizontal::_slacken ( Flags flags )
|
2016-07-18 07:48:37 -05:00
|
|
|
{
|
|
|
|
cdebug_log(149,0) << "AutoHorizontal::_slacken() " << this << endl;
|
|
|
|
|
|
|
|
if (not isStrongTerminal()) return false;
|
|
|
|
|
|
|
|
const Configuration* configuration = Session::getConfiguration();
|
|
|
|
const Layer* metal2 = configuration->getRoutingLayer( 1 );
|
|
|
|
|
|
|
|
bool success = false;
|
|
|
|
bool isMetal2Source = false;
|
|
|
|
bool isMetal2Target = false;
|
|
|
|
DbU::Unit height = 0;
|
|
|
|
AutoContact* source = getAutoSource();
|
|
|
|
AutoContact* target = getAutoTarget();
|
|
|
|
if (source->isTerminal()) {
|
|
|
|
height = (static_cast<RoutingPad*>(source->getAnchor()))->getBoundingBox().getHeight();
|
|
|
|
isMetal2Source = (source->getLayer() == metal2);
|
|
|
|
}
|
|
|
|
if (target->isTerminal()) {
|
|
|
|
height = std::min( height, (static_cast<RoutingPad*>(target->getAnchor()))->getBoundingBox().getHeight() );
|
|
|
|
isMetal2Target = (target->getLayer() == metal2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (height >= 4*getPitch()) {
|
|
|
|
if (not (_flags & (SegGlobal|SegWeakGlobal)) and (getLength() < 5*getPitch()))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
cdebug_tabw(149,1);
|
|
|
|
cdebug_log(149,0) << "_flags:" << (_flags & (SegGlobal|SegWeakGlobal)) << endl;
|
|
|
|
cdebug_log(149,0) << "test:" << (getLength() < 5*getPitch()) << endl;
|
|
|
|
cdebug_log(149,0) << "length:" << DbU::getValueString(getLength()) << endl;
|
|
|
|
|
2016-08-28 12:09:07 -05:00
|
|
|
int lowSlack = (flags & Flags::HalfSlacken) ? 3 : 10;
|
|
|
|
bool sourceSlackened = false;
|
|
|
|
bool targetSlackened = false;
|
|
|
|
bool halfSlackened = false;
|
|
|
|
DbU::Unit targetPosition = getTargetPosition();
|
|
|
|
AutoSegment* parallel = this;
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
if (source->isTerminal()) {
|
|
|
|
Interval perpandConstraints = getAutoTarget()->getUConstraints(Flags::Horizontal);
|
|
|
|
Interval constraints = source->getUConstraints (Flags::Vertical|Flags::NoGCellShrink);
|
|
|
|
Interval nativeConstraints = source->getNativeUConstraints(Flags::Vertical|Flags::NoGCellShrink);
|
|
|
|
int slack = constraints.getSize() / getPitch();
|
|
|
|
int nativeSlack = nativeConstraints.getSize() / getPitch();
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "Source constraint: " << constraints
|
|
|
|
<< " slack:" << slack
|
|
|
|
<< " native slack:" << nativeSlack << endl;
|
|
|
|
cdebug_log(149,0) << "Perpand constraints on target: " << perpandConstraints << endl;
|
|
|
|
// Ugly: GCell's track number is hardwired.
|
|
|
|
if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) {
|
|
|
|
cdebug_log(149,0) << "Slackening from Source: " << source << endl;
|
|
|
|
_makeDogleg( source->getGCell(), Flags::NoFlags );
|
2016-08-28 12:09:07 -05:00
|
|
|
sourceSlackened = true;
|
2016-07-18 07:48:37 -05:00
|
|
|
} else if (slack < 10) {
|
|
|
|
halfSlackened = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
const vector<AutoSegment*>& doglegs = Session::getDoglegs();
|
2016-08-28 12:09:07 -05:00
|
|
|
if (sourceSlackened and (doglegs.size() >= 2)) {
|
|
|
|
cdebug_log(149,0) << "AutoHorizontal::_slacken(): Source @" << DbU::getValueString(getSourcePosition()) << endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
doglegs[doglegs.size()-2]->setAxis( getSourcePosition() );
|
|
|
|
success = true;
|
|
|
|
|
|
|
|
if (isMetal2Source) {
|
|
|
|
cdebug_log(149,0) << "Fixing on source terminal contact."
|
|
|
|
<< doglegs[doglegs.size()-2]->getAutoSource() << endl;
|
|
|
|
//doglegs[doglegs.size()-2]->getAutoSource()->setFlags( CntFixed );
|
|
|
|
doglegs[doglegs.size()-2]->getAutoSource()->setConstraintBox( source->getConstraintBox() );
|
|
|
|
doglegs[doglegs.size()-2]->getAutoSource()->setFlags( CntUserNativeConstraints );
|
|
|
|
}
|
|
|
|
|
|
|
|
parallel = doglegs[ doglegs.size()-1 ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parallel) target = parallel->getAutoTarget();
|
|
|
|
|
|
|
|
if (target->isTerminal()) {
|
|
|
|
Interval constraints = target->getUConstraints (Flags::Vertical|Flags::NoGCellShrink);
|
|
|
|
Interval nativeConstraints = target->getNativeUConstraints(Flags::Vertical|Flags::NoGCellShrink);
|
|
|
|
int slack = constraints.getSize() / getPitch();
|
|
|
|
int nativeSlack = nativeConstraints.getSize() / getPitch();
|
|
|
|
|
|
|
|
// Ugly: GCell's track number is hardwired.
|
|
|
|
cdebug_log(149,0) << "Target constraint: " << constraints
|
|
|
|
<< " slack:" << slack
|
|
|
|
<< " native slack:" << nativeSlack << endl;
|
|
|
|
if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) {
|
|
|
|
cdebug_log(149,0) << "Slackening from Target: " << target << endl;
|
|
|
|
parallel->_makeDogleg( target->getGCell(), Flags::NoFlags );
|
2016-08-28 12:09:07 -05:00
|
|
|
targetSlackened = true;
|
2016-07-18 07:48:37 -05:00
|
|
|
} else if (slack < 10) {
|
|
|
|
halfSlackened = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
const vector<AutoSegment*>& doglegs = Session::getDoglegs();
|
2016-08-28 12:09:07 -05:00
|
|
|
if (targetSlackened and (doglegs.size() >= 2)) {
|
|
|
|
cdebug_log(149,0) << "AutoHorizontal::_slacken(): Target @" << DbU::getValueString(targetPosition) << endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
doglegs[doglegs.size()-2]->setAxis( targetPosition );
|
|
|
|
success = true;
|
|
|
|
|
|
|
|
if (isMetal2Target) {
|
|
|
|
cdebug_log(149,0) << "Fixing on target terminal contact: "
|
|
|
|
<< doglegs[doglegs.size()-2]->getAutoTarget() << endl;
|
|
|
|
//doglegs[doglegs.size()-2]->getAutoTarget()->setFlags( CntFixed );
|
|
|
|
doglegs[doglegs.size()-2]->getAutoTarget()->setConstraintBox( target->getConstraintBox() );
|
|
|
|
doglegs[doglegs.size()-2]->getAutoTarget()->setFlags( CntUserNativeConstraints );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-28 12:09:07 -05:00
|
|
|
|
|
|
|
if (sourceSlackened and targetSlackened) {
|
|
|
|
setFlags ( SegSlackened );
|
|
|
|
unsetFlags( SegHalfSlackened );
|
|
|
|
} else {
|
|
|
|
if (sourceSlackened or targetSlackened) {
|
|
|
|
if (halfSlackened) {
|
|
|
|
setFlags( SegHalfSlackened );
|
|
|
|
} else {
|
|
|
|
setFlags ( SegSlackened );
|
|
|
|
unsetFlags( SegHalfSlackened );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-18 07:48:37 -05:00
|
|
|
cdebug_tabw(149,-1);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::_setAxis ( DbU::Unit axis )
|
|
|
|
{
|
|
|
|
setFlags( SegAxisSet );
|
|
|
|
|
|
|
|
if ((axis != getAxis()) and isFixed()) {
|
|
|
|
cerr << Error( "AutoHorizontal::setAxis(): Cannot move fixed segment to %s.\n"
|
|
|
|
" (on: %s)"
|
|
|
|
, DbU::getValueString(axis).c_str()
|
|
|
|
, _getString().c_str()
|
|
|
|
) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_horizontal->getY() == axis) return;
|
|
|
|
|
First intergration of the Analogic router parts.
* New: In Anabatic::AutoSegment, introduce a the kind (associated to a
flag) "LongLocal". Analog GCells can be very wide, so at least some
carefuly choosen long local segments must be took into account as
attractors in the computation of the optimal axis.
* New: In Anabatic::AutoSegment::computeOptimal(), take LongLocal into
account as attractors.
* Change: In ::GCellTopology constructors compare the layers of the
RoutingPads using layer masks instead of Layer pointers. Allows to
find both "METALx" (symbolic) and "metalX" (real).
* Change: In ::GCellTopology::_doHChannel(), _doChannel(), _doStrut()
and _doDevice(), tag long locals as "LongLocal". This need to be
reviewed as it as bind done a bit too quickly.
* Change: In Anabatic::AutoSegment, due too a much bigger span of the
analogic GCells the _optimalMin & _optimalMax bitfields must use
16 bits instead of 8 (they where overflowed).
* New: In Katana, reorganisation of the initialization procedure to fit
both digital and analogic cases. Create an analogInit() method.
* Change: In Katana::RoutingEvent, the _tracksNb and _tracksFree bitfields
where too short for the Analog GCell size, now uses 16 bits instead of
6.
* Bug: In Katana::GraphicKatanEngine::drawGCell(), skip drawing of a
GCell if *both* width and height are under 150 pixels.
* New: In Katana::Session, add a new isOpen() method.
2016-10-04 10:12:58 -05:00
|
|
|
cdebug_log(145,0) << "_setAxis() @Y " << DbU::getValueString(axis) << " " << this << endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
|
|
|
|
_horizontal->setY( axis );
|
|
|
|
invalidate();
|
|
|
|
|
|
|
|
AutoContact* anchor = getAutoSource();
|
|
|
|
anchor->invalidate();
|
|
|
|
if (anchor->isTerminal()) anchor->setY( axis );
|
|
|
|
|
|
|
|
anchor = getAutoTarget();
|
|
|
|
anchor->invalidate();
|
|
|
|
if (anchor->isTerminal()) anchor->setY( axis );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::updateOrient ()
|
|
|
|
{
|
|
|
|
if (_horizontal->getTargetX() < _horizontal->getSourceX()) {
|
|
|
|
cdebug_log(145,0) << "updateOrient() " << this << " (before S/T swap)" << endl;
|
|
|
|
_horizontal->invert();
|
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Flags spinFlags = _flags & SegDepthSpin;
|
2016-07-18 07:48:37 -05:00
|
|
|
unsetFlags( SegDepthSpin );
|
|
|
|
if (spinFlags & SegSourceTop ) setFlags( SegTargetTop );
|
|
|
|
if (spinFlags & SegSourceBottom) setFlags( SegTargetBottom );
|
|
|
|
if (spinFlags & SegTargetTop ) setFlags( SegSourceTop );
|
|
|
|
if (spinFlags & SegTargetBottom) setFlags( SegSourceBottom );
|
2016-08-18 14:54:33 -05:00
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Flags invalidatedFlags = _flags & (SegInvalidatedSource|SegInvalidatedTarget);
|
2016-08-18 14:54:33 -05:00
|
|
|
unsetFlags( SegInvalidatedSource|SegInvalidatedTarget );
|
|
|
|
if (invalidatedFlags & SegInvalidatedSource) setFlags( SegInvalidatedTarget );
|
|
|
|
if (invalidatedFlags & SegInvalidatedTarget) setFlags( SegInvalidatedSource );
|
2016-08-28 09:12:05 -05:00
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Flags terminalFlags = _flags & SegStrongTerminal;
|
2016-08-28 09:12:05 -05:00
|
|
|
unsetFlags( SegStrongTerminal );
|
|
|
|
if (terminalFlags & SegSourceTerminal) setFlags( SegTargetTerminal );
|
|
|
|
if (terminalFlags & SegTargetTerminal) setFlags( SegSourceTerminal );
|
2016-07-18 07:48:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::updatePositions ()
|
|
|
|
{
|
|
|
|
_sourcePosition = _horizontal->getSourceX() - Session::getExtensionCap(getLayer());
|
|
|
|
_targetPosition = _horizontal->getTargetX() + Session::getExtensionCap(getLayer());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AutoHorizontal::updateNativeConstraints ()
|
|
|
|
{
|
|
|
|
vector<GCell*> gcells;
|
|
|
|
getGCells( gcells );
|
|
|
|
|
2016-08-30 09:05:15 -05:00
|
|
|
resetNativeConstraints( gcells[0]->getYMin(), gcells[0]->getConstraintYMax() );
|
2016-07-18 07:48:37 -05:00
|
|
|
for ( GCell* gcell : gcells ) {
|
|
|
|
mergeNativeMin( gcell->getYMin() );
|
2016-08-30 09:05:15 -05:00
|
|
|
mergeNativeMax( gcell->getConstraintYMax() );
|
2016-07-18 07:48:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::checkPositions () const
|
|
|
|
{
|
|
|
|
bool coherency = true;
|
|
|
|
DbU::Unit sourcePosition = _horizontal->getSourceX() - Session::getExtensionCap(getLayer());
|
|
|
|
DbU::Unit targetPosition = _horizontal->getTargetX() + Session::getExtensionCap(getLayer());
|
|
|
|
|
|
|
|
if ( _sourcePosition != sourcePosition ) {
|
|
|
|
cerr << Error ( "%s\n Source position incoherency: "
|
|
|
|
"shadow: %s, real: %s."
|
|
|
|
, _getString().c_str()
|
|
|
|
, DbU::getValueString(_sourcePosition).c_str()
|
|
|
|
, DbU::getValueString( sourcePosition).c_str()
|
|
|
|
) << endl;
|
|
|
|
coherency = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( _targetPosition != targetPosition ) {
|
|
|
|
cerr << Error ( "%s\n Target position incoherency: "
|
|
|
|
"shadow: %s, real: %s."
|
|
|
|
, _getString().c_str()
|
|
|
|
, DbU::getValueString(_targetPosition).c_str()
|
|
|
|
, DbU::getValueString( targetPosition).c_str()
|
|
|
|
) << endl;
|
|
|
|
coherency = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return coherency;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::checkConstraints () const
|
|
|
|
{
|
|
|
|
Interval sourceConstraints = Interval(getAutoSource()->getCBYMin(),getAutoSource()->getCBYMax());
|
|
|
|
Interval targetConstraints = Interval(getAutoTarget()->getCBYMin(),getAutoTarget()->getCBYMax());
|
|
|
|
|
|
|
|
if (not sourceConstraints.intersect(targetConstraints)) {
|
|
|
|
cerr << Error ( "%s\n Constraints incoherency:\n"
|
|
|
|
" S:%s %s\n"
|
|
|
|
" T:%s %s"
|
|
|
|
, _getString().c_str()
|
|
|
|
, getString(sourceConstraints).c_str()
|
|
|
|
, getString(getAutoSource()).c_str()
|
|
|
|
, getString(targetConstraints).c_str()
|
|
|
|
, getString(getAutoTarget()).c_str()
|
|
|
|
) << endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::canMoveULeft ( float reserve ) const
|
|
|
|
{
|
|
|
|
#if THIS_IS_DISABLED
|
|
|
|
//cerr << "canMoveULeft() " << this << endl;
|
|
|
|
|
|
|
|
if (not isGlobal()) return false;
|
|
|
|
if (not getAutoSource()->isTurn() or not getAutoTarget()->isTurn()) return false;
|
|
|
|
if (not getAutoSource()->getGCell()->getDown()) return false;
|
|
|
|
|
|
|
|
AutoContact* autoSource = getAutoSource();
|
|
|
|
AutoContact* autoTarget = getAutoTarget();
|
|
|
|
AutoSegment* perpandiculars[2] = { autoSource->getSegment(0), autoTarget->getSegment(0) };
|
|
|
|
|
|
|
|
if ( ( (not perpandiculars[0]->isGlobal()) or (perpandiculars[0]->getAutoSource() == autoSource) )
|
|
|
|
and ( (not perpandiculars[1]->isGlobal()) or (perpandiculars[1]->getAutoSource() == autoTarget) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GCell* begin = autoSource->getGCell();
|
|
|
|
GCell* end = autoTarget->getGCell();
|
|
|
|
unsigned int depth = Session::getRoutingGauge()->getLayerDepth( getLayer() );
|
|
|
|
float currMaxDensity = 0.0;
|
|
|
|
float leftMaxDensity = 0.0;
|
|
|
|
|
|
|
|
//cerr << "| begin:" << begin << endl;
|
|
|
|
//cerr << "| end: " << end << endl;
|
|
|
|
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
//cerr << "| gcell:" << gcell << endl;
|
|
|
|
if (currMaxDensity < gcell->getWDensity(depth)) currMaxDensity = gcell->getWDensity( depth );
|
|
|
|
}
|
|
|
|
|
|
|
|
begin = begin->getDown();
|
|
|
|
end = end ->getDown();
|
|
|
|
|
|
|
|
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
if (leftMaxDensity < gcell->getWDensity(depth)) leftMaxDensity = gcell->getWDensity( depth );
|
|
|
|
}
|
|
|
|
|
|
|
|
return (leftMaxDensity + reserve < currMaxDensity);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::canMoveURight ( float reserve ) const
|
|
|
|
{
|
|
|
|
#if THIS_IS_DISABLED
|
|
|
|
//cerr << "canMoveURight() " << this << endl;
|
|
|
|
|
|
|
|
if (not isGlobal()) return false;
|
|
|
|
if (not getAutoSource()->isTurn() or not getAutoTarget()->isTurn()) return false;
|
|
|
|
if (not getAutoSource()->getGCell()->getUp()) return false;
|
|
|
|
|
|
|
|
AutoContact* autoSource = getAutoSource();
|
|
|
|
AutoContact* autoTarget = getAutoTarget();
|
|
|
|
AutoSegment* perpandiculars[2] = { autoSource->getSegment(0), autoTarget->getSegment(0) };
|
|
|
|
|
|
|
|
if ( ( (not perpandiculars[0]->isGlobal()) or (perpandiculars[0]->getAutoTarget() == autoSource) )
|
|
|
|
and ( (not perpandiculars[1]->isGlobal()) or (perpandiculars[1]->getAutoTarget() == autoTarget) ) )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GCell* begin = autoSource->getGCell();
|
|
|
|
GCell* end = autoTarget->getGCell();
|
|
|
|
unsigned int depth = Session::getRoutingGauge()->getLayerDepth( getLayer() );
|
|
|
|
float currMaxDensity = 0.0;
|
|
|
|
float leftMaxDensity = 0.0;
|
|
|
|
|
|
|
|
//cerr << "| begin:" << begin << endl;
|
|
|
|
//cerr << "| end: " << end << endl;
|
|
|
|
|
|
|
|
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
//cerr << "| gcell: " << gcell << endl;
|
|
|
|
if (currMaxDensity < gcell->getWDensity(depth)) currMaxDensity = gcell->getWDensity( depth );
|
|
|
|
}
|
|
|
|
|
|
|
|
begin = begin->getUp();
|
|
|
|
end = end ->getUp();
|
|
|
|
|
|
|
|
for ( GCell* gcell=begin ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
if (leftMaxDensity < gcell->getWDensity(depth)) leftMaxDensity = gcell->getWDensity( depth );
|
|
|
|
}
|
|
|
|
|
|
|
|
return (leftMaxDensity + reserve < currMaxDensity);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::moveULeft ()
|
|
|
|
{
|
|
|
|
#if THIS_IS_DISABLED
|
|
|
|
if (not getAutoSource()->isTurn() or not getAutoTarget()->isTurn()) return false;
|
|
|
|
if (not getAutoSource()->getGCell()->getDown()) return false;
|
|
|
|
|
|
|
|
AutoContact* autoSource = getAutoSource();
|
|
|
|
AutoContact* autoTarget = getAutoTarget();
|
|
|
|
GCell* begin = autoSource->getGCell();
|
|
|
|
GCell* end = autoTarget->getGCell();
|
|
|
|
AutoSegment* perpandicular = autoSource->getSegment(2);
|
|
|
|
|
|
|
|
if (perpandicular->isLocal()) {
|
|
|
|
perpandicular->setFlags( Anabatic::SegGlobal );
|
|
|
|
} else {
|
|
|
|
if (perpandicular->getAutoSource() == autoSource) {
|
|
|
|
begin->addVSegment( perpandicular );
|
|
|
|
} else {
|
|
|
|
if (begin->getDown() == perpandicular->getAutoSource()->getGCell()) {
|
|
|
|
perpandicular->unsetFlags( Anabatic::SegGlobal );
|
|
|
|
} else
|
|
|
|
begin->getDown()->removeVSegment( perpandicular );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
perpandicular = autoTarget->getSegment(2);
|
|
|
|
if (perpandicular->isLocal()) {
|
|
|
|
perpandicular->setFlags( Anabatic::SegGlobal );
|
|
|
|
} else {
|
|
|
|
if (perpandicular->getAutoSource() == autoTarget) {
|
|
|
|
end->addVSegment( perpandicular );
|
|
|
|
} else {
|
|
|
|
if (end->getDown() == perpandicular->getAutoSource()->getGCell()) {
|
|
|
|
perpandicular->unsetFlags( Anabatic::SegGlobal );
|
|
|
|
} else
|
|
|
|
end->getDown()->removeVSegment( perpandicular );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (begin != end) {
|
|
|
|
for ( GCell* gcell=begin->getRight() ; gcell and gcell!=end ; gcell=gcell->getRight() )
|
|
|
|
gcell->removeHSegment( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
begin = begin->getDown();
|
|
|
|
end = end ->getDown();
|
|
|
|
|
|
|
|
autoSource->setGCell( begin );
|
|
|
|
autoTarget->setGCell( end );
|
|
|
|
if (begin != end) {
|
|
|
|
for ( GCell* gcell=begin->getRight() ; gcell and gcell!=end ; gcell=gcell->getRight() )
|
|
|
|
gcell->addHSegment( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
DbU::Unit y = begin->getSide(Flags::Vertical).getVMax();
|
|
|
|
setAxis( y );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AutoHorizontal::moveURight ()
|
|
|
|
{
|
|
|
|
#if THIS_IS_DISABLED
|
|
|
|
//cerr << "moveURight() " << this << endl;
|
|
|
|
|
|
|
|
if (not getAutoSource()->isTurn() or not getAutoTarget()->isTurn()) return false;
|
|
|
|
if (not getAutoSource()->getGCell()->getUp()) return false;
|
|
|
|
|
|
|
|
AutoContact* autoSource = getAutoSource();
|
|
|
|
AutoContact* autoTarget = getAutoTarget();
|
|
|
|
GCell* begin = autoSource->getGCell();
|
|
|
|
GCell* end = autoTarget->getGCell();
|
|
|
|
AutoSegment* perpandicular = autoSource->getSegment(2);
|
|
|
|
|
|
|
|
if (perpandicular->isLocal()) {
|
|
|
|
perpandicular->setFlags( Anabatic::SegGlobal );
|
|
|
|
} else {
|
|
|
|
if (perpandicular->getAutoTarget() == autoSource) {
|
|
|
|
begin->addVSegment( perpandicular );
|
|
|
|
} else {
|
|
|
|
if (begin->getUp() == perpandicular->getAutoTarget()->getGCell()) {
|
|
|
|
perpandicular->unsetFlags( Anabatic::SegGlobal );
|
|
|
|
} else
|
|
|
|
begin->getUp()->removeVSegment( perpandicular );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
perpandicular = autoTarget->getSegment(2);
|
|
|
|
if (perpandicular->isLocal()) {
|
|
|
|
perpandicular->setFlags( Anabatic::SegGlobal );
|
|
|
|
} else {
|
|
|
|
if (perpandicular->getAutoTarget() == autoTarget) {
|
|
|
|
end->addVSegment( perpandicular );
|
|
|
|
} else {
|
|
|
|
if (end->getUp() == perpandicular->getAutoTarget()->getGCell()) {
|
|
|
|
perpandicular->unsetFlags( Anabatic::SegGlobal );
|
|
|
|
} else
|
|
|
|
end->getUp()->removeVSegment( perpandicular );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//cerr << "| begin:" << begin << endl;
|
|
|
|
//cerr << "| end: " << end << endl;
|
|
|
|
|
|
|
|
//cerr << "* remove" << endl;
|
|
|
|
if (begin != end) {
|
|
|
|
for ( GCell* gcell=begin->getRight() ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
//cerr << "| gcell: " << end << endl;
|
|
|
|
gcell->removeHSegment( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
begin = begin->getUp();
|
|
|
|
end = end ->getUp();
|
|
|
|
|
|
|
|
autoSource->setGCell( begin );
|
|
|
|
autoTarget->setGCell( end );
|
|
|
|
//cerr << "* add" << endl;
|
|
|
|
if (begin != end) {
|
|
|
|
for ( GCell* gcell=begin->getRight() ; gcell and gcell!=end ; gcell=gcell->getRight() ) {
|
|
|
|
//cerr << "| gcell: " << end << endl;
|
|
|
|
gcell->addHSegment( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DbU::Unit y = begin->getSide( Flags::Vertical ).getVMin();
|
|
|
|
setAxis( y );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Replace "unsigned int" by "Flags" in all AutoSegments collections.
* Change: In Anabatic::AutoSegments collections, change the type of all
the flags that where in "unsigned int" (32 bits) to Flags (uint64_t)
as there is now more than 32 flags for functions.
* New: In Ababatic::Constants, added new flag Flags::WithPerpands, which
makes the number of flags tip over 32 bits, thus making mandatory
to uses Flags and not unsigned int.
* New: In Anabatic::AutoSegments_Perpandiculars, manage a new flag
Flags::WithDoglegs to allow to propagate through global segments that
are connecteds via doglegs on local segments. Meaning that there is
a good chance that they could be aligned.
Slighly change the way we propagate on aligned segments: no longer
check for VTee or HTee, but only for same direction and layer as
master.
* New: In Anabatic & Katana, replace all the "int", "long" and their
variants by the less implementation ambiguous "int32_t", "int64_t"
(and variant). This should help to better detect bit trucation in
flags.
Use the type to give a hint about the flags kind:
- Type "Flags", for flags shared among Anabatic & Katana
functions/methods (may also appear in some objects states).
- Type "uint32_t" for flags belonging to an object internal
state of from Hurricane functions flags (those should be
grouped in a Flag subclass in a perfect world).
2017-05-16 07:53:33 -05:00
|
|
|
Flags AutoHorizontal::_makeDogleg ( GCell* doglegGCell, Flags flags )
|
2016-07-18 07:48:37 -05:00
|
|
|
{
|
|
|
|
DebugSession::open( getNet(), 140, 150 );
|
2016-08-28 12:09:07 -05:00
|
|
|
cdebug_log(149,0) << "AutoHorizontal::_makeDogleg(GCell*) in " << doglegGCell << endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
cdebug_tabw(149,1);
|
|
|
|
|
|
|
|
//Session::doglegReset();
|
|
|
|
|
|
|
|
AutoContact* autoTarget = getAutoTarget();
|
|
|
|
AutoContact* autoSource = getAutoSource();
|
|
|
|
GCell* begin = autoSource->getGCell();
|
|
|
|
GCell* end = autoTarget->getGCell();
|
|
|
|
|
|
|
|
DbU::Unit doglegAxis = (doglegGCell->getXMax() + doglegGCell->getXMin()) / 2;
|
|
|
|
if (isLocal())
|
|
|
|
doglegAxis = (getSourceX() + getTargetX()) / 2;
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "Detaching from Target AutoContact " << autoTarget << "." << endl;
|
|
|
|
|
|
|
|
if (doglegGCell == begin) unsetFlags( SegGlobal );
|
|
|
|
if (doglegGCell != end) {
|
|
|
|
GCell* gcell = doglegGCell;
|
|
|
|
do {
|
2016-08-30 09:05:15 -05:00
|
|
|
if (gcell != begin) {
|
|
|
|
cdebug_log(149,0) << "| Remove from:" << gcell << endl;
|
2016-07-18 07:48:37 -05:00
|
|
|
gcell->removeHSegment( this );
|
2016-08-30 09:05:15 -05:00
|
|
|
}
|
2016-07-18 07:48:37 -05:00
|
|
|
gcell = gcell->getEast( getNativeMin() );
|
|
|
|
} while ( gcell and (gcell != end) );
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t depth = Session::getRoutingGauge()->getLayerDepth( _horizontal->getLayer() );
|
|
|
|
bool upLayer = (depth+1 <= Session::getConfiguration()->getAllowedDepth());
|
|
|
|
Layer* contactLayer = Session::getRoutingGauge()->getContactLayer( depth + ((upLayer)?0:-1) );
|
|
|
|
const Layer* doglegLayer = Session::getRoutingGauge()->getRoutingLayer( depth + ((upLayer)?1:-1) );
|
|
|
|
|
|
|
|
Session::dogleg( this );
|
|
|
|
targetDetach();
|
|
|
|
invalidate( Flags::Topology );
|
|
|
|
autoTarget->invalidate( Flags::Topology );
|
|
|
|
AutoContact* dlContact1 = AutoContactTurn::create( doglegGCell, _horizontal->getNet(), contactLayer );
|
|
|
|
AutoContact* dlContact2 = AutoContactTurn::create( doglegGCell, _horizontal->getNet(), contactLayer );
|
|
|
|
AutoSegment* segment1 = AutoSegment::create( dlContact1 , dlContact2, Flags::Vertical );
|
|
|
|
segment1->setLayer( doglegLayer );
|
|
|
|
segment1->_setAxis( doglegAxis );
|
|
|
|
segment1->setFlags( SegDogleg|SegSlackened|SegCanonical|SegNotAligned );
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "New " << dlContact1 << endl;
|
|
|
|
cdebug_log(149,0) << "New " << dlContact2 << endl;
|
|
|
|
Session::dogleg( segment1 );
|
|
|
|
|
|
|
|
targetAttach( dlContact1 );
|
|
|
|
AutoSegment* segment2 = AutoSegment::create( dlContact2 , autoTarget, Flags::Horizontal );
|
|
|
|
autoTarget->cacheAttach( segment2 );
|
|
|
|
segment2->setLayer( getLayer() );
|
|
|
|
segment2->_setAxis( getY() );
|
|
|
|
segment2->setFlags( (isSlackened()?SegSlackened:0) );
|
|
|
|
Session::dogleg( segment2 );
|
|
|
|
|
|
|
|
if (autoSource->isTerminal()) {
|
|
|
|
segment1->setFlags( SegWeakTerminal1 );
|
|
|
|
segment2->setFlags( SegWeakTerminal1 );
|
|
|
|
autoTarget->unsetFlags( CntWeakTerminal );
|
|
|
|
dlContact1->setFlags ( CntWeakTerminal );
|
|
|
|
if (autoTarget->getGCell() == doglegGCell)
|
|
|
|
dlContact1->migrateConstraintBox( autoTarget );
|
|
|
|
} else if (autoTarget->isTerminal()) {
|
|
|
|
unsetFlags( SegTargetTerminal );
|
|
|
|
setFlags( SegWeakTerminal1 );
|
|
|
|
segment1->setFlags( SegWeakTerminal1 );
|
|
|
|
segment2->setFlags( SegTargetTerminal );
|
|
|
|
autoSource->unsetFlags( CntWeakTerminal );
|
|
|
|
dlContact2->setFlags ( CntWeakTerminal );
|
|
|
|
if (autoSource->getGCell() == doglegGCell)
|
|
|
|
dlContact2->migrateConstraintBox( autoSource );
|
|
|
|
} else if (isWeakTerminal()) {
|
|
|
|
segment1->setFlags( SegWeakTerminal1 );
|
|
|
|
segment2->setFlags( SegWeakTerminal1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
cdebug_log(149,0) << "Session::dogleg[x+1] perpand: " << segment1 << endl;
|
|
|
|
cdebug_log(149,0) << "Session::dogleg[x+2] new paral: " << segment2 << endl;
|
|
|
|
cdebug_log(149,0) << "Session::dogleg[x+0] original: " << this << endl;
|
|
|
|
|
|
|
|
dlContact1->updateCache();
|
|
|
|
dlContact2->updateCache();
|
|
|
|
//autoTarget->updateCache();
|
|
|
|
|
|
|
|
segment2->canonize( flags );
|
|
|
|
if (not isCanonical()) canonize( flags );
|
|
|
|
|
|
|
|
updateNativeConstraints();
|
|
|
|
segment2->updateNativeConstraints();
|
|
|
|
|
|
|
|
cdebug_tabw(149,-1);
|
|
|
|
DebugSession::close();
|
|
|
|
|
|
|
|
return (upLayer) ? Flags::AboveLayer : Flags::BelowLayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string AutoHorizontal::_getString () const
|
|
|
|
{
|
|
|
|
string s = AutoSegment::_getString();
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Record* AutoHorizontal::_getRecord () const
|
|
|
|
{
|
|
|
|
Record* record = AutoSegment::_getRecord ();
|
|
|
|
record->add ( getSlot ( "_horizontal", _horizontal ) );
|
|
|
|
|
|
|
|
return record;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // End of Anabatic namespace.
|