2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
2013-12-03 18:58:58 -06:00
|
|
|
// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved
|
2010-03-09 09:24:29 -06:00
|
|
|
//
|
2012-12-03 02:28:43 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:24:29 -06:00
|
|
|
// | C O R I O L I S |
|
|
|
|
// | K a t a b a t i c - Routing Toolbox |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
2013-12-03 18:58:58 -06:00
|
|
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
2010-03-09 09:24:29 -06:00
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./NetOptimals.cpp" |
|
2012-12-03 02:28:43 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <sstream>
|
2010-03-09 09:24:29 -06:00
|
|
|
#include "hurricane/DebugSession.h"
|
|
|
|
#include "hurricane/Net.h"
|
|
|
|
#include "hurricane/Segment.h"
|
|
|
|
#include "katabatic/Session.h"
|
|
|
|
#include "katabatic/AutoSegment.h"
|
|
|
|
#include "katabatic/KatabaticEngine.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Katabatic {
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using Hurricane::tab;
|
|
|
|
using Hurricane::ltracein;
|
|
|
|
using Hurricane::ltraceout;
|
|
|
|
using Hurricane::inltrace;
|
|
|
|
using Hurricane::ForEachIterator;
|
|
|
|
using Hurricane::Net;
|
|
|
|
using Hurricane::Segment;
|
|
|
|
using Hurricane::DebugSession;
|
|
|
|
|
|
|
|
|
|
|
|
void KatabaticEngine::_computeNetOptimals ( Net* net )
|
|
|
|
{
|
2013-12-03 18:58:58 -06:00
|
|
|
DebugSession::open( net, 88 );
|
|
|
|
ltrace(100) << "Katabatic::_computeNetOptimals( " << net << " )" << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
ltracein(99);
|
|
|
|
|
|
|
|
vector<AutoSegment*> segments;
|
|
|
|
forEach ( Segment*, segment, net->getSegments() ) {
|
2013-12-03 18:58:58 -06:00
|
|
|
AutoSegment* autoSegment = Session::lookup( *segment );
|
|
|
|
if (autoSegment) segments.push_back( autoSegment );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
2013-12-03 18:58:58 -06:00
|
|
|
sort( segments.begin(), segments.end(), AutoSegment::CompareId() );
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
set<AutoSegment*> processeds;
|
|
|
|
for ( size_t i=0 ; i<segments.size() ; i++ )
|
2013-12-03 18:58:58 -06:00
|
|
|
segments[i]->computeOptimal( processeds );
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
ltraceout(99);
|
2013-12-03 18:58:58 -06:00
|
|
|
DebugSession::close();
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
void KatabaticEngine::toOptimals ( Net* net )
|
2010-03-09 09:24:29 -06:00
|
|
|
{
|
2013-12-03 18:58:58 -06:00
|
|
|
DebugSession::open( net, 88 );
|
|
|
|
ltrace(100) << "Katabatic::_toOptimals( " << net << " )" << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
ltracein(99);
|
|
|
|
|
|
|
|
vector<AutoSegment*> segments;
|
|
|
|
forEach ( Segment*, segment, net->getSegments() ) {
|
2013-12-03 18:58:58 -06:00
|
|
|
AutoSegment* autoSegment = Session::lookup( *segment );
|
|
|
|
if (autoSegment) segments.push_back( autoSegment );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
2013-12-03 18:58:58 -06:00
|
|
|
sort( segments.begin(), segments.end(), AutoSegment::CompareId() );
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
for ( size_t i=0 ; i<segments.size() ; i++ ) {
|
|
|
|
if (segments[i]->isCanonical()) segments[i]->toOptimalAxis();
|
|
|
|
}
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
ltraceout(99);
|
2013-12-03 18:58:58 -06:00
|
|
|
DebugSession::close();
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
} // Katabatic namespace.
|