Rationalization of Cell's flags. Compilation warnings hunt.

* New: In Hurricane, dedicated class BaseFlags to wrap a set of flags.
    Similar to the Mask class, only with a slightly different semantic.
    Encapsulation of <unsigned int>.
      Also provide support for the Inspector, to have a human-readable
    display of the flags.
* Change: In Hurricane, in Cell, regroup all the flags under a Flags
    sub-class of Cell. No more mixing between booleans and bit flags.
    (first use of BaseClass).
* In Hurricane, CRL Core & Knik, many small corrections to suppress
    annoying warning messages at compile time.
      Most noticeably, Bison errors in VstParserGrammar generated by
    rules and token with mismatched return value type. This was not
    problematic because the badly defined return value where not used.
    But still...
This commit is contained in:
Jean-Paul Chaput 2015-06-10 15:49:58 +02:00
parent 701487247d
commit e2fcfcb699
31 changed files with 490 additions and 202 deletions

View File

@ -227,7 +227,7 @@ namespace CRL {
remove( relation );
}
DBo::_preDestroy();
_cell->notify( Cell::CellChanged );
_cell->notify( Cell::Flags::CellChanged );
}

View File

@ -446,10 +446,10 @@ namespace CRL {
}
#endif
bool systemConfFound = false;
//bool systemConfFound = false;
Utilities::Path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py";
if ( systemConfFile.exists() ) {
systemConfFound = true;
//systemConfFound = true;
//cout << " o Reading python dot configuration:" << endl;
//cout << " - <" << systemConfFile.string() << ">." << endl;
@ -461,18 +461,18 @@ namespace CRL {
,systemConfFile.toString().c_str()) << endl;
}
bool homeConfFound = false;
//bool homeConfFound = false;
Utilities::Path homeConfFile = getPath("home");
homeConfFile /= ".coriolis2.configuration.xml";
if ( homeConfFile.exists() ) {
homeConfFound = true;
//homeConfFound = true;
conf->readFromFile ( homeConfFile.toString() );
}
bool dotConfFound = false;
//bool dotConfFound = false;
Utilities::Path dotConfFile = "./.coriolis2.configuration.xml";
if ( dotConfFile.exists() ) {
dotConfFound = true;
//dotConfFound = true;
conf->readFromFile ( dotConfFile.toString() );
}

View File

@ -846,7 +846,7 @@ namespace {
break;
}
}
if (isPlaced) _cell->setFlags( Cell::Placed );
if (isPlaced) _cell->setFlags( Cell::Flags::Placed );
fileStream.close ();
}

View File

