From c647a670b18a859639e810fd0e3acfec74f9d9e6 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 21 Jul 2022 19:24:42 +0200 Subject: [PATCH] Add full inspector support (getString/getRecord) to Seabreeze. --- Seabreeze/src/Delay.cpp | 2 +- Seabreeze/src/Elmore.cpp | 50 ++++++++++++++++++++++++++++ Seabreeze/src/Node.cpp | 33 +++++++++++++++++++ Seabreeze/src/SeabreezeEngine.cpp | 26 +++++++-------- Seabreeze/src/Tree.cpp | 24 ++++++++++++++ Seabreeze/src/seabreeze/Delay.h | 34 +++++++++++++------ Seabreeze/src/seabreeze/Elmore.h | 54 ++++++++++++++++++------------- Seabreeze/src/seabreeze/Node.h | 46 ++++++++++++++------------ Seabreeze/src/seabreeze/Tree.h | 17 +++++++--- 9 files changed, 213 insertions(+), 73 deletions(-) diff --git a/Seabreeze/src/Delay.cpp b/Seabreeze/src/Delay.cpp index 6c9cb254..0394ad24 100644 --- a/Seabreeze/src/Delay.cpp +++ b/Seabreeze/src/Delay.cpp @@ -10,7 +10,7 @@ // | Author : Vu Hoang Anh PHAM | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./seabreeze/Delay.h" | +// | C++ Header : "./seabreeze/Delay.h" | // +-----------------------------------------------------------------+ diff --git a/Seabreeze/src/Elmore.cpp b/Seabreeze/src/Elmore.cpp index 13a42852..39a0495a 100644 --- a/Seabreeze/src/Elmore.cpp +++ b/Seabreeze/src/Elmore.cpp @@ -18,6 +18,7 @@ #include "hurricane/DebugSession.h" #include "hurricane/Error.h" #include "seabreeze/Elmore.h" +#include "seabreeze/Node.h" #include "seabreeze/SeabreezeEngine.h" namespace Seabreeze { @@ -49,6 +50,7 @@ namespace Seabreeze { Elmore::~Elmore () { + cdebug_log(199,0) << "Elmore::~Elmore() " << endl; delete _tree; } @@ -295,6 +297,30 @@ namespace Seabreeze { { _tree->print( os ); } + string Elmore::_getTypeName () const + { return "Seabreeze::Elmore"; } + + + string Elmore::_getString () const + { + string s = "<" + _getTypeName() + ">"; + return s; + } + + + Record* Elmore::_getRecord () const + { + Record* record = new Record ( _getString() ); + if (record != nullptr) { + record->add( getSlot("_seabreeze", _seabreeze) ); + record->add( getSlot("_contacts" , &_contacts) ); + record->add( getSlot("_checker" , &_checker ) ); + record->add( getSlot("_tree" , _tree ) ); + } + return record; + } + + //--------------------------------------------------------- // Class : "ElmoreProperty" @@ -314,6 +340,7 @@ namespace Seabreeze { } _elmore.setSeabreeze( seabreeze ); } + cdebug_log(199,0) << "ElmoreProperty::ElmoreProperty() on " << net << endl; } @@ -337,25 +364,48 @@ namespace Seabreeze { { return "ElmoreProperty"; } + string ElmoreProperty::_getString () const + { + string s = PrivateProperty::_getString (); + s.insert ( s.length() - 1 , " " + getString(&_elmore) ); + return s; + } + + + Record* ElmoreProperty::_getRecord () const + { + Record* record = PrivateProperty::_getRecord(); + if ( record ) { + record->add( getSlot( "_name" , _name ) ); + record->add( getSlot( "_elmore", &_elmore ) ); + } + return record; + } + + //--------------------------------------------------------- // Class : "ElmoreExtension" Elmore* ElmoreExtension::create ( Net* net ) { + cdebug_log(199,1) << "ElmoreExtension::create() " << net << endl; Elmore* elmore = get( net ); if (not elmore) { ElmoreProperty* property = new ElmoreProperty( net ); net->put( property ); elmore = property->getElmore(); } + cdebug_tabw(199,-1); return elmore; } void ElmoreExtension::destroy ( Net* net ) { + cdebug_log(199,1) << "ElmoreExtension::destroy() " << net << endl; Property* property = net->getProperty( ElmoreProperty::staticGetName() ); if (property) net->remove( property ); + cdebug_tabw(199,-1); } diff --git a/Seabreeze/src/Node.cpp b/Seabreeze/src/Node.cpp index c783e581..f0361a17 100644 --- a/Seabreeze/src/Node.cpp +++ b/Seabreeze/src/Node.cpp @@ -19,6 +19,8 @@ namespace Seabreeze { + using std::string; + Node::Node () : _R (0.0) @@ -50,4 +52,35 @@ namespace Seabreeze { { } + string Node::_getTypeName () const + { return "Seabreeze::Node"; } + + + string Node::_getString () const + { + string s = "add( getSlot("_R" , _R ) ); + record->add( getSlot("_Rt" , _Rt ) ); + record->add( getSlot("_C" , _C ) ); + record->add( getSlot("_parent" , _parent ) ); + record->add( getSlot("_childs" , &_childs ) ); + record->add( getSlot("_contact", _contact) ); + record->add( getSlot("_label" , _label ) ); + record->add( getSlot("_ap" , _ap ) ); + } + return record; + } + } // Seabreeze namespace. diff --git a/Seabreeze/src/SeabreezeEngine.cpp b/Seabreeze/src/SeabreezeEngine.cpp index bd88ff46..acd34470 100644 --- a/Seabreeze/src/SeabreezeEngine.cpp +++ b/Seabreeze/src/SeabreezeEngine.cpp @@ -89,29 +89,26 @@ namespace Seabreeze { const Name& SeabreezeEngine::getName () const { return _toolName; }; + - - Record* SeabreezeEngine::_getRecord () const - { - Record* record= Super::_getRecord (); - - if ( record ) { - // Add new records here - } - return record; - } + string SeabreezeEngine::_getTypeName () const + { return getString(_toolName); } string SeabreezeEngine::_getString () const { ostringstream os; - os << "<" << "SeabreezeEngine " << _cell->getName() << ">"; + os << "<" << _toolName << " " << _cell->getName() << ">"; return os.str(); } - string SeabreezeEngine::_getTypeName () const - { return "Seabreeze::SeabreezeEngine"; } + Record* SeabreezeEngine::_getRecord () const + { + Record* record = Super::_getRecord(); + record->add( getSlot("_configuration", _configuration) ); + return record; + } void SeabreezeEngine::buildElmore ( Net* net ) @@ -129,7 +126,7 @@ namespace Seabreeze { } } - Elmore* elmore = ElmoreProperty::create( net )->getElmore(); + Elmore* elmore = ElmoreExtension::create( net ); elmore->contFromNet( net ); cdebug_log(199,0) << "Found " << elmore->getContacts().size() << " RoutingPads:" << endl; @@ -182,6 +179,5 @@ namespace Seabreeze { void SeabreezeEngine::_preDestroy () {} - } // Seabreeze namespace. diff --git a/Seabreeze/src/Tree.cpp b/Seabreeze/src/Tree.cpp index ff00e89f..6277e55d 100644 --- a/Seabreeze/src/Tree.cpp +++ b/Seabreeze/src/Tree.cpp @@ -18,7 +18,9 @@ #include #include #include "hurricane/Error.h" +#include "hurricane/RoutingPad.h" #include "seabreeze/Tree.h" +#include "seabreeze/Node.h" namespace Seabreeze { @@ -30,6 +32,7 @@ namespace Seabreeze { using std::endl; using std::ostream; using Hurricane::Error; + using Hurricane::Component; Tree::Tree () @@ -169,4 +172,25 @@ namespace Seabreeze { } + string Tree::_getTypeName () const + { return "Seabreeze::Tree"; } + + + string Tree::_getString () const + { + string s = "<" + _getTypeName() + ">"; + return s; + } + + + Record* Tree::_getRecord () const + { + Record* record = new Record ( _getString() ); + if (record != nullptr) { + record->add( getSlot("_nodes", &_nodes) ); + } + return record; + } + + } // Seabreeze namespace. diff --git a/Seabreeze/src/seabreeze/Delay.h b/Seabreeze/src/seabreeze/Delay.h index 9174e9d6..6439a9e8 100644 --- a/Seabreeze/src/seabreeze/Delay.h +++ b/Seabreeze/src/seabreeze/Delay.h @@ -19,27 +19,41 @@ #include #include "hurricane/RoutingPad.h" -using namespace std; namespace Seabreeze { + using Hurricane::DBo; using Hurricane::RoutingPad; + //--------------------------------------------------------- // Class : Seabreeze::Delay class Delay { public: - Delay (); - ~Delay (); - inline const map>& getValues () const ; - void addPair ( RoutingPad*, RoutingPad*, double ); - void addValue ( RoutingPad*, RoutingPad*, double ); - void printDelays (); + typedef std::map< RoutingPad* + , std::map< RoutingPad*, double, DBo::CompareById > + , DBo::CompareById> DelayMap; + public: + Delay (); + ~Delay (); + inline const DelayMap& getValues () const ; + void addPair ( RoutingPad*, RoutingPad*, double ); + void addValue ( RoutingPad*, RoutingPad*, double ); + void printDelays (); + Record* _getRecord () const; + std::string _getString () const; + std::string _getTypeName () const; private: - map> _values; + DelayMap _values; }; - inline const map>& Delay::getValues () const { return _values; } -} + + inline const Delay::DelayMap& Delay::getValues () const { return _values; } + + +} // Seabreeze namespace. + + +INSPECTOR_P_SUPPORT(Seabreeze::Delay); diff --git a/Seabreeze/src/seabreeze/Elmore.h b/Seabreeze/src/seabreeze/Elmore.h index 4e3c677e..4168d015 100644 --- a/Seabreeze/src/seabreeze/Elmore.h +++ b/Seabreeze/src/seabreeze/Elmore.h @@ -30,7 +30,6 @@ namespace Hurricane { namespace Seabreeze { - using namespace std; using Hurricane::Name; using Hurricane::DBo; using Hurricane::Net; @@ -48,33 +47,38 @@ namespace Seabreeze { class Elmore { public: - Elmore ( Net* ); - ~Elmore (); - inline SeabreezeEngine* getSeabreeze () const; - const Configuration* getConfiguration () const; - void contFromNet ( Net* ); - void buildTree ( RoutingPad* ); - void buildFromNode ( Node* source, Segment* ); - Contact* buildBranch ( double* R, double* C, Contact* contact ); - void setRC ( double* R, double* C, Contact* , Segment* ); - void clearTree (); - inline Tree* getTree (); - inline const set& getContacts () const; - double delayElmore ( RoutingPad* ); - void toTree ( ostream& ) const; - inline void setSeabreeze ( SeabreezeEngine* ); + typedef std::set ContactSet; + public: + Elmore ( Net* ); + ~Elmore (); + inline SeabreezeEngine* getSeabreeze () const; + const Configuration* getConfiguration () const; + void contFromNet ( Net* ); + void buildTree ( RoutingPad* ); + void buildFromNode ( Node* source, Segment* ); + Contact* buildBranch ( double* R, double* C, Contact* contact ); + void setRC ( double* R, double* C, Contact* , Segment* ); + void clearTree (); + inline Tree* getTree (); + inline const ContactSet& getContacts () const; + double delayElmore ( RoutingPad* ); + void toTree ( std::ostream& ) const; + inline void setSeabreeze ( SeabreezeEngine* ); + virtual Record* _getRecord () const; + virtual std::string _getString () const; + virtual std::string _getTypeName () const; private: SeabreezeEngine* _seabreeze; - set _contacts; - set _checker; + ContactSet _contacts; + ContactSet _checker; Tree* _tree; }; - inline SeabreezeEngine* Elmore::getSeabreeze () const { return _seabreeze; } - inline const set& Elmore::getContacts () const { return _contacts; } - inline Tree* Elmore::getTree () { return _tree; } - inline void Elmore::setSeabreeze ( SeabreezeEngine* seabreeze ) { _seabreeze = seabreeze; } + inline SeabreezeEngine* Elmore::getSeabreeze () const { return _seabreeze; } + inline const Elmore::ContactSet& Elmore::getContacts () const { return _contacts; } + inline Tree* Elmore::getTree () { return _tree; } + inline void Elmore::setSeabreeze ( SeabreezeEngine* seabreeze ) { _seabreeze = seabreeze; } //--------------------------------------------------------- @@ -90,6 +94,8 @@ namespace Seabreeze { Name getName () const; inline Elmore* getElmore (); virtual string _getTypeName () const; + virtual Record* _getRecord () const; + virtual std::string _getString () const; protected: Elmore _elmore; protected: @@ -129,3 +135,7 @@ namespace Seabreeze { } // Seabreeze Namespace + + +INSPECTOR_P_SUPPORT(Seabreeze::Elmore); +INSPECTOR_P_SUPPORT(Seabreeze::ElmoreProperty); diff --git a/Seabreeze/src/seabreeze/Node.h b/Seabreeze/src/seabreeze/Node.h index 86935669..7f6c868d 100644 --- a/Seabreeze/src/seabreeze/Node.h +++ b/Seabreeze/src/seabreeze/Node.h @@ -15,12 +15,12 @@ #pragma once #include -namespace Hurricane { - class Contact; -} +#include "hurricane/Contact.h" + namespace Seabreeze { + using Hurricane::Record; using Hurricane::Contact; @@ -29,23 +29,26 @@ namespace Seabreeze { class Node { public: - Node (); - Node ( Node* parent, Contact* ); - ~Node (); - inline double R () const; - inline double Rt () const; - inline double C () const; - inline int label () const; - inline int ap () const; - inline Contact* contact () const; - inline Node* parent () const; - inline const std::vector& childs () const; - inline void addChild ( Node* ); - inline void setLabel ( int ); - inline void setAp ( int ); - inline void setRt ( double ); - inline void setR ( double ); - inline void setC ( double ); + Node (); + Node ( Node* parent, Contact* ); + ~Node (); + inline double R () const; + inline double Rt () const; + inline double C () const; + inline int label () const; + inline int ap () const; + inline Contact* contact () const; + inline Node* parent () const; + inline const std::vector& childs () const; + inline void addChild ( Node* ); + inline void setLabel ( int ); + inline void setAp ( int ); + inline void setRt ( double ); + inline void setR ( double ); + inline void setC ( double ); + Record* _getRecord () const; + std::string _getString () const; + std::string _getTypeName () const; private : double _R; double _Rt; @@ -75,3 +78,6 @@ namespace Seabreeze { } // Seabreeze namespace; + + +INSPECTOR_P_SUPPORT(Seabreeze::Node); diff --git a/Seabreeze/src/seabreeze/Tree.h b/Seabreeze/src/seabreeze/Tree.h index 16b3aa3e..df62946d 100644 --- a/Seabreeze/src/seabreeze/Tree.h +++ b/Seabreeze/src/seabreeze/Tree.h @@ -18,17 +18,18 @@ #include #include #include -#include "hurricane/Contact.h" -#include "hurricane/RoutingPad.h" -#include "hurricane/Component.h" -#include "Node.h" +namespace Hurricane { + class Contact; + class RoutingPad; +} namespace Seabreeze { + using Hurricane::Record; using Hurricane::Contact; using Hurricane::RoutingPad; - using Hurricane::Component; + class Node; //--------------------------------------------------------- @@ -49,6 +50,9 @@ namespace Seabreeze { void printNode ( std::ostream& , Node* , size_t depth ); void print ( std::ostream& ); void clear (); + Record* _getRecord () const; + std::string _getString () const; + std::string _getTypeName () const; private: std::vector _nodes; }; @@ -59,3 +63,6 @@ namespace Seabreeze { } // Seabreeze namespace. + + +INSPECTOR_P_SUPPORT(Seabreeze::Tree);