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:
*
* -# The netlist is fixed and generated (in C++) in the Transistor, by
* instanciating one MetaTransistor.
* -# The layout is generated <em>on the fly</em> 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 <code>Pharos</code> graphical
* interface.
* -# <code>Arguments</code>, 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 <em>on the fly</em> 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:
*
* -# <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
*
* -# 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.
*/

View File

@ -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 ; 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

View File

@ -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;

View File

@ -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;