* ./Kite:

- New: In BuildPowerRails, special processing for the power ring segments.
        The "diagonal" of vias at each corner is causing a misbehavior of the
        routing algorithm (due to fully saturated GCells in one direction).
        As a temporary fix, extend the segments so they form a "square corner".
        (problem arise on "d_in_i(22)").
    - New: In RoutingEvent::_processNegociate, disable the "isForcedToHint()"
        feature. No noticeable loss of quality or speed.
    - New: In TrackElement/TrackSegment, wraps the AutoSegment parent's mechanism.
        Allows to gets the DataNegociate of either the segment or it's parent.
    - New: State::solveFullBlockages(), dedicated method to solves the case when
        all the allowed tracks of a segment are blocked, tries to moves up
        local segments and to break-up global ones.
    - New: RoutingEventLoop, a more sophisticated way to detect looping.
        Maintain a dynamic histogram of the last N (default 10) segments routeds,
        with the count of how many times they have occurred. If that count
        exeed 40, we *may* be facing a loop.
    - Change: In State::conflictSolve1, implement new policy. The global segments
        no more can be broken by local ones. The idea behind is that breaking
        a global on the request of a local will only produce more cluttering
        in the GCell. Globals must be keep straigth pass through, especially
        inside near-saturated GCells. Globals breaking however can occurs at
        another global's request.
    - Change: In TrackCost, implement the new policy about locals segments that
        cannot break globals segments. The sorting class now accept flags to
        modulate the sorting function. Two options avalaibles: IgnoreAxisWeigth
        (to uses for strap segments) and DiscardGlobals (to uses with locals).
    - Change: In TrackCost, the "distance to fixed" have now an upper bound of
        50 lambdas (no need to be greater because it means it's outside the
        begin & en GCells). Take account not only of fixed segment, but also
        of placed segments which makes bound.
    - Bug: In Track::_check(), while calling each individual TrackSegment check,
        uses it as the *first* argument of the "or", otherwise it may not be
        called.
    - Bug: In ProtectRoutingPad, loop over segment Collections while modificating
        it was producing non-deterministic results. The fact that a collection
        must be not modificated while beeing iterated is becoming a more and more
        painful problem.
This commit is contained in:
Jean-Paul Chaput 2010-12-30 18:42:17 +00:00
parent 8faade8bc6
commit 3c9d064fd8
23 changed files with 1107 additions and 608 deletions

View File