@ -70,6 +70,14 @@ namespace Vst {
void checkForIeee ( bool ieeeEnabled );
enum TokenConstants { VhdlTo = 1
, VhdlDownto = 2
, VhdlPlus = 3
, VhdlMinus = 4
, VhdlBus = 5
};
class Constraint {
private:
int _from;
@ -81,7 +89,7 @@ namespace Vst {
int getFrom () const { return _from; }
int getTo () const { return _to; }
bool IsSet () const { return _set; }
void Set ( int from, int direction, int to );
void Set ( int from, unsigned int direction, int to );
void UnSet () { _set = false; }
void Init ( int& index ) { index = _from; };
void Next ( int& index );
@ -89,7 +97,7 @@ namespace Vst {
};
void Constraint::Set ( int from, int direction, int to )
void Constraint::Set ( int from, unsigned int direction, int to )
{
_set = true;
_from = from;
@ -117,8 +125,6 @@ namespace Vst {
typedef map<Cell*,VectorMap> CellVectorMap;
class YaccState {
public:
string _vhdFileName;
@ -210,9 +216,9 @@ namespace Vst {
%token RightParen
%token DoubleStar
%token Star
%token Plus
%token <_flag> Plus
%token Comma
%token Minus
%token <_flag> Minus
%token VarAsgn
%token Colon
%token Semicolon
@ -261,7 +267,7 @@ namespace Vst {
%token CONSTANT
%token CONVERT
%token DISCONNECT
%token DOWNTO
%token <_value> DOWNTO
%token ELSE
%token ELSIF
%token _END
@ -324,7 +330,7 @@ namespace Vst {
%token STRING
%token SUBTYPE
%token THEN
%token TO
%token <_value> TO
%token TRANSPORT
%token _TYPE
%token UNITS
@ -506,8 +512,8 @@ range
;
direction
: TO
| DOWNTO
: TO { $$ = Vst::VhdlTo; }
| DOWNTO { $$ = Vst::VhdlDownto; }
;
.port_clause.
@ -858,9 +864,9 @@ generic_simple_expression
;
.sign.
: /*empty*/
| Plus
| Minus
: /*empty*/ { $$ = (char)0; }
| Plus { $$ = (char)Vst::VhdlPlus; }
| Minus { $$ = (char)Vst::VhdlMinus; }
;
generic_term
@ -1092,20 +1098,20 @@ factor
primary
: aggregate
| type_convertion
| name
| name { $$ = $1; }
;
aggregate
: LeftParen
expression
RightParen_ERR
RightParen_ERR { $$ = $2; }
;
type_convertion
: CONVERT
LeftParen
expression
RightParen_ERR
RightParen_ERR { $$ = $3; }
;
@ -1149,8 +1155,8 @@ type_mark
;
.BUS.
: /*empty*/
| BUS
: /*empty*/ { $$ = 0; }
| BUS { $$ = Vst::VhdlBus; }
;
identifier_list

View File

@ -63,14 +63,20 @@ extern "C" {
HTRY
if ( pyBanner ) {
char* name = "";
char* version = "";
char* purpose = "";
char* date = "";
char* authors = "";
char* contributors = "";
char* name = (char*)"";
char* version = (char*)"";
char* purpose = (char*)"";
char* date = (char*)"";
char* authors = (char*)"";
char* contributors = (char*)"";
static char* keywords[] = { "name", "version", "purpose", "date", "authors", "contributors", NULL };
static char* keywords[] = { (char*)"name"
, (char*)"version"
, (char*)"purpose"
, (char*)"date"
, (char*)"authors"
, (char*)"contributors"
, NULL };
if (PyArg_ParseTupleAndKeywords( args
, kwArgs

View File

@ -74,7 +74,7 @@ extern "C" {
char* libName = NULL;
int addMode = Environment::Append;
static char* keywords[] = { "library", "libName", "mode", NULL };
static char* keywords[] = { (char*)"library", (char*)"libName", (char*)"mode", NULL };
if (PyArg_ParseTupleAndKeywords( args
, kwArgs

View File

@ -52,7 +52,7 @@ extern "C" {
PyObject* pyCell = NULL;
char* name = NULL;
static char* keywords[] = { "cell", "name", NULL };
static char* keywords[] = { (char*)"cell", (char*)"name", NULL };
if (PyArg_ParseTupleAndKeywords( args
, kwArgs

View File

@ -451,7 +451,7 @@ namespace Etesian {
DbU::Unit pitch = getPitch();
cmess1 << " - Building RoutingPads (transhierarchical) ..." << endl;
getCell()->flattenNets( Cell::BuildRings|Cell::NoClockFlatten );
getCell()->flattenNets( Cell::Flags::BuildRings|Cell::Flags::NoClockFlatten );
// Coloquinte circuit description data-structures.
size_t instancesNb = getCell()->getLeafInstanceOccurrences().getSize();
@ -918,7 +918,7 @@ namespace Etesian {
_placed = true;
getCell()->setFlags( Cell::Placed );
getCell()->setFlags( Cell::Flags::Placed );
}

View File

@ -3,6 +3,7 @@
${Boost_INCLUDE_DIRS}
)
set ( includes hurricane/Mask.h
hurricane/Flags.h
hurricane/DebugSession.h
hurricane/Backtrace.h
hurricane/Observer.h
@ -93,6 +94,7 @@
set ( cpps Record.cpp
Slot.cpp
Commons.cpp
Flags.cpp
Backtrace.cpp
Exception.cpp
Bug.cpp

View File

@ -165,14 +165,11 @@ Cell::Cell(Library* library, const Name& name)
//_viewSet(),
_abutmentBox(),
_boundingBox(),
_isTerminal(true),
_isFlattenLeaf(false),
_isPad(false),
_nextOfLibraryCellMap(NULL),
_nextOfSymbolCellSet(NULL),
_slaveEntityMap(),
_observers(),
_flags(0)
_flags(Flags::Terminal)
{
if (!_library)
throw Error("Can't create " + _TName("Cell") + " : null library");
@ -282,7 +279,7 @@ void Cell::setAbutmentBox(const Box& abutmentBox)
DeepNet* Cell::getDeepNet ( Path path, const Net* leafNet ) const
// **************************************************************
{
if (not (_flags & FlattenedNets)) return NULL;
if (not (_flags.isset(Flags::FlattenedNets))) return NULL;
Occurrence rootNetOccurrence ( getHyperNetRootNetOccurrence(Occurrence(leafNet,path)) );
@ -305,7 +302,7 @@ void Cell::flattenNets(unsigned int flags)
UpdateSession::open();
_flags |= FlattenedNets;
_flags |= Flags::FlattenedNets;
vector<HyperNet> hyperNets;
vector<HyperNet> topHyperNets;
@ -313,7 +310,7 @@ void Cell::flattenNets(unsigned int flags)
forEach ( Occurrence, ioccurrence, getHyperNetRootNetOccurrences() ) {
Net* net = static_cast<Net*>((*ioccurrence).getEntity());
if (net->isClock() and (flags & NoClockFlatten)) continue;
if (net->isClock() and (flags & Flags::NoClockFlatten)) continue;
HyperNet hyperNet ( *ioccurrence );
if ( not (*ioccurrence).getPath().isEmpty() ) {
@ -353,10 +350,10 @@ void Cell::flattenNets(unsigned int flags)
bool buildRing = false;
if (net->isGlobal()) {
if ( (flags & Cell::BuildClockRings ) and net->isClock () ) buildRing = true;
else if ( (flags & Cell::BuildSupplyRings) and net->isSupply() ) buildRing = true;
if ( (flags & Cell::Flags::BuildClockRings ) and net->isClock () ) buildRing = true;
else if ( (flags & Cell::Flags::BuildSupplyRings) and net->isSupply() ) buildRing = true;
} else {
buildRing = flags & Cell::BuildRings;
buildRing = flags & Cell::Flags::BuildRings;
}
forEach ( Component*, icomponent, net->getComponents() ) {
@ -375,7 +372,7 @@ void Cell::flattenNets(unsigned int flags)
currentRp = RoutingPad::create( net, *iplugOccurrence, RoutingPad::BiggestArea );
currentRp->materialize();
if (flags & WarnOnUnplacedInstances)
if (flags & Flags::WarnOnUnplacedInstances)
currentRp->isPlacedOccurrence( RoutingPad::ShowWarning );
if (buildRing) {
@ -439,17 +436,17 @@ Cell* Cell::getClone()
clone->setPad ( isPad () );
clone->setAbutmentBox( getAbutmentBox() );
forEach( Net*, inet, getNets() ) {
if (dynamic_cast<DeepNet*>(*inet)) continue;
for ( Net* inet : getNets() ) {
if (dynamic_cast<DeepNet*>(inet)) continue;
inet->getClone( clone );
}
bool isPlaced = true;
forEach( Instance*, iinstance, getInstances() ) {
for ( Instance* iinstance : getInstances() ) {
if (iinstance->getClone(clone)->getPlacementStatus() == Instance::PlacementStatus::UNPLACED)
isPlaced = false;
}
if (isPlaced) clone->setFlags( Placed );
if (isPlaced) clone->setFlags( Flags::Placed );
UpdateSession::close();
@ -463,13 +460,13 @@ void Cell::uniquify(unsigned int depth)
vector<Instance*> toUniquify;
set<Cell*> masterCells;
forEach ( Instance*, iinstance, getInstances() ) {
for ( Instance* iinstance : getInstances() ) {
Cell* masterCell = iinstance->getMasterCell();
if (masterCell->isTerminal()) continue;
masterCells.insert( masterCell );
if (masterCell->getSlaveInstances().getSize() > 1) {
toUniquify.push_back( *iinstance );
toUniquify.push_back( iinstance );
}
}
@ -549,21 +546,20 @@ Record* Cell::_getRecord() const
{
Record* record = Inherit::_getRecord();
if (record) {
record->add(getSlot("_library", _library));
record->add(getSlot("_name", &_name));
record->add(getSlot("_instances", &_instanceMap));
record->add(getSlot("_quadTree", &_quadTree));
record->add(getSlot("_slaveInstances", &_slaveInstanceSet));
record->add(getSlot("_netMap", &_netMap));
record->add(getSlot("_netAliasSet", &_netAliasSet));
record->add(getSlot("_pinMap", &_pinMap));
record->add(getSlot("_sliceMap", &_sliceMap));
record->add(getSlot("_markerSet", &_markerSet));
record->add(getSlot("_slaveEntityMap", &_slaveEntityMap));
record->add(getSlot("_abutmentBox", &_abutmentBox));
record->add(getSlot("_boundingBox", &_boundingBox));
record->add(getSlot("_isTerminal", &_isTerminal));
record->add(getSlot("_isFlattenLeaf", &_isFlattenLeaf));
record->add( getSlot("_library" , _library ) );
record->add( getSlot("_name" , &_name ) );
record->add( getSlot("_instances" , &_instanceMap ) );
record->add( getSlot("_quadTree" , &_quadTree ) );
record->add( getSlot("_slaveInstances", &_slaveInstanceSet) );
record->add( getSlot("_netMap" , &_netMap ) );
record->add( getSlot("_netAliasSet" , &_netAliasSet ) );
record->add( getSlot("_pinMap" , &_pinMap ) );
record->add( getSlot("_sliceMap" , &_sliceMap ) );
record->add( getSlot("_markerSet" , &_markerSet ) );
record->add( getSlot("_slaveEntityMap", &_slaveEntityMap ) );
record->add( getSlot("_abutmentBox" , &_abutmentBox ) );
record->add( getSlot("_boundingBox" , &_boundingBox ) );
record->add( getSlot("_flags" , &_flags ) );
}
return record;
}
@ -575,9 +571,8 @@ void Cell::_fit(const Box& box)
if (_boundingBox.isEmpty()) return;
if (_boundingBox.contains(box)) return;
_boundingBox.merge(box);
for_each_instance(instance, getSlaveInstances()) {
instance->getCell()->_fit(instance->getTransformation().getBox(box));
end_for;
for ( Instance* iinstance : getSlaveInstances() ) {
iinstance->getCell()->_fit(iinstance->getTransformation().getBox(box));
}
}
@ -588,9 +583,8 @@ void Cell::_unfit(const Box& box)
if (_boundingBox.isEmpty()) return;
if (!_boundingBox.isConstrainedBy(box)) return;
_boundingBox.makeEmpty();
for_each_instance(instance, getSlaveInstances()) {
instance->getCell()->_unfit(instance->getTransformation().getBox(box));
end_for;
for ( Instance* iinstance : getSlaveInstances() ) {
iinstance->getCell()->_unfit(iinstance->getTransformation().getBox(box));
}
}
@ -650,6 +644,58 @@ void Cell::notify(unsigned flags)
_observers.notify(flags);
}
// ****************************************************************************************************
// Cell::Flags implementation
// ****************************************************************************************************
Cell::Flags::Flags ( unsigned int flags)
: BaseFlags(flags)
{ }
Cell::Flags::~Flags ()
{ }
string Cell::Flags::_getTypeName () const
{ return _TName("Cell::Flags"); }
string Cell::Flags::_getString () const
{
if (not _flags) return "<NoFlags>";
string s = "<";
if (_flags & Pad) {
s += "Pad";
}
if (_flags & Terminal) {
if (s.size() > 1) s += "|";
s += "Terminal";
}
if (_flags & FlattenLeaf) {
if (s.size() > 1) s += "|";
s += "FlattenLeaf";
}
if (_flags & FlattenedNets) {
if (s.size() > 1) s += "|";
s += "FlattenedNets";
}
if (_flags & Placed) {
if (s.size() > 1) s += "|";
s += "Placed";
}
if (_flags & Routed) {
if (s.size() > 1) s += "|";
s += "Routed";
}
s += ">";
return s;
}
// ****************************************************************************************************
// Cell::ClonedSet implementation
// ****************************************************************************************************

View File

@ -89,17 +89,17 @@ namespace Hurricane {
nbRoutingPads++;
currentRp = RoutingPad::create( this, *ioccurrence, RoutingPad::BiggestArea );
if (flags & Cell::WarnOnUnplacedInstances)
if (flags & Cell::Flags::WarnOnUnplacedInstances)
currentRp->isPlacedOccurrence ( RoutingPad::ShowWarning );
if (nbRoutingPads == 1) {
Net* net = currentRp->getNet();
if (net->isGlobal()) {
if ( (flags & Cell::BuildClockRings ) and net->isClock () ) buildRing = true;
else if ( (flags & Cell::BuildSupplyRings) and net->isSupply() ) buildRing = true;
if ( (flags & Cell::Flags::BuildClockRings ) and net->isClock () ) buildRing = true;
else if ( (flags & Cell::Flags::BuildSupplyRings) and net->isSupply() ) buildRing = true;
} else {
buildRing = flags & Cell::BuildRings;
buildRing = flags & Cell::Flags::BuildRings;
}
//cerr << "_createRoutingPads on " << net->getName() << " buildRing:" << buildRing << endl;

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
//
// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved
//
// This file is part of Hurricane.
//
// Hurricane is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// Hurricane is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
// General Public License for more details.
//
// You should have received a copy of the Lesser GNU General Public
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// +-----------------------------------------------------------------+
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./BaseFlags.cpp" |
// +-----------------------------------------------------------------+
#include <climits>
#include <iomanip>
#include "hurricane/Flags.h"
namespace Hurricane {
BaseFlags::~BaseFlags ()
{ }
string BaseFlags::_getTypeName () const
{ return "Flags"; }
string BaseFlags::_getString () const
{
static size_t width = sizeof(unsigned int) * CHAR_BIT;
std::ostringstream formatted;
formatted << "0x" << std::hex << std::setw(width) << std::setfill('0') << _flags;
return formatted.str();
}
} // Hurricane namespace.

View File

@ -105,7 +105,7 @@ void UpdateSession::_destroy()
// They also should be sorted according to their hierarchical depth and
// revalidated bottom-up (TODO).
for ( auto icell : changedCells ) {
icell->notify( Cell::CellChanged );
icell->notify( Cell::Flags::CellChanged );
}
Inherit::_preDestroy();
@ -179,7 +179,7 @@ void UpdateSession::onNotOwned()
// Put the cell in the UpdateSession relation, but *do not* unmaterialize it.
//cerr << "Notify Cell::CellAboutToChange to: " << getCell() << endl;
getCell()->put ( UPDATOR_STACK->top() );
getCell()->notify( Cell::CellAboutToChange );
getCell()->notify( Cell::Flags::CellAboutToChange );
forEach( Instance*, iinstance, getCell()->getSlaveInstances() ) {
iinstance->invalidate( false );
}

View File

@ -21,6 +21,7 @@
#define HURRICANE_CELL_H
#include <limits>
#include "hurricane/Flags.h"
#include "hurricane/Observer.h"
#include "hurricane/Relation.h"
#include "hurricane/Pathes.h"
@ -68,22 +69,36 @@ class Cell : public Entity {
// Types
// *****
public: enum Flag { BuildRings = 0x0001
, BuildClockRings = 0x0002
, BuildSupplyRings = 0x0004
, NoClockFlatten = 0x0008
, WarnOnUnplacedInstances = 0x0010
// Flags set for Observers.
, CellAboutToChange = 0x0001
, CellChanged = 0x0002
// Cell states
, FlattenedNets = 0x0001
, Placed = 0x0002
, Routed = 0x0004
};
public: typedef Entity Inherit;
public: typedef map<Name,ExtensionSlice*> ExtensionSliceMap;
public: class Flags : public BaseFlags {
public:
enum Flag { NoFlags = 0x00000000
, BuildRings = 0x00000001
, BuildClockRings = 0x00000002
, BuildSupplyRings = 0x00000004
, NoClockFlatten = 0x00000008
, WarnOnUnplacedInstances = 0x00000010
// Flags set for Observers.
, CellAboutToChange = 0x00000100
, CellChanged = 0x00000200
// Cell states
, Terminal = 0x00001000
, FlattenLeaf = 0x00002000
, Pad = 0x00004000
, FlattenedNets = 0x00008000
, Placed = 0x00010000
, Routed = 0x00020000
};
public:
Flags ( unsigned int flags = NoFlags );
virtual ~Flags ();
virtual std::string _getTypeName () const;
virtual std::string _getString () const;
};
class UniquifyRelation : public Relation {
public:
static UniquifyRelation* create ( Cell* );
@ -225,15 +240,12 @@ class Cell : public Entity {
private: MarkerSet _markerSet;
private: Box _abutmentBox;
private: Box _boundingBox;
private: bool _isTerminal;
private: bool _isFlattenLeaf;
private: bool _isPad;
private: Cell* _nextOfLibraryCellMap;
private: Cell* _nextOfSymbolCellSet;
private: SlaveEntityMap _slaveEntityMap;
private: AliasNameSet _netAliasSet;
private: Observable _observers;
private: unsigned int _flags;
private: Flags _flags;
// Constructors
// ************
@ -250,6 +262,9 @@ class Cell : public Entity {
public: virtual string _getTypeName() const {return _TName("Cell");};
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
public: static string getFlagString( unsigned int );
public: static Record* getFlagRecord( unsigned int );
public: static Slot* getFlagSlot( unsigned int );
public: InstanceMap& _getInstanceMap() {return _instanceMap;};
public: QuadTree* _getQuadTree() {return &_quadTree;};
@ -360,13 +375,13 @@ class Cell : public Entity {
// **********
public: bool isCalledBy(Cell* cell) const;
public: bool isTerminal() const {return _isTerminal;};
public: bool isFlattenLeaf() const {return _isFlattenLeaf;};
public: bool isTerminal() const {return _flags.isset(Flags::Terminal);};
public: bool isFlattenLeaf() const {return _flags.isset(Flags::FlattenLeaf);};
public: bool isLeaf() const;
public: bool isPad() const {return _isPad;};
public: bool isFlattenedNets() const {return _flags & FlattenedNets;};
public: bool isPlaced() const {return _flags & Placed;};
public: bool isRouted() const {return _flags & Routed;};
public: bool isPad() const {return _flags.isset(Flags::Pad);};
public: bool isFlattenedNets() const {return _flags.isset(Flags::FlattenedNets);};
public: bool isPlaced() const {return _flags.isset(Flags::Placed);};
public: bool isRouted() const {return _flags.isset(Flags::Routed);};
public: bool isNetAlias(const Name& name) const;
// Updators
@ -374,10 +389,10 @@ class Cell : public Entity {
public: void setName(const Name& name);
public: void setAbutmentBox(const Box& abutmentBox);
public: void setTerminal(bool isTerminal) {_isTerminal = isTerminal;};
public: void setFlattenLeaf(bool isFlattenLeaf) {_isFlattenLeaf = isFlattenLeaf;};
public: void setPad(bool isPad) {_isPad = isPad;};
public: void flattenNets(unsigned int flags=BuildRings);
public: void setTerminal(bool isTerminal) {_flags.set(Flags::Terminal,isTerminal);};
public: void setFlattenLeaf(bool isFlattenLeaf) {_flags.set(Flags::FlattenLeaf,isFlattenLeaf);};
public: void setPad(bool isPad) {_flags.set(Flags::Pad,isPad);};
public: void flattenNets(unsigned int flags=Flags::BuildRings);
public: void setFlags(unsigned int flags) { _flags |= flags; }
public: void resetFlags(unsigned int flags) { _flags &= ~flags; }
public: void materialize();
@ -411,6 +426,7 @@ inline Cell::ClonedSet::ClonedSet ( const ClonedSet& other )
INSPECTOR_P_SUPPORT(Hurricane::Cell);
INSPECTOR_P_SUPPORT(Hurricane::Cell::Flags);
INSPECTOR_P_SUPPORT(Hurricane::Cell::InstanceMap);
INSPECTOR_P_SUPPORT(Hurricane::Cell::SlaveInstanceSet);
INSPECTOR_P_SUPPORT(Hurricane::Cell::NetMap);

View File

@ -195,24 +195,27 @@ template<class Type> class Collection {
return record;
}
public:
class iterator{
Locator<Type>* _locator;
public: iterator(Locator<Type>* l) : _locator(l) {}
public: bool operator!=(iterator const & o) const {
bool invalidA = ( _locator == NULL) or not( _locator->isValid());
bool invalidB = (o._locator == NULL) or not(o._locator->isValid());
return invalidA != invalidB or (not invalidA and not invalidB and _locator != o._locator);
}
public: bool operator==(iterator const & o) const { return not(*this != o); }
public: iterator& operator++(){ _locator->progress(); return *this; }
public: Type operator*() { return _locator->getElement(); }
public:
class iterator {
public:
iterator ( Locator<Type>* l ) : _locator(l) {}
bool operator== ( const iterator& o) const { return not (*this != o); }
iterator& operator++ () { _locator->progress(); return *this; }
Type operator* () { return _locator->getElement(); }
bool operator!= ( const iterator& o ) const
{
bool invalidA = ( _locator == NULL) or not ( _locator->isValid());
bool invalidB = (o._locator == NULL) or not (o._locator->isValid());
return invalidA != invalidB or (not invalidA and not invalidB and _locator != o._locator);
}
private:
Locator<Type>* _locator;
};
public: iterator begin() { return iterator(getLocator()); }
public: iterator end() { return iterator(NULL); }
public: bool empty() { return begin() == end(); }
public:
iterator begin() { return iterator(getLocator()); }
iterator end() { return iterator(NULL); }
bool empty() { return begin() == end(); }
};

View File

@ -0,0 +1,143 @@
// -*- C++ -*-
//
// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved
//
// This file is part of Hurricane.
//
// Hurricane is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// Hurricane is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
// General Public License for more details.
//
// You should have received a copy of the Lesser GNU General Public
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// +-----------------------------------------------------------------+
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/BaseFlags.h" |
// +-----------------------------------------------------------------+
#ifndef HURRICANE_BASE_FLAGS_H
#define HURRICANE_BASE_FLAGS_H
#include <string>
#include "hurricane/Commons.h"
namespace Hurricane {
class BaseFlags {
public:
// Methods.
inline BaseFlags ( unsigned int flags=0 );
virtual ~BaseFlags ();
inline bool zero () const;
inline BaseFlags& set ( BaseFlags, bool state=true );
inline BaseFlags& reset ( BaseFlags );
inline bool isset ( BaseFlags ) const;
inline bool contains ( BaseFlags ) const;
inline bool intersect ( BaseFlags ) const;
inline BaseFlags nthbit ( unsigned int ) const;
inline BaseFlags operator compl () const;
inline BaseFlags operator bitand ( BaseFlags ) const;
inline BaseFlags operator bitor ( BaseFlags ) const;
inline BaseFlags operator xor ( BaseFlags ) const;
inline BaseFlags operator bitand ( unsigned int ) const;
inline BaseFlags operator bitor ( unsigned int ) const;
inline BaseFlags operator xor ( unsigned int ) const;
inline BaseFlags lshift ( unsigned int ) const;
inline BaseFlags rshift ( unsigned int ) const;
inline BaseFlags& operator |= ( BaseFlags );
inline BaseFlags& operator &= ( BaseFlags );
inline bool operator == ( BaseFlags ) const;
inline bool operator != ( BaseFlags ) const;
inline bool operator < ( BaseFlags ) const;
inline bool operator > ( BaseFlags ) const;
inline BaseFlags& operator |= ( unsigned int );
inline BaseFlags& operator &= ( unsigned int );
inline bool operator == ( unsigned int ) const;
inline bool operator != ( unsigned int ) const;
inline bool operator < ( unsigned int ) const;
inline bool operator > ( unsigned int ) const;
inline operator unsigned int () const;
// Hurricane Managment.
virtual std::string _getTypeName () const;
virtual std::string _getString () const;
inline Record* _getRecord () const;
protected:
// Internal: Attributes.
unsigned int _flags;
};
// Inline Functions.
inline BaseFlags::BaseFlags ( unsigned int flags ) : _flags(flags) { }
inline bool BaseFlags::zero () const { return _flags == 0; }
inline BaseFlags& BaseFlags::reset ( BaseFlags flags ) { _flags &= ~flags._flags; return *this; }
inline bool BaseFlags::isset ( BaseFlags flags ) const { return _flags & flags._flags; }
inline bool BaseFlags::contains ( BaseFlags flags ) const { return (_flags & flags._flags) && !(~_flags & flags._flags); }
inline bool BaseFlags::intersect ( BaseFlags flags ) const { return _flags & flags._flags; }
inline BaseFlags BaseFlags::operator compl () const { return ~_flags; }
inline BaseFlags BaseFlags::operator bitand ( BaseFlags flags ) const { return _flags & flags._flags; }
inline BaseFlags BaseFlags::operator bitor ( BaseFlags flags ) const { return _flags | flags._flags; }
inline BaseFlags BaseFlags::operator xor ( BaseFlags flags ) const { return _flags ^ flags._flags; }
inline BaseFlags BaseFlags::operator bitand ( unsigned int flags ) const { return _flags & flags; }
inline BaseFlags BaseFlags::operator bitor ( unsigned int flags ) const { return _flags | flags; }
inline BaseFlags BaseFlags::operator xor ( unsigned int flags ) const { return _flags ^ flags; }
inline BaseFlags BaseFlags::lshift ( unsigned int s ) const { return _flags << s; }
inline BaseFlags BaseFlags::rshift ( unsigned int s ) const { return _flags >> s; }
inline BaseFlags& BaseFlags::operator |= ( BaseFlags flags ) { _flags |= flags._flags; return *this; }
inline BaseFlags& BaseFlags::operator &= ( BaseFlags flags ) { _flags &= flags._flags; return *this; }
inline bool BaseFlags::operator == ( BaseFlags flags ) const { return _flags == flags._flags; }
inline bool BaseFlags::operator != ( BaseFlags flags ) const { return _flags != flags._flags; }
inline bool BaseFlags::operator < ( BaseFlags flags ) const { return _flags < flags._flags; }
inline bool BaseFlags::operator > ( BaseFlags flags ) const { return _flags > flags._flags; }
inline BaseFlags& BaseFlags::operator |= ( unsigned int flags ) { _flags |= flags; return *this; }
inline BaseFlags& BaseFlags::operator &= ( unsigned int flags ) { _flags &= flags; return *this; }
inline bool BaseFlags::operator == ( unsigned int flags ) const { return _flags == flags; }
inline bool BaseFlags::operator != ( unsigned int flags ) const { return _flags != flags; }
inline bool BaseFlags::operator < ( unsigned int flags ) const { return _flags < flags; }
inline bool BaseFlags::operator > ( unsigned int flags ) const { return _flags > flags; }
inline BaseFlags::operator unsigned int () const { return _flags; }
inline BaseFlags& BaseFlags::set ( BaseFlags flags, bool state )
{
if (state) _flags |= flags._flags;
else _flags &= ~flags._flags;
return *this;
}
inline BaseFlags BaseFlags::nthbit ( unsigned int nth ) const
{
unsigned int select = 1;
for ( ; select ; select=select<<1 ) {
if ( _flags & select ) nth--;
if ( !nth ) break;
}
return select;
}
inline Record* BaseFlags::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add( getSlot("_flags", &_flags) );
return record;
}
} // Hurricane namespace.
# endif // HURRICANE_BASE_FLAGS_H

View File

@ -1,7 +1,6 @@
// -*- C++ -*-
//
// Copyright (c) BULL S.A. 2000-2009, All Rights Reserved
// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved
//
// This file is part of Hurricane.
//
@ -19,12 +18,7 @@
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
@ -32,17 +26,14 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/Mask.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_MASK__
#define __HURRICANE_MASK__
#ifndef HURRICANE_MASK_H
#define HURRICANE_MASK_H
#include <iomanip>
#include "hurricane/Commons.h"
#include <iomanip>
#include "hurricane/Commons.h"
namespace Hurricane {
@ -198,7 +189,6 @@ namespace Hurricane {
size_t Mask<IntType>::_width = sizeof(IntType)<<2;
} // End of Hurricane namespace.
} // Hurricane namespace.
# endif // __HURRICANE_MASK__
# endif // HURRICANE_MASK_H

View File

@ -805,10 +805,10 @@ extern "C" {
PyObject* dictionnary = PyModule_GetDict ( module );
ConstructorError = PyErr_NewException ( "hurricane.ConstructorError", NULL, NULL );
ProxyError = PyErr_NewException ( "hurricane.ProxyError" , NULL, NULL );
HurricaneError = PyErr_NewException ( "hurricane.HurricaneError" , NULL, NULL );
HurricaneWarning = PyErr_NewException ( "hurricane.HurricaneWarning", PyExc_Warning, NULL );
ConstructorError = PyErr_NewException ( (char*)"hurricane.ConstructorError", NULL, NULL );
ProxyError = PyErr_NewException ( (char*)"hurricane.ProxyError" , NULL, NULL );
HurricaneError = PyErr_NewException ( (char*)"hurricane.HurricaneError" , NULL, NULL );
HurricaneWarning = PyErr_NewException ( (char*)"hurricane.HurricaneWarning", PyExc_Warning, NULL );
PyDict_SetItemString ( dictionnary, "ConstructorError", ConstructorError );
PyDict_SetItemString ( dictionnary, "ProxyError" , ProxyError );

View File

@ -401,7 +401,7 @@ extern "C" {
HTRY
METHOD_HEAD ( "Net.addAlias()" )
char* name;
char* name = NULL;
if (PyArg_ParseTuple(args,"s:Net.addAlias",args,name)) {
if (net->addAlias(Name(name))) Py_RETURN_TRUE;
} else {
@ -425,7 +425,7 @@ extern "C" {
HTRY
METHOD_HEAD ( "Net.removeAlias()" )
char* name;
char* name = NULL;
if (PyArg_ParseTuple(args,"s:Net.removeAlias",args,name)) {
if (net->removeAlias(Name(name))) Py_RETURN_TRUE;
} else {

View File

@ -61,11 +61,11 @@ namespace Hurricane {
void CellObserver::notify ( unsigned int flags )
{
CellViewer* viewer = getOwner();
switch ( flags & (Cell::CellAboutToChange|Cell::CellChanged) ) {
case Cell::CellAboutToChange:
switch ( flags & (Cell::Flags::CellAboutToChange|Cell::Flags::CellChanged) ) {
case Cell::Flags::CellAboutToChange:
viewer->emitCellAboutToChange();
break;
case Cell::CellChanged:
case Cell::Flags::CellChanged:
viewer->emitCellChanged();
break;
}
@ -692,8 +692,7 @@ namespace Hurricane {
QAction* historyAction = qobject_cast<QAction*> ( sender() );
if ( historyAction ) {
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
size_t index = historyAction->data().toUInt();
//size_t index = historyAction->data().toUInt();
//for ( ; index>0 ; index--, istate++ )
// cerr << "History: " << (*istate)->getName() << endl;
emit stateChanged ( *istate );

View File

@ -270,15 +270,22 @@ extern "C" {
HTRY
METHOD_HEAD("DisplayStyle.addDrawingStyle()")
char* argGroupKey = "Not part of any group (error)";
char* argKey = "No key defined (error)";
char* argPattern = "FFFFFFFFFFFFFFFF";
char* argColor = "255,255,255";
char* argGroupKey = (char*)"Not part of any group (error)";
char* argKey = (char*)"No key defined (error)";
char* argPattern = (char*)"FFFFFFFFFFFFFFFF";
char* argColor = (char*)"255,255,255";
int borderWidth = 0;
float threshold = 1.0;
PyObject* argGoMatched = NULL;
static char* keywords[] = { "group", "name", "color", "pattern", "border", "threshold", "goMatched", NULL };
static char* keywords[] = { (char*)"group"
, (char*)"name"
, (char*)"color"
, (char*)"pattern"
, (char*)"border"
, (char*)"threshold"
, (char*)"goMatched"
, NULL };
if (PyArg_ParseTupleAndKeywords( args
, kwArgs

View File

@ -102,14 +102,20 @@ extern "C" {
HTRY
METHOD_HEAD("DrawingGroup.addDrawingStyle()")
char* argKey = "No key defined (error)";
char* argPattern = "FFFFFFFFFFFFFFFF";
char* argColor = "255,255,255";
char* argKey = (char*)"No key defined (error)";
char* argPattern = (char*)"FFFFFFFFFFFFFFFF";
char* argColor = (char*)"255,255,255";
int borderWidth = 0;
float threshold = 1.0;
char* argGoMatched = "true";
char* argGoMatched = (char*)"true";
static char* keywords[] = { "name", "color", "pattern", "border", "threshold", "goMatched", NULL };
static char* keywords[] = { (char*)"name"
, (char*)"color"
, (char*)"pattern"
, (char*)"border"
, (char*)"threshold"
, (char*)"goMatched"
, NULL };
if (PyArg_ParseTupleAndKeywords( args
, kwArgs

View File

@ -316,8 +316,8 @@ namespace Kite {
Cell* cell = getCell();
//Box cellBb = cell->getBoundingBox();
if (not _knik) {
unsigned int flags = Cell::WarnOnUnplacedInstances;
flags |= (mode & KtBuildGlobalRouting) ? Cell::BuildRings : 0;
unsigned int flags = Cell::Flags::WarnOnUnplacedInstances;
flags |= (mode & KtBuildGlobalRouting) ? Cell::Flags::BuildRings : 0;
//if (not cell->isFlattenedNets()) cell->flattenNets( flags );
cell->flattenNets( flags );
@ -419,7 +419,7 @@ namespace Kite {
{
cmess1 << " o Back annotate global routing graph." << endl;
const Torus& chipCorona = getChipTools().getCorona();
//const Torus& chipCorona = getChipTools().getCorona();
int hEdgeCapacity = 0;
int vEdgeCapacity = 0;
@ -459,7 +459,7 @@ namespace Kite {
continue;
}
Box elementBb = element->getBoundingBox();
//Box elementBb = element->getBoundingBox();
//int elementCapacity = (chipCorona.contains(elementBb)) ? -hEdgeCapacity : -1;
int elementCapacity = -1;
@ -497,7 +497,7 @@ namespace Kite {
continue;
}
Box elementBb = element->getBoundingBox();
//Box elementBb = element->getBoundingBox();
//int elementCapacity = (chipCorona.contains(elementBb)) ? -vEdgeCapacity : -1;
int elementCapacity = -1;
@ -817,7 +817,7 @@ namespace Kite {
KatabaticEngine::finalizeLayout();
ltrace(90) << "State: " << getState() << endl;
getCell()->setFlags( Cell::Routed );
getCell()->setFlags( Cell::Flags::Routed );
ltraceout(90);
}

View File

@ -412,7 +412,7 @@ namespace Kite {
ltrace(149) << "Level: " << getEventLevel()
<< ", area: " << _segment->getFreedomDegree() << endl;
_preCheck( _segment );
//_preCheck( _segment );
_eventLevel = 0;
history.push( this );

View File

@ -247,7 +247,7 @@ namespace Kite {
# if !defined(NDEBUG)
# define _preCheck(segment) \
DbU::Unit beforeMin = segment->base()->getSourcePosition(); \
DbU::Unit beforeMin = segment->base()->getSourcePosition(); \
DbU::Unit beforeMax = segment->base()->getTargetPosition(); \
segment->base()->checkPositions (); \
if ( Session::getSegmentStackSize() ) \

View File

@ -154,7 +154,7 @@ namespace Knik {
KnikEngine* knik = KnikEngine::get ( cell );
if ( !knik ) {
if ( cell->getRubbers().getFirst() == NULL )
cell->flattenNets ( ((mode==BuildSolution)?Cell::BuildRings:0) );
cell->flattenNets ( ((mode==BuildSolution)?Cell::Flags::BuildRings:0) );
knik = KnikEngine::create ( cell
, _congestion
, _preCongestion
@ -178,7 +178,7 @@ namespace Knik {
//emit cellPreModificated();
cell->flattenNets ( Cell::BuildRings );
cell->flattenNets ( Cell::Flags::BuildRings );
//emit cellPostModificated();
}

View File

@ -159,7 +159,7 @@ DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc)
{
DTYPE xs[MAXD], ys[MAXD], minval, l, xu, xl, yu, yl;
int s[MAXD];
int i, j, k, minidx;
int i, j, minidx;
struct point pt[MAXD], *ptp[MAXD], *tmpp;
if (d==2)
@ -206,17 +206,20 @@ DTYPE flute_wl(int d, DTYPE x[], DTYPE y[], int acc)
}
#if REMOVE_DUPLICATE_PIN==1
ptp[d] = &pt[d];
ptp[d]->x = ptp[d]->y = -999999;
j = 0;
for (i=0; i<d; i++) {
for (k=i+1; ptp[k]->x == ptp[i]->x; k++)
if (ptp[k]->y == ptp[i]->y) // pins k and i are the same
break;
if (ptp[k]->x != ptp[i]->x)
ptp[j++] = ptp[i];
{
int k;
ptp[d] = &pt[d];
ptp[d]->x = ptp[d]->y = -999999;
j = 0;
for (i=0; i<d; i++) {
for (k=i+1; ptp[k]->x == ptp[i]->x; k++)
if (ptp[k]->y == ptp[i]->y) // pins k and i are the same
break;
if (ptp[k]->x != ptp[i]->x)
ptp[j++] = ptp[i];
}
d = j;
}
d = j;
#endif
for (i=0; i<d; i++) {
@ -597,7 +600,7 @@ FTree flute(int d, DTYPE x[], DTYPE y[], int acc)
{
DTYPE *xs, *ys, minval;
int *s;
int i, j, k, minidx;
int i, j, minidx;
struct point *pt, **ptp, *tmpp;
FTree t;
@ -645,17 +648,20 @@ FTree flute(int d, DTYPE x[], DTYPE y[], int acc)
}
#if REMOVE_DUPLICATE_PIN==1
ptp[d] = &pt[d];
ptp[d]->x = ptp[d]->y = -999999;
j = 0;
for (i=0; i<d; i++) {
for (k=i+1; ptp[k]->x == ptp[i]->x; k++)
if (ptp[k]->y == ptp[i]->y) // pins k and i are the same
break;
if (ptp[k]->x != ptp[i]->x)
ptp[j++] = ptp[i];
{
int k;
ptp[d] = &pt[d];
ptp[d]->x = ptp[d]->y = -999999;
j = 0;
for (i=0; i<d; i++) {
for (k=i+1; ptp[k]->x == ptp[i]->x; k++)
if (ptp[k]->y == ptp[i]->y) // pins k and i are the same
break;
if (ptp[k]->x != ptp[i]->x)
ptp[j++] = ptp[i];
}
d = j;
}
d = j;
#endif
for (i=0; i<d; i++) {

View File

@ -134,8 +134,6 @@ void extract_heap(node_pair *np)
void init_param()
{
int i;
heap = (node_pair*)malloc(sizeof(node_pair)*(max_heap_size+1));
}

View File

@ -24,7 +24,7 @@ void allocate_heap( long n )
_heap = (Heap*)realloc( (void*)_heap, (size_t)(n+1)*sizeof(Heap) );
if( ! _heap )
{
err_exit( "Cannot reallocate memory in allocate_heap!" );
err_exit( (char*)"Cannot reallocate memory in allocate_heap!" );
}
_max_heap_size = n;
}

View File

@ -39,7 +39,7 @@ void allocate_nn_arrays( long n )
aux = (long*)realloc( (void*)aux, (size_t)n*sizeof(long) );
if( !nn || !sheared || !sorted || !aux )
{
err_exit( "Cannot allocate memory in allocate_nn_arrays!" );
err_exit( (char*)"Cannot allocate memory in allocate_nn_arrays!" );
}
max_arrays_size = n;
}

View File

@ -250,8 +250,9 @@ namespace Utilities {
unsigned int Path::mode () const
{
struct stat bstat;
int status = 0;
status = ::stat( toString().c_str(), &bstat );
//int status = 0;
//status =
::stat( toString().c_str(), &bstat );
// Should check for errno here.
return bstat.st_mode;