Seabreeze : phase 2, add Configuration

This commit is contained in:
HoangAnhP 2022-07-06 18:20:35 +02:00
parent d9db42447d
commit 871622f482
9 changed files with 252 additions and 64 deletions

View File

@ -20,6 +20,7 @@
Seabreeze.cpp
Node.cpp
Tree.cpp
Configuration.cpp
#GraphicSeabreezeEngine.cpp
)
set( pyCpps PySeabreeze.cpp

View File

@ -0,0 +1,68 @@
#include <iostream>
#include <iomanip>
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Warning.h"
#include "hurricane/Error.h"
#include "hurricane/Technology.h"
#include "hurricane/DataBase.h"
#include "hurricane/RoutingPad.h"
#include "hurricane/Contact.h"
#include "hurricane/Net.h"
#include "hurricane/Segment.h"
#include "hurricane/Cell.h"
#include "crlcore/Utilities.h"
#include "Seabreeze/Configuration.h"
namespace Seabreeze {
using std::string;
using Hurricane::Warning;
using Hurricane::Error;
using Hurricane::Technology;
using Hurricane::RoutingPad;
using Hurricane::Contact;
using Hurricane::Segment;
using Hurricane::Cell;
using Hurricane::Net;
using Hurricane::DataBase;
using Hurricane::Record;
using Hurricane::Name;
using Hurricane::Layer;
using Hurricane::DbU;
//------------------------------------------------------------------------
// Class : "Seabreeze::Configuration"
Configuration::Configuration ()
: _Rct (1)
, _Rsm (1)
, _Csm (1)
{}
Configuration::~Configuration ()
{}
Configuration::Configuration ( const Configuration& other )
: _Rct (other._Rct)
, _Rsm (other._Rsm)
, _Csm (other._Csm)
{}
Configuration* Configuration::clone () const
{ return new Configuration(*this); }
double Configuration::getRct ()
{
return _Rct;
}
double Configuration::getRsm ()
{
return _Rsm;
}
double Configuration::getCsm ()
{
return _Csm;
}
}

View File

@ -1,25 +1,29 @@
#include "Seabreeze/Seabreeze.h"
#include "hurricane/Net.h"
#include "hurricane/Segment.h"
#include "hurricane/DebugSession.h"
namespace Seabreeze {
using namespace std;
using Hurricane::DBo;
using Hurricane::DbU;
using Hurricane::Net;
using Hurricane::Cell;
using Hurricane::Instance;
using Hurricane::PrivateProperty;
using Hurricane::Component;
using Hurricane::Segment;
using Hurricane::DebugSession;
//---------------------------------------------------------
// Class : "Elmore"
Elmore::Elmore ( Net* net )
: _conts()
, checker()
, _tree(new Tree())
: _config (new Configuration())
, _conts ()
, checker ()
, _tree (new Tree())
{}
Elmore::~Elmore ()
@ -64,7 +68,14 @@ namespace Seabreeze {
cerr << "Start building tree..." << endl;
Node* s = new Node(nullptr, ct);
//---------------------------------------------------------
double R = 0;
double C = 0;
Set_RC(&R, &C, ct, nullptr);
//---------------------------------------------------------
s->R = R;
s->C = C;
Segment* seg = nullptr;
int c = 0;
for ( Component* comp : ct->getSlaveComponents() ) {
@ -83,39 +94,50 @@ namespace Seabreeze {
_tree->print(cerr);
}
void Elmore::build_from_Node ( Node* s, Segment* seg ) {
void Elmore::build_from_Node ( Node* s, Segment* seg )
{
if ( s->_contact == nullptr ) {
cerr << "No contact found" << s->_contact << endl;
return;
}
_tree->add_node(s);
//----------------------------------------------------------------------------------------
cerr << endl << endl << "Build from contact : " << s->_contact << endl;
cerr << "With segment : " << seg << endl;
//----------------------------------------------------------------------------------------
cdebug_log(199,0) << endl
<< endl
<< "Build from contact : " << s->_contact << endl
<< "With segment : " << seg << endl;
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
return;
//----------------------------------------------------------------------------------------
cerr << "Target contact : " << ccont << endl;
//----------------------------------------------------------------------------------------
cdebug_log(199,0) << "Target contact : " << ccont << endl;
//-----------------------------------------------------------------------
double Rb = 0;
double Cb = 0;
//-----------------------------------------------------------------------
ccont = build_branch(ccont);
//----------------------------------------------------------------------------------------
cerr << "Found a node : " << ccont << endl;
//----------------------------------------------------------------------------------------
cdebug_log(199, 0) << "Found a node : " << ccont << endl;
if ( not ccont ) {
cerr << "This branch leads to a NULL contact ?" << endl;
return;
}
Node* node = new Node(s, ccont);
//-----------------------------------------------------------------------
Set_RC(&Rb, &Cb, ccont, seg);
node->R = Rb;
node->C = Cb;
//-----------------------------------------------------------------------
int count = 0;
for ( Component* comp : ccont->getSlaveComponents() ) {
count += (dynamic_cast<Segment*>(comp)) ? 1 : 0;
}
//-----------------------------------------------------------------------------------------
cerr << "This contact has : " << count << " segments" << endl;
//-----------------------------------------------------------------------------------------
cdebug_log(199,0) << "This node's contact has : " << count << " segments" << endl;
if ( count == 1 ){
_tree->add_node(node);
}
@ -124,30 +146,33 @@ namespace Seabreeze {
Segment* segmt = dynamic_cast<Segment*>(comp);
if ( not segmt )
continue;
//----------------------------------------------------------------------
cerr << "Segment : " << segmt << endl;
//----------------------------------------------------------------------
cdebug_log(199,1) << "Segment : " << segmt << endl;
cdebug_tabw(199,-1);
Contact* target = dynamic_cast<Contact*>(segmt->getOppositeAnchor(ccont));
if ( not target ) {
cerr << "Wait... How can this happen ?" << endl;
continue;
}
//----------------------------------------------------------------------
cerr << "Target is : " << target << endl;
//----------------------------------------------------------------------
cdebug_log(199,0) << "Target is : " << target << endl;
cdebug_tabw(199,-1);
if ( checker.count(target) == 0 ){
build_from_Node(node, segmt);
cerr << endl;
cdebug_log(199,0) << endl;
}
}
}
}
Contact* Elmore::build_branch ( Contact* ct ) {
Contact* Elmore::build_branch ( Contact* ct )
{
Contact* tmp = ct;
//------------------------------------------------------
cerr << endl << "Start building branch with contact : " << ct << endl;
//------------------------------------------------------
cdebug_log(199,1) << endl << "Start building branch with contact : " << ct << endl;
int count;
do {
checker.insert(tmp);
@ -169,20 +194,21 @@ namespace Seabreeze {
sm = dynamic_cast<Segment*>(cp);
if ( not sm )
continue;
//-----------------------------------------------------------------------------------------------
cerr << "Sm : " << sm << endl;
//-----------------------------------------------------------------------------------------------
cdebug_log(199,1) << "Sm : " << sm << endl;
cdebug_tabw(199,-1);
Contact* tar = dynamic_cast<Contact*>(sm->getOppositeAnchor(tmp));
//-----------------------------------------------------------------------------------------------
cerr << "tar : " << tar << endl;
//-----------------------------------------------------------------------------------------------
cdebug_log(199,0) << "tar : " << tar << endl << endl;
if ( tar && checker.count(tar) == 0 )
cct = tar;
}
//-----------------------------------------------------------------------------------------------
cerr << "cct : " << cct << endl;
//-----------------------------------------------------------------------------------------------
cdebug_tabw(199,-1);
cdebug_log(199,0) << "cct : " << cct << endl;
if ( not cct || checker.count(cct) != 0 ) {
cerr << "This branch leads to no where ?" << endl;
tmp = nullptr;
@ -190,14 +216,38 @@ namespace Seabreeze {
}
else
tmp = cct;
// Set_RC(R, C, tmp, sm);
}
} while ( count == 2 );
//----------------------------------------------------------------------------------------------
cerr << "Branch done !" << endl;
//----------------------------------------------------------------------------------------------
cdebug_tabw(199,-1);
cdebug_log(199,0) << "Branch done !" << endl;
return tmp;
}
void Elmore::Set_RC ( double* R, double* C, Contact* ct, Segment* sm ) {
double Rct = getConfig()->getRct();
double Rsm = getConfig()->getRsm();
double Csm = getConfig()->getCsm();
//double h_ct = DbU::toPhysical(ct->getHeight(), DbU::UnitPower::Nano);
double w_ct = DbU::toPhysical(ct->getWidth(), DbU::UnitPower::Nano);
double S_ct = w_ct*w_ct;
(*R) += Rct*S_ct;
if ( sm == nullptr ) {
cerr << "Segment NULL !" << endl;
}
else {
double l_sm = DbU::toPhysical(sm->getLength(), DbU::UnitPower::Nano);
double w_sm = DbU::toPhysical(sm->getWidth(), DbU::UnitPower::Nano);
double S_sm = l_sm*w_sm;
(*R) += Rsm*S_sm;
(*C) += Csm*S_sm;
}
}
void Elmore::clearTree ()
{
_tree->clear();
@ -253,7 +303,7 @@ namespace Seabreeze {
void ElmoreExtension::destroyAll ()
{
}
void ElmoreExtension::destroy ( Net* net )

View File

@ -0,0 +1,59 @@
#pragma once
#include <string>
#include <vector>
#include <hurricane/DbU.h>
namespace Hurricane {
class Layer;
class Cell;
class Net;
class RoutingPad;
class Contact;
class Segment;
}
namespace CRL {
class CellGauge;
class RoutingGauge;
class RoutingLayerGauge;
}
namespace Seabreeze {
using std::string;
using Hurricane::Record;
using Hurricane::Name;
using Hurricane::Layer;
using Hurricane::DbU;
using Hurricane::RoutingPad;
using Hurricane::Cell;
using Hurricane::Net;
using Hurricane::Contact;
using Hurricane::Segment;
//------------------------------------------------------------------------
// Class : "Seabreeze::Configuration"
class Configuration {
public :
// Constructor & Destructor
virtual Configuration* clone () const;
Configuration ();
Configuration ( const Configuration& );
~Configuration ();
// Methods
double getRct ();
double getRsm ();
double getCsm ();
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
protected :
// Attributes
double _Rct;
double _Rsm;
double _Csm;
private :
Configuration& operator = ( const Configuration& ) = delete;
};
}

View File

@ -8,9 +8,9 @@ using Hurricane::Contact;
class Node {
public :
int R;
int Rt;
int C;
double R;
double Rt;
double C;
Node* Np;
std::vector<Node*> Ne;
Contact* _contact;

View File

@ -6,7 +6,7 @@
#include "hurricane/RoutingPad.h"
#include "hurricane/Contact.h"
#include "hurricane/Segment.h"
#include "Configuration.h"
#include "Tree.h"
namespace Hurricane {
@ -38,14 +38,17 @@ namespace Seabreeze {
void buildTree ( RoutingPad* rp );
void build_from_Node ( Node* source, Segment* seg );
Contact* build_branch ( Contact* contact );
void Set_RC ( double* R, double* C, Contact* ct, Segment* sm );
void clearTree ();
Tree* getTree ();
inline const set<Contact*>& get_conts () const;
inline Configuration* getConfig ();
int delayElmore ( RoutingPad* rp );
void toTREE ( ostream& ) const;
private:
set<Contact*> _conts;
set<Contact*> checker;
Configuration* _config;
set<Contact*> _conts;
set<Contact*> checker;
Tree* _tree;
};
@ -54,6 +57,10 @@ namespace Seabreeze {
return _conts;
}
inline Configuration* Elmore::getConfig ()
{
return _config;
}
//---------------------------------------------------------
// Class : Seabreeze::ElmoreProperty

View File

@ -55,15 +55,15 @@ namespace Seabreeze {
SeabreezeEngine& operator= ( const SeabreezeEngine& );
private :
// Attributes.
static Name _toolName;
static Name _toolName;
protected :
CellViewer* _viewer;
};
// Inline Functions.
inline CellViewer* SeabreezeEngine::getViewer () const { return _viewer; }
inline ToolEngine* SeabreezeEngine::base () { return static_cast<ToolEngine*>(this); }
inline void SeabreezeEngine::setViewer ( CellViewer* viewer ) { _viewer = viewer; }
inline CellViewer* SeabreezeEngine::getViewer () const { return _viewer; }
inline ToolEngine* SeabreezeEngine::base () { return static_cast<ToolEngine*>(this); }
inline void SeabreezeEngine::setViewer ( CellViewer* viewer ) { _viewer = viewer; }
} // Seabreeze namespace.
INSPECTOR_P_SUPPORT(Seabreeze::SeabreezeEngine);

View File

@ -94,7 +94,10 @@ namespace Seabreeze {
void SeabreezeEngine::runTool ( Net* net )
{
cerr << "SeabreezeEngine::runTool() has been called." << endl;
DebugSession::addToTrace(net);
DebugSession::open(net, 190, 200);
RoutingPad* driver= nullptr;
for ( RoutingPad* rp : net->getRoutingPads() ) {
@ -107,15 +110,16 @@ namespace Seabreeze {
Elmore* elm = ElmoreProperty::create(net)->getElmore();
elm->contFromNet(net);
//-------------------------------------------------------------------------
cerr << endl;
cerr << "There are : " << (elm->get_conts()).size() << " routing pads presented by :" << endl;
cdebug_log(199, 0) << endl << "There are : " << (elm->get_conts()).size() << " routing pads presented by :" << endl;
for ( Contact* ct : elm->get_conts() ) {
cerr << ct << endl;
cdebug_log(199, 1) << ct << endl;
cdebug_tabw(199, -1);
}
cerr << endl;
//-------------------------------------------------------------------------
cdebug_log(199,0) << endl;
elm->buildTree(driver);
DebugSession::close();
}
SeabreezeEngine::SeabreezeEngine ( Cell* cell )

View File

@ -56,9 +56,8 @@ void Tree::After_i ( Node *ni )
return;
ni->ap = 1;
int size = ni->Ne.size();
for(int i = 0; i < size; i++){
After_i(ni->Ne[i]);
for ( Node* ne : ni->Ne ) {
After_i(ne);
}
}
@ -66,7 +65,7 @@ set<Node*> Tree::Branch_i ( Contact* ct )
{
set<Node*> ln;
Node *ni = get_node(ct);
while(ni != nullptr){
while ( ni != nullptr ) {
ln.insert(ni->Np);
ni = ni->Np;
}