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 2008-2013, All Rights Reserved
|
2010-03-09 09:24:29 -06:00
|
|
|
//
|
2013-12-03 18:58:58 -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 : "./NetConstraints.cpp" |
|
2013-12-03 18:58:58 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <sstream>
|
|
|
|
#include "hurricane/DebugSession.h"
|
|
|
|
#include "hurricane/BasicLayer.h"
|
|
|
|
#include "hurricane/Net.h"
|
|
|
|
#include "hurricane/NetExternalComponents.h"
|
|
|
|
#include "hurricane/RoutingPad.h"
|
|
|
|
#include "hurricane/Pad.h"
|
|
|
|
#include "hurricane/Plug.h"
|
|
|
|
#include "hurricane/Instance.h"
|
|
|
|
#include "hurricane/Vertical.h"
|
|
|
|
#include "hurricane/Horizontal.h"
|
|
|
|
#include "hurricane/Cell.h"
|
|
|
|
#include "katabatic/AutoContact.h"
|
|
|
|
#include "katabatic/AutoSegment.h"
|
|
|
|
#include "katabatic/Session.h"
|
|
|
|
#include "katabatic/KatabaticEngine.h"
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
// \addtogroup NetConstraints
|
|
|
|
// \{
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
/* \function void propagateConstraintFromRp ( RoutingPad* rp )
|
2010-03-09 09:24:29 -06:00
|
|
|
* \param rp The \c RoutingPad starting point.
|
|
|
|
*
|
|
|
|
* Do a full constraint propagation starting from this \c RoutingPad.
|
|
|
|
*/
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
// \}
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace CRL;
|
|
|
|
using namespace Hurricane;
|
|
|
|
using namespace Katabatic;
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
// Local Functions.
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
void propagateConstraintFromRp ( RoutingPad* rp )
|
2010-03-09 09:24:29 -06:00
|
|
|
{
|
2013-12-03 18:58:58 -06:00
|
|
|
ltrace(99) << "propagateConstraintFromRp() - " << rp << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
ltracein(99);
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
forEach ( Component*, icomponent, rp->getSlaveComponents() ) {
|
|
|
|
ltrace(99) << "slave component: " << *icomponent << endl;
|
|
|
|
AutoContact* sourceContact = Session::lookup( dynamic_cast<Contact*>(*icomponent) );
|
|
|
|
if (sourceContact) {
|
|
|
|
ltrace(99) << "Start slave: " << sourceContact << endl;
|
|
|
|
|
|
|
|
set<AutoSegment*> verticalSegments;
|
|
|
|
set<AutoSegment*> horizontalSegments;
|
|
|
|
|
|
|
|
forEach ( AutoSegment*, isegment, sourceContact->getAutoSegments() ) {
|
|
|
|
ltrace(99) << "Examining: " << (*isegment) << endl;
|
|
|
|
AutoContact* targetContact = isegment->getOppositeAnchor(sourceContact);
|
|
|
|
|
|
|
|
if (targetContact) {
|
|
|
|
if (isegment->isHorizontal()) {
|
|
|
|
ltrace(99) << "On horizontal stack " << (*isegment) << endl;
|
|
|
|
horizontalSegments.insert( (*isegment) );
|
|
|
|
} else {
|
|
|
|
ltrace(99) << "On vertical stack " << (*isegment) << endl;
|
|
|
|
verticalSegments.insert( (*isegment) );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
Box constraintBox = sourceContact->getConstraintBox();
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
// Propagate constraint through horizontally aligned segments.
|
|
|
|
ltrace(99) << "Propagate constraint on horizontal segments" << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
set<AutoSegment*>::iterator ihorizontal = horizontalSegments.begin();
|
|
|
|
for ( ; ihorizontal != horizontalSegments.end() ; ++ihorizontal ) {
|
|
|
|
AutoContact* contact = NULL;
|
|
|
|
forEach ( AutoSegment*, ialigned, (*ihorizontal)->getAligneds() ) {
|
|
|
|
contact = ialigned->getAutoTarget();
|
|
|
|
ltrace(99) << "contact: " << contact << endl;
|
|
|
|
if (contact) {
|
|
|
|
ltrace(99) << "Apply to (target): " << contact << endl;
|
|
|
|
contact->restrictConstraintBox( constraintBox.getYMin()
|
|
|
|
, constraintBox.getYMax()
|
|
|
|
, KbHorizontal );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
2013-12-03 18:58:58 -06:00
|
|
|
contact = ialigned->getAutoSource();
|
|
|
|
ltrace(99) << "contact: " << contact << endl;
|
|
|
|
if (contact) {
|
|
|
|
ltrace(99) << "Apply to (source): " << contact << endl;
|
|
|
|
contact->restrictConstraintBox( constraintBox.getYMin()
|
|
|
|
, constraintBox.getYMax()
|
|
|
|
, KbHorizontal );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
}
|
2013-12-03 18:58:58 -06:00
|
|
|
}
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
// Propagate constraint through vertically aligned segments.
|
|
|
|
ltrace(99) << "Propagate constraint on vertical segments" << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
set<AutoSegment*>::iterator ivertical = verticalSegments.begin();
|
|
|
|
for ( ; ivertical != verticalSegments.end() ; ++ivertical ) {
|
|
|
|
AutoContact* contact = NULL;
|
|
|
|
forEach ( AutoSegment*, ialigned, (*ivertical)->getAligneds() ) {
|
|
|
|
contact = ialigned->getAutoTarget();
|
|
|
|
if (contact) {
|
|
|
|
ltrace(99) << "Apply to (target): " << contact << endl;
|
|
|
|
contact->restrictConstraintBox( constraintBox.getXMin()
|
|
|
|
, constraintBox.getXMax()
|
|
|
|
, KbVertical );
|
|
|
|
}
|
|
|
|
contact = ialigned->getAutoSource();
|
|
|
|
if (contact) {
|
|
|
|
ltrace(99) << "Apply to (source): " << contact << endl;
|
|
|
|
contact->restrictConstraintBox( constraintBox.getXMin()
|
|
|
|
, constraintBox.getXMax()
|
|
|
|
, KbVertical );
|
|
|
|
}
|
|
|
|
}
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ltrace(99) << "propagateConstraintFromRp() - Exit" << endl;
|
2013-12-03 18:58:58 -06:00
|
|
|
ltraceout(99);
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
} // Anonymous namespace.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Katabatic {
|
|
|
|
|
|
|
|
|
|
|
|
using Hurricane::Cell;
|
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
void KatabaticEngine::computeNetConstraints ( Net* net )
|
2010-03-09 09:24:29 -06:00
|
|
|
{
|
2013-12-03 18:58:58 -06:00
|
|
|
DebugSession::open( net );
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
ltrace(100) << "Katabatic::computeNetConstraints( " << net << " )" << endl;
|
2010-03-09 09:24:29 -06:00
|
|
|
ltracein(99);
|
|
|
|
|
|
|
|
vector<RoutingPad*> routingPads;
|
|
|
|
forEach ( Component*, icomponent, net->getComponents() ) {
|
2013-12-03 18:58:58 -06:00
|
|
|
Contact* contact = dynamic_cast<Contact*>( *icomponent );
|
|
|
|
if (contact) {
|
|
|
|
AutoContact* autoContact = Session::lookup( contact );
|
|
|
|
if (autoContact)
|
|
|
|
autoContact->restoreNativeConstraintBox();
|
2010-03-09 09:24:29 -06:00
|
|
|
} else {
|
2013-12-03 18:58:58 -06:00
|
|
|
RoutingPad* routingPad = dynamic_cast<RoutingPad*>( *icomponent );
|
|
|
|
if (routingPad) routingPads.push_back( routingPad );
|
2010-03-09 09:24:29 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( size_t i=0 ; i<routingPads.size() ; i++ )
|
2013-12-03 18:58:58 -06:00
|
|
|
propagateConstraintFromRp( routingPads[i] );
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
// forEach ( Segment*, isegment, net->getSegments() ) {
|
|
|
|
// AutoSegment* autoSegment = Session::lookup( *isegment );
|
|
|
|
// if (autoSegment) autoSegment->toConstraintAxis();
|
|
|
|
// }
|
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.
|