* ./crlcore:
- New: "linefill" class which allows to print filled lines and automatically go to the next line whenever the line is full (more than 80 characters). - New: In ToolBox, getInstancesCount() recursively counts leaf cell instances. - New: In CellGauge, added getClone() method (for Configuration). - Change: It seems that the changes to match the new VLSISAPD weren't commited by Damien...
This commit is contained in:
parent
f4537e017c
commit
3a9619d938
|
@ -75,11 +75,20 @@ namespace CRL {
|
|||
, const DbU::Unit pitch
|
||||
, const DbU::Unit sliceHeight
|
||||
, const DbU::Unit sliceStep
|
||||
) : _name(name)
|
||||
) : _name (name)
|
||||
, _pinLayerName(pinLayerName)
|
||||
, _pitch(pitch)
|
||||
, _sliceHeight(sliceHeight)
|
||||
, _sliceStep(sliceStep)
|
||||
, _pitch (pitch)
|
||||
, _sliceHeight (sliceHeight)
|
||||
, _sliceStep (sliceStep)
|
||||
{ }
|
||||
|
||||
|
||||
CellGauge::CellGauge ( const CellGauge& other )
|
||||
: _name (other._name)
|
||||
, _pinLayerName(other._pinLayerName)
|
||||
, _pitch (other._pitch)
|
||||
, _sliceHeight (other._sliceHeight)
|
||||
, _sliceStep (other._sliceStep)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -110,6 +119,10 @@ namespace CRL {
|
|||
{ delete this; }
|
||||
|
||||
|
||||
CellGauge* CellGauge::getClone () const
|
||||
{ return new CellGauge(*this); }
|
||||
|
||||
|
||||
string CellGauge::_getTypeName () const
|
||||
{ return _TName("CellGauge"); }
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ Dots::Dots ( const std::string& left, const std::string& right ) : _left(left),
|
|||
Dots Dots::asPercentage ( const std::string& left, float value )
|
||||
{
|
||||
std::ostringstream right;
|
||||
right << std::setprecision(3) << value << "%";
|
||||
right << std::setprecision(3) << (value*100.0) << "%";
|
||||
return Dots(left,right.str());
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,10 @@ Dots Dots::asUInt ( const std::string& left, unsigned int value )
|
|||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asInt ( const std::string& left, int value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asULong ( const std::string& left, unsigned long value )
|
||||
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
||||
|
||||
|
@ -81,6 +85,10 @@ Dots Dots::asLambda ( const std::string& left, Hurricane::DbU::Unit value )
|
|||
{ std::ostringstream right; right << Hurricane::DbU::getValueString(value); return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asLambda ( const std::string& left, double value )
|
||||
{ std::ostringstream right; right << Hurricane::DbU::getValueString(value); return Dots(left,right.str()); }
|
||||
|
||||
|
||||
Dots Dots::asIdentifier ( const std::string& left, const std::string& value )
|
||||
{ std::ostringstream right; right << "<" << value << ">"; return Dots(left,right.str()); }
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ using namespace std;
|
|||
#include "hurricane/Query.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include "vlsisapd/agds/GdsLibrary.h"
|
||||
#include "vlsisapd/agds/GdsStructure.h"
|
||||
#include "vlsisapd/agds/GdsRectangle.h"
|
||||
using namespace vlsisapd;
|
||||
#include "vlsisapd/agds/Library.h"
|
||||
#include "vlsisapd/agds/Structure.h"
|
||||
#include "vlsisapd/agds/Rectangle.h"
|
||||
using namespace AGDS;
|
||||
|
||||
#include "Agds.h"
|
||||
|
||||
|
@ -33,7 +33,7 @@ class AgdsQuery : public Query {
|
|||
public:
|
||||
AgdsQuery ( Cell* );
|
||||
|
||||
inline void setStructure(GdsStructure*);
|
||||
inline void setStructure(Structure*);
|
||||
|
||||
virtual bool hasGoCallback() const;
|
||||
virtual void goCallback ( Go* );
|
||||
|
@ -43,14 +43,14 @@ class AgdsQuery : public Query {
|
|||
|
||||
private:
|
||||
Cell* _cell;
|
||||
GdsStructure* _str;
|
||||
Structure* _str;
|
||||
};
|
||||
|
||||
AgdsQuery::AgdsQuery(Cell* cell) : Query(), _cell(cell), _str(NULL) {
|
||||
Query::setQuery(_cell, _cell->getBoundingBox(), Transformation(), NULL, 0, Query::DoComponents);
|
||||
}
|
||||
|
||||
inline void AgdsQuery::setStructure(GdsStructure* str) { _str = str; }
|
||||
inline void AgdsQuery::setStructure(Structure* str) { _str = str; }
|
||||
|
||||
bool AgdsQuery::hasGoCallback() const { return true; }
|
||||
|
||||
|
@ -75,11 +75,11 @@ void AgdsQuery::goCallback(Go* go) {
|
|||
else {
|
||||
return;
|
||||
}
|
||||
GdsRectangle* rect = new GdsRectangle ( layer->getExtractNumber()
|
||||
, DbU::getPhysical(b.getXMin(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getYMin(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getXMax(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getYMax(), DbU::Nano));
|
||||
Rectangle* rect = new Rectangle ( layer->getExtractNumber()
|
||||
, DbU::getPhysical(b.getXMin(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getYMin(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getXMax(), DbU::Nano)
|
||||
, DbU::getPhysical(b.getYMax(), DbU::Nano));
|
||||
_str->addElement(rect);
|
||||
}
|
||||
} // namespace
|
||||
|
@ -92,12 +92,12 @@ void agdsDriver(const string& filePath, Cell* cell, string& name, string& lib, d
|
|||
replace(lib.begin(), lib.end(), ' ', '_');
|
||||
uUnits = 0.001;
|
||||
pUnits = 1.0E-9;
|
||||
GdsLibrary* gdsLib = new GdsLibrary(lib);
|
||||
AGDS::Library* gdsLib = new AGDS::Library(lib);
|
||||
gdsLib->setUserUnits(uUnits);
|
||||
gdsLib->setPhysUnits(pUnits);
|
||||
AgdsQuery agdsQuery (cell);
|
||||
|
||||
GdsStructure* str = new GdsStructure(getString(name));
|
||||
Structure* str = new Structure(getString(name));
|
||||
agdsQuery.setStructure(str);
|
||||
|
||||
forEach ( BasicLayer*, basicLayer, DataBase::getDB()->getTechnology()->getBasicLayers() ) {
|
||||
|
@ -106,6 +106,6 @@ void agdsDriver(const string& filePath, Cell* cell, string& name, string& lib, d
|
|||
}
|
||||
|
||||
gdsLib->addStructure(str);
|
||||
gdsLib->write(filePath);
|
||||
gdsLib->writeToFile(filePath);
|
||||
}
|
||||
} // namespace CRL
|
||||
|
|
|
@ -21,9 +21,9 @@ using namespace std;
|
|||
#include "hurricane/Query.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include "vlsisapd/cif/CifCircuit.h"
|
||||
#include "vlsisapd/cif/CifPolygon.h"
|
||||
using namespace vlsisapd;
|
||||
#include "vlsisapd/cif/Circuit.h"
|
||||
#include "vlsisapd/cif/Polygon.h"
|
||||
using namespace CIF;
|
||||
|
||||
#include "Cif.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@ class CifQuery : public Query {
|
|||
public:
|
||||
CifQuery ( Cell* );
|
||||
|
||||
inline void setCircuit(CifCircuit*);
|
||||
inline void setCircuit(Circuit*);
|
||||
|
||||
virtual bool hasGoCallback() const;
|
||||
virtual void goCallback ( Go* );
|
||||
|
@ -41,15 +41,15 @@ class CifQuery : public Query {
|
|||
virtual void masterCellCallback() {};
|
||||
|
||||
private:
|
||||
Cell* _cell;
|
||||
CifCircuit* _circuit;
|
||||
Cell* _cell;
|
||||
Circuit* _circuit;
|
||||
};
|
||||
|
||||
CifQuery::CifQuery(Cell* cell) : Query(), _cell(cell), _circuit(NULL) {
|
||||
Query::setQuery(_cell, _cell->getBoundingBox(), Transformation(), NULL, 0, Query::DoComponents);
|
||||
}
|
||||
|
||||
inline void CifQuery::setCircuit(CifCircuit* circuit) { _circuit = circuit; }
|
||||
inline void CifQuery::setCircuit(Circuit* circuit) { _circuit = circuit; }
|
||||
|
||||
bool CifQuery::hasGoCallback() const { return true; }
|
||||
|
||||
|
@ -74,7 +74,7 @@ void CifQuery::goCallback(Go* go) {
|
|||
else {
|
||||
return;
|
||||
}
|
||||
CifPolygon* poly = new CifPolygon ( layer->getExtractNumber() );
|
||||
Polygon* poly = new Polygon ( layer->getExtractNumber() );
|
||||
long xMin = (long)round(DbU::getPhysical(b.getXMin(), DbU::Nano));
|
||||
long yMin = (long)round(DbU::getPhysical(b.getYMin(), DbU::Nano));
|
||||
long xMax = (long)round(DbU::getPhysical(b.getXMax(), DbU::Nano));
|
||||
|
@ -94,7 +94,7 @@ void cifDriver(const string& filePath, Cell* cell, string& name, string& units,
|
|||
replace(name.begin(), name.end(), ' ', '_');
|
||||
units = "micro";
|
||||
scale = 0.001;
|
||||
CifCircuit* circuit = new CifCircuit(name, units, scale);
|
||||
Circuit* circuit = new Circuit(name, units, scale);
|
||||
CifQuery cifQuery (cell);
|
||||
|
||||
cifQuery.setCircuit(circuit);
|
||||
|
@ -104,6 +104,6 @@ void cifDriver(const string& filePath, Cell* cell, string& name, string& units,
|
|||
cifQuery.doQuery();
|
||||
}
|
||||
|
||||
circuit->write(filePath);
|
||||
circuit->writeToFile(filePath);
|
||||
}
|
||||
} // namespace CRL
|
||||
|
|
|
@ -62,9 +62,9 @@ namespace CRL {
|
|||
// Constructors & Destructor.
|
||||
static CellGauge* create ( const char* name
|
||||
, const char* pinLayerName
|
||||
, const DbU::Unit pitch=0
|
||||
, const DbU::Unit sliceHeight=0
|
||||
, const DbU::Unit sliceStep=0 );
|
||||
, const DbU::Unit pitch =0
|
||||
, const DbU::Unit sliceHeight =0
|
||||
, const DbU::Unit sliceStep =0 );
|
||||
virtual void destroy ();
|
||||
// Accessors
|
||||
inline const Name& getName () const;
|
||||
|
@ -72,6 +72,7 @@ namespace CRL {
|
|||
inline const DbU::Unit getPitch () const;
|
||||
inline const DbU::Unit getSliceHeight () const;
|
||||
inline const DbU::Unit getSliceStep () const;
|
||||
CellGauge* getClone () const;
|
||||
// Hurricane management.
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace CRL {
|
|||
bool isNoInstancePlacedOrFixed ( Cell* );
|
||||
Occurrence getRootNetOccurrence ( const Occurrence& netoccurrence );
|
||||
void ConnectPlugHooks ( Cell* );
|
||||
size_t getInstancesCount ( const Cell* cell );
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
||||
|
|
|
@ -350,11 +350,13 @@ class Dots {
|
|||
public:
|
||||
static Dots asPercentage ( const std::string& left, float );
|
||||
static Dots asBool ( const std::string& left, bool );
|
||||
static Dots asInt ( const std::string& left, int );
|
||||
static Dots asUInt ( const std::string& left, unsigned int );
|
||||
static Dots asULong ( const std::string& left, unsigned long );
|
||||
static Dots asSizet ( const std::string& left, size_t );
|
||||
static Dots asDouble ( const std::string& left, double );
|
||||
static Dots asLambda ( const std::string& left, Hurricane::DbU::Unit );
|
||||
static Dots asLambda ( const std::string& left, double );
|
||||
static Dots asIdentifier ( const std::string& left, const std::string& );
|
||||
static Dots asString ( const std::string& left, const std::string& );
|
||||
private:
|
||||
|
@ -366,4 +368,90 @@ class Dots {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "::linefill()".
|
||||
//
|
||||
// Wrapper around the STL ostream which try print unbufferized filed
|
||||
// lines.
|
||||
|
||||
|
||||
class linefill : public std::ostream {
|
||||
public:
|
||||
inline linefill ( const std::string& header, std::ostream &s );
|
||||
// Overload for formatted outputs.
|
||||
template<typename T> inline linefill& operator<< ( T& t );
|
||||
template<typename T> inline linefill& operator<< ( T* t );
|
||||
template<typename T> inline linefill& operator<< ( const T& t );
|
||||
template<typename T> inline linefill& operator<< ( const T* t );
|
||||
inline std::ostream& base ();
|
||||
inline void _print ( const std::string& field );
|
||||
inline linefill& flush ();
|
||||
inline linefill& reset ();
|
||||
// Overload for manipulators.
|
||||
inline linefill& operator<< ( std::ostream &(*pf)(std::ostream &) );
|
||||
|
||||
// Internal: Attributes.
|
||||
private:
|
||||
std::string _header;
|
||||
size_t _width;
|
||||
size_t _lines;
|
||||
};
|
||||
|
||||
|
||||
inline linefill::linefill ( const std::string& header, std::ostream& s ): std::ostream(s.rdbuf()) , _header(header), _width(0), _lines(0) {}
|
||||
inline std::ostream& linefill::base () { return (*static_cast<std::ostream*>(this)); }
|
||||
inline linefill& linefill::reset () { (*this) << std::endl; _width=0; return *this; }
|
||||
inline linefill& linefill::flush () { static_cast<std::ostream*>(this)->flush(); return *this; }
|
||||
inline linefill& linefill::operator<< ( std::ostream& (*pf)(std::ostream&) ) { (*pf)(*this); return *this; }
|
||||
|
||||
inline void linefill::_print ( const std::string& field ) {
|
||||
size_t fieldWidth = field.length();
|
||||
if ( _width+fieldWidth > 80 ) { _width = 0; ++_lines; }
|
||||
if ( _width == 0 ) {
|
||||
if ( _lines > 0 ) base() << std::endl;
|
||||
base() << _header; _width+=_header.length();
|
||||
} else
|
||||
base() << " ";
|
||||
|
||||
_width += fieldWidth + 1;
|
||||
base() << field;
|
||||
base().flush ();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline linefill& linefill::operator<< ( T& t )
|
||||
{ std::ostringstream s; s << t; _print(s.str()); return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline linefill& linefill::operator<< ( T* t )
|
||||
{ std::ostringstream s; s << t; _print(s.str()); return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline linefill& linefill::operator<< ( const T& t )
|
||||
{ std::ostringstream s; s << t; _print(s.str()); return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline linefill& linefill::operator<< ( const T* t )
|
||||
{ std::ostringstream s; s << t; _print(s.str()); return *this; };
|
||||
|
||||
// Specific non-member operator overload. Must be one for each type.
|
||||
#define LINEFILL_V_SUPPORT(Type) \
|
||||
inline linefill& operator<< ( linefill& o, const Type t ) \
|
||||
{ std::ostringstream s; s << t; return o; };
|
||||
|
||||
#define LINEFILL_R_SUPPORT(Type) \
|
||||
inline linefill& operator<< ( linefill& o, const Type& t ) \
|
||||
{ std::ostringstream s; s << t; return o; };
|
||||
|
||||
#define LINEFILL_P_SUPPORT(Type) \
|
||||
inline linefill& operator<< ( linefill& o, const Type* t ) \
|
||||
{ std::ostringstream s; s << t; return o; };
|
||||
|
||||
#define LINEFILL_PR_SUPPORT(Type) \
|
||||
LINEFILL_P_SUPPORT(Type) \
|
||||
LINEFILL_R_SUPPORT(Type)
|
||||
|
||||
LINEFILL_PR_SUPPORT(std::string);
|
||||
|
||||
|
||||
# endif
|
||||
|
|
|
@ -540,4 +540,34 @@ void ConnectPlugHooks(Cell* cell)
|
|||
__plughooksconnected.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
size_t _getInstancesCount ( const Cell* cell, map<const Cell*,size_t>& gatesByMaster )
|
||||
{
|
||||
map<const Cell*,size_t>::iterator imaster = gatesByMaster.find ( cell );
|
||||
if ( imaster != gatesByMaster.end() )
|
||||
return imaster->second;
|
||||
|
||||
size_t gates = 0;
|
||||
forEach ( Instance*, iinstance, cell->getInstances() ) {
|
||||
Cell* masterCell = iinstance->getMasterCell();
|
||||
|
||||
if ( masterCell->isTerminal() )
|
||||
++gates;
|
||||
else
|
||||
_getInstancesCount ( masterCell, gatesByMaster );
|
||||
}
|
||||
gatesByMaster.insert ( make_pair(cell,gates) );
|
||||
|
||||
return gates;
|
||||
}
|
||||
|
||||
|
||||
size_t getInstancesCount ( const Cell* cell )
|
||||
{
|
||||
map<const Cell*,size_t> gatesByMaster;
|
||||
|
||||
return _getInstancesCount ( cell, gatesByMaster );
|
||||
}
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
Loading…
Reference in New Issue