diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index d4f54eb0..45825626 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -799,17 +799,10 @@ DeepNet* Cell::getDeepNet ( Path path, const Net* leafNet ) const if (not (_flags.isset(Flags::FlattenedNets))) return NULL; Occurrence rootNetOccurrence ( getHyperNetRootNetOccurrence(Occurrence(leafNet,path)) ); - - forEach ( Net*, inet, getNets() ) { - DeepNet* deepNet = dynamic_cast( *inet ); - if (not deepNet) continue; - - Occurrence deepNetOccurrence = deepNet->getRootNetOccurrence(); - if ( (rootNetOccurrence.getEntity() == deepNetOccurrence.getEntity()) - and (rootNetOccurrence.getPath () == deepNetOccurrence.getPath ()) ) - return deepNet; - } - return NULL; + DeepNet::Uplink* uplink = static_cast + ( rootNetOccurrence.getProperty( DeepNet::Uplink::staticGetName() )); + if (not uplink) return NULL; + return uplink->getUplink(); } void Cell::flattenNets (uint64_t flags ) diff --git a/hurricane/src/hurricane/DeepNet.cpp b/hurricane/src/hurricane/DeepNet.cpp index acfef581..34196ce0 100644 --- a/hurricane/src/hurricane/DeepNet.cpp +++ b/hurricane/src/hurricane/DeepNet.cpp @@ -57,6 +57,7 @@ namespace Hurricane { , _netOccurrence(netOccurrence) { cdebug_log(18,0) << "DeepNet::DeepNet() " << getCell() << " " << this << endl; + _netOccurrence.put( Uplink::create(this) ); } @@ -83,6 +84,14 @@ namespace Hurricane { } + void DeepNet::_preDestroy () + { + _netOccurrence.removeProperty( Uplink::staticGetName() ); + Inherit::_preDestroy(); + } + + + size_t DeepNet::_createRoutingPads ( unsigned int flags ) { cdebug_log(18,1) << "DeepNet::_createRoutingPads(): " << this << endl; @@ -207,4 +216,55 @@ namespace Hurricane { } + +// ------------------------------------------------------------------- +// Class : "Uplink" + + Name DeepNet::Uplink::_name = "DeepNet::Uplink"; + + + DeepNet::Uplink* DeepNet::Uplink::create ( DeepNet* uplink ) + { + Uplink *property = new Uplink( uplink ); + property->_postCreate (); + return property; + } + + + void DeepNet::Uplink::onReleasedBy ( DBo* owner ) + { PrivateProperty::onReleasedBy( owner ); } + + + Name DeepNet::Uplink::getPropertyName () + { return _name; } + + + Name DeepNet::Uplink::getName () const + { return getPropertyName(); } + + + string DeepNet::Uplink::_getTypeName () const + { return _TName( "DeepNet::Uplink" ); } + + + string DeepNet::Uplink::_getString () const + { + string s = PrivateProperty::_getString (); + s.insert ( s.length() - 1 , " " + getString(_uplink) ); + + return s; + } + + + Record* DeepNet::Uplink::_getRecord () const + { + Record* record = PrivateProperty::_getRecord(); + if (record) { + record->add( getSlot( "_name" , _name ) ); + record->add( getSlot( "_uplink", _uplink ) ); + } + return record; + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/DeepNet.h b/hurricane/src/hurricane/hurricane/DeepNet.h index 0afd4045..49f87a16 100644 --- a/hurricane/src/hurricane/hurricane/DeepNet.h +++ b/hurricane/src/hurricane/hurricane/DeepNet.h @@ -29,9 +29,8 @@ // +-----------------------------------------------------------------+ -#ifndef HURRICANE_DEEPNET_H -#define HURRICANE_DEEPNET_H - +#pragma once +#include "hurricane/Property.h" #include "hurricane/Net.h" #include "hurricane/HyperNet.h" #include "hurricane/Occurrence.h" @@ -45,6 +44,23 @@ namespace Hurricane { class DeepNet : public Net { public: typedef Net Inherit; + public: + class Uplink : public Hurricane::PrivateProperty { + static Name _name; + public: + static Uplink* create ( DeepNet* uplink ); + static Name getPropertyName (); + virtual Name getName () const; + inline DeepNet* getUplink (); + virtual void onReleasedBy ( DBo* owner ); + virtual std::string _getTypeName () const; + virtual std::string _getString () const; + virtual Record* _getRecord () const; + protected: + DeepNet* _uplink; + protected: + inline Uplink ( DeepNet* uplink ); + }; public: static DeepNet* create ( HyperNet& hyperNet ); inline Occurrence getRootNetOccurrence () const; @@ -55,6 +71,7 @@ namespace Hurricane { virtual void _toJson ( JsonWriter* ) const; protected: DeepNet ( Occurrence& netOccurrence ); + virtual void _preDestroy (); protected: Occurrence _netOccurrence; @@ -66,6 +83,14 @@ namespace Hurricane { Net* getDeepNet(HyperNet& hyperNet); + inline DeepNet::Uplink::Uplink ( DeepNet* uplink ) + : PrivateProperty(), _uplink(uplink) + { } + + inline DeepNet* DeepNet::Uplink::getUplink () { return _uplink; } + + + // ------------------------------------------------------------------- // Class : "JsonDeepNet". @@ -83,5 +108,3 @@ namespace Hurricane { } // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::DeepNet); - -#endif