2010-03-09 09:24:55 -06:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
Improved UpdateSession & exception catching. Start of RoutingGauge implem.
Miscellaneous:
* Change: In <crlcore>, in display.conf use the same display threshold
for both METAL2 & METAL3.
In alliance.conf, the side of VIAs in the gauge is 2l (not 3l).
In kite.conf, separate edge densities for H/V.
* Change: In <Cell>, in flattenNets() use flag as argument, not a
boolean. Do not create rings for clock or supply nets.
* Change: In <DeepNet>, in _createRoutingPads() do not create rings
for clock or supply net (duplicated policy as in Cell::flattenNets()).
* Bug: In <ControllerWidget>, at last find the bad signal disconnect
that was causing ungraceful messages.
* Change: In <knik>, in Edge display occupancy/capacity in the string
name. Improved display progress and debugging capabilities.
Improved exception catch & breakpoint managment:
* Bug: In <PaletteWidget>, in updateExtensions() replace the calls to
deleteLayer() by delete. This cause the widget to be immediatly
erased instead of waiting for the event queue to be completly
processed. This was causing the widget to be left in a incoherent
state when stoping at a breakpoint.
* Bug: In <BreakpointWidget>, in execNoModal(), flush the main event
loop (QApplication::flush()) *before* lauching the *local* event
loop. This is to ensure all widgets are in their final state when
waiting (especially <PaletteWidget>).
* Change: In <ExceptionWidget>, new method catchAllWrapper() to
execute any std::function< void() > function/method with a "try"/
"catch" wraparound and lauch the widget in case something is catch.
* New: In <hurricane>, support for a oberver pattern, backported from
<katabatic> with an Obervable capable of being linked to any
number of Obervers.
* New: In <Cell>, made it observable to detect Cell change, currently
emit two kind of signals:
- Cell::CellAboutToChange : *before* any change.
- Cell::CellChanged : *after* the change has been completed.
* New: In <UpdateSession>, in Go::invalidate() add the Cell owning the
Go to the UPDATOR_STACK (of course the cell is added only once).
In addition, when the Cell is added, send a notification of
Cell::CellAboutToChange to all it's observers. The slave instances
are also invalidated.
Conversely in UpdateSession::_preDestroy() for each invalidated
Cell send a Cell::CellChanged notification to all observer.
The UPDATOR_STACK has been slightly amended to accept Cell which
are not Gos. Prior to this, the Cell where completly excluded from
the UpdateSession mechanism, so it's instances where never actualised
of anything referring to the Cell for that matter.
Note: we use two different mechanisms to transmit a Cell change,
observers and the slave instance map. I think at some point it
should be unificated.
* Change: In <CellViewer>, make it a Cell observer to redraw when the
cell is modificated (also update the palette).
Uses the catchAllWrapper() to protect all critical actions.
* Change: In <GraphicTool>, no longer need of cellPreModificated and
cellPostModificated signals. Now done through the Cell obersvers.
* Change: In <mauka>, <etesian> & <kite> now uses the catchAllWrapper
method for protection (need to split methods in two, to be able
to pass it as argument). No longer emit cellPreModificated and
cellPostModificated.
Support for RoutingGauge in P&R:
* Bug: In <placeandroute.py>, the connection from the internal power
ring to the connectors was not done correctly. Wrong contact layers
leading to a gap.
* Change: In <BuildPowerRails>, detection of the corona signals based
on how the "pck_px" pad is connected. No longer based on name
matching.
* Change: In <placeandroute.py>, support for 2 routing metal only
(3 metal in the technology).
* Change: In <katabatic> & <kite> support for a "top layer" limitation
on the routing gauge, this allows to use only two routing metals
(METAL2 & METAL3). Work in progress.
2014-04-20 12:25:08 -05:00
|
|
|
// Copyright (c) UPMC 2008-2014, All Rights Reserved
|
2010-03-09 09:24:55 -06:00
|
|
|
//
|
2013-12-03 18:59:29 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:24:55 -06:00
|
|
|
// | C O R I O L I S |
|
|
|
|
// | K i t e - D e t a i l e d R o u t e r |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./TrackElement.cpp" |
|
2013-12-03 18:59:29 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
#include <sstream>
|
|
|
|
#include "hurricane/Bug.h"
|
|
|
|
#include "hurricane/Warning.h"
|
|
|
|
#include "hurricane/Net.h"
|
|
|
|
#include "hurricane/Name.h"
|
|
|
|
#include "katabatic/AutoContact.h"
|
|
|
|
#include "katabatic/GCell.h"
|
|
|
|
#include "crlcore/RoutingGauge.h"
|
|
|
|
#include "kite/DataNegociate.h"
|
|
|
|
#include "kite/TrackElement.h"
|
|
|
|
#include "kite/TrackCost.h"
|
|
|
|
#include "kite/Track.h"
|
|
|
|
#include "kite/Session.h"
|
|
|
|
#include "kite/RoutingEvent.h"
|
|
|
|
#include "kite/NegociateWindow.h"
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Hurricane;
|
|
|
|
using namespace CRL;
|
|
|
|
using namespace Kite;
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
void dummyOverlapCost ( const TrackElement* segment, TrackCost& cost )
|
2010-03-09 09:24:55 -06:00
|
|
|
{
|
|
|
|
cerr << Warning("No overlapCost callback has been set (%s)."
|
|
|
|
,getString(segment).c_str()) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
} // Anonymous namespace.
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
namespace Kite {
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
using Hurricane::inltrace;
|
|
|
|
using Hurricane::ltracein;
|
|
|
|
using Hurricane::ltraceout;
|
|
|
|
using Hurricane::tab;
|
2010-03-09 09:24:55 -06:00
|
|
|
using Hurricane::Bug;
|
|
|
|
using Hurricane::Net;
|
|
|
|
using Hurricane::Name;
|
2010-12-12 15:42:57 -06:00
|
|
|
using Katabatic::GCell;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
2013-12-03 18:59:29 -06:00
|
|
|
// Comparison Classes.
|
|
|
|
//
|
|
|
|
// Return: lhs < rhs.
|
|
|
|
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
bool Compare::operator() ( TrackElement* lhs, TrackElement* rhs )
|
|
|
|
{ return lhs->getFreedomDegree() > rhs->getFreedomDegree(); }
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
|
|
|
|
bool CompareByPosition::operator() ( const TrackElement* lhs, const TrackElement* rhs ) const
|
2010-03-09 09:24:55 -06:00
|
|
|
{
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs == rhs) return false;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->isBlockage() xor rhs->isBlockage()) return lhs->isBlockage();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->getLength() < rhs->getLength()) return true;
|
|
|
|
if (lhs->getLength() > rhs->getLength()) return false;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->isHorizontal() xor rhs->isHorizontal()) return rhs->isHorizontal();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->getAxis() > rhs->getAxis()) return true;
|
|
|
|
if (lhs->getAxis() < rhs->getAxis()) return false;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->getSourceU() > rhs->getSourceU()) return true;
|
|
|
|
if (lhs->getSourceU() < rhs->getSourceU()) return false;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
if (lhs->isBlockage() and rhs->isBlockage()) return false;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
return lhs->getId() < rhs->getId();
|
|
|
|
}
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "SegmentObserver".
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
void SegmentObserver::notify ( unsigned int flags )
|
|
|
|
{
|
|
|
|
TrackElement* segment = getOwner();
|
|
|
|
switch ( flags ) {
|
|
|
|
case AutoSegment::Invalidate:
|
|
|
|
if (not segment->isInvalidated()) {
|
|
|
|
ltrace(200) << "::notify() <Invalidate> on " << segment << endl;
|
|
|
|
segment->invalidate();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AutoSegment::Revalidate:
|
|
|
|
// Revalidation must be delayed until *all* the AutoSegments have been revalidated.
|
|
|
|
// if (segment->isInvalidated()) {
|
|
|
|
// ltrace(200) << "::notify() <Revalidate> on " << segment << endl;
|
|
|
|
// segment->revalidate( true );
|
|
|
|
// }
|
|
|
|
break;
|
|
|
|
}
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "TrackElement".
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
SegmentOverlapCostCB* TrackElement::_overlapCostCallback = dummyOverlapCost;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
SegmentOverlapCostCB* TrackElement::setOverlapCostCB ( SegmentOverlapCostCB* cb )
|
|
|
|
{
|
|
|
|
SegmentOverlapCostCB* oldCb = _overlapCostCallback;
|
|
|
|
_overlapCostCallback = cb;
|
|
|
|
return oldCb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
// Wrapped AutoSegment Functions.
|
|
|
|
AutoSegment* TrackElement::base () const { return NULL; }
|
|
|
|
bool TrackElement::isFixed () const { return false; }
|
|
|
|
bool TrackElement::isLocal () const { return true; }
|
|
|
|
bool TrackElement::isGlobal () const { return not isLocal(); }
|
|
|
|
bool TrackElement::isBipoint () const { return false; }
|
|
|
|
bool TrackElement::isTerminal () const { return false; }
|
|
|
|
bool TrackElement::isStrongTerminal ( unsigned int ) const { return false; }
|
|
|
|
bool TrackElement::isStrap () const { return false; }
|
|
|
|
bool TrackElement::isSlackened () const { return false; }
|
|
|
|
bool TrackElement::isDogleg () const { return false; }
|
|
|
|
// Predicates.
|
|
|
|
bool TrackElement::canSlacken () const { return false; }
|
|
|
|
bool TrackElement::canPivotUp ( float ) const { return false; };
|
|
|
|
bool TrackElement::canPivotDown ( float ) const { return false; };
|
|
|
|
bool TrackElement::canMoveUp ( float, unsigned int ) const { return false; };
|
|
|
|
bool TrackElement::canDogleg () { return false; };
|
|
|
|
bool TrackElement::canDogleg ( Interval ) { return false; };
|
|
|
|
bool TrackElement::canDogleg ( Katabatic::GCell*, unsigned int ) { return false; };
|
|
|
|
// Accessors.
|
|
|
|
unsigned long TrackElement::getId () const { return 0; }
|
|
|
|
unsigned long TrackElement::getFreedomDegree () const { return 0; }
|
|
|
|
float TrackElement::getMaxUnderDensity ( unsigned int ) const { return 0.0; };
|
|
|
|
unsigned int TrackElement::getDoglegLevel () const { return 0; }
|
|
|
|
TrackElement* TrackElement::getParent () const { return NULL; }
|
|
|
|
Interval TrackElement::getSourceConstraints () const { return Interval(); }
|
|
|
|
Interval TrackElement::getTargetConstraints () const { return Interval(); }
|
|
|
|
DataNegociate* TrackElement::getDataNegociate ( unsigned int ) const { return NULL; }
|
|
|
|
TrackElements TrackElement::getPerpandiculars () { return new TrackElements_Perpandiculars(NULL); }
|
|
|
|
void TrackElement::invalidate () { }
|
|
|
|
TrackElement* TrackElement::getCanonical ( Interval& i ) { i=Interval(getSourceU(),getTargetU()); return this; }
|
|
|
|
TrackElement* TrackElement::getSourceDogleg () { return NULL; }
|
|
|
|
TrackElement* TrackElement::getTargetDogleg () { return NULL; }
|
|
|
|
// Mutators.
|
|
|
|
void TrackElement::setTrack ( Track* track ) { _track = track; }
|
|
|
|
void TrackElement::updateFreedomDegree () { }
|
|
|
|
void TrackElement::setDoglegLevel ( unsigned int ) { }
|
|
|
|
void TrackElement::swapTrack ( TrackElement* ) { }
|
|
|
|
void TrackElement::reschedule ( unsigned int ) { }
|
|
|
|
void TrackElement::detach () { }
|
|
|
|
void TrackElement::revalidate () { }
|
|
|
|
void TrackElement::setAxis ( DbU::Unit, unsigned int flags ) { }
|
|
|
|
TrackElement* TrackElement::makeDogleg () { return NULL; }
|
|
|
|
TrackElement* TrackElement::makeDogleg ( Interval, unsigned int& ) { return NULL; }
|
|
|
|
TrackElement* TrackElement::makeDogleg ( Katabatic::GCell*, TrackElement*&, TrackElement*& ) { return NULL; }
|
|
|
|
void TrackElement::_postDoglegs ( TrackElement*&, TrackElement*& ) { }
|
|
|
|
bool TrackElement::moveAside ( unsigned int ) { return false; }
|
|
|
|
bool TrackElement::slacken ( unsigned int ) { return false; }
|
|
|
|
bool TrackElement::moveUp ( unsigned int ) { return false; }
|
|
|
|
bool TrackElement::moveDown ( unsigned int ) { return false; }
|
|
|
|
#if THIS_IS_DISABLED
|
|
|
|
void TrackElement::desalignate () { }
|
|
|
|
#endif
|
|
|
|
bool TrackElement::_check () const { return true; }
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
TrackElement::TrackElement ( Track* track )
|
2013-12-03 18:59:29 -06:00
|
|
|
: _flags (0)
|
|
|
|
, _track (track)
|
|
|
|
, _index ((size_t)-1)
|
|
|
|
, _sourceU (0)
|
|
|
|
, _targetU (0)
|
|
|
|
, _observer(this)
|
2010-03-09 09:24:55 -06:00
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
void TrackElement::_postCreate ()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
TrackElement::~TrackElement ()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
void TrackElement::_preDestroy ()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
void TrackElement::destroy ()
|
|
|
|
{
|
|
|
|
_preDestroy ();
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TrackElement* TrackElement::getNext () const
|
|
|
|
{
|
|
|
|
size_t dummy = _index;
|
2013-12-03 18:59:29 -06:00
|
|
|
return _track->getNext( dummy, getNet() );
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TrackElement* TrackElement::getPrevious () const
|
|
|
|
{
|
|
|
|
size_t dummy = _index;
|
2013-12-03 18:59:29 -06:00
|
|
|
return _track->getPrevious( dummy, getNet() );
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-12 15:42:57 -06:00
|
|
|
Interval TrackElement::getFreeInterval () const
|
2010-03-09 09:24:55 -06:00
|
|
|
{
|
2013-12-03 18:59:29 -06:00
|
|
|
if (not _track) return Interval(false);
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
size_t begin = _index;
|
|
|
|
size_t end = _index;
|
2013-12-03 18:59:29 -06:00
|
|
|
return _track->expandFreeInterval( begin, end, Track::InsideElement, getNet() );
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
size_t TrackElement::getGCells ( Katabatic::GCellVector& gcells ) const
|
2010-03-09 09:24:55 -06:00
|
|
|
{
|
2013-12-03 18:59:29 -06:00
|
|
|
vector<GCell*>().swap( gcells );
|
2010-03-09 09:24:55 -06:00
|
|
|
return gcells.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TrackElement::incOverlapCost ( Net* net, TrackCost& cost ) const
|
|
|
|
{
|
2013-12-03 18:59:29 -06:00
|
|
|
if (not _track or (getNet() == net)) return;
|
|
|
|
_overlapCostCallback( this, cost );
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string TrackElement::_getTypeName () const
|
|
|
|
{ return "TrackElement"; }
|
|
|
|
|
|
|
|
|
|
|
|
string TrackElement::_getString () const
|
2013-12-03 18:59:29 -06:00
|
|
|
{ return "<"+_getTypeName()+">"; }
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
|
|
|
Record* TrackElement::_getRecord () const
|
|
|
|
{
|
2013-12-03 18:59:29 -06:00
|
|
|
Record* record = new Record( _getString() );
|
|
|
|
record->add( getSlot( "_flags", _track ) );
|
|
|
|
record->add( getSlot( "_track", _track ) );
|
|
|
|
record->add( getSlot( "_index", _index ) );
|
|
|
|
record->add( DbU::getValueSlot( "_sourceU", &_sourceU ) );
|
|
|
|
record->add( DbU::getValueSlot( "_targetU", &_targetU ) );
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
return record;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
} // Kite namespace.
|