From e704306cad9700b005b88dd9d853907e61c4d813 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 26 Feb 2019 19:56:29 +0100 Subject: [PATCH] More robust deterministic netmap. Use classic string hash. * Change: In Hurricane::Cell::NetMap, the hash function is now based on the string itself and not on the id of the SharedName. We now may remove the id attribute of the SharedName. This to ensure a more robust deterministic behavior. The sort order do not depend on whether we did use names before or not. --- hurricane/doc/analog/MainPage.dox | 60 +++++++++++++--------- hurricane/src/hurricane/Cell.cpp | 16 +++++- hurricane/src/hurricane/Entity.cpp | 20 +++++--- hurricane/src/hurricane/hurricane/Entity.h | 6 ++- 4 files changed, 69 insertions(+), 33 deletions(-) diff --git a/hurricane/doc/analog/MainPage.dox b/hurricane/doc/analog/MainPage.dox index 1d3d8ba1..f8ec3cde 100644 --- a/hurricane/doc/analog/MainPage.dox +++ b/hurricane/doc/analog/MainPage.dox @@ -69,33 +69,45 @@ Instance* instance = cell->getSlaveInstances().getFirst(); * * For the Transistor device: * - * -# The netlist is fixed and generated (in C++) in the Transistor, by - * instanciating one MetaTransistor. - * -# The layout is generated on the fly by calling the relevant - * python sceript. - * -# The parameters, which are commons to all the Transistor based - * devices are created in TransistorFamily. The parameters are created - * through the Device parameter factory and stored at the Device level. - * A pointer to the concrete type of Parameter is also kept at the - * TransistorFamily level. - * -# The Device::getParameters() method is implemented at this level - * and returns a TransistorArguments pointer. - * -# Parameters are used to set up the Device characteristics, either - * programmatically or through the Pharos graphical - * interface. - * -# Arguments, on the other hand, are mostly used to - * transmit the setting of a Device (i.e. it's Parameters values) - * to the Python script in charge of the layout generation. - * Arguments have Python wrapper PyArguments, and it is copies of - * the values that are transmitted. + * -# The netlist is fixed and generated (in C++) in the Transistor, by + * instanciating one MetaTransistor. + * + * -# The layout is generated on the fly by calling the relevant + * python script. + * + * -# The parameters, which are commons to all the Transistor based + * devices are created in TransistorFamily. The parameters are created + * through the Device parameter factory and stored at the Device level. + * A pointer to the concrete type of Parameter is also kept at the + * TransistorFamily level. + * + * -# The Device::getParameters() method is implemented at this level + * and returns a reference to the set of parameters. + * + * -# Parameters are used to set up the Device characteristics, either + * programmatically or through the graphical interface. + * + * The layout Python generation scripts also uses the Parameter + * to know the settings of a device. + * + * Deprecateds: + * + * -# Arguments where fully redundant with Parameters, so + * we did remove them. + * + * The Arguments must be removed from the UML schema. * * * \subsection ssecOpenQuestions Open questions * - * -# As Arguments are used to transmit parameters, why not simply - * encapsulate Parameters in a Python wrapper? Thus completly - * suppressing Arguments. And by the way, using pointers to - * to make the relationship bi-directionnal (event if it's not - * needed now). + * -# In Bora::channelRouting, what is implemented is in fact an + * interval tree (or segment tree). We should try to use their + * \c Boost implementation. + * + * -# In Bora::SlicingTree, whe should merge the list of user nodes + * (devices and hierarchical) with the routing nodes (channels and + * struts) to unify the underlying management. This sould enable + * us to move lots method implementation \e upward in the class + * hierarchy. */ diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 60e9df28..9549ced1 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -1584,7 +1584,21 @@ Name Cell::NetMap::_getKey(Net* net) const unsigned Cell::NetMap::_getHashValue(Name name) const // ************************************************** { - return (unsigned int)name._getSharedName()->getId() / 8; + unsigned long hash = 0; + unsigned long sum4 = 0; + const string& s = name._getSharedName()->_getSString(); + for ( size_t i=0 ; igetId() / 8; } Net* Cell::NetMap::_getNextElement(Net* net) const diff --git a/hurricane/src/hurricane/Entity.cpp b/hurricane/src/hurricane/Entity.cpp index a042a179..c18e7f8f 100644 --- a/hurricane/src/hurricane/Entity.cpp +++ b/hurricane/src/hurricane/Entity.cpp @@ -34,11 +34,11 @@ namespace Hurricane { // **************************************************************************************************** - unsigned int Entity::_memoryLimit = 0; - unsigned long Entity::_flags = 0; - unsigned int Entity::_nextId = 0; - unsigned int Entity::_idCounterLimit = 0; - unsigned int Entity::_idCounter = 1; + unsigned int Entity::_memoryLimit = 0; + unsigned long Entity::_flags = 0; + unsigned int Entity::_nextId = 0; + unsigned int Entity::_idCounterLimit = 0; + unsigned int Entity::_idCounter = 1; void Entity::setIdCounterLimit ( unsigned int limit ) @@ -99,7 +99,7 @@ namespace Hurricane { } } - return _idCounter++; + return ++_idCounter; } @@ -130,6 +130,14 @@ namespace Hurricane { } + void Entity::_postCreate() + { + Inherit::_postCreate(); + + //cerr << _getString() << endl; + } + + void Entity::_preDestroy() { //ltrace(10) << "Entity::_preDestroy() - " << (void*)this << endl; diff --git a/hurricane/src/hurricane/hurricane/Entity.h b/hurricane/src/hurricane/hurricane/Entity.h index 8ba92e52..ae8ef382 100644 --- a/hurricane/src/hurricane/hurricane/Entity.h +++ b/hurricane/src/hurricane/hurricane/Entity.h @@ -40,8 +40,8 @@ namespace Hurricane { public: typedef DBo Inherit; public: - enum EntityFlags { ForcedIdMode = (1<<0) - , NextIdSet = (1<<1) + enum EntityFlags { ForcedIdMode = (1<<0) + , NextIdSet = (1<<1) }; public: static void setMemoryLimit ( unsigned int ); @@ -52,6 +52,7 @@ namespace Hurricane { static bool inForcedIdMode (); static void enableForcedIdMode (); static void disableForcedIdMode (); + static void useIdCounter2 (); public: inline unsigned int getId () const; virtual Cell* getCell () const = 0; @@ -63,6 +64,7 @@ namespace Hurricane { Quark* _getQuark ( SharedPath* sharedPath = NULL ) const; protected: Entity (); + virtual void _postCreate (); virtual void _preDestroy (); private: static unsigned int _memoryLimit;