diff --git a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy index 71133cb6..2bf1f56d 100644 --- a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy +++ b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy @@ -120,9 +120,9 @@ namespace Vst { } - typedef vector PinVector; - typedef map VectorMap; - typedef map CellVectorMap; + typedef vector PinVector; + typedef map VectorMap; + typedef map CellVectorMap; class YaccState { diff --git a/crlcore/src/ccore/toolbox/NamingScheme.cpp b/crlcore/src/ccore/toolbox/NamingScheme.cpp index 0625b1ca..0c904bf6 100644 --- a/crlcore/src/ccore/toolbox/NamingScheme.cpp +++ b/crlcore/src/ccore/toolbox/NamingScheme.cpp @@ -23,6 +23,7 @@ namespace CRL { using namespace std; using Hurricane::ForEachIterator; + using Hurricane::Entity; using Hurricane::Net; using Hurricane::Cell; using Hurricane::Instance; @@ -109,16 +110,14 @@ namespace CRL { topCell->setName( converter(topCell->getName()) ); vector nets; - forEach ( Net*, inet, topCell->getNets() ) nets.push_back( *inet ); - for ( auto net : nets ) { - net->setName( converter( net->getName() ) ); - } + for ( Net* net : topCell->getNets() ) nets.push_back( net ); + for ( auto net : nets ) net->setName( converter( net->getName() ) ); - vector instances; - set models; - forEach ( Instance*, iinst, topCell->getInstances() ) { - instances.push_back( *iinst ); - models.insert( iinst->getMasterCell() ); + vector instances; + set models; + for ( Instance* inst : topCell->getInstances() ) { + instances.push_back( inst ); + models.insert( inst->getMasterCell() ); } for ( auto inst : instances ) inst->setName( converter( inst->getName() ) ); diff --git a/crlcore/src/ccore/toolbox/ToVhdlName.cpp b/crlcore/src/ccore/toolbox/ToVhdlName.cpp index cff763a2..b0a09921 100644 --- a/crlcore/src/ccore/toolbox/ToVhdlName.cpp +++ b/crlcore/src/ccore/toolbox/ToVhdlName.cpp @@ -62,14 +62,14 @@ namespace CRL { if (not topCell) return; vector nets; - forEach ( Net*, inet, topCell->getNets() ) nets.push_back( *inet ); - for ( auto net : nets ) net->setName( vlogToVhdl( inet->getName() ) ); + for ( Net* net : topCell->getNets() ) nets.push_back( net ); + for ( auto net : nets ) net->setName( vlogToVhdl( net->getName() ) ); - vector instances; - set models; - forEach ( Instance*, iinst, topCell->getInstances() ) { - instances.push_back( *iinst ); - models.insert( iinst->getMasterCell() ); + vector instances; + set models; + for ( Instance* inst : topCell->getInstances() ) { + instances.push_back( inst ); + models.insert( inst->getMasterCell() ); } for ( auto inst : instances ) inst->setName( vlogToVhdl( inst->getName() ) ); diff --git a/crlcore/src/ccore/toolbox/ToolBox.cpp b/crlcore/src/ccore/toolbox/ToolBox.cpp index dfacf65c..1a219cb8 100644 --- a/crlcore/src/ccore/toolbox/ToolBox.cpp +++ b/crlcore/src/ccore/toolbox/ToolBox.cpp @@ -533,9 +533,9 @@ void ConnectPlugHooks(Cell* cell) } - size_t _getInstancesCount ( const Cell* cell, map& gatesByMaster ) + size_t _getInstancesCount ( const Cell* cell, map& gatesByMaster ) { - map::iterator imaster = gatesByMaster.find ( cell ); + map::iterator imaster = gatesByMaster.find ( cell ); if ( imaster != gatesByMaster.end() ) return imaster->second; @@ -556,7 +556,7 @@ void ConnectPlugHooks(Cell* cell) size_t getInstancesCount ( const Cell* cell ) { - map gatesByMaster; + map gatesByMaster; return _getInstancesCount ( cell, gatesByMaster ); } diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index fa955bb2..60e9df28 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -996,8 +996,8 @@ Cell* Cell::getClone() } bool isPlaced = true; - for ( Instance* iinstance : getInstances() ) { - if (iinstance->getClone(clone)->getPlacementStatus() == Instance::PlacementStatus::UNPLACED) + for ( Instance* instance : getInstances() ) { + if (instance->getClone(clone)->getPlacementStatus() == Instance::PlacementStatus::UNPLACED) isPlaced = false; } if (isPlaced) clone->setFlags( Flags::Placed ); diff --git a/hurricane/src/hurricane/CellCollections.cpp b/hurricane/src/hurricane/CellCollections.cpp index 4b0d149c..7b3a4309 100644 --- a/hurricane/src/hurricane/CellCollections.cpp +++ b/hurricane/src/hurricane/CellCollections.cpp @@ -1653,7 +1653,7 @@ class Cell_SubCells : public Collection { public: typedef Hurricane::Locator Inherit; - private: set _cellSet; + private: set _cellSet; private: InstanceLocator _instanceLocator; public: Locator(); diff --git a/hurricane/src/hurricane/Component.cpp b/hurricane/src/hurricane/Component.cpp index d750eae8..23678d95 100644 --- a/hurricane/src/hurricane/Component.cpp +++ b/hurricane/src/hurricane/Component.cpp @@ -164,7 +164,7 @@ class Component_ConnexComponents : public Collection { public: typedef Hurricane::Locator Inherit; private: const Component* _component; - private: set _componentSet; + private: set _componentSet; private: stack _componentStack; public: Locator(const Component* component = NULL); @@ -232,7 +232,7 @@ class Component_SlaveComponents : public Collection { public: typedef Hurricane::Locator Inherit; private: const Component* _component; - private: set _componentSet; + private: set _componentSet; private: stack _componentStack; public: Locator(const Component* component = NULL); diff --git a/hurricane/src/hurricane/Occurrence.cpp b/hurricane/src/hurricane/Occurrence.cpp index 63a16ff8..b6a84473 100644 --- a/hurricane/src/hurricane/Occurrence.cpp +++ b/hurricane/src/hurricane/Occurrence.cpp @@ -88,8 +88,21 @@ bool Occurrence::operator!=(const Occurrence& occurrence) const bool Occurrence::operator<(const Occurrence& occurrence) const // ******************************************************** { - return ((_entity < occurrence._entity) || - ((_entity == occurrence._entity) && (_sharedPath < occurrence._sharedPath))); + if (not _entity and not occurrence._entity) return false; + if (not _entity) return true; + if (not occurrence._entity) return false; + + if (_entity->getId() < occurrence._entity->getId()) return true; + if (_entity->getId() > occurrence._entity->getId()) return false; + + if (not _sharedPath and not occurrence._sharedPath) return false; + if (not _sharedPath) return true; + if (not occurrence._sharedPath) return false; + + return _sharedPath->getId() < occurrence._sharedPath->getId(); + +//return ((_entity < occurrence._entity) or +// ((_entity == occurrence._entity) and (_sharedPath < occurrence._sharedPath))); } Cell* Occurrence::getOwnerCell() const diff --git a/hurricane/src/hurricane/SharedName.cpp b/hurricane/src/hurricane/SharedName.cpp index c7b010dc..ca6e9e59 100644 --- a/hurricane/src/hurricane/SharedName.cpp +++ b/hurricane/src/hurricane/SharedName.cpp @@ -69,7 +69,7 @@ void SharedName::release() string SharedName::_getString() const // ********************************** { - return "<" + _TName("SharedName") + " " + getString(_count) + " " + _string + ">"; + return "<" + _TName("SharedName") + " " + getString(_count) + " id:" + getString(_id) + " " + _string + ">"; } Record* SharedName::_getRecord() const diff --git a/hurricane/src/hurricane/hurricane/IntrusiveMap.h b/hurricane/src/hurricane/hurricane/IntrusiveMap.h index 0e36cad1..31c84223 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveMap.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveMap.h @@ -132,17 +132,29 @@ template class IntrusiveMap { public: virtual void progress() // **************************** { - if (_element) { - _element = _map->_getNextElement(_element); - if (!_element) { - unsigned length = _map->_getLength(); - if (_index < length) { - do { - _element = _map->_getArray()[_index++]; - } while (!_element && (_index < length)); - } - } + if (_element) { + cdebug_log(0,0) << "IntrusiveMap::progress() from:" + << " -> " << tsetw(4) << _index + << " + " << _map->_getHashValue(_map->_getKey(_element)) + << "/" << _map->_getKey(_element) << ":" << _element << endl; + + _element = _map->_getNextElement(_element); + if (!_element) { + unsigned length = _map->_getLength(); + if (_index < length) { + do { + cdebug_log(0,0) << "next bucket: " << _index+1 << endl; + _element = _map->_getArray()[_index++]; + } while (!_element && (_index < length)); + } + + if (_element) + cdebug_log(0,0) << "IntrusiveMap::progress() to:" + << " -> " << tsetw(4) << _index + << " + " << _map->_getHashValue(_map->_getKey(_element)) + << "/" << _map->_getKey(_element) << ":" << _element << endl; } + } }; // Others @@ -393,7 +405,7 @@ template class IntrusiveMap { public: void _remove(Element* element) // *********************************** { - if (_contains(element)) { + if (_contains(element)) { unsigned index = (_getHashValue(_getKey(element)) / 8) % _length; Element* currentElement = _array[index]; if (currentElement) { @@ -418,32 +430,41 @@ template class IntrusiveMap { public: void _resize() // ******************* { - unsigned newLength = _length; - double ratio = (double)_size / (double)_length; - if (ratio < 3) - newLength = max(_size / 8, (unsigned)1); - else if (10 < ratio) - newLength = min(_size / 5, (unsigned)512); + unsigned newLength = _length; + double ratio = (double)_size / (double)_length; + if (ratio < 3.0) newLength = max(_size / 8, (unsigned)1); + else if (ratio > 10.0) newLength = min(_size / 5, (unsigned)512); - if (newLength != _length) { - // cerr << "Resizing: " << this << " " << _length << " " << newLength << endl; - unsigned oldLength = _length; - Element** oldArray = _array; - _length = newLength; - _array = new Element*[_length]; - memset(_array, 0, _length * sizeof(Element*)); - for (unsigned index = 0; index < oldLength; index++) { - Element* element = oldArray[index]; - while (element) { - Element* nextElement = _getNextElement(element); - unsigned newIndex = (_getHashValue(_getKey(element)) / 8) % _length; - _setNextElement(element, _array[newIndex]); - _array[newIndex] = element; - element = nextElement; - } - } - delete[] oldArray; + if (newLength != _length) { + cdebug_log(0,0) << "IntrusiveMap::_resize() " << _length << " -> " << newLength << endl; + + unsigned oldLength = _length; + Element** oldArray = _array; + _length = newLength; + _array = new Element* [_length]; + memset( _array, 0, _length * sizeof(Element*) ); + + for ( unsigned index = 0; index < oldLength; ++index ) { + Element* element = oldArray[index]; + if (not element) + cdebug_log(0,0) << "| entry:" << tsetw(4) << index << " empty" << endl; + + while ( element ) { + Element* nextElement = _getNextElement(element); + unsigned newIndex = (_getHashValue(_getKey(element)) / 8) % _length; + _setNextElement(element, _array[newIndex]); + _array[ newIndex ] = element; + + cdebug_log(0,0) << "| entry:" << tsetw(4) << index + << " -> " << tsetw(4) << newIndex + << " + " << _getHashValue(_getKey(element)) + << "/" << _getKey(element) << ":" << element << endl; + + element = nextElement; + } } + delete [] oldArray; + } }; }; diff --git a/hurricane/src/hurricane/hurricane/IntrusiveSet.h b/hurricane/src/hurricane/hurricane/IntrusiveSet.h index 52605642..4da23905 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveSet.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveSet.h @@ -444,11 +444,12 @@ template class IntrusiveSet { unsigned newIndex = (_getHashValue(element) / 8) % _length; _setNextElement(element, _array[newIndex]); _array[newIndex] = element; - element = nextElement; cdebug_log(0,0) << "| bucket:" << tsetw(4) << index << " -> " << tsetw(4) << newIndex << " + " << element << endl; + + element = nextElement; } } delete[] oldArray;