Code reorganisation of Seabreeze consolidating objects.

This commit is contained in:
Jean-Paul Chaput 2022-07-22 01:01:21 +02:00
parent c647a670b1
commit 149b4997fd
10 changed files with 227 additions and 158 deletions

View File

@ -12,11 +12,17 @@
set( includes seabreeze/SeabreezeEngine.h set( includes seabreeze/SeabreezeEngine.h
#seabreeze/GraphicSeabreezeEngine.h #seabreeze/GraphicSeabreezeEngine.h
) )
set( pyIncludes seabreeze/PySeabreezeEngine.h set( pyIncludes seabreeze/Configuration.h
seabreeze/Delay.h
seabreeze/Node.h
seabreeze/Tree.h
seabreeze/Elmore.h
seabreeze/PySeabreezeEngine.h
#seabreeze/PyGraphicSeabreezeEngine.h #seabreeze/PyGraphicSeabreezeEngine.h
) )
#set( mocIncludes seabreeze/GraphicSeabreezeEngine.h ) #set( mocIncludes seabreeze/GraphicSeabreezeEngine.h )
set( cpps Configuration.cpp set( cpps Configuration.cpp
Delay.cpp
Node.cpp Node.cpp
Tree.cpp Tree.cpp
Elmore.cpp Elmore.cpp

View File

@ -15,6 +15,7 @@
#include <iostream> #include <iostream>
#include <sstream>
#include <iomanip> #include <iomanip>
#include "hurricane/configuration/Configuration.h" #include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h" #include "hurricane/Warning.h"
@ -33,6 +34,7 @@
namespace Seabreeze { namespace Seabreeze {
using std::string; using std::string;
using std::ostringstream;
using Hurricane::Warning; using Hurricane::Warning;
using Hurricane::Error; using Hurricane::Error;
using Hurricane::Technology; using Hurricane::Technology;
@ -73,22 +75,28 @@ namespace Seabreeze {
{ return new Configuration( *this ); } { return new Configuration( *this ); }
/* string Configuration::_getTypeName () const
Record* Configuration::_getRecord () const { return "Seabreeze::Configuration"; }
{
}
string Configuration::_getString () const string Configuration::_getString () const
{ {
ostringstream os;
os << "<" << _getTypeName() << ">";
return os.str();
} }
*/
string Configuration::_getTypeName () const Record* Configuration::_getRecord () const
{ return "Configuration"; } {
Record* record = new Record ( _getString() );
if (record != nullptr) {
record->add( getSlot("_Rct", _Rct) );
record->add( getSlot("_Rsm", _Rsm) );
record->add( getSlot("_Csm", _Csm) );
}
return record;
}
} // Seabreeze namespace. } // Seabreeze namespace.

View File

@ -14,38 +14,58 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#pragma once
#include <map> #include <map>
#include <iostream> #include <iostream>
#include "hurricane/RoutingPad.h" #include "hurricane/RoutingPad.h"
#include "seabreeze/Delay.h" #include "seabreeze/Delay.h"
#include "seabreeze/Elmore.h"
using namespace std; using namespace std;
namespace Seabreeze { namespace Seabreeze {
using Hurricane::RoutingPad; using Hurricane::RoutingPad;
//--------------------------------------------------------- //---------------------------------------------------------
// Class : Seabreeze::Delay // Class : Seabreeze::Delay
Delay::Delay() Delay::Delay ( Elmore* elmore, RoutingPad* sink )
: _values() : _elmore(elmore)
{} , _sink (sink)
, _delay (0.0)
{ }
Delay::~Delay()
{} Delay::~Delay ()
{ }
void Delay::addPair ( RoutingPad* driver, RoutingPad* sink, double delay)
{
if ( _values.count(driver) > 0 ) { string Delay::_getTypeName () const
cerr << "Driver already exist." << endl { return "Seabreeze::Delay"; }
<< "If you want to add value, please use the function addValue( RoutingPad*, RoutingPad*, double)" << endl
<< "Example : addValue(driver, sink, delay)" << endl;
} string Delay::_getString () const
else { {
map<RoutingPad*, double> val { {sink, delay}, }; string s = "<Delay ";
_values.insert(driver, val); s += getString( _sink );
} s += " d=" + getString( _delay );
s += ">";
return s;
}
Record* Delay::_getRecord () const
{
Record* record = new Record ( _getString() );
if (record != nullptr) {
record->add( getSlot("_elmore" , _elmore) );
record->add( getSlot("_sink" , _sink ) );
record->add( getSlot("_delay" , _delay ) );
} }
} return record;
}
} // Seabreeze namespace.

View File

@ -13,10 +13,11 @@
// | C++ Module : "./Elmore.cpp" | // | C++ Module : "./Elmore.cpp" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#include "hurricane/Net.h"
#include "hurricane/Segment.h"
#include "hurricane/DebugSession.h" #include "hurricane/DebugSession.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/Segment.h"
#include "hurricane/Plug.h"
#include "hurricane/Net.h"
#include "seabreeze/Elmore.h" #include "seabreeze/Elmore.h"
#include "seabreeze/Node.h" #include "seabreeze/Node.h"
#include "seabreeze/SeabreezeEngine.h" #include "seabreeze/SeabreezeEngine.h"
@ -27,6 +28,7 @@ namespace Seabreeze {
using Hurricane::Error; using Hurricane::Error;
using Hurricane::DBo; using Hurricane::DBo;
using Hurricane::DbU; using Hurricane::DbU;
using Hurricane::Plug;
using Hurricane::Net; using Hurricane::Net;
using Hurricane::Cell; using Hurricane::Cell;
using Hurricane::Instance; using Hurricane::Instance;
@ -42,9 +44,10 @@ namespace Seabreeze {
Elmore::Elmore ( Net* net ) Elmore::Elmore ( Net* net )
: _seabreeze(nullptr) : _seabreeze(nullptr)
, _contacts () , _net (net)
, _checker () , _driver (nullptr)
, _tree (new Tree()) , _tree (new Tree(this))
, _delays ()
{} {}
@ -52,6 +55,44 @@ namespace Seabreeze {
{ {
cdebug_log(199,0) << "Elmore::~Elmore() " << endl; cdebug_log(199,0) << "Elmore::~Elmore() " << endl;
delete _tree; delete _tree;
for ( Delay* delay : _delays ) delete delay;
}
void Elmore::setup ()
{
cdebug_log(199,1) << "Elmore::findDriver()" << endl;
for ( RoutingPad* rp : _net->getRoutingPads() ) {
Plug* plug = static_cast<Plug*>( rp->getPlugOccurrence().getEntity() );
if (plug->getMasterNet()->getDirection() & Net::Direction::DirOut) {
if (_driver) {
cerr << Error( "Elmore::setup(): %s has more than one driver:\n"
" * Using: %s\n"
" * Ignoring: %s"
, getString(_net).c_str()
, getString(_driver).c_str()
, getString(rp).c_str()
) << endl;
continue;
}
_driver = rp;
} else {
_delays.push_back( new Delay(this,rp) );
}
}
cdebug_log(199,0) << "Found " << _delays.size() << " sink points:" << endl;
for ( Delay* delay : _delays ) {
cdebug_log(199,0) << "| " << delay << endl;
}
if (not _driver) {
cerr << Error( "Elmore::_postCreate(): No driver found on %s, aborting."
, getString(_net).c_str() ) << endl;
cdebug_tabw(199,-1);
return;
}
cdebug_tabw(199,-1);
} }
@ -59,27 +100,24 @@ namespace Seabreeze {
{ return _seabreeze->getConfiguration(); } { return _seabreeze->getConfiguration(); }
void Elmore::contFromNet ( Net* net ) Delay* Elmore::getDelay ( RoutingPad* rp ) const
{ {
for ( RoutingPad* rp : net->getRoutingPads() ) { for ( Delay* delay : _delays ) {
for ( Component* component : rp->getSlaveComponents() ) { if (delay->getSink() == rp) return delay;
Contact* contact = dynamic_cast<Contact*>( component );
if (not contact) continue;
_contacts.insert( contact );
}
} }
return nullptr;
} }
void Elmore::buildTree ( RoutingPad* rp ) void Elmore::buildTree ()
{ {
if (not rp) { if (not _driver) {
cerr << Error( "Elmore::buildTree(): NULL RoutingPad, aborting." ) << endl; cerr << Error( "Elmore::buildTree(): Net has no driver, aborting." ) << endl;
return; return;
} }
Contact* rootContact = nullptr; Contact* rootContact = nullptr;
for ( Component* component : rp->getSlaveComponents() ) { for ( Component* component : _driver->getSlaveComponents() ) {
Contact* contact = dynamic_cast<Contact*>(component); Contact* contact = dynamic_cast<Contact*>(component);
if (contact) { if (contact) {
rootContact = contact; rootContact = contact;
@ -88,14 +126,13 @@ namespace Seabreeze {
} }
if (not rootContact) { if (not rootContact) {
cerr << Error( "Elmore::buildTree(): No Contact anchored on %s." cerr << Error( "Elmore::buildTree(): No Contact anchored on %s."
, getString(rp).c_str() ) << endl; , getString(_driver).c_str() ) << endl;
return; return;
} }
cdebug_log(199,1) << "Elmore::buildTree()" << endl; cdebug_log(199,1) << "Elmore::buildTree()" << endl;
cdebug_log(199,0) << "Root contact " << rootContact << endl; cdebug_log(199,0) << "Root contact " << rootContact << endl;
_checker.insert( rootContact );
Node* rootNode = new Node( nullptr, rootContact ); Node* rootNode = new Node( nullptr, rootContact );
double R = 0; double R = 0;
double C = 0; double C = 0;
@ -183,7 +220,7 @@ namespace Seabreeze {
} }
cdebug_log(199,0) << "target=" << target << endl; cdebug_log(199,0) << "target=" << target << endl;
if (not _checker.count(target)) { if (not _tree->isReached(target)) {
buildFromNode( node, segment); buildFromNode( node, segment);
} }
} }
@ -198,7 +235,7 @@ namespace Seabreeze {
cdebug_log(199,0) << "current=" << current << endl; cdebug_log(199,0) << "current=" << current << endl;
while ( true ) { while ( true ) {
_checker.insert( current ); _tree->setReached( current );
int count = 0; int count = 0;
Segment* segment = nullptr; Segment* segment = nullptr;
for ( Component* component : current->getSlaveComponents() ) { for ( Component* component : current->getSlaveComponents() ) {
@ -206,7 +243,7 @@ namespace Seabreeze {
if (not segment) continue; if (not segment) continue;
Contact* opposite = dynamic_cast<Contact*>( segment->getOppositeAnchor(current) ); Contact* opposite = dynamic_cast<Contact*>( segment->getOppositeAnchor(current) );
if (opposite and (_checker.count(opposite)) != 0) { if (opposite and _tree->isReached(opposite)) {
setRC( R, C, current, segment ); setRC( R, C, current, segment );
cdebug_log(199,0) << "current=" << current << endl; cdebug_log(199,0) << "current=" << current << endl;
cdebug_log(199,0) << "segment=" << segment << endl; cdebug_log(199,0) << "segment=" << segment << endl;
@ -235,7 +272,7 @@ namespace Seabreeze {
Contact* opposite = dynamic_cast<Contact*>( segment->getOppositeAnchor(current) ); Contact* opposite = dynamic_cast<Contact*>( segment->getOppositeAnchor(current) );
cdebug_log(199,0) << "opposite=" << opposite << endl; cdebug_log(199,0) << "opposite=" << opposite << endl;
if (opposite and (_checker.count(opposite) == 0)) if (opposite and not _tree->isReached(opposite))
next = opposite; next = opposite;
} }
@ -280,24 +317,17 @@ namespace Seabreeze {
*C += (Aseg) ? 1/(Cseg*Aseg) : 0.0; *C += (Aseg) ? 1/(Cseg*Aseg) : 0.0;
} }
} }
void Elmore::clearTree ()
{
_tree->clear();
_checker.clear();
}
double Elmore::delayElmore ( RoutingPad* rp ) Delay* Elmore::delayElmore ( RoutingPad* rp )
{ return _tree->computeElmoreDelay( rp ); } { return _tree->computeElmoreDelay( rp ); }
void Elmore::toTree ( ostream& os ) const void Elmore::toTree ( ostream& os ) const
{ _tree->print( os ); } { _tree->print( os ); }
string Elmore::_getTypeName () const string Elmore::_getTypeName () const
{ return "Seabreeze::Elmore"; } { return "Seabreeze::Elmore"; }
@ -313,9 +343,10 @@ namespace Seabreeze {
Record* record = new Record ( _getString() ); Record* record = new Record ( _getString() );
if (record != nullptr) { if (record != nullptr) {
record->add( getSlot("_seabreeze", _seabreeze) ); record->add( getSlot("_seabreeze", _seabreeze) );
record->add( getSlot("_contacts" , &_contacts) ); record->add( getSlot("_net" , _net ) );
record->add( getSlot("_checker" , &_checker ) ); record->add( getSlot("_driver" , _driver ) );
record->add( getSlot("_tree" , _tree ) ); record->add( getSlot("_tree" , _tree ) );
record->add( getSlot("_delays" , &_delays ) );
} }
return record; return record;
} }
@ -339,6 +370,7 @@ namespace Seabreeze {
, getString(net->getCell()).c_str()) << endl; , getString(net->getCell()).c_str()) << endl;
} }
_elmore.setSeabreeze( seabreeze ); _elmore.setSeabreeze( seabreeze );
_elmore.setup();
} }
cdebug_log(199,0) << "ElmoreProperty::ElmoreProperty() on " << net << endl; cdebug_log(199,0) << "ElmoreProperty::ElmoreProperty() on " << net << endl;
} }

View File

@ -36,6 +36,7 @@
#include "seabreeze/SeabreezeEngine.h" #include "seabreeze/SeabreezeEngine.h"
#include "seabreeze/Elmore.h" #include "seabreeze/Elmore.h"
namespace Seabreeze { namespace Seabreeze {
using namespace std; using namespace std;
@ -117,41 +118,15 @@ namespace Seabreeze {
cdebug_log(199,1) << "SeabreezeEngine::buildElmore()" << endl; cdebug_log(199,1) << "SeabreezeEngine::buildElmore()" << endl;
cdebug_log(199,0) << "Run on " << net << endl; cdebug_log(199,0) << "Run on " << net << endl;
RoutingPad* driver = nullptr;
for ( RoutingPad* rp : net->getRoutingPads() ) {
Plug* p = static_cast<Plug*>( rp->getPlugOccurrence().getEntity() );
if (p->getMasterNet()->getDirection() & Net::Direction::DirOut) {
driver = rp;
break;
}
}
Elmore* elmore = ElmoreExtension::create( net ); Elmore* elmore = ElmoreExtension::create( net );
elmore->contFromNet( net ); elmore->buildTree();
cerr << "Net has " << elmore->getDelays().size() << " sink(s)." << endl;
cdebug_log(199,0) << "Found " << elmore->getContacts().size() << " RoutingPads:" << endl;
for ( Contact* contact : elmore->getContacts() ) {
cdebug_log(199,0) << "| " << contact << endl;
}
elmore->buildTree( driver );
for ( RoutingPad* rp : net->getRoutingPads() ) { for ( RoutingPad* rp : net->getRoutingPads() ) {
Plug* plug = static_cast<Plug*>( rp->getPlugOccurrence().getEntity() ); Plug* plug = static_cast<Plug*>( rp->getPlugOccurrence().getEntity() );
if (plug->getMasterNet()->getDirection() & Net::Direction::DirOut) { if (plug->getMasterNet()->getDirection() & Net::Direction::DirOut) {
continue; continue;
} }
cdebug_log(199,0) << "| Elmore's delay: " << elmore->delayElmore(rp) << " " << rp << endl; cerr << "| Elmore's delay: " << elmore->delayElmore(rp) << endl;
Contact* ct = nullptr;
for ( Component* comp : rp->getSlaveComponents() ) {
Contact* cont = dynamic_cast<Contact*>(comp);
if (cont) {
ct = cont;
break;
}
}
cerr << "| Elmore's delay: " << elmore->delayElmore(rp) << " " << ct << endl;
} }
cdebug_tabw(199,-1); cdebug_tabw(199,-1);
DebugSession::close(); DebugSession::close();

View File

@ -19,8 +19,11 @@
#include <algorithm> #include <algorithm>
#include "hurricane/Error.h" #include "hurricane/Error.h"
#include "hurricane/RoutingPad.h" #include "hurricane/RoutingPad.h"
#include "hurricane/Net.h"
#include "seabreeze/Elmore.h"
#include "seabreeze/Tree.h" #include "seabreeze/Tree.h"
#include "seabreeze/Node.h" #include "seabreeze/Node.h"
#include "seabreeze/Delay.h"
namespace Seabreeze { namespace Seabreeze {
@ -35,8 +38,10 @@ namespace Seabreeze {
using Hurricane::Component; using Hurricane::Component;
Tree::Tree () Tree::Tree ( Elmore* elmore )
: _nodes() : _elmore (elmore)
, _nodes ()
, _reacheds()
{} {}
@ -55,14 +60,12 @@ namespace Seabreeze {
} }
void Tree::newNode ()
{ _nodes.push_back( new Node() ); }
void Tree::addNode ( Node* node ) void Tree::addNode ( Node* node )
{ {
if (find(_nodes.begin(), _nodes.end(), node) == _nodes.end()) if (find(_nodes.begin(), _nodes.end(), node) == _nodes.end()) {
setReached( node->contact() );
_nodes.push_back( node ); _nodes.push_back( node );
}
} }
@ -91,11 +94,17 @@ namespace Seabreeze {
} }
double Tree::computeElmoreDelay ( RoutingPad* rp ) Delay* Tree::computeElmoreDelay ( RoutingPad* rp )
{ {
if (not rp) { if (not rp) {
cerr << Error( "Tree::computeDelay(): Sink RoutingPad argument is NULL." ) << endl; cerr << Error( "Tree::computeDelay(): Sink RoutingPad argument is NULL." ) << endl;
return -1.0; return nullptr;
}
Delay* delay = _elmore->getDelay( rp );
if (not delay) {
cerr << Error( "Tree::computeDelay(): No delay for %s, aborting."
, getString(rp).c_str() ) << endl;
return nullptr;
} }
Contact* sink = nullptr; Contact* sink = nullptr;
@ -111,7 +120,7 @@ namespace Seabreeze {
" (on %s)" " (on %s)"
, getString(rp).c_str() , getString(rp).c_str()
) << endl; ) << endl;
return -1.0; return nullptr;
} }
cdebug_log(199,1) << "Tree::computeDelay()" << endl; cdebug_log(199,1) << "Tree::computeDelay()" << endl;
@ -139,9 +148,9 @@ namespace Seabreeze {
} }
} }
// Compute Elmore delay time // Compute Elmore delay time
double delay = 0.0; delay->setDelay( 0.0 );
for ( size_t k = 0; k < _nodes.size(); k++ ) { for ( size_t k = 0; k < _nodes.size(); k++ ) {
delay += (_nodes[k]->Rt()) * (_nodes[k]->C()); delay->incDelay( (_nodes[k]->Rt()) * (_nodes[k]->C()) );
} }
return delay; return delay;
@ -166,12 +175,6 @@ namespace Seabreeze {
} }
void Tree::clear ()
{
_nodes.clear();
}
string Tree::_getTypeName () const string Tree::_getTypeName () const
{ return "Seabreeze::Tree"; } { return "Seabreeze::Tree"; }
@ -187,7 +190,8 @@ namespace Seabreeze {
{ {
Record* record = new Record ( _getString() ); Record* record = new Record ( _getString() );
if (record != nullptr) { if (record != nullptr) {
record->add( getSlot("_nodes", &_nodes) ); record->add( getSlot("_nodes" , &_nodes ) );
record->add( getSlot("_reacheds", &_reacheds) );
} }
return record; return record;
} }

View File

@ -41,9 +41,9 @@ namespace Seabreeze {
inline double getRct () const; inline double getRct () const;
inline double getRsm () const; inline double getRsm () const;
inline double getCsm () const; inline double getCsm () const;
//virtual Record* _getRecord () const; string _getTypeName () const;
//virtual string _getString () const; string _getString () const;
virtual string _getTypeName () const; Record* _getRecord () const;
protected : protected :
// Attributes // Attributes
double _Rct; double _Rct;
@ -60,3 +60,5 @@ namespace Seabreeze {
} // Seabreeze namespace. } // Seabreeze namespace.
INSPECTOR_P_SUPPORT(Seabreeze::Configuration);

View File

@ -22,8 +22,10 @@
namespace Seabreeze { namespace Seabreeze {
using Hurricane::Record;
using Hurricane::DBo; using Hurricane::DBo;
using Hurricane::RoutingPad; using Hurricane::RoutingPad;
class Elmore;
//--------------------------------------------------------- //---------------------------------------------------------
@ -31,28 +33,31 @@ namespace Seabreeze {
class Delay { class Delay {
public: public:
typedef std::map< RoutingPad* Delay ( Elmore*, RoutingPad* );
, std::map< RoutingPad*, double, DBo::CompareById > ~Delay ();
, DBo::CompareById> DelayMap; inline Elmore* getElmore () const;
public: inline RoutingPad* getSink () const;
Delay (); inline double getDelay () const;
~Delay (); inline void setDelay ( double );
inline const DelayMap& getValues () const ; inline void incDelay ( double );
void addPair ( RoutingPad*, RoutingPad*, double ); std::string _getTypeName () const;
void addValue ( RoutingPad*, RoutingPad*, double ); std::string _getString () const;
void printDelays (); Record* _getRecord () const;
Record* _getRecord () const;
std::string _getString () const;
std::string _getTypeName () const;
private: private:
DelayMap _values; Elmore* _elmore;
RoutingPad* _sink;
double _delay;
}; };
inline const Delay::DelayMap& Delay::getValues () const { return _values; }
inline Elmore* Delay::getElmore () const { return _elmore; }
inline RoutingPad* Delay::getSink () const { return _sink; }
inline double Delay::getDelay () const { return _delay; }
inline void Delay::setDelay ( double delay ) { _delay = delay; }
inline void Delay::incDelay ( double delay ) { _delay += delay; }
} // Seabreeze namespace. } // Seabreeze namespace.

View File

@ -22,6 +22,7 @@
#include "hurricane/Segment.h" #include "hurricane/Segment.h"
#include "Configuration.h" #include "Configuration.h"
#include "Tree.h" #include "Tree.h"
#include "Delay.h"
namespace Hurricane { namespace Hurricane {
class Net; class Net;
@ -40,45 +41,52 @@ namespace Seabreeze {
using Hurricane::Segment; using Hurricane::Segment;
using Hurricane::PrivateProperty; using Hurricane::PrivateProperty;
class SeabreezeEngine; class SeabreezeEngine;
class ElmoreProperty;
//---------------------------------------------------------- //----------------------------------------------------------
// Class : Seabreeze::Elmore // Class : Seabreeze::Elmore
class Elmore { class Elmore {
public: friend class ElmoreProperty;
typedef std::set<Contact*,DBo::CompareById> ContactSet;
public: public:
Elmore ( Net* ); Elmore ( Net* );
~Elmore (); ~Elmore ();
inline SeabreezeEngine* getSeabreeze () const; inline SeabreezeEngine* getSeabreeze () const;
const Configuration* getConfiguration () const; const Configuration* getConfiguration () const;
void contFromNet ( Net* ); inline Net* getNet () const;
void buildTree ( RoutingPad* ); inline RoutingPad* getDriver () const;
Delay* getDelay ( RoutingPad* ) const;
inline const std::vector<Delay*>&
getDelays () const;
void buildTree ();
void buildFromNode ( Node* source, Segment* ); void buildFromNode ( Node* source, Segment* );
Contact* buildBranch ( double* R, double* C, Contact* contact ); Contact* buildBranch ( double* R, double* C, Contact* contact );
void setRC ( double* R, double* C, Contact* , Segment* ); void setRC ( double* R, double* C, Contact* , Segment* );
void clearTree ();
inline Tree* getTree (); inline Tree* getTree ();
inline const ContactSet& getContacts () const; void setup ();
double delayElmore ( RoutingPad* ); Delay* delayElmore ( RoutingPad* );
void toTree ( std::ostream& ) const; void toTree ( std::ostream& ) const;
inline void setSeabreeze ( SeabreezeEngine* ); inline void setSeabreeze ( SeabreezeEngine* );
virtual Record* _getRecord () const; Record* _getRecord () const;
virtual std::string _getString () const; std::string _getString () const;
virtual std::string _getTypeName () const; std::string _getTypeName () const;
private: private:
SeabreezeEngine* _seabreeze; private:
ContactSet _contacts; SeabreezeEngine* _seabreeze;
ContactSet _checker; Net* _net;
Tree* _tree; RoutingPad* _driver;
Tree* _tree;
std::vector<Delay*> _delays;
}; };
inline SeabreezeEngine* Elmore::getSeabreeze () const { return _seabreeze; } inline SeabreezeEngine* Elmore::getSeabreeze () const { return _seabreeze; }
inline const Elmore::ContactSet& Elmore::getContacts () const { return _contacts; } inline Net* Elmore::getNet () const { return _net; }
inline Tree* Elmore::getTree () { return _tree; } inline RoutingPad* Elmore::getDriver () const { return _driver; }
inline void Elmore::setSeabreeze ( SeabreezeEngine* seabreeze ) { _seabreeze = seabreeze; } inline Tree* Elmore::getTree () { return _tree; }
inline void Elmore::setSeabreeze ( SeabreezeEngine* seabreeze ) { _seabreeze = seabreeze; }
inline const std::vector<Delay*>& Elmore::getDelays () const { return _delays; }
//--------------------------------------------------------- //---------------------------------------------------------

View File

@ -18,18 +18,18 @@
#include <set> #include <set>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
namespace Hurricane { #include "hurricane/RoutingPad.h"
class Contact;
class RoutingPad;
}
namespace Seabreeze { namespace Seabreeze {
using Hurricane::Record; using Hurricane::Record;
using Hurricane::DBo;
using Hurricane::Contact; using Hurricane::Contact;
using Hurricane::RoutingPad; using Hurricane::RoutingPad;
class Node; class Node;
class Delay;
class Elmore;
//--------------------------------------------------------- //---------------------------------------------------------
@ -37,30 +37,39 @@ namespace Seabreeze {
class Tree { class Tree {
public: public:
Tree (); typedef std::set<Contact*,DBo::CompareById> ContactSet;
public:
Tree ( Elmore* );
~Tree (); ~Tree ();
inline bool isReached ( Contact* ) const;
inline Elmore* getElmore () const;
inline size_t getN (); inline size_t getN ();
Node* getNode ( Contact* ); Node* getNode ( Contact* );
inline const std::vector<Node*>& getNodeList () const; inline const std::vector<Node*>& getNodeList () const;
void newNode (); inline void setReached ( Contact* );
void addNode ( Node* ); void addNode ( Node* );
void markNodeAfter ( Node* ); void markNodeAfter ( Node* );
void getBranch ( Contact* ); void getBranch ( Contact* );
double computeElmoreDelay ( RoutingPad* ); Delay* computeElmoreDelay ( RoutingPad* );
void printNode ( std::ostream& , Node* , size_t depth ); void printNode ( std::ostream& , Node* , size_t depth );
void print ( std::ostream& ); void print ( std::ostream& );
void clear ();
Record* _getRecord () const; Record* _getRecord () const;
std::string _getString () const; std::string _getString () const;
std::string _getTypeName () const; std::string _getTypeName () const;
private: private:
Elmore* _elmore;
std::vector<Node*> _nodes; std::vector<Node*> _nodes;
ContactSet _reacheds;
}; };
inline Elmore* Tree::getElmore () const { return _elmore; }
inline size_t Tree::getN () { return _nodes.size(); } inline size_t Tree::getN () { return _nodes.size(); }
inline const std::vector<Node*>& Tree::getNodeList () const { return _nodes; } inline const std::vector<Node*>& Tree::getNodeList () const { return _nodes; }
inline void Tree::setReached ( Contact* contact ) { _reacheds.insert( contact ); }
inline bool Tree::isReached ( Contact* contact ) const { return _reacheds.count( contact ); }
} // Seabreeze namespace. } // Seabreeze namespace.