2016-05-23 09:15:25 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
|
|
|
// Copyright (c) UPMC 2016-2016, All Rights Reserved
|
|
|
|
//
|
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
// | C O R I O L I S |
|
|
|
|
// | A n a b a t i c - Global Routing Toolbox |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./AnabaticEngine.cpp" |
|
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <iostream>
|
|
|
|
#include "hurricane/Error.h"
|
2016-05-26 06:56:16 -05:00
|
|
|
#include "hurricane/RegularLayer.h"
|
Anabatic transient commit 10. Ripup & reroute support in Dijsktra.
* New: In Anabatic:
- In AnabaticEngine, keep track of overflowed edges.
- In AnabaticEngine, getNetsFromedge() to lookup all nets going
through an Edge.
- In Configuration, read the Kite "reserved local" parameter to
decrease the Edge capacity (it's a guessing of the cost of the
local routing).
- In Edge, add an attribute to know if there is an associated
segment of the current net (set by Dijkstra::_traceback()).
Transparently manage the overflowed edges.
- In GCell_Edges, correct a filtering bug when not all sides are
selecteds.
- New GCell::getEdgeTo() to find the edge between two adjacent
GCells.
- New GCell::unrefContact() to automatically removes global contacts
no longer used by any global segments (used during the ripup
step).
- In Dijkstra::load(), now able to "reload" and already partially
or completly routed net (look for Contact of "gcontact" layer
and their attached segments).
- In Dijkstra, keep the last net loaded until the next one is.
Put the cleanup operations in an isolated function "_cleanup()".
- In Dijkstra::_selectFirstsource() and run(), load first source
component made of multiple vertexes.
- In Dijkstra::_trackback(), link the Net segments to the Edges.
- New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform
the ripup of one edge of a Net (must be loaded in Dijkstra first).
Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes
- that are connecteds through edges *with* segments.
- In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global
routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
|
|
|
#include "hurricane/Horizontal.h"
|
|
|
|
#include "hurricane/Vertical.h"
|
2016-05-23 09:15:25 -05:00
|
|
|
#include "hurricane/Cell.h"
|
|
|
|
#include "hurricane/UpdateSession.h"
|
2016-05-26 06:56:16 -05:00
|
|
|
#include "crlcore/RoutingGauge.h"
|
2016-05-23 09:15:25 -05:00
|
|
|
#include "anabatic/GCell.h"
|
|
|
|
#include "anabatic/AnabaticEngine.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Anabatic {
|
|
|
|
|
|
|
|
using std::cerr;
|
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
|
|
|
using std::ostringstream;
|
|
|
|
using Hurricane::Error;
|
2016-05-26 06:56:16 -05:00
|
|
|
using Hurricane::RegularLayer;
|
Anabatic transient commit 10. Ripup & reroute support in Dijsktra.
* New: In Anabatic:
- In AnabaticEngine, keep track of overflowed edges.
- In AnabaticEngine, getNetsFromedge() to lookup all nets going
through an Edge.
- In Configuration, read the Kite "reserved local" parameter to
decrease the Edge capacity (it's a guessing of the cost of the
local routing).
- In Edge, add an attribute to know if there is an associated
segment of the current net (set by Dijkstra::_traceback()).
Transparently manage the overflowed edges.
- In GCell_Edges, correct a filtering bug when not all sides are
selecteds.
- New GCell::getEdgeTo() to find the edge between two adjacent
GCells.
- New GCell::unrefContact() to automatically removes global contacts
no longer used by any global segments (used during the ripup
step).
- In Dijkstra::load(), now able to "reload" and already partially
or completly routed net (look for Contact of "gcontact" layer
and their attached segments).
- In Dijkstra, keep the last net loaded until the next one is.
Put the cleanup operations in an isolated function "_cleanup()".
- In Dijkstra::_selectFirstsource() and run(), load first source
component made of multiple vertexes.
- In Dijkstra::_trackback(), link the Net segments to the Edges.
- New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform
the ripup of one edge of a Net (must be loaded in Dijkstra first).
Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes
- that are connecteds through edges *with* segments.
- In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global
routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
|
|
|
using Hurricane::Component;
|
|
|
|
using Hurricane::Horizontal;
|
|
|
|
using Hurricane::Vertical;
|
2016-05-23 09:15:25 -05:00
|
|
|
using Hurricane::Cell;
|
|
|
|
using Hurricane::UpdateSession;
|
2016-05-26 06:56:16 -05:00
|
|
|
using CRL::RoutingGauge;
|
|
|
|
using CRL::RoutingLayerGauge;
|
2016-05-23 09:15:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "Anabatic::AnabaticEngine".
|
|
|
|
|
|
|
|
Name AnabaticEngine::_toolName = "Anabatic";
|
|
|
|
|
|
|
|
|
|
|
|
AnabaticEngine* AnabaticEngine::get ( const Cell* cell )
|
|
|
|
{ return static_cast<AnabaticEngine*>(ToolEngine::get(cell,staticGetName())); }
|
|
|
|
|
|
|
|
|
|
|
|
const Name& AnabaticEngine::staticGetName ()
|
|
|
|
{ return _toolName; }
|
|
|
|
|
|
|
|
|
|
|
|
const Name& AnabaticEngine::getName () const
|
|
|
|
{ return _toolName; }
|
|
|
|
|
|
|
|
|
|
|
|
AnabaticEngine::AnabaticEngine ( Cell* cell )
|
|
|
|
: Super(cell)
|
2016-06-17 06:09:34 -05:00
|
|
|
, _timer ()
|
2016-05-23 09:15:25 -05:00
|
|
|
, _configuration (new ConfigurationConcrete())
|
|
|
|
, _matrix ()
|
2016-05-26 11:30:03 -05:00
|
|
|
, _gcells ()
|
Anabatic transient commit 10. Ripup & reroute support in Dijsktra.
* New: In Anabatic:
- In AnabaticEngine, keep track of overflowed edges.
- In AnabaticEngine, getNetsFromedge() to lookup all nets going
through an Edge.
- In Configuration, read the Kite "reserved local" parameter to
decrease the Edge capacity (it's a guessing of the cost of the
local routing).
- In Edge, add an attribute to know if there is an associated
segment of the current net (set by Dijkstra::_traceback()).
Transparently manage the overflowed edges.
- In GCell_Edges, correct a filtering bug when not all sides are
selecteds.
- New GCell::getEdgeTo() to find the edge between two adjacent
GCells.
- New GCell::unrefContact() to automatically removes global contacts
no longer used by any global segments (used during the ripup
step).
- In Dijkstra::load(), now able to "reload" and already partially
or completly routed net (look for Contact of "gcontact" layer
and their attached segments).
- In Dijkstra, keep the last net loaded until the next one is.
Put the cleanup operations in an isolated function "_cleanup()".
- In Dijkstra::_selectFirstsource() and run(), load first source
component made of multiple vertexes.
- In Dijkstra::_trackback(), link the Net segments to the Edges.
- New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform
the ripup of one edge of a Net (must be loaded in Dijkstra first).
Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes
- that are connecteds through edges *with* segments.
- In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global
routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
|
|
|
, _ovEdges ()
|
2016-05-26 11:30:03 -05:00
|
|
|
, _viewer (NULL)
|
|
|
|
, _flags (Flags::NoFlags)
|
2016-05-30 04:30:29 -05:00
|
|
|
, _stamp (-1)
|
2016-05-23 09:15:25 -05:00
|
|
|
{
|
2016-05-30 04:30:29 -05:00
|
|
|
_matrix.setCell( cell, _configuration->getSliceHeight() );
|
|
|
|
Edge::unity = _configuration->getSliceHeight();
|
2016-05-23 09:15:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AnabaticEngine::_postCreate ()
|
|
|
|
{
|
|
|
|
Super::_postCreate();
|
|
|
|
|
|
|
|
UpdateSession::open();
|
2016-05-26 06:56:16 -05:00
|
|
|
GCell::create( this );
|
2016-05-23 09:15:25 -05:00
|
|
|
UpdateSession::close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AnabaticEngine* AnabaticEngine::create ( Cell* cell )
|
|
|
|
{
|
|
|
|
if (not cell) throw Error( "AnabaticEngine::create(): NULL cell argument." );
|
|
|
|
if (cell->getAbutmentBox().isEmpty())
|
|
|
|
throw Error( "AnabaticEngine::create(): %s has no abutment box." , getString(cell).c_str() );
|
|
|
|
|
|
|
|
AnabaticEngine* engine = new AnabaticEngine ( cell );
|
|
|
|
engine->_postCreate();
|
|
|
|
return engine;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AnabaticEngine::~AnabaticEngine ()
|
|
|
|
{
|
|
|
|
delete _configuration;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AnabaticEngine::_preDestroy ()
|
|
|
|
{
|
2016-05-26 11:30:03 -05:00
|
|
|
_clear();
|
2016-05-23 09:15:25 -05:00
|
|
|
Super::_preDestroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-26 11:30:03 -05:00
|
|
|
void AnabaticEngine::_clear ()
|
|
|
|
{
|
|
|
|
_flags |= Flags::Destroy;
|
|
|
|
|
|
|
|
for ( GCell* gcell : _gcells ) gcell->_destroyEdges();
|
|
|
|
for ( GCell* gcell : _gcells ) gcell->destroy();
|
|
|
|
_gcells.clear();
|
Anabatic transient commit 10. Ripup & reroute support in Dijsktra.
* New: In Anabatic:
- In AnabaticEngine, keep track of overflowed edges.
- In AnabaticEngine, getNetsFromedge() to lookup all nets going
through an Edge.
- In Configuration, read the Kite "reserved local" parameter to
decrease the Edge capacity (it's a guessing of the cost of the
local routing).
- In Edge, add an attribute to know if there is an associated
segment of the current net (set by Dijkstra::_traceback()).
Transparently manage the overflowed edges.
- In GCell_Edges, correct a filtering bug when not all sides are
selecteds.
- New GCell::getEdgeTo() to find the edge between two adjacent
GCells.
- New GCell::unrefContact() to automatically removes global contacts
no longer used by any global segments (used during the ripup
step).
- In Dijkstra::load(), now able to "reload" and already partially
or completly routed net (look for Contact of "gcontact" layer
and their attached segments).
- In Dijkstra, keep the last net loaded until the next one is.
Put the cleanup operations in an isolated function "_cleanup()".
- In Dijkstra::_selectFirstsource() and run(), load first source
component made of multiple vertexes.
- In Dijkstra::_trackback(), link the Net segments to the Edges.
- New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform
the ripup of one edge of a Net (must be loaded in Dijkstra first).
Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes
- that are connecteds through edges *with* segments.
- In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global
routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
|
|
|
_ovEdges.clear();
|
2016-05-26 11:30:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-23 09:15:25 -05:00
|
|
|
Configuration* AnabaticEngine::getConfiguration ()
|
|
|
|
{ return _configuration; }
|
|
|
|
|
|
|
|
|
2016-05-26 06:56:16 -05:00
|
|
|
int AnabaticEngine::getCapacity ( Interval span, Flags flags ) const
|
|
|
|
{
|
|
|
|
int capacity = 0;
|
|
|
|
Box ab = getCell()->getAbutmentBox();
|
|
|
|
RoutingGauge* rg = _configuration->getRoutingGauge();
|
|
|
|
|
2016-05-26 11:54:57 -05:00
|
|
|
span.inflate( 0, -1 );
|
|
|
|
if (span.isEmpty()) return 0;
|
|
|
|
|
2016-05-26 06:56:16 -05:00
|
|
|
const vector<RoutingLayerGauge*>& layerGauges = rg->getLayerGauges();
|
|
|
|
for ( size_t depth=0 ; depth <= _configuration->getAllowedDepth() ; ++depth ) {
|
|
|
|
if (layerGauges[depth]->getType() != Constant::Default) continue;
|
|
|
|
|
|
|
|
if (flags & Flags::Horizontal) {
|
|
|
|
if (layerGauges[depth]->getDirection() != Constant::Horizontal) continue;
|
|
|
|
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getYMin()
|
|
|
|
, span.getVMax() - ab.getYMin() );
|
2016-06-17 06:09:34 -05:00
|
|
|
//cdebug_log(110,0) << "Horizontal edge capacity:" << capacity << endl;
|
2016-05-26 06:56:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & Flags::Vertical) {
|
|
|
|
if (layerGauges[depth]->getDirection() != Constant::Vertical) continue;
|
|
|
|
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getXMin()
|
|
|
|
, span.getVMax() - ab.getXMin() );
|
2016-06-17 06:09:34 -05:00
|
|
|
//cdebug_log(110,0) << "Vertical edge capacity:" << capacity << endl;
|
2016-05-26 06:56:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return capacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-26 11:30:03 -05:00
|
|
|
void AnabaticEngine::reset ()
|
2016-05-23 09:15:25 -05:00
|
|
|
{
|
2016-05-26 11:30:03 -05:00
|
|
|
_clear();
|
|
|
|
_flags.reset( Flags::Destroy );
|
|
|
|
|
|
|
|
UpdateSession::open();
|
|
|
|
GCell::create( this );
|
|
|
|
UpdateSession::close();
|
2016-05-23 09:15:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Anabatic transient commit 10. Ripup & reroute support in Dijsktra.
* New: In Anabatic:
- In AnabaticEngine, keep track of overflowed edges.
- In AnabaticEngine, getNetsFromedge() to lookup all nets going
through an Edge.
- In Configuration, read the Kite "reserved local" parameter to
decrease the Edge capacity (it's a guessing of the cost of the
local routing).
- In Edge, add an attribute to know if there is an associated
segment of the current net (set by Dijkstra::_traceback()).
Transparently manage the overflowed edges.
- In GCell_Edges, correct a filtering bug when not all sides are
selecteds.
- New GCell::getEdgeTo() to find the edge between two adjacent
GCells.
- New GCell::unrefContact() to automatically removes global contacts
no longer used by any global segments (used during the ripup
step).
- In Dijkstra::load(), now able to "reload" and already partially
or completly routed net (look for Contact of "gcontact" layer
and their attached segments).
- In Dijkstra, keep the last net loaded until the next one is.
Put the cleanup operations in an isolated function "_cleanup()".
- In Dijkstra::_selectFirstsource() and run(), load first source
component made of multiple vertexes.
- In Dijkstra::_trackback(), link the Net segments to the Edges.
- New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform
the ripup of one edge of a Net (must be loaded in Dijkstra first).
Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes
- that are connecteds through edges *with* segments.
- In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global
routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
|
|
|
size_t AnabaticEngine::getNetsFromEdge ( const Edge* edge, NetSet& nets )
|
|
|
|
{
|
|
|
|
size_t count = 0;
|
|
|
|
GCell* source = edge->getSource();
|
|
|
|
GCell* target = edge->getTarget();
|
|
|
|
const vector<Contact*>& contacts = source->getGContacts();
|
|
|
|
|
|
|
|
for ( Contact* contact : contacts ) {
|
|
|
|
for ( Component* component : contact->getSlaveComponents() ) {
|
|
|
|
if (edge->isHorizontal()) {
|
|
|
|
Horizontal* horizontal = dynamic_cast<Horizontal*>( component );
|
|
|
|
if (horizontal
|
|
|
|
and (horizontal->getSource() == contact)
|
|
|
|
and (target->hasGContact(dynamic_cast<Contact*>(horizontal->getTarget())))) {
|
|
|
|
nets.insert( horizontal->getNet() );
|
|
|
|
++count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (edge->isVertical()) {
|
|
|
|
Vertical* vertical = dynamic_cast<Vertical*>( component );
|
|
|
|
if (vertical
|
|
|
|
and (vertical->getSource() == contact)
|
|
|
|
and (target->hasGContact(dynamic_cast<Contact*>(vertical->getTarget())))) {
|
|
|
|
nets.insert( vertical->getNet() );
|
|
|
|
++count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-17 06:09:34 -05:00
|
|
|
void AnabaticEngine::startMeasures ()
|
|
|
|
{
|
|
|
|
_timer.resetIncrease();
|
|
|
|
_timer.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AnabaticEngine::stopMeasures ()
|
|
|
|
{ _timer.stop(); }
|
|
|
|
|
|
|
|
|
|
|
|
void AnabaticEngine::printMeasures ( const string& tag ) const
|
|
|
|
{
|
|
|
|
ostringstream result;
|
|
|
|
|
|
|
|
result << Timer::getStringTime(_timer.getCombTime())
|
|
|
|
<< ", " << Timer::getStringMemory(_timer.getIncrease());
|
|
|
|
cmess1 << Dots::asString( " - Done in", result.str() ) << endl;
|
|
|
|
|
|
|
|
result.str("");
|
|
|
|
result << _timer.getCombTime()
|
|
|
|
<< "s, +" << (_timer.getIncrease()>>10) << "Kb/"
|
|
|
|
<< (_timer.getMemorySize()>>10) << "Kb";
|
|
|
|
cmess2 << Dots::asString( " - Raw measurements", result.str() ) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-23 09:15:25 -05:00
|
|
|
string AnabaticEngine::_getTypeName () const
|
|
|
|
{ return getString(_toolName); }
|
|
|
|
|
|
|
|
|
|
|
|
string AnabaticEngine::_getString () const
|
|
|
|
{
|
|
|
|
ostringstream os;
|
|
|
|
os << "<" << _toolName << " " << _cell->getName() << ">";
|
|
|
|
return os.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Record* AnabaticEngine::_getRecord () const
|
|
|
|
{
|
|
|
|
Record* record = Super::_getRecord();
|
2016-05-26 06:56:16 -05:00
|
|
|
record->add( getSlot("_configuration", _configuration) );
|
|
|
|
record->add( getSlot("_gcells" , &_gcells ) );
|
|
|
|
record->add( getSlot("_matrix" , &_matrix ) );
|
2016-05-26 11:30:03 -05:00
|
|
|
record->add( getSlot("_flags" , &_flags ) );
|
2016-05-23 09:15:25 -05:00
|
|
|
return record;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // Anabatic namespace.
|