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.
This commit is contained in:
Jean-Paul Chaput 2019-02-26 19:56:29 +01:00
parent 9f69230837
commit e704306cad
4 changed files with 69 additions and 33 deletions

View File

@ -69,33 +69,45 @@ Instance* instance = cell->getSlaveInstances().getFirst();
* *
* For the Transistor device: * For the Transistor device:
* *
* -# The netlist is fixed and generated (in C++) in the Transistor, by * -# The netlist is fixed and generated (in C++) in the Transistor, by
* instanciating one MetaTransistor. * instanciating one MetaTransistor.
* -# The layout is generated <em>on the fly</em> by calling the relevant *
* python sceript. * -# The layout is generated <em>on the fly</em> by calling the relevant
* -# The parameters, which are commons to all the Transistor based * python script.
* devices are created in TransistorFamily. The parameters are created *
* through the Device parameter factory and stored at the Device level. * -# The parameters, which are commons to all the Transistor based
* A pointer to the concrete type of Parameter is also kept at the * devices are created in TransistorFamily. The parameters are created
* TransistorFamily level. * through the Device parameter factory and stored at the Device level.
* -# The Device::getParameters() method is implemented at this level * A pointer to the concrete type of Parameter is also kept at the
* and returns a TransistorArguments pointer. * TransistorFamily level.
* -# Parameters are used to set up the Device characteristics, either *
* programmatically or through the <code>Pharos</code> graphical * -# The Device::getParameters() method is implemented at this level
* interface. * and returns a reference to the set of parameters.
* -# <code>Arguments</code>, on the other hand, are mostly used to *
* transmit the setting of a Device (i.e. it's Parameters values) * -# Parameters are used to set up the Device characteristics, either
* to the Python script in charge of the layout generation. * programmatically or through the graphical interface.
* Arguments have Python wrapper PyArguments, and it is copies of *
* the values that are transmitted. * The layout Python generation scripts also uses the Parameter
* to know the settings of a device.
*
* Deprecateds:
*
* -# <code>Arguments</code> where fully redundant with Parameters, so
* we did remove them.
*
* <b>The Arguments must be removed from the UML schema.</b>
* *
* *
* \subsection ssecOpenQuestions Open questions * \subsection ssecOpenQuestions Open questions
* *
* -# As Arguments are used to transmit parameters, why not simply * -# In Bora::channelRouting, what is implemented is in fact an
* encapsulate Parameters in a Python wrapper? Thus completly * interval tree (or segment tree). We should try to use their
* suppressing Arguments. And by the way, using pointers to * \c Boost implementation.
* to make the relationship bi-directionnal (event if it's not *
* needed now). * -# 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.
*/ */

View File

@ -1584,7 +1584,21 @@ Name Cell::NetMap::_getKey(Net* net) const
unsigned Cell::NetMap::_getHashValue(Name name) 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 ; i<s.size() ; ++i ) {
sum4 |= ((unsigned long)s[i]) << ((i%4) * 8);
if (i%4 == 3) {
hash += sum4;
sum4 = 0;
}
}
hash += sum4;
return hash;
//return (unsigned int)name._getSharedName()->getId() / 8;
} }
Net* Cell::NetMap::_getNextElement(Net* net) const Net* Cell::NetMap::_getNextElement(Net* net) const

View File

@ -34,11 +34,11 @@ namespace Hurricane {
// **************************************************************************************************** // ****************************************************************************************************
unsigned int Entity::_memoryLimit = 0; unsigned int Entity::_memoryLimit = 0;
unsigned long Entity::_flags = 0; unsigned long Entity::_flags = 0;
unsigned int Entity::_nextId = 0; unsigned int Entity::_nextId = 0;
unsigned int Entity::_idCounterLimit = 0; unsigned int Entity::_idCounterLimit = 0;
unsigned int Entity::_idCounter = 1; unsigned int Entity::_idCounter = 1;
void Entity::setIdCounterLimit ( unsigned int limit ) 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() void Entity::_preDestroy()
{ {
//ltrace(10) << "Entity::_preDestroy() - " << (void*)this << endl; //ltrace(10) << "Entity::_preDestroy() - " << (void*)this << endl;

View File

@ -40,8 +40,8 @@ namespace Hurricane {
public: public:
typedef DBo Inherit; typedef DBo Inherit;
public: public:
enum EntityFlags { ForcedIdMode = (1<<0) enum EntityFlags { ForcedIdMode = (1<<0)
, NextIdSet = (1<<1) , NextIdSet = (1<<1)
}; };
public: public:
static void setMemoryLimit ( unsigned int ); static void setMemoryLimit ( unsigned int );
@ -52,6 +52,7 @@ namespace Hurricane {
static bool inForcedIdMode (); static bool inForcedIdMode ();
static void enableForcedIdMode (); static void enableForcedIdMode ();
static void disableForcedIdMode (); static void disableForcedIdMode ();
static void useIdCounter2 ();
public: public:
inline unsigned int getId () const; inline unsigned int getId () const;
virtual Cell* getCell () const = 0; virtual Cell* getCell () const = 0;
@ -63,6 +64,7 @@ namespace Hurricane {
Quark* _getQuark ( SharedPath* sharedPath = NULL ) const; Quark* _getQuark ( SharedPath* sharedPath = NULL ) const;
protected: protected:
Entity (); Entity ();
virtual void _postCreate ();
virtual void _preDestroy (); virtual void _preDestroy ();
private: private:
static unsigned int _memoryLimit; static unsigned int _memoryLimit;