Add full inspector support (getString/getRecord) to Seabreeze.

This commit is contained in:
Jean-Paul Chaput 2022-07-21 19:24:42 +02:00
parent bf181787cb
commit c647a670b1
9 changed files with 213 additions and 73 deletions

View File

@ -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" |
// +-----------------------------------------------------------------+

View File

@ -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);
}

View File

@ -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 = "<Node ";
s += getString( _contact );
s += " R=" + getString( _R );
s += " C=" + getString( _C );
s += ">";
return s;
}
Record* Node::_getRecord () const
{
Record* record = new Record ( _getString() );
if (record != nullptr) {
record->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.

View File

@ -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.

View File

@ -18,7 +18,9 @@
#include <iostream>
#include <algorithm>
#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.

View File

@ -19,27 +19,41 @@
#include <iostream>
#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<RoutingPad*, map<RoutingPad*, double>>& 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<RoutingPad*, map<RoutingPad*, double>> _values;
DelayMap _values;
};
inline const map<RoutingPad*, map<RoutingPad*, double>>& Delay::getValues () const { return _values; }
}
inline const Delay::DelayMap& Delay::getValues () const { return _values; }
} // Seabreeze namespace.
INSPECTOR_P_SUPPORT(Seabreeze::Delay);

View File

@ -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<Contact*>& getContacts () const;
double delayElmore ( RoutingPad* );
void toTree ( ostream& ) const;
inline void setSeabreeze ( SeabreezeEngine* );
typedef std::set<Contact*,DBo::CompareById> 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<Contact*> _contacts;
set<Contact*> _checker;
ContactSet _contacts;
ContactSet _checker;
Tree* _tree;
};
inline SeabreezeEngine* Elmore::getSeabreeze () const { return _seabreeze; }
inline const set<Contact*>& 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);

View File

@ -15,12 +15,12 @@
#pragma once
#include <vector>
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<Node*>& 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<Node*>& 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);

View File

@ -18,17 +18,18 @@
#include <set>
#include <vector>
#include <iostream>
#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<Node*> _nodes;
};
@ -59,3 +63,6 @@ namespace Seabreeze {
} // Seabreeze namespace.
INSPECTOR_P_SUPPORT(Seabreeze::Tree);