@ -73,6 +73,7 @@ namespace {
using Hurricane::Technology;
using Hurricane::DataBase;
using CRL::AllianceFramework;
using Katabatic::ChipTools;
using namespace Kite;
@ -327,6 +328,7 @@ namespace {
public:
Plane ( const Layer*, RoutingPlane* );
~Plane ();
inline const Layer* getLayer () const;
inline RoutingPlane* getRoutingPlane ();
inline Constant::Direction getDirection () const;
void merge ( const Box&, Net* );
@ -596,6 +598,7 @@ namespace {
}
inline const Layer* PowerRailsPlanes::Plane::getLayer () const { return _layer; }
inline RoutingPlane* PowerRailsPlanes::Plane::getRoutingPlane () { return _routingPlane; }
inline Constant::Direction PowerRailsPlanes::Plane::getDirection () const { return (Constant::Direction)_routingPlane->getDirection(); }
@ -749,6 +752,7 @@ namespace {
, const Box& area
, const Transformation& transformation
);
void ringAddToPowerRails ();
virtual void doQuery ();
inline void doLayout ();
inline unsigned int getGoMatchCount () const;
@ -756,8 +760,11 @@ namespace {
AllianceFramework* _framework;
KiteEngine* _kite;
RoutingGauge* _routingGauge;
const ChipTools& _chipTools;
PowerRailsPlanes _powerRailsPlanes;
bool _isBlockagePlane;
vector<const Segment*> _hRingSegments;
vector<const Segment*> _vRingSegments;
unsigned int _goMatchCount;
};
@ -767,8 +774,11 @@ namespace {
, _framework (AllianceFramework::get())
, _kite (kite)
, _routingGauge (kite->getConfiguration()->getRoutingGauge())
, _chipTools (kite->getChipTools())
, _powerRailsPlanes(kite)
, _isBlockagePlane (false)
, _hRingSegments ()
, _vRingSegments ()
, _goMatchCount (0)
{
setCell ( kite->getCell() );
@ -802,6 +812,7 @@ namespace {
{
if ( not _powerRailsPlanes.getActivePlane() ) return;
Query::doQuery ();
}
@ -844,6 +855,21 @@ namespace {
ltrace(300) << " Merging PowerRail element: " << segment << endl;
Box bb = segment->getBoundingBox ( basicLayer );
unsigned int depth = _routingGauge->getLayerDepth ( segment->getLayer() );
if ( _chipTools.isChip()
and ((depth == 2) or (depth == 3))
and (segment->getWidth () == DbU::lambda( 12.0))
and (segment->getLength() > DbU::lambda(200.0))
and (_kite->getChipTools().getCorona().contains(bb)) ) {
switch ( depth ) {
case 2: _vRingSegments.push_back ( segment ); break; // M3 V.
case 3: _hRingSegments.push_back ( segment ); break; // M4 H.
}
return;
}
transformation.applyOn ( bb );
_powerRailsPlanes.merge ( bb, rootNet );
@ -864,6 +890,51 @@ namespace {
}
void QueryPowerRails::ringAddToPowerRails ()
{
if ( not _hRingSegments.empty() ) {
const RegularLayer* layer = dynamic_cast<const RegularLayer*>(_routingGauge->getRoutingLayer(3));
setBasicLayer ( layer->getBasicLayer() );
DbU::Unit xmin = DbU::Max;
DbU::Unit xmax = DbU::Min;
vector<Box> boxes;
for ( size_t i=0 ; i<_hRingSegments.size() ; ++i ) {
boxes.push_back ( _hRingSegments[i]->getBoundingBox() );
xmin = std::min ( xmin, boxes.back().getXMin() );
xmax = std::max ( xmax, boxes.back().getXMax() );
}
for ( size_t i=0 ; i<_hRingSegments.size() ; ++i ) {
_powerRailsPlanes.merge ( Box(xmin,boxes[i].getYMin(),xmax,boxes[i].getYMax())
, _powerRailsPlanes.getRootNet(_hRingSegments[i]->getNet(),Path()) );
}
}
if ( not _vRingSegments.empty() ) {
const RegularLayer* layer = dynamic_cast<const RegularLayer*>(_routingGauge->getRoutingLayer(2));
setBasicLayer ( layer->getBasicLayer() );
DbU::Unit ymin = DbU::Max;
DbU::Unit ymax = DbU::Min;
vector<Box> boxes;
for ( size_t i=0 ; i<_vRingSegments.size() ; ++i ) {
boxes.push_back ( _vRingSegments[i]->getBoundingBox() );
ymin = std::min ( ymin, boxes.back().getYMin() );
ymax = std::max ( ymax, boxes.back().getYMax() );
}
for ( size_t i=0 ; i<_vRingSegments.size() ; ++i ) {
_powerRailsPlanes.merge ( Box(boxes[i].getXMin(),ymin,boxes[i].getXMax(),ymax)
, _powerRailsPlanes.getRootNet(_vRingSegments[i]->getNet(),Path()) );
}
}
}
void QueryPowerRails::rubberCallback ( Rubber* )
{ }
@ -910,6 +981,7 @@ namespace Kite {
query.setBasicLayer ( *iLayer );
query.doQuery ();
}
query.ringAddToPowerRails ();
query.doLayout ();
cmess1 << " - " << query.getGoMatchCount() << " power rails elements found." << endl;

View File

@ -22,6 +22,7 @@
kite/RoutingEvent.h
kite/RoutingEventQueue.h
kite/RoutingEventHistory.h
kite/RoutingEventLoop.h
kite/RoutingPlane.h
kite/NegociateWindow.h
kite/Configuration.h
@ -45,6 +46,7 @@
RoutingEvent.cpp
RoutingEventQueue.cpp
RoutingEventHistory.cpp
RoutingEventLoop.cpp
RoutingPlane.cpp
BuildPowerRails.cpp
ProtectRoutingPads.cpp

View File

@ -77,11 +77,12 @@ namespace Kite {
threshold = 2*50;
break;
default:
threshold = 29*50;
threshold = 30*50;
break;
}
_globalMinBreaks[i] = DbU::lambda(Cfg::getParamInt(paramName.str(),threshold)->asInt());
Cfg::getParamDouble(paramName.str())->setDouble(threshold);
_globalMinBreaks[i] = DbU::lambda (Cfg::getParamDouble(paramName.str())->asDouble());
}
}
@ -239,9 +240,7 @@ namespace Kite {
string Configuration::_getTypeName () const
{
return "Configuration";
}
{ return "Configuration"; }
string Configuration::_getString () const
@ -258,6 +257,24 @@ namespace Kite {
{
Record* record = _base->_getRecord();
//record->add ( getSlot ( "_rg" , _rg ) );
if ( record ) {
record->add ( getSlot("_edgeCapacityPercent",_edgeCapacityPercent) );
record->add ( getSlot("_ripupCost" ,_ripupCost ) );
record->add ( getSlot("_eventsLimit" ,_eventsLimit ) );
record->add ( getSlot("_edgeCapacityPercent",_edgeCapacityPercent) );
record->add ( getSlot("_ripupLimits[StrapRipupLimit]" ,_ripupLimits[StrapRipupLimit] ) );
record->add ( getSlot("_ripupLimits[LocalRipupLimit]" ,_ripupLimits[LocalRipupLimit] ) );
record->add ( getSlot("_ripupLimits[GlobalRipupLimit]" ,_ripupLimits[GlobalRipupLimit] ) );
record->add ( getSlot("_ripupLimits[LongGlobalRipupLimit]",_ripupLimits[LongGlobalRipupLimit]) );
for ( size_t i=0 ; i<MaxMetalDepth ; ++i ) {
ostringstream paramName;
paramName << "metal" << (i+1) << "MinBreak";
record->add ( DbU::getValueSlot(paramName.str(),&_globalMinBreaks[i]) );
}
}
return record;
}

View File

@ -459,19 +459,23 @@ namespace Kite {
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_soper_se(20)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_res_re(20)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_addsub32_carith_se_gi_1_29" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_instaddbracry_sd_gi_1_21" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.instaddbracry_sd.gi_1_29" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.instseqadr_sd.pi_2_26" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_addsub32_carith_se_pi_3_29" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_dp_res_se(28)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.etat32_otheri_sd_2.enx" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.yoper_se(26)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.yoper_se(13)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.toper_se(5)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.soper_se(20)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.shift32_rshift_se.muxoutput(68)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.imdsgn_sd0" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.res_re(12)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.res_re(20)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.nextpc_rd(21)" );
//DebugSession::addToTrace ( getCell(), "addr_i(1)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.opcod_rd(1)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.otheri_sd(29)" );
//DebugSession::addToTrace ( getCell(), "d_in_i(11)" );
//DebugSession::addToTrace ( getCell(), "d_in_i(22)" );
//DebugSession::addToTrace ( getCell(), "ng_i" );
//DebugSession::addToTrace ( getCell(), "d_out_i(14)" );
//DebugSession::addToTrace ( getCell(), "d_out_i(19)" );
@ -479,13 +483,33 @@ namespace Kite {
//DebugSession::addToTrace ( getCell(), "dout_e_i(2)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.aux44" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.na4_x1_11_sig" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.nxr2_x1_7_sig" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.rsdnbr_sd(14)" );
//DebugSession::addToTrace ( getCell(), "d_out_i(27)" );
//DebugSession::addToTrace ( getCell(), "d_out_i(28)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_1m_ct_mbk_buf_opcod_sd_0" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.break_re" );
//DebugSession::addToTrace ( getCell(), "d_atype_i(0)" );
//DebugSession::addToTrace ( getCell(), "addr_i(0)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.i_write_sm" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_i_ri(11)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_opcod_rd(0)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.no4_x1_7_sig" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.i_ri(5)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_aux144" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_aux143" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.aux78" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_hold_si" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_ct.not_i_ri(30)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.data_rm(0)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.toper_se(0)" );
//DebugSession::addToTrace ( getCell(), "mips_r3000_core.mips_r3000_1m_dp.res_se(17)" );
createDetailedGrid ();
buildPowerRails ();
protectRoutingPads ();
Session::revalidate ();
if ( mode == LoadGlobalSolution ) {
_knik->loadSolution ();
} else {
@ -665,7 +689,7 @@ namespace Kite {
bool coherency = true;
coherency = coherency && KatabaticEngine::_check ( message );
for ( size_t i=0 ; i<_routingPlanes.size() ; i++ )
coherency = _routingPlanes[i]->_check(overlap) && coherency;
coherency = _routingPlanes[i]->_check(overlap) and coherency;
Katabatic::Session* ktbtSession = Session::base ();
forEach ( Net*, inet, getCell()->getNets() ) {
@ -687,7 +711,7 @@ namespace Kite {
}
#if defined(CHECK_DATABASE)
//Session::getKiteEngine()->setInterrupt ( !coherency );
//Session::getKiteEngine()->setInterrupt ( not coherency );
#endif
return coherency;
@ -823,7 +847,10 @@ namespace Kite {
{
Record* record = KatabaticEngine::_getRecord ();
if ( record ) {
record->add ( getSlot ( "_routingPlanes", &_routingPlanes ) );
record->add ( getSlot ( "_configuration", _configuration ) );
}
return record;
}

View File

@ -48,6 +48,7 @@
#include "kite/RoutingPlane.h"
#include "kite/RoutingEventQueue.h"
#include "kite/RoutingEventHistory.h"
#include "kite/RoutingEventLoop.h"
#include "kite/NegociateWindow.h"
#include "kite/KiteEngine.h"
@ -75,6 +76,7 @@ namespace {
return;
}
if ( cost.getInterval().getVMax() > intersect.getVMax() ) cost.setLeftOverlap();
if ( cost.getInterval().getVMin() < intersect.getVMin() ) cost.setRightOverlap();
@ -92,6 +94,12 @@ namespace {
}
}
if ( segment->isGlobal() ) {
//if ( data->getState() >= DataNegociate::ConflictSolve1 ) {
cost.setOverlapGlobal();
//}
}
// if ( data->getRipupCount() > 3 ) {
// ltrace(200) << "Infinite cost from: " << segment << endl;
// cost.setFixed ();
@ -164,6 +172,7 @@ namespace Kite {
, _segments ()
, _eventQueue ()
, _eventHistory()
, _eventLoop (10,50)
{ }
@ -378,14 +387,15 @@ namespace Kite {
while ( not _eventQueue.empty() and not isInterrupted() ) {
RoutingEvent* event = _eventQueue.pop ();
event->process ( _eventQueue, _eventHistory );
event->process ( _eventQueue, _eventHistory, _eventLoop );
if (tty::enabled()) {
cmess1 << " <event:" << tty::bold << setw(7) << setfill('0')
cmess2 << " <event:" << tty::bold << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << tty::reset << ">" << tty::cr;
cmess1.flush ();
cmess2.flush ();
} else {
cmess2 << " <event:" << setw(7) << setfill('0')
<< RoutingEvent::getProcesseds() << setfill(' ') << "> id:"
<< RoutingEvent::getProcesseds() << setfill(' ') << "> @"
<< DbU::getValueString(event->getSegment()->getAxis()) << " id:"
<< event->getSegment()->getId() << " "
<< event->getSegment()->getNet()->getName()
<< endl;
@ -410,7 +420,7 @@ namespace Kite {
count++;
event->setProcessed ( false );
event->setMode ( RoutingEvent::PostPack );
event->process ( _eventQueue, _eventHistory );
event->process ( _eventQueue, _eventHistory, _eventLoop );
if (tty::enabled()) {
cmess1 << " <event:"
@ -503,7 +513,7 @@ namespace Kite {
const Katabatic::GCellVector* gcells = getKiteEngine()->getGCellGrid()->getGCellVector();
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::AverageHVDensity );
getKiteEngine()->getGCellGrid()->setDensityMode ( Katabatic::GCellGrid::MaxHVDensity );
for ( size_t igcell=0 ; igcell<(*gcells).size() ; ++igcell ) {
densityHistogram->addSample ( (*gcells)[igcell]->getDensity(), 0 );
}

View File

@ -85,28 +85,34 @@ namespace {
if ( CatalogExtension::isPad(masterNet->getCell()) ) return;
vector<Segment*> segments;
forEach ( Segment*, isegment, masterNet->getSegments() ) {
RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(isegment->getLayer());
if ( plane == NULL ) {
continue;
if ( plane == NULL ) continue;
if ( usedComponent == dynamic_cast<Component*>(*isegment) ) continue;
if ( not NetExternalComponents::isExternal(*isegment) ) continue;
//cerr << "Looking " << (void*)*isegment << ":" << *isegment << endl;
segments.push_back ( *isegment );
}
for ( size_t i=0 ; i<segments.size() ; ++i ) {
//cerr << "Protecting " << segments[i] << endl;
RoutingPlane* plane = Session::getKiteEngine()->getRoutingPlaneByLayer(segments[i]->getLayer());
unsigned int direction = plane->getDirection();
DbU::Unit wireWidth = plane->getLayerGauge()->getWireWidth();
DbU::Unit delta = plane->getLayerGauge()->getHalfPitch()
+ wireWidth/2
- DbU::lambda(0.1);
DbU::Unit extension = isegment->getLayer()->getExtentionCap();
DbU::Unit extension = segments[i]->getLayer()->getExtentionCap();
Box bb ( segments[i]->getBoundingBox() );
if ( usedComponent == dynamic_cast<Component*>(*isegment) ) continue;
if ( not NetExternalComponents::isExternal(*isegment) ) continue;
//cinfo << "Protecting " << *isegment << endl;
Box bb ( (*isegment)->getBoundingBox() );
transformation.applyOn ( bb );
//cinfo << "bb: " << bb << endl;
cinfo << "bb: " << bb << endl;
if ( direction == Constant::Horizontal ) {
DbU::Unit axisMin = bb.getYMin() - delta;
@ -115,61 +121,14 @@ namespace {
Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior );
for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNext() ) {
Horizontal* segment = Horizontal::create ( rp->getNet()
, isegment->getLayer()
, segments[i]->getLayer()
, track->getAxis()
, wireWidth
, bb.getXMin()+extension
, bb.getXMax()-extension
);
// TrackElement* element =
TrackFixedSegment::create ( track, segment );
//cinfo << " Rp Protect:" << track << "+" << element << endl;
}
// Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior );
// for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNext() ) {
// Point sourcePosition (bb.getXMin()+extension,track->getAxis());
// Point targetPosition (bb.getXMax()-extension,track->getAxis());
// Katabatic::GCell* sourceGCell = Session::getKatabatic()->getGCellGrid()->getGCell ( sourcePosition );
// Katabatic::GCell* targetGCell = Session::getKatabatic()->getGCellGrid()->getGCell ( targetPosition );
// cinfo << " S: " << sourceGCell << " from " << sourcePosition << endl;
// cinfo << " T: " << targetGCell << " from " << targetPosition << endl;
// unsigned int segmentType
// = (sourceGCell == targetGCell) ? AutoSegment::Local : AutoSegment::Global;
// AutoContact* source = AutoContact::fromRp ( sourceGCell
// , rp
// , rp->getLayer()
// , sourcePosition
// , DbU::lambda(1.0), DbU::lambda(1.0)
// , true
// );
// AutoContact* target = AutoContact::fromRp ( targetGCell
// , rp
// , rp->getLayer()
// , targetPosition
// , DbU::lambda(1.0), DbU::lambda(1.0)
// , true
// );
// AutoSegment* segment = AutoSegment::create ( source
// , target
// , Constant::Horizontal
// , segmentType
// , true
// , false
// );
// segment->setLayer ( isegment->getLayer() );
// segment->setFixed ( true );
// bool created = true;
// TrackElement* element = TrackSegment::create ( segment, track, created );
// cinfo << " Rp Protect " << track << "+" << element << endl;
// }
} else {
DbU::Unit axisMin = bb.getXMin() - delta;
DbU::Unit axisMax = bb.getXMax() + delta;
@ -177,63 +136,14 @@ namespace {
Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior );
for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNext() ) {
Vertical* segment = Vertical::create ( rp->getNet()
, isegment->getLayer()
, segments[i]->getLayer()
, track->getAxis()
, wireWidth
, bb.getYMin()+extension
, bb.getYMax()-extension
);
// TrackElement* element =
TrackFixedSegment::create ( track, segment );
//cinfo << " Rp Protect:" << track << "+" << element << endl;
}
// Track* track = plane->getTrackByPosition ( axisMin, Constant::Superior );
// for ( ; track and (track->getAxis() <= axisMax) ; track = track->getNext() ) {
// cinfo << " Track Axis: " << DbU::getValueString(track->getAxis()) << endl;
// Point sourcePosition (track->getAxis(),bb.getYMin()+extension);
// Point targetPosition (track->getAxis(),bb.getYMax()-extension);
// Katabatic::GCell* sourceGCell = Session::getKatabatic()->getGCellGrid()->getGCell ( sourcePosition );
// Katabatic::GCell* targetGCell = Session::getKatabatic()->getGCellGrid()->getGCell ( targetPosition );
// cinfo << " S: " << sourceGCell << " from " << sourcePosition << endl;
// cinfo << " T: " << targetGCell << " from " << targetPosition << endl;
// unsigned int segmentType
// = (sourceGCell == targetGCell) ? AutoSegment::Local : AutoSegment::Global;
// AutoContact* source = AutoContact::fromRp ( sourceGCell
// , rp
// , rp->getLayer()
// , sourcePosition
// , DbU::lambda(1.0), DbU::lambda(1.0)
// , true
// );
// AutoContact* target = AutoContact::fromRp ( targetGCell
// , rp
// , rp->getLayer()
// , targetPosition
// , DbU::lambda(1.0), DbU::lambda(1.0)
// , true
// );
// AutoSegment* segment = AutoSegment::create ( source
// , target
// , Constant::Vertical
// , segmentType
// , true
// , false
// );
// segment->setLayer ( isegment->getLayer() );
// segment->setFixed ( true );
// bool created = true;
// TrackElement* element = TrackSegment::create ( segment, track, created );
// cinfo << " Rp Protect: " << track << "+" << element << endl;
// }
}
}
}
@ -257,11 +167,18 @@ namespace Kite {
cmess1 << " o Protect external components not useds as RoutingPads." << endl;
forEach ( Net*, inet, getCell()->getNets() ) {
// cerr << *inet << " isSupply():" << (*inet)->isSupply()
// << " " << (*inet)->getType()
// << endl;
if ( (*inet)->isSupply() ) continue;
vector<RoutingPad*> rps;
forEach ( RoutingPad*, irp, (*inet)->getRoutingPads() ) {
protectRoutingPad ( *irp );
rps.push_back ( *irp );
}
for ( size_t i=0 ; i<rps.size() ; ++i )
protectRoutingPad ( rps[i] );
}
Session::revalidate ();

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,6 @@ namespace Kite {
RoutingEventHistory::RoutingEventHistory ()
: _events ()
, _identicals(0)
{ }
@ -83,19 +82,7 @@ namespace Kite {
void RoutingEventHistory::push ( RoutingEvent* event )
{
if ( _events.size() && (event->getSegment() == _events.back()->getSegment()) )
_identicals++;
else
_identicals = 0;
_events.push_back(event);
// if ( _identicals > 30 ) {
// dump ( cerr, 40 );
// throw Error("RoutingEventHistory::push(): More than 30 identicals events, we are looping.");
// }
}
{ _events.push_back(event); }
void RoutingEventHistory::clear ()
@ -103,7 +90,6 @@ namespace Kite {
for ( size_t i=0 ; i < _events.size() ; i++ )
_events[i]->destroy();
_events.clear ();
_identicals = 0;
}

View File

@ -0,0 +1,94 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | 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 : "./RoutingEventLoop.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
#include <algorithm>
#include "kite/RoutingEvent.h"
#include "kite/RoutingEventLoop.h"
namespace Kite {
using std::cerr;
using std::endl;
using std::vector;
using std::stable_sort;
RoutingEventLoop::RoutingEventLoop ( size_t depth, int countLimit )
: _elements ()
, _depth (depth)
, _maxCount (0)
, _countLimit(countLimit)
, _isLooping (false)
{ }
void RoutingEventLoop::update ( size_t id )
{
vector<Element>::iterator ielement = _elements.begin();
for ( ; ielement != _elements.end() ; ++ielement ) {
if ( (*ielement)._id == id ) {
// Increment an already present element.
(*ielement)._count += 1;
(*ielement)._timestamp = RoutingEvent::getProcesseds();
_maxCount = std::max ( _maxCount, (*ielement)._count );
if ( _maxCount > _countLimit ) _isLooping = true;
break;
}
}
// The Event was not found.
if ( ielement == _elements.end() ) {
if ( _elements.size() >= _depth ) _elements.pop_back ();
_elements.push_back ( Element(id,RoutingEvent::getProcesseds()) );
}
stable_sort ( _elements.begin(), _elements.end(), CompareByTimestamp() );
}
void RoutingEventLoop::erase ( size_t id )
{
vector<Element>::iterator ielement = _elements.begin();
for ( ; ielement != _elements.end() ; ++ielement ) {
if ( (*ielement)._id == id ) {
_elements.erase ( ielement );
break;
}
}
_maxCount = 0;
ielement = _elements.begin();
for ( ; ielement != _elements.end() ; ++ielement ) {
_maxCount = std::max ( _maxCount, (*ielement)._count );
}
_isLooping = (_maxCount > _countLimit);
}
} // End of Kite namespace.

View File

@ -160,7 +160,7 @@ namespace Kite {
bool coherency = true;
for ( size_t i=0 ; i<_tracks.size() ; i++ ) {
coherency = _tracks[i]->_check(overlaps) && coherency;
coherency = _tracks[i]->_check(overlaps) and coherency;
}
return coherency;

View File

@ -286,7 +286,7 @@ namespace Kite {
TrackCost Track::getOverlapCost ( Interval interval, Net* net, size_t begin, size_t end ) const
{
TrackCost cost ( const_cast<Track*>(this), interval, begin, end );
TrackCost cost ( const_cast<Track*>(this), interval, begin, end, net );
ltrace(190) << "getOverlapCost() @" << DbU::getValueString(_axis)
<< " [" << DbU::getValueString(interval.getVMin())
@ -538,7 +538,7 @@ namespace Kite {
coherency = false;
}
coherency = coherency && _segments[i]->_check ();
coherency = _segments[i]->_check () and coherency;
} else {
cerr << "[CHECK] Hole at position " << i << "." << endl;
holes = true;
@ -547,7 +547,7 @@ namespace Kite {
}
if ( !holes )
coherency = coherency && (checkOverlap(overlaps) == 0);
coherency = (checkOverlap(overlaps) == 0) and coherency;
return coherency;
}

View File

@ -51,6 +51,7 @@ namespace Kite {
, const Interval& interval
, size_t begin
, size_t end
, Net* net
)
: _track (track)
, _begin (begin)
@ -63,29 +64,41 @@ namespace Kite {
, _overlap (false)
, _leftOverlap (false)
, _rightOverlap (false)
, _overlapGlobal (false)
, _terminals (0)
, _delta (-interval.getSize())
, _deltaShared (0)
, _deltaPerpand (0)
, _axisWeight (0)
, _distanceToFixed(DbU::Max)
, _distanceToFixed(DbU::lambda(100.0))
, _dataState (0)
, _ripupCount (0)
{
TrackElement* neighbor;
if ( _begin != Track::NPOS ) {
neighbor = _track->getSegment(_begin);
if ( neighbor && neighbor->isFixed() ) {
if ( _distanceToFixed == DbU::Max ) _distanceToFixed = 0;
_distanceToFixed += interval.getVMin() - neighbor->getTargetU();
if ( neighbor and (neighbor->getNet() != net) ) {
DbU::Unit distance = interval.getVMin() - neighbor->getTargetU();
if ( distance < DbU::lambda(50.0) )
_distanceToFixed = distance;
}
// if ( neighbor and neighbor->isFixed() ) {
// if ( _distanceToFixed == DbU::Max ) _distanceToFixed = 0;
// _distanceToFixed += interval.getVMin() - neighbor->getTargetU();
// }
}
if ( _end != Track::NPOS ) {
neighbor = _track->getSegment(_end);
if ( neighbor && neighbor->isFixed() ) {
if ( _distanceToFixed == DbU::Max ) _distanceToFixed = 0;
_distanceToFixed += neighbor->getSourceU() - interval.getVMax();
if ( neighbor and (neighbor->getNet() != net) ) {
DbU::Unit distance = neighbor->getSourceU() - interval.getVMax();
if ( _distanceToFixed == DbU::lambda(100.0) ) _distanceToFixed = 0;
if ( distance < DbU::lambda(50.0) )
_distanceToFixed += distance;
}
// if ( neighbor and neighbor->isFixed() ) {
// if ( _distanceToFixed == DbU::Max ) _distanceToFixed = 0;
// _distanceToFixed += neighbor->getSourceU() - interval.getVMax();
// }
}
}
@ -100,36 +113,36 @@ namespace Kite {
}
bool operator< ( const TrackCost& lhs, const TrackCost& rhs )
bool TrackCost::Compare::operator() ( const TrackCost& lhs, const TrackCost& rhs )
{
if ( lhs._infinite xor rhs._infinite ) return rhs._infinite;
if ( (_flags & TrackCost::DiscardGlobals)
and (lhs._overlapGlobal xor rhs._overlapGlobal) )
return rhs._overlapGlobal;
if ( lhs._hardOverlap xor rhs._hardOverlap ) return rhs._hardOverlap;
int lhsRipupCost = (lhs._dataState<<2) + lhs._ripupCount;
int rhsRipupCost = (rhs._dataState<<2) + rhs._ripupCount;
if ( lhs._ripupCount + (int)Session::getRipupCost() < rhs._ripupCount ) return true;
if ( lhs._ripupCount > (int)Session::getRipupCost() + rhs._ripupCount ) return false;
// if ( lhs._ripupCount + (int)Session::getRipupCost() < rhs._ripupCount ) return true;
// if ( lhs._ripupCount > rhs._ripupCount + (int)Session::getRipupCost() ) return false;
if ( lhsRipupCost + (int)Session::getRipupCost() < rhsRipupCost ) return true;
if ( lhsRipupCost > (int)Session::getRipupCost() + rhsRipupCost ) return false;
//int lhsRipupCost = (lhs._dataState<<2) + lhs._ripupCount;
//int rhsRipupCost = (rhs._dataState<<2) + rhs._ripupCount;
//if ( lhsRipupCost + (int)Session::getRipupCost() < rhsRipupCost ) return true;
//if ( lhsRipupCost > (int)Session::getRipupCost() + rhsRipupCost ) return false;
if ( lhs._overlap xor rhs._overlap ) return rhs._overlap;
//std::cerr << "lhs:" << lhs._ripupCount
// << " rhs:" << rhs._ripupCount
// << " " << rhs._ripupCount - lhs._ripupCount << " > " << Session::getRipupCost()
// << std::endl;
//if ( lhs._ripupCount - rhs._ripupCount > (int)Session::getRipupCost() ) return false;
if ( lhs._terminals < rhs._terminals ) return true;
if ( lhs._terminals > rhs._terminals ) return false;
if ( lhs._delta < rhs._delta ) return true;
if ( lhs._delta > rhs._delta ) return false;
if ( not (_flags & TrackCost::IgnoreAxisWeight) ) {
if ( lhs._axisWeight < rhs._axisWeight ) return true;
if ( lhs._axisWeight > rhs._axisWeight ) return false;
}
if ( lhs._deltaPerpand < rhs._deltaPerpand ) return true;
if ( lhs._deltaPerpand > rhs._deltaPerpand ) return false;
@ -161,10 +174,13 @@ namespace Kite {
string s = "<" + _getTypeName();
s += " " + getString(_track);
s += " " + getString(_ripupCount);
s += " " + getString(_dataState);
s += "+" + getString(_ripupCount);
s += ":" + getString((_dataState<<2)+_ripupCount);
s += " " + string ( (_blockage )?"b":"-" );
s += string ( (_hardOverlap )?"h":"-" );
s += string ( (_overlap )?"o":"-" );
s += string ( (_overlapGlobal)?"g":"-" );
s += " " + getString(_terminals);
s += "/" + DbU::getValueString(_delta);
s += "/" + DbU::getValueString(_axisWeight);

View File

@ -162,7 +162,7 @@ namespace Kite {
unsigned int TrackElement::getDogLegOrder () const { return 0; }
Interval TrackElement::getSourceConstraints () const { return Interval(); }
Interval TrackElement::getTargetConstraints () const { return Interval(); }
DataNegociate* TrackElement::getDataNegociate () const { return NULL; }
DataNegociate* TrackElement::getDataNegociate ( unsigned int ) const { return NULL; }
TrackElements TrackElement::getCollapsedPerpandiculars () { return new TrackElements_CollapsedPerpandicular(NULL); }
void TrackElement::setAllowOutsideGCell ( bool ) { }
void TrackElement::setLock ( bool ) { }
@ -177,12 +177,14 @@ namespace Kite {
bool TrackElement::canDesalignate () 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::canDogLegAt ( Katabatic::GCell*, bool allowReuse ) { return false; };
bool TrackElement::canDogLegAt ( Katabatic::GCell*, unsigned int ) { return false; };
TrackElement* TrackElement::getSourceDogLeg () { return NULL; }
TrackElement* TrackElement::getTargetDogLeg () { return NULL; }
TrackElement* TrackElement::getParent () const { return NULL; }
void TrackElement::dataInvalidate () { }
void TrackElement::eventInvalidate () { }
void TrackElement::setArea () { }
@ -197,6 +199,7 @@ namespace Kite {
void TrackElement::setAxis ( DbU::Unit, unsigned int flags ) { }
void TrackElement::slacken () { }
bool TrackElement::moveUp ( unsigned int ) { return false; }
bool TrackElement::moveDown ( unsigned int ) { return false; }
bool TrackElement::moveAside ( bool onLeft ) { return false; }
TrackElement* TrackElement::makeDogLeg () { return NULL; }
TrackElement* TrackElement::makeDogLeg ( Interval, bool& leftDogleg ) { return NULL; }

View File

@ -111,14 +111,14 @@ namespace Kite {
guside = gcell->getUSide ( Constant::Horizontal /*, true*/ );
Interval usedLength = guside.getIntersection ( segside );
gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() );
gcell->addBlockage ( depth, usedLength.getSize() );
gcell = right;
}
if ( end ) {
guside = gcell->getUSide ( Constant::Horizontal /*, true*/ );
Interval usedLength = guside.getIntersection ( segside );
end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() );
end->addBlockage ( depth, usedLength.getSize() );
}
} else
cerr << Warning("TrackFixedSegment(): TrackFixedElement outside GCell grid.") << endl;
@ -141,14 +141,14 @@ namespace Kite {
guside = gcell->getUSide ( Constant::Vertical /*, true*/ );
Interval usedLength = guside.getIntersection ( segside );
gcell->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() );
gcell->addBlockage ( depth, usedLength.getSize() );
gcell = up;
}
if ( end ) {
guside = gcell->getUSide ( Constant::Vertical /*, true*/ );
Interval usedLength = guside.getIntersection ( segside );
end->addBlockage ( depth, (float)usedLength.getSize()/(float)guside.getSize() );
end->addBlockage ( depth, usedLength.getSize() );
}
} else
cerr << Warning("TrackFixedSegment(): TrackFixedElement outside GCell grid.") << endl;

View File

@ -38,7 +38,6 @@
#include "crlcore/RoutingGauge.h"
#include "kite/DataNegociate.h"
#include "kite/TrackSegment.h"
#include "kite/TrackCost.h"
#include "kite/Track.h"
#include "kite/Session.h"
#include "kite/RoutingEvent.h"
@ -157,7 +156,6 @@ namespace Kite {
unsigned int TrackSegment::getDogLegLevel () const { return _dogLegLevel; }
Interval TrackSegment::getSourceConstraints () const { return _base->getSourceConstraints(); }
Interval TrackSegment::getTargetConstraints () const { return _base->getTargetConstraints(); }
DataNegociate* TrackSegment::getDataNegociate () const { return _data; }
TrackElements TrackSegment::getCollapsedPerpandiculars () { return new TrackElements_CollapsedPerpandicular(this); }
void TrackSegment::setAllowOutsideGCell ( bool state ) { _base->setAllowOutsideGCell(state,true); }
void TrackSegment::setLock ( bool state ) { _lock = state; }
@ -196,12 +194,13 @@ namespace Kite {
{ return _base->getLayer(); }
// DbU::Unit TrackSegment::getSourceU () const
// { return _base->getSourceU(); }
DataNegociate* TrackSegment::getDataNegociate ( unsigned int flags ) const
{
if ( flags & TrackElement::DataSelf ) return _data;
// DbU::Unit TrackSegment::getTargetU () const
// { return _base->getTargetU(); }
TrackElement* parent = getParent();
return (parent) ? parent->getDataNegociate() : NULL;
}
TrackElement* TrackSegment::getNext () const
@ -218,6 +217,16 @@ namespace Kite {
}
TrackElement* TrackSegment::getParent () const
{
AutoSegment* baseParent = base()->getParent();
if ( not baseParent ) return NULL;
TrackElement* element = Session::lookup ( baseParent );
return element;
}
Interval TrackSegment::getFreeInterval () const
{
if ( not _track ) return Interval(false);
@ -412,7 +421,7 @@ namespace Kite {
other->getTrack()->_check();
#endif
RoutingEvent* thisEvent = getDataNegociate()->getRoutingEvent();
RoutingEvent* thisEvent = getDataNegociate(TrackElement::DataSelf)->getRoutingEvent();
RoutingEvent* otherEvent = other->getDataNegociate()->getRoutingEvent();
if ( thisEvent ) thisEvent ->setSegment ( other );
@ -459,6 +468,10 @@ namespace Kite {
{ return _base->canPivotUp(reserve); }
bool TrackSegment::canPivotDown ( float reserve ) const
{ return _base->canPivotDown(reserve); }
bool TrackSegment::canMoveUp ( float reserve, unsigned int flags ) const
{ return _base->canMoveUp ( reserve, flags ); }
@ -478,7 +491,7 @@ namespace Kite {
for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
TrackElement* segment = Session::getNegociateWindow()->addTrackSegment(invalidateds[i],false);
if ( segment != NULL ) {
ltrace(200) << "moved: " << invalidateds[i] << endl;
ltrace(200) << "moved up: " << invalidateds[i] << endl;
segments.push_back ( segment );
// if ( (segment->getTrack() == NULL)
// or (segment->getLayer() != segment->getTrack()->getLayer()) )
@ -486,7 +499,45 @@ namespace Kite {
}
}
for ( size_t i=0 ; i<segments.size() ; i++ ) {
ltrace(200) << "moved: " << segments[i] << endl;
ltrace(200) << "moved up: " << segments[i] << endl;
}
}
// if ( _data and success ) {
// _data->setState ( DataNegociate::ConflictSolve1, true );
// _data->resetRipupCount ();
// }
ltraceout(200);
return success;
}
bool TrackSegment::moveDown ( unsigned int flags )
{
bool success = false;
ltrace(200) << "TrackSegment::moveDown() " << flags << endl;
ltracein(200);
success = base()->moveDown ( flags );
const vector<AutoSegment*>& invalidateds = Session::getInvalidateds();
if ( not invalidateds.empty() ) {
vector<TrackElement*> segments;
for ( size_t i=0 ; i<invalidateds.size() ; i++ ) {
TrackElement* segment = Session::getNegociateWindow()->addTrackSegment(invalidateds[i],false);
if ( segment != NULL ) {
ltrace(200) << "moved down: " << invalidateds[i] << endl;
segments.push_back ( segment );
// if ( (segment->getTrack() == NULL)
// or (segment->getLayer() != segment->getTrack()->getLayer()) )
segment->reschedule ( 0 );
}
}
for ( size_t i=0 ; i<segments.size() ; i++ ) {
ltrace(200) << "moved down: " << segments[i] << endl;
}
}
@ -650,7 +701,7 @@ namespace Kite {
}
bool TrackSegment::canDogLegAt ( Katabatic::GCell* dogLegGCell, bool allowReuse )
bool TrackSegment::canDogLegAt ( Katabatic::GCell* dogLegGCell, unsigned int flags )
{
ltrace(200) << "TrackSegment::canDogLegAt(GCell*) " << dogLegGCell << endl;
@ -683,7 +734,7 @@ namespace Kite {
isGCellInside = true;
if ( igcell == 0 ) {
if ( hasSourceDogLeg() ) {
if ( allowReuse ) return true;
if ( flags & TrackElement::AllowDoglegReuse ) return true;
ltrace(200) << "Cannot dogleg again in source GCell." << endl;
return false;
@ -691,7 +742,7 @@ namespace Kite {
}
if ( hasTargetDogLeg() && (igcell == gcells.size()-1) ) {
if ( allowReuse ) return true;
if ( flags & TrackElement::AllowDoglegReuse ) return true;
ltrace(200) << "Cannot dogleg again in target GCell." << endl;
return false;
@ -848,7 +899,7 @@ namespace Kite {
bool coherency = true;
if ( !base()->isCanonical() ) {
if ( not base()->isCanonical() ) {
cerr << "[CHECK] " << this << " supporting AutoSegment is not canonical." << endl;
coherency = false;
}

View File

@ -64,9 +64,9 @@ namespace Kite {
public:
enum SlackState { RipupPerpandiculars= 1
, Minimize = 2
, DogLeg = 3
, Desalignate = 4
, Desalignate = 2
, Minimize = 3
, DogLeg = 4
, Slacken = 5
, ConflictSolve1 = 6
, ConflictSolve2 = 7

View File

@ -37,6 +37,7 @@ namespace Hurricane {
#include "katabatic/Grid.h"
#include "kite/RoutingEventQueue.h"
#include "kite/RoutingEventHistory.h"
#include "kite/RoutingEventLoop.h"
namespace Kite {
@ -114,6 +115,7 @@ namespace Kite {
inline const Katabatic::GCellVector& getGCells () const;
inline RoutingEventQueue& getEventQueue ();
inline RoutingEventHistory& getEventHistory ();
inline RoutingEventLoop& getEventLoop ();
inline Stage getStage () const;
void setGCells ( const Katabatic::GCellVector& );
inline void setInterrupt ( bool );
@ -139,6 +141,7 @@ namespace Kite {
std::vector<TrackElement*> _segments;
RoutingEventQueue _eventQueue;
RoutingEventHistory _eventHistory;
RoutingEventLoop _eventLoop;
Statistics _statistics;
// Constructors.

View File

@ -27,6 +27,7 @@
#define __KITE_ROUTING_EVENT__
#include <vector>
#include <cstdlib>
#include "hurricane/Interval.h"
namespace Hurricane {
@ -48,6 +49,7 @@ namespace Kite {
class Track;
class RoutingEventHistory;
class RoutingEventQueue;
class RoutingEventLoop;
// -------------------------------------------------------------------
@ -106,6 +108,7 @@ namespace Kite {
inline bool isDisabled () const;
inline bool isForcedToHint () const;
inline bool isSheared () const;
inline bool isRipedByLocal () const;
inline bool getMode () const;
inline bool canMinimize () const;
unsigned int getState () const;
@ -114,7 +117,7 @@ namespace Kite {
inline const vector<TrackElement*>& getPerpandiculars () const;
inline DbU::Unit getAxisHint () const;
inline DbU::Unit getAxisHistory () const;
long getAxisWeight ( DbU::Unit ) const;
inline long getAxisWeight ( DbU::Unit ) const;
inline const Interval& getOptimalAxis () const;
inline const Interval& getConstraints () const;
inline const Interval& getOptimal () const;
@ -128,7 +131,10 @@ namespace Kite {
inline void invalidate ( bool withPerpandiculars=false, bool withConstraints=false );
void revalidate ( bool force=false );
inline void updateKey ();
void process ( RoutingEventQueue&, RoutingEventHistory& );
void process ( RoutingEventQueue&
, RoutingEventHistory&
, RoutingEventLoop&
);
void setSegment ( TrackElement* );
RoutingEvent* reschedule ( RoutingEventQueue&, unsigned int eventLevel );
inline void setMode ( unsigned int );
@ -136,10 +142,12 @@ namespace Kite {
inline void setProcessed ( bool state=true );
inline void setDisabled ( bool state=true );
inline void setMinimized ( bool state=true );
inline void setRipedByLocal ( bool state=true );
void setEventLevel ( unsigned int );
inline void setTracksFree ( unsigned int );
inline void setForcedToHint ( bool state = true );
void setAxisHint ( DbU::Unit );
void cacheAxisHint ();
inline void setOptimalAxis ( Interval );
inline void incInsertState ();
inline void resetInsertState ();
@ -166,6 +174,7 @@ namespace Kite {
bool _canHandleConstraints;
bool _minimized;
bool _forceToHint;
bool _ripedByLocal;
TrackElement* _segment;
DbU::Unit _axisHistory;
DbU::Unit _axisHint;
@ -193,13 +202,15 @@ namespace Kite {
inline bool RoutingEvent::isDisabled () const { return _disabled; }
inline bool RoutingEvent::isForcedToHint () const { return _forceToHint; }
inline bool RoutingEvent::isSheared () const { return (_shearGCell != NULL); }
inline bool RoutingEvent::isRipedByLocal () const { return _ripedByLocal; }
inline bool RoutingEvent::getMode () const { return _mode; }
inline bool RoutingEvent::canMinimize () const { return !_minimized; }
inline const RoutingEvent::Key& RoutingEvent::getKey () const { return _key; }
inline TrackElement* RoutingEvent::getSegment () const { return _segment; }
inline const vector<TrackElement*>& RoutingEvent::getPerpandiculars () const { return _perpandiculars; }
inline DbU::Unit RoutingEvent::getAxisHint () const { return _axisHint; }
inline DbU::Unit RoutingEvent::getAxisHistory () const { return _axisHistory; }
inline DbU::Unit RoutingEvent::getAxisHint () const { return _axisHint; }
inline long RoutingEvent::getAxisWeight ( DbU::Unit axis ) const { return abs(axis - getAxisHint()); }
inline const Interval& RoutingEvent::getOptimalAxis () const { return _optimalAxis; }
inline const Interval& RoutingEvent::getConstraints () const { return _constraints; }
inline const Interval& RoutingEvent::getOptimal () const { return _optimal; }
@ -214,6 +225,7 @@ namespace Kite {
inline void RoutingEvent::setProcessed ( bool state ) { _processed = state; }
inline void RoutingEvent::setDisabled ( bool state ) { _disabled = state; }
inline void RoutingEvent::setMinimized ( bool state ) { _minimized = state; }
inline void RoutingEvent::setRipedByLocal ( bool state ) { _ripedByLocal = state; }
inline void RoutingEvent::setTracksFree ( unsigned int nb ) { _tracksFree = nb; }
inline void RoutingEvent::setForcedToHint ( bool state ) { _forceToHint = state; }
inline void RoutingEvent::setOptimalAxis ( Interval i ) { _optimalAxis = i; }

View File

@ -49,7 +49,6 @@ namespace Kite {
public:
RoutingEventHistory ();
~RoutingEventHistory ();
inline bool looping () const;
inline bool empty () const;
inline size_t size () const;
RoutingEvent* getNth ( size_t ) const;
@ -64,7 +63,6 @@ namespace Kite {
protected:
// Attributes.
vector<RoutingEvent*> _events;
size_t _identicals;
private:
RoutingEventHistory& operator= ( const RoutingEventHistory& );
@ -74,7 +72,6 @@ namespace Kite {
// Inline Functions.
inline bool RoutingEventHistory::looping () const { return _identicals > 30; }
inline bool RoutingEventHistory::empty () const { return _events.empty(); }
inline size_t RoutingEventHistory::size () const { return _events.size(); }
inline string RoutingEventHistory::_getTypeName () const { return "RoutingEventHistory"; }

View File

@ -0,0 +1,93 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | 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++ Header : "./kite/RoutingEventLoop.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __KITE_ROUTING_EVENT_LOOP__
#define __KITE_ROUTING_EVENT_LOOP__
#include <vector>
namespace Kite {
class RoutingEvent;
// -------------------------------------------------------------------
// Class : "RoutingEventLoop".
class RoutingEventLoop {
public:
class Element {
public:
inline Element ( size_t id=0, size_t timestamp=0 );
public:
size_t _id;
size_t _timestamp;
int _count;
};
class CompareByTimestamp {
public:
inline bool operator() ( const Element& lhs, const Element& rhs );
};
public:
RoutingEventLoop ( size_t depth=10, int limit=20 );
inline bool isLooping () const;
inline int getMaxCount () const;
inline const std::vector<Element>& getElements () const;
void update ( size_t id );
void erase ( size_t id );
private:
std::vector<Element> _elements;
size_t _depth;
int _maxCount;
int _countLimit;
bool _isLooping;
};
inline RoutingEventLoop::Element::Element ( size_t id, size_t timestamp )
: _id(id), _timestamp(timestamp), _count(1)
{ }
inline bool RoutingEventLoop::CompareByTimestamp::operator() ( const RoutingEventLoop::Element& lhs, const RoutingEventLoop::Element& rhs )
{ return lhs._timestamp > rhs._timestamp; }
inline bool RoutingEventLoop::isLooping () const { return _isLooping; }
inline int RoutingEventLoop::getMaxCount () const { return _maxCount; }
inline const std::vector<RoutingEventLoop::Element>&
RoutingEventLoop::getElements () const { return _elements; }
} // End of Kite namespace.
//INSPECTOR_P_SUPPORT(Kite::RoutingEvent);
#endif // __KITE_ROUTING_EVENT_LOOP__

View File

@ -30,6 +30,9 @@
#include <string>
#include "hurricane/Interval.h"
namespace Hurricane {
class Net;
}
namespace Kite {
@ -39,6 +42,7 @@ namespace Kite {
using Hurricane::Record;
using Hurricane::DbU;
using Hurricane::Interval;
using Hurricane::Net;
class Track;
@ -46,6 +50,8 @@ namespace Kite {
// Class : "TrackCost".
class TrackCost {
public:
enum Flags { IgnoreAxisWeight=0x1, DiscardGlobals=0x2 };
public:
// Sub-Class: "CompareByDelta()".
@ -53,12 +59,20 @@ namespace Kite {
public:
bool operator() ( const TrackCost& lhs, const TrackCost& rhs );
};
class Compare {
public:
inline Compare ( unsigned int flags=0 );
bool operator() ( const TrackCost& lhs, const TrackCost& rhs );
private:
unsigned int _flags;
};
public:
TrackCost ( Track* track
, const Interval& interval
, size_t begin
, size_t end
, Net* net
);
~TrackCost ();
inline bool isBlockage () const;
@ -68,6 +82,7 @@ namespace Kite {
inline bool isLeftOverlap () const;
inline bool isRightOverlap () const;
inline bool isHardOverlap () const;
inline bool isOverlapGlobal () const;
bool isFree () const;
inline Track* getTrack () const;
inline size_t getBegin () const;
@ -86,6 +101,7 @@ namespace Kite {
inline void setLeftOverlap ();
inline void setRightOverlap ();
inline void setHardOverlap ();
inline void setOverlapGlobal ();
inline void incTerminals ( unsigned int );
inline void incDelta ( DbU::Unit );
inline void incDeltaPerpand ( DbU::Unit );
@ -98,7 +114,6 @@ namespace Kite {
string _getString () const;
inline string _getTypeName () const;
// Operators.
friend bool operator< ( const TrackCost& lhs, const TrackCost& rhs );
// Attributes.
protected:
@ -113,6 +128,7 @@ namespace Kite {
bool _overlap;
bool _leftOverlap;
bool _rightOverlap;
bool _overlapGlobal;
unsigned int _terminals;
DbU::Unit _delta;
DbU::Unit _deltaShared;
@ -133,6 +149,7 @@ namespace Kite {
inline bool TrackCost::isLeftOverlap () const { return _leftOverlap; }
inline bool TrackCost::isRightOverlap () const { return _rightOverlap; }
inline bool TrackCost::isHardOverlap () const { return _hardOverlap; }
inline bool TrackCost::isOverlapGlobal () const { return _overlapGlobal; }
inline Track* TrackCost::getTrack () const { return _track; }
inline size_t TrackCost::getBegin () const { return _begin; }
inline size_t TrackCost::getEnd () const { return _end; }
@ -149,6 +166,7 @@ namespace Kite {
inline void TrackCost::setLeftOverlap () { _leftOverlap = true; }
inline void TrackCost::setRightOverlap () { _rightOverlap = true; }
inline void TrackCost::setHardOverlap () { _hardOverlap = true; }
inline void TrackCost::setOverlapGlobal() { _overlapGlobal = true; }
inline void TrackCost::incTerminals ( unsigned int terminals ) { _terminals += terminals; }
inline void TrackCost::incDelta ( DbU::Unit delta ) { _delta += delta; }
inline void TrackCost::incDeltaPerpand ( DbU::Unit delta ) { _deltaPerpand += delta; }
@ -158,6 +176,8 @@ namespace Kite {
inline void TrackCost::mergeDataState ( unsigned int state ) { _dataState = (state>_dataState)?state:_dataState; }
inline string TrackCost::_getTypeName () const { return "TrackCost"; }
inline TrackCost::Compare::Compare ( unsigned int flags ) : _flags(flags) { }
} // End of Kite namespace.

View File

@ -74,7 +74,14 @@ namespace Kite {
class TrackElement {
public:
enum Flags { AddToGCells=0x1, RemoveFromGCells=0x2, UnRouted=0x4, Routed=0x8 };
enum Flags { AddToGCells =0x01
, RemoveFromGCells=0x02
, UnRouted =0x04
, Routed =0x08
, AllowDoglegReuse=0x10
, DataSelf =0x01
, DataParent =0x02
};
public:
// Sub-Class: "Compare()".
@ -116,13 +123,14 @@ namespace Kite {
virtual bool canGoOutsideGCell () const;
virtual bool canSlacken () const;
virtual bool canPivotUp ( float reserve ) const;
virtual bool canMoveUp ( float reserve, unsigned int flags=/*Katabatic::AutoSegment::Propagate*/0 ) const;
virtual bool canPivotDown ( float reserve ) const;
virtual bool canMoveUp ( float reserve, unsigned int flags=AutoSegment::Propagate ) const;
virtual bool canRipple () const;
virtual bool hasSourceDogLeg () const;
virtual bool hasTargetDogLeg () const;
virtual bool canDogLeg ();
virtual bool canDogLeg ( Interval );
virtual bool canDogLegAt ( Katabatic::GCell*, bool allowReuse=false );
virtual bool canDogLegAt ( Katabatic::GCell*, unsigned int flags=0 );
virtual unsigned long getId () const;
virtual unsigned int getDirection () const = 0;
virtual Net* getNet () const = 0;
@ -135,6 +143,7 @@ namespace Kite {
virtual unsigned int getDogLegOrder () const;
virtual TrackElement* getNext () const;
virtual TrackElement* getPrevious () const;
virtual TrackElement* getParent () const;
virtual DbU::Unit getAxis () const = 0;
inline DbU::Unit getSourceU () const;
inline DbU::Unit getTargetU () const;
@ -143,7 +152,7 @@ namespace Kite {
inline Interval getCanonicalInterval () const;
virtual Interval getSourceConstraints () const;
virtual Interval getTargetConstraints () const;
virtual DataNegociate* getDataNegociate () const;
virtual DataNegociate* getDataNegociate ( unsigned int flags=DataSelf ) const;
virtual TrackElement* getCanonical ( Interval& );
virtual size_t getGCells ( Katabatic::GCellVector& ) const;
virtual TrackElement* getSourceDogLeg ();
@ -174,7 +183,8 @@ namespace Kite {
virtual void invalidate ();
virtual void setAxis ( DbU::Unit, unsigned int flags=Katabatic::AxisSet );
virtual void slacken ();
virtual bool moveUp ( unsigned int flags=/*Katabatic::AutoSegment::Propagate*/0 );
virtual bool moveUp ( unsigned int flags=AutoSegment::Propagate );
virtual bool moveDown ( unsigned int flags=AutoSegment::Propagate );
virtual bool moveAside ( bool onLeft );
virtual TrackElement* makeDogLeg ();
virtual TrackElement* makeDogLeg ( Interval, bool& leftDogleg );

View File

@ -78,13 +78,14 @@ namespace Kite {
virtual bool canGoOutsideGCell () const;
virtual bool canSlacken () const;
virtual bool canPivotUp ( float reserve ) const;
virtual bool canMoveUp ( float reserve, unsigned int flags=Katabatic::AutoSegment::Propagate ) const;
virtual bool canPivotDown ( float reserve ) const;
virtual bool canMoveUp ( float reserve, unsigned int flags ) const;
virtual bool canRipple () const;
virtual bool hasSourceDogLeg () const;
virtual bool hasTargetDogLeg () const;
virtual bool canDogLeg ();
virtual bool canDogLeg ( Interval );
virtual bool canDogLegAt ( Katabatic::GCell*, bool allowReuse=false );
virtual bool canDogLegAt ( Katabatic::GCell*, unsigned int flags );
virtual unsigned long getId () const;
virtual unsigned int getDirection () const;
virtual Net* getNet () const;
@ -93,11 +94,12 @@ namespace Kite {
virtual unsigned int getDogLegLevel () const;
virtual TrackElement* getNext () const;
virtual TrackElement* getPrevious () const;
virtual TrackElement* getParent () const;
virtual DbU::Unit getAxis () const;
virtual Interval getFreeInterval () const;
virtual Interval getSourceConstraints () const;
virtual Interval getTargetConstraints () const;
virtual DataNegociate* getDataNegociate () const;
virtual DataNegociate* getDataNegociate ( unsigned int flags ) const;
virtual TrackElement* getCanonical ( Interval& );
virtual size_t getGCells ( vector<Katabatic::GCell*>& ) const;
virtual TrackElement* getSourceDogLeg ();
@ -109,8 +111,8 @@ namespace Kite {
virtual void setAllowOutsideGCell ( bool );
virtual void setRevalidated ( bool );
virtual void setCanRipple ( bool );
virtual void setSourceDogLeg ( bool state=true );
virtual void setTargetDogLeg ( bool state=true );
virtual void setSourceDogLeg ( bool );
virtual void setTargetDogLeg ( bool );
virtual void setLock ( bool );
virtual void setRouted ( bool );
virtual void setTrack ( Track* );
@ -119,11 +121,12 @@ namespace Kite {
virtual void swapTrack ( TrackElement* );
virtual void reschedule ( unsigned int level );
virtual void detach ();
virtual void revalidate ( bool invalidEvent=false );
virtual void revalidate ( bool invalidEvent );
virtual void invalidate ();
virtual void setAxis ( DbU::Unit, unsigned int flags=Katabatic::AxisSet );
virtual void setAxis ( DbU::Unit, unsigned int flags );
virtual void slacken ();
virtual bool moveUp ( unsigned int flags=Katabatic::AutoSegment::Propagate );
virtual bool moveUp ( unsigned int flags );
virtual bool moveDown ( unsigned int flags );
virtual bool moveAside ( bool onLeft );
virtual TrackElement* makeDogLeg ();
virtual TrackElement* makeDogLeg ( Interval, bool& leftDogleg );