22 #include "hurricane/Flags.h"
23 #include "hurricane/Observer.h"
24 #include "hurricane/Signature.h"
25 #include "hurricane/Relation.h"
26 #include "hurricane/Pathes.h"
27 #include "hurricane/Entity.h"
28 #include "hurricane/Cells.h"
29 #include "hurricane/DeepNet.h"
30 #include "hurricane/Instance.h"
31 #include "hurricane/Pin.h"
32 #include "hurricane/Pins.h"
33 #include "hurricane/Slices.h"
34 #include "hurricane/ExtensionSlice.h"
35 #include "hurricane/Rubbers.h"
36 #include "hurricane/Markers.h"
37 #include "hurricane/Marker.h"
38 #include "hurricane/Reference.h"
39 #include "hurricane/Components.h"
40 #include "hurricane/Occurrences.h"
41 #include "hurricane/Transformation.h"
42 #include "hurricane/Layer.h"
43 #include "hurricane/QuadTree.h"
45 #include "hurricane/IntrusiveSet.h"
46 #include "hurricane/MapCollection.h"
47 #include "hurricane/NetAlias.h"
56 typedef multimap<Entity*,Entity*> SlaveEntityMap;
71 public:
typedef map<Name,ExtensionSlice*> ExtensionSliceMap;
73 public:
class Flags :
public BaseFlags {
75 enum Flag { NoFlags = 0
76 , BuildRings = (1 << 1)
77 , BuildClockRings = (1 << 2)
78 , BuildSupplyRings = (1 << 3)
79 , NoClockFlatten = (1 << 4)
80 , WarnOnUnplacedInstances = (1 << 5)
81 , StayOnPlugs = (1 << 6)
82 , MaskRings = BuildRings|BuildClockRings|BuildSupplyRings
84 , CellAboutToChange = (1 << 10)
85 , CellChanged = (1 << 11)
86 , CellDestroyed = (1 << 12)
88 , TerminalNetlist = (1 << 20)
92 , PowerFeed = (1 << 24)
93 , FlattenedNets = (1 << 25)
94 , AbstractedSupply = (1 << 26)
97 , SlavedAb = (1 << 29)
98 , Materialized = (1 << 30)
102 Flags ( uint64_t flags = NoFlags );
104 virtual std::string _getTypeName ()
const;
105 virtual std::string _getString ()
const;
108 class UniquifyRelation :
public Relation {
111 static UniquifyRelation* get (
const Cell* );
113 static Name staticGetName ();
114 Name getUniqueName ();
115 static std::string getTrunkName (
Name name );
116 virtual bool hasJson ()
const;
117 virtual void toJson ( JsonWriter*,
const DBo* )
const;
118 inline void _setOwner (
Cell* );
119 inline void _setDuplicates (
unsigned int );
120 virtual string _getTypeName ()
const;
121 virtual Record* _getRecord ()
const;
123 static const Name _name;
124 unsigned int _duplicates;
126 UniquifyRelation (
Cell* );
128 virtual void _preDestroy ();
133 static void initialize ();
134 JsonProperty (
unsigned long flags );
135 virtual string getTypeName ()
const;
136 virtual JsonProperty* clone (
unsigned long )
const;
142 static void initialize ();
143 JsonPropertyRef (
unsigned long flags );
144 virtual string getTypeName ()
const;
145 virtual JsonPropertyRef* clone (
unsigned long )
const;
157 virtual Cell* getElement ()
const;
159 virtual bool isValid ()
const;
160 virtual void progress ();
161 virtual string _getString ()
const;
167 inline ClonedSet (
const Cell* cell );
168 inline ClonedSet (
const ClonedSet& );
171 virtual string _getString ()
const;
176 class SlavedsRelation :
public Relation {
179 static SlavedsRelation* get (
const Cell* );
181 static Name staticGetName ();
182 virtual bool hasJson ()
const;
183 virtual void toJson ( JsonWriter*,
const DBo* )
const;
184 inline void _setOwner (
Cell* );
185 virtual string _getTypeName ()
const;
186 virtual Record* _getRecord ()
const;
188 static const Name _name;
190 SlavedsRelation (
Cell* );
192 virtual void _preDestroy ();
197 static void initialize ();
198 JsonProperty (
unsigned long flags );
199 virtual string getTypeName ()
const;
200 virtual JsonProperty* clone (
unsigned long )
const;
206 static void initialize ();
207 JsonPropertyRef (
unsigned long flags );
208 virtual string getTypeName ()
const;
209 virtual JsonPropertyRef* clone (
unsigned long )
const;
221 virtual Cell* getElement ()
const;
223 virtual bool isValid ()
const;
224 virtual void progress ();
225 virtual string _getString ()
const;
231 inline SlavedsSet (
const Cell* cell );
232 inline SlavedsSet (
const SlavedsSet& );
235 virtual string _getString ()
const;
240 class InstanceMap :
public IntrusiveMap<Name, Instance> {
243 public:
typedef IntrusiveMap<Name, Instance>
Inherit;
245 public: InstanceMap();
248 public:
virtual unsigned _getHashValue(
Name name)
const;
250 public:
virtual void _setNextElement(
Instance* instance,
Instance* nextInstance)
const;
254 public:
class SlaveInstanceSet :
public IntrusiveSet<Instance> {
257 public:
typedef IntrusiveSet<Instance>
Inherit;
259 public: SlaveInstanceSet();
261 public:
virtual unsigned _getHashValue(
Instance* slaveInstance)
const;
263 public:
virtual void _setNextElement(
Instance* slaveInstance,
Instance* nextSlaveInstance)
const;
267 public:
class NetMap :
public IntrusiveMapConst<Name, Net> {
270 public:
typedef IntrusiveMapConst<Name, Net>
Inherit;
274 public:
virtual const Name& _getKey(
Net* net)
const;
275 public:
virtual unsigned _getHashValue(
const Name& name)
const;
276 public:
virtual Net* _getNextElement(
Net* net)
const;
277 public:
virtual void _setNextElement(
Net* net,
Net* nextNet)
const;
281 class PinMap :
public IntrusiveMap<Name, Pin> {
284 public:
typedef IntrusiveMap<Name, Pin>
Inherit;
288 public:
virtual Name _getKey(
Pin* pin)
const;
289 public:
virtual unsigned _getHashValue(
Name name)
const;
290 public:
virtual Pin* _getNextElement(
Pin* pin)
const;
291 public:
virtual void _setNextElement(
Pin* pin,
Pin* nextPin)
const;
295 public:
class SliceMap :
public IntrusiveMap<const Layer*, Slice> {
298 public:
typedef IntrusiveMap<const Layer*, Slice>
Inherit;
302 public:
virtual const Layer* _getKey(
Slice* slice)
const;
303 public:
virtual unsigned _getHashValue(
const Layer* layer)
const;
304 public:
virtual Slice* _getNextElement(
Slice* slice)
const;
305 public:
virtual void _setNextElement(
Slice* slice,
Slice* nextSlice)
const;
309 public:
class MarkerSet :
public IntrusiveSet<Marker> {
312 public:
typedef IntrusiveSet<Marker>
Inherit;
316 public:
virtual unsigned _getHashValue(Marker* marker)
const;
317 public:
virtual Marker* _getNextElement(Marker* marker)
const;
318 public:
virtual void _setNextElement(Marker* marker, Marker* nextMarker)
const;
327 private:
Path _shuntedPath;
328 private: InstanceMap _instanceMap;
330 private: SlaveInstanceSet _slaveInstanceSet;
331 private: NetMap _netMap;
332 private: PinMap _pinMap;
333 private: SliceMap* _sliceMap;
334 private: ExtensionSliceMap _extensionSlices;
335 private: MarkerSet _markerSet;
336 private:
Box _abutmentBox;
337 private:
Box _boundingBox;
338 private:
Cell* _nextOfLibraryCellMap;
339 private:
Cell* _nextOfSymbolCellSet;
340 private: SlaveEntityMap _slaveEntityMap;
341 private: AliasNameSet _netAliasSet;
342 private: Observable _observers;
343 private: Flags _flags;
353 protected:
virtual void _postCreate();
355 protected:
virtual void _preDestroy();
357 public:
virtual string _getTypeName()
const {
return _TName(
"Cell");};
358 public:
virtual string _getString()
const;
359 public:
virtual Record* _getRecord()
const;
360 public:
static string getFlagString( uint64_t );
361 public:
static Record* getFlagRecord( uint64_t );
362 public:
static Slot* getFlagSlot( uint64_t );
364 public: InstanceMap& _getInstanceMap() {
return _instanceMap;};
365 public:
QuadTree* _getQuadTree() {
return _quadTree;};
366 public: SlaveInstanceSet& _getSlaveInstanceSet() {
return _slaveInstanceSet;};
367 public: NetMap& _getNetMap() {
return _netMap;};
368 public: PinMap& _getPinMap() {
return _pinMap;};
369 public: SliceMap* _getSliceMap() {
return _sliceMap;};
370 public: ExtensionSliceMap& _getExtensionSliceMap() {
return _extensionSlices;};
371 public: MarkerSet& _getMarkerSet() {
return _markerSet;};
372 public:
Cell* _getNextOfLibraryCellMap()
const {
return _nextOfLibraryCellMap;};
373 public:
Cell* _getNextOfSymbolCellSet()
const {
return _nextOfSymbolCellSet;};
374 public: AliasNameSet& _getNetAliasSet() {
return _netAliasSet; }
376 public:
void _setNextOfLibraryCellMap(
Cell* cell) {_nextOfLibraryCellMap = cell;};
377 public:
void _setNextOfSymbolCellSet(
Cell* cell) {_nextOfSymbolCellSet = cell;};
379 public:
void _addNetAlias(NetAliasName* alias) { _netAliasSet.insert(alias); }
380 public:
void _removeNetAlias(NetAliasName* alias) { _netAliasSet.erase(alias); }
382 public:
void _fit(
const Box& box);
383 public:
void _unfit(
const Box& box);
385 public:
void _addSlaveEntity(
Entity* entity,
Entity* slaveEntity);
386 public:
void _removeSlaveEntity(
Entity* entity,
Entity* slaveEntity);
387 public:
void _getSlaveEntities(SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end);
388 public:
void _getSlaveEntities(
Entity* entity, SlaveEntityMap::iterator& begin, SlaveEntityMap::iterator& end);
389 public:
void _insertSlice(ExtensionSlice*);
390 public:
void _removeSlice(ExtensionSlice*);
391 public:
void _slaveAbutmentBox(
Cell*);
392 public:
void _setShuntedPath(
Path path) { _shuntedPath=path; }
393 protected:
void _setAbutmentBox(
const Box& abutmentBox);
395 public:
virtual void _toJson(JsonWriter*)
const;
396 public:
virtual void _toJsonCollections(JsonWriter*)
const;
402 public:
static Cell* fromJson(
const string& filename);
407 public:
virtual Cell* getCell()
const {
return (
Cell*)
this;};
408 public:
virtual Box getBoundingBox()
const;
410 public:
string getHierarchicalName()
const;
412 public:
const Flags& getFlags()
const {
return _flags; }
413 public: Flags& getFlags() {
return _flags; }
414 public: Path getShuntedPath()
const {
return _shuntedPath; }
415 public: Entity* getEntity(
const Signature&)
const;
418 public:
Instances getPlacedInstances()
const;
419 public:
Instances getFixedInstances()
const;
420 public:
Instances getUnplacedInstances()
const;
421 public:
Instances getNotUnplacedInstances()
const;
423 public:
Instances getPlacedInstancesUnder(
const Box& area)
const;
424 public:
Instances getFixedInstancesUnder(
const Box& area)
const;
425 public:
Instances getUnplacedInstancesUnder(
const Box& area)
const;
426 public:
Instances getNotUnplacedInstancesUnder(
const Box& area)
const;
428 public:
Instances getTerminalInstances()
const;
429 public:
Instances getTerminalInstancesUnder(
const Box& area)
const;
430 public:
Instances getNonTerminalInstances()
const;
431 public:
Instances getNonTerminalInstancesUnder(
const Box& area)
const;
432 public:
Instances getTerminalNetlistInstances()
const;
433 public:
Instances getTerminalNetlistInstancesUnder(
const Box& area)
const;
434 public:
Instances getNonTerminalNetlistInstances()
const;
435 public:
Instances getNonTerminalNetlistInstancesUnder(
const Box& area)
const;
437 public: DeepNet* getDeepNet(
Path,
const Net* )
const;
444 public:
Nets getPowerNets()
const;
445 public:
Nets getGroundNets()
const;
446 public:
Pin* getPin(
const Name& name)
const {
return _pinMap.getElement(name);};
447 public:
Pins getPins()
const {
return _pinMap.getElements();};
450 public:
const ExtensionSliceMap& getExtensionSliceMap()
const {
return _extensionSlices; };
451 public: ExtensionSlice* getExtensionSlice(
const Name& name)
const;
452 public: ExtensionSlices getExtensionSlices(ExtensionSlice::Mask mask=~0)
const;
455 public: Markers getMarkers()
const {
return _markerSet.getElements();};
456 public: Markers getMarkersUnder(
const Box& area)
const;
457 public: References getReferences()
const;
463 public:
Occurrences getTerminalInstanceOccurrencesUnder(
const Box& area)
const;
465 public:
Occurrences getTerminalNetlistInstanceOccurrencesUnder(
const Box& area)
const;
469 public:
Occurrences getHyperNetRootNetOccurrences()
const;
470 public: ExtensionSlice::Mask getExtensionSliceMask (
const Name& name )
const;
471 public:
Gos getExtensionGos (
const Name& name )
const;
472 public:
Gos getExtensionGos ( ExtensionSlice::Mask mask = ~0 )
const;
473 public:
Gos getExtensionGosUnder (
const Box& area,
const Name& name )
const;
474 public:
Gos getExtensionGosUnder (
const Box& area, ExtensionSlice::Mask mask = ~0 )
const;
475 public:
Cells getSubCells()
const;
476 public:
Cells getClonedCells()
const;
477 public:
Cell* getCloneMaster()
const;
478 public:
Pathes getRecursiveSlavePathes()
const;
485 public:
bool isTerminal()
const {
return _instanceMap.isEmpty();};
490 public:
bool isPad()
const {
return _flags.isset(Flags::Pad);};
491 public:
bool isFeed()
const {
return _flags.isset(Flags::Feed);};
492 public:
bool isDiode()
const {
return _flags.isset(Flags::Diode);};
493 public:
bool isPowerFeed()
const {
return _flags.isset(Flags::PowerFeed);};
494 public:
bool isFlattenedNets()
const {
return _flags.isset(Flags::FlattenedNets);};
495 public:
bool isAbstractedSupply()
const {
return _flags.isset(Flags::AbstractedSupply);};
496 public:
bool isPlaced()
const {
return _flags.isset(Flags::Placed);};
497 public:
bool isRouted()
const {
return _flags.isset(Flags::Routed);};
498 public:
bool isNetAlias(
const Name& name)
const;
505 public:
void slaveAbutmentBox(
Cell*);
506 public:
void unslaveAbutmentBox(
Cell*);
508 public:
void setPad(
bool state) {_flags.set(Flags::Pad,state);};
509 public:
void setFeed(
bool state) {_flags.set(Flags::Feed,state);};
510 public:
void setDiode(
bool state) {_flags.set(Flags::Diode,state);};
511 public:
void setPowerFeed(
bool state) {_flags.set(Flags::PowerFeed,state);};
512 public:
void setRouted(
bool state) {_flags.set(Flags::Routed,state);};
513 public:
void setAbstractedSupply(
bool state) { _flags.set(Flags::AbstractedSupply,state); };
514 public:
void flattenNets(uint64_t flags=Flags::BuildRings);
515 public:
void flattenNets(
const Instance* instance, uint64_t flags=Flags::BuildRings);
516 public:
void flattenNets(
const Instance* instance,
const std::set<std::string>& excludeds, uint64_t flags=Flags::BuildRings);
517 public:
void createRoutingPadRings(uint64_t flags=Flags::BuildRings);
518 public:
void setFlags(uint64_t flags) { _flags |= flags; }
519 public:
void resetFlags(uint64_t flags) { _flags &= ~flags; }
520 public:
bool updatePlacedFlag();
524 public:
void uniquify(
unsigned int depth=std::numeric_limits<unsigned int>::max());
525 public:
void addObserver(BaseObserver*);
526 public:
void removeObserver(BaseObserver*);
527 public:
void notify(
unsigned flags);
528 public:
void destroyPhysical();
532 inline Cell::ClonedSet::Locator::Locator (
const Locator& other )
534 , _dboLocator(other._dboLocator)
537 inline Cell::ClonedSet::ClonedSet (
const Cell* cell )
542 inline Cell::ClonedSet::ClonedSet (
const ClonedSet& other )
548 inline void Cell::UniquifyRelation::_setOwner ( Cell* owner ) { _setMasterOwner(owner); }
549 inline void Cell::UniquifyRelation::_setDuplicates (
unsigned int duplicates ) { _duplicates=duplicates; }
552 inline Cell::SlavedsSet::Locator::Locator (
const Locator& other )
554 , _dboLocator(other._dboLocator)
557 inline Cell::SlavedsSet::SlavedsSet (
const Cell* cell )
562 inline Cell::SlavedsSet::SlavedsSet (
const SlavedsSet& other )
568 inline void Cell::SlavedsRelation::_setOwner ( Cell* owner ) { _setMasterOwner(owner); }
571 class JsonCell :
public JsonEntity {
574 public:
static void initialize();
575 public: JsonCell(
unsigned long flags);
576 public:
virtual ~JsonCell();
577 public:
virtual string getTypeName()
const;
578 public:
virtual JsonCell* clone(
unsigned long)
const;
579 public:
virtual void toData(JsonStack&);
580 private: Cell* _cell;
581 private:
bool _materializationState;
588 INSPECTOR_P_SUPPORT(Hurricane::Cell::Flags);
589 INSPECTOR_P_SUPPORT(Hurricane::Cell::InstanceMap);
590 INSPECTOR_P_SUPPORT(Hurricane::Cell::SlaveInstanceSet);
591 INSPECTOR_P_SUPPORT(Hurricane::Cell::NetMap);
592 INSPECTOR_P_SUPPORT(Hurricane::Cell::PinMap);
593 INSPECTOR_P_SUPPORT(Hurricane::Cell::SliceMap);
594 INSPECTOR_P_SUPPORT(Hurricane::Cell::MarkerSet);
595 INSPECTOR_PR_SUPPORT(Hurricane::Cell::SlavedsRelation);
Box description (API)
Definition: Box.h:31
The model (API).
Definition: Cell.h:64
const Name & getName() const
Definition: Cell.h:411
bool isUniquifyMaster() const
Components getComponentsUnder(const Box &area, const Layer::Mask &mask=~0) const
Nets getInternalNets() const
const Box & getAbutmentBox() const
Definition: Cell.h:479
Components getComponents(const Layer::Mask &mask=~0) const
Nets getGlobalNets() const
bool isCalledBy(Cell *cell) const
Nets getClockNets() const
Occurrences getTerminalInstanceOccurrences() const
Instances getInstancesUnder(const Box &area, DbU::Unit threshold=0) const
void setTerminalNetlist(bool state)
Definition: Cell.h:507
Rubbers getRubbers() const
Rubbers getRubbersUnder(const Box &area) const
Occurrences getTerminalNetlistInstanceOccurrences(const Instance *topInstance=NULL) const
bool isTerminalNetlist() const
Definition: Cell.h:486
Net * getNet(const Name &name, bool useAlias=true) const
Instances getSlaveInstances() const
bool isUniquified() const
Nets getNets() const
Definition: Cell.h:438
Occurrences getNonTerminalNetlistInstanceOccurrences(const Instance *topInstance=NULL) const
void uniquify(unsigned int depth=std::numeric_limits< unsigned int >::max())
Nets getExternalNets() const
Library * getLibrary() const
Definition: Cell.h:409
Instances getInstances() const
Definition: Cell.h:417
bool isTerminal() const
Definition: Cell.h:485
void setAbutmentBox(const Box &abutmentBox)
Occurrences getOccurrences(unsigned searchDepth=std::numeric_limits< unsigned int >::max()) const
Slices getSlices(const Layer::Mask &mask=~0) const
Instance * getInstance(const Name &name) const
Definition: Cell.h:416
Slice * getSlice(const Layer *layer) const
Definition: Cell.h:448
Nets getSupplyNets() const
void setName(const Name &name)
static Cell * create(Library *library, const Name &name)
Occurrences getOccurrencesUnder(const Box &area, unsigned searchDepth=std::numeric_limits< unsigned int >::max(), DbU::Unit threshold=0) const
Collection description (API)
Definition: Collection.h:39
DataBase object root class (API).
Definition: DBo.h:45
std::int64_t Unit
Definition: DbU.h:67
Occurrenceable objects root class (API).
Definition: Entity.h:37
Generic Collection auto-pointer.
Definition: Collection.h:235
Instance description (API)
Definition: Instance.h:35
Support for JSON export.
Definition: JsonObject.h:83
JSON Parser Stack.
Definition: JsonObject.h:249
Layer description (API)
Definition: Layer.h:52
Hurricane::Mask< unsigned long long > Mask
Definition: Layer.h:65
Library description (API)
Definition: Library.h:38
Locator description (API)
Definition: Locator.h:33
Name description (API)
Definition: Name.h:35
Net description (API)
Definition: Net.h:48
Pad description (API)
Definition: Pad.h:36
Path description (API)
Definition: Path.h:35
Pin description (API)
Definition: Pin.h:41
QuadTree description (API)
Definition: QuadTree.h:33
Relation description (API)
Definition: Relation.h:33
Slice description (API)
Definition: Slice.h:38
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5