22#include "hurricane/Entity.h"
23#include "hurricane/Nets.h"
24#include "hurricane/Component.h"
25#include "hurricane/Rubbers.h"
26#include "hurricane/Rubber.h"
27#include "hurricane/RoutingPads.h"
28#include "hurricane/Plugs.h"
29#include "hurricane/Pins.h"
30#include "hurricane/Contacts.h"
31#include "hurricane/Segments.h"
32#include "hurricane/Verticals.h"
33#include "hurricane/Horizontals.h"
34#include "hurricane/Pads.h"
35#include "hurricane/IntrusiveSet.h"
36#include "hurricane/Path.h"
37#include "hurricane/NetAlias.h"
46class Net :
public Entity {
49 static FastRTTI _fastRTTI;
51 static inline const FastRTTI& fastRTTI ();
52 virtual const FastRTTI& vfastRTTI ()
const;
72 public:
Type& operator=(
const Type& type);
74 public:
operator const Code&()
const {
return _code;};
76 public:
const Code& getCode()
const {
return _code;};
78 public:
string _getTypeName()
const {
return _TName(
"Net::type"); };
79 public:
string _getString()
const;
80 public: Record* _getRecord()
const;
84 public:
class Direction {
112 public:
operator const Code&()
const {
return _code;};
114 public:
const Code& getCode()
const {
return _code;};
116 public:
string _getTypeName()
const {
return _TName(
"Net::Direction"); };
117 public:
string _getString()
const;
118 public: Record* _getRecord()
const;
122 class ComponentSet :
public IntrusiveSet<Component> {
125 public:
typedef IntrusiveSet<Component>
Inherit;
127 public: ComponentSet();
129 public:
virtual unsigned _getHashValue(Component* component)
const;
130 public:
virtual Component* _getNextElement(Component* component)
const;
131 public:
virtual void _setNextElement(Component* component, Component* nextComponent)
const;
135 class RubberSet :
public IntrusiveSet<Rubber> {
138 public:
typedef IntrusiveSet<Rubber> Inherit;
142 public:
virtual unsigned _getHashValue(Rubber* rubber)
const;
143 public:
virtual Rubber* _getNextElement(Rubber* rubber)
const;
144 public:
virtual void _setNextElement(Rubber* rubber, Rubber* nextRubber)
const;
151 private: Cell* _cell;
153 private:
Arity _arity;
154 private:
bool _isGlobal;
155 private:
bool _isExternal;
156 private:
bool _isAutomatic;
159 private: Point _position;
160 private: ComponentSet _componentSet;
161 private: RubberSet _rubberSet;
162 private: Net* _nextOfCellNetMap;
163 private: NetMainName _mainName;
168 protected: Net(Cell* cell,
const Name& name);
175 public:
virtual Cell*
getCell()
const {
return _cell;};
178 public:
const NetMainName* getMainName()
const {
return &_mainName; }
189 public: Pins getPins()
const;
198 public: Aliases getAliases()
const {
return new AliasList(
this); };
203 public:
static NetFilter getIsCellNetFilter();
204 public:
static NetFilter getIsDeepNetFilter();
210 public:
static NetFilter getIsPowerFilter();
211 public:
static NetFilter getIsGroundFilter();
216 public:
virtual bool isDeepNet ()
const {
return false;};
217 public:
bool isGlobal ()
const {
return _isGlobal;};
219 public:
bool isAutomatic()
const {
return _isAutomatic;};
220 public:
bool isBlockage ()
const {
return (_type == Type::BLOCKAGE);};
221 public:
bool isFused ()
const {
return (_type == Type::FUSED);};
224 public:
bool isPower ()
const {
return (_type ==
Type::POWER);};
225 public:
bool isGround ()
const {
return (_type ==
Type::GROUND);};
226 public:
bool isSupply ()
const {
return (isPower() || isGround());};
227 public:
bool hasAlias (
const Name& )
const;
228 public: NetAliasHook* getAlias (
const Name& )
const;
237 public:
void setAutomatic(
bool isAutomatic);
241 public:
void setRoutingState(uint32_t state);
245 public:
bool removeAlias(
const Name& name);
252 protected:
virtual void _postCreate();
253 protected:
virtual void _preDestroy();
255 public:
virtual void _toJson(JsonWriter*)
const;
256 public:
virtual void _toJsonSignature(JsonWriter*)
const;
257 public:
virtual void _toJsonCollections(JsonWriter*)
const;
258 public:
virtual string _getTypeName()
const {
return _TName(
"Net");};
259 public:
string _getFlagsAsString()
const;
260 public:
virtual string _getString()
const;
261 public:
virtual Record* _getRecord()
const;
262 public: NetMainName& _getMainName() {
return _mainName; }
263 public: ComponentSet& _getComponentSet() {
return _componentSet;};
264 public: RubberSet& _getRubberSet() {
return _rubberSet;};
265 public: Net* _getNextOfCellNetMap()
const {
return _nextOfCellNetMap;};
267 public:
void _setNextOfCellNetMap(Net* net) {_nextOfCellNetMap = net;};
269 public:
struct CompareByName {
270 inline bool operator() (
const Net* lhs,
const Net* rhs )
const {
return lhs->getName() < rhs->getName(); }
276 inline const FastRTTI& Net::fastRTTI () {
return _fastRTTI; }
284 inline HookKey (
unsigned int id,
const std::string& tname );
285 inline unsigned int id ()
const;
286 inline std::string tname ()
const;
293 inline HookKey::HookKey (
unsigned int id,
const std::string& tname ) : _id(id), _tname(tname) { }
294 inline unsigned int HookKey::id ()
const {
return _id; }
295 inline std::string HookKey::tname ()
const {
return _tname; }
297 inline bool operator< (
const HookKey& lhs,
const HookKey& rhs )
299 if (lhs.id() != rhs.id())
return lhs.id() < rhs.id();
300 return lhs.tname() < rhs.tname();
309 enum Flags { OpenRingStart = (1<<0)
310 , ClosedRing = (1<<1)
313 inline HookElement ( Hook*,
unsigned long flags=0 );
314 inline Hook* hook ()
const;
315 inline HookElement* next ()
const;
316 inline void setHook ( Hook* );
317 inline void setNext ( HookElement* );
318 inline unsigned long flags ()
const;
319 inline HookElement& setFlags (
unsigned long mask );
320 inline HookElement& resetFlags (
unsigned long mask );
321 inline bool issetFlags (
unsigned long mask )
const;
325 unsigned long _flags;
329 inline HookElement::HookElement (
Hook* hook,
unsigned long flags ) : _hook(hook), _next(NULL), _flags(flags) { }
330 inline Hook* HookElement::hook ()
const {
return _hook; }
331 inline HookElement* HookElement::next ()
const {
return _next; }
332 inline void HookElement::setHook (
Hook* hook ) { _hook = hook; }
333 inline void HookElement::setNext ( HookElement* element ) { _next = element; }
334 inline unsigned long HookElement::flags ()
const {
return _flags; }
335 inline HookElement& HookElement::setFlags (
unsigned long mask ) { _flags |= mask;
return *
this; }
336 inline HookElement& HookElement::resetFlags (
unsigned long mask ) { _flags &= ~mask;
return *
this; }
337 inline bool HookElement::issetFlags (
unsigned long mask )
const {
return _flags & mask; }
340 typedef map<HookKey,HookElement> HookLut;
346 class JsonNet :
public JsonEntity {
348 static bool hookFromString ( std::string s,
unsigned int&
id, std::string& tname );
349 static void initialize ();
350 JsonNet (
unsigned long flags );
353 virtual JsonNet* clone (
unsigned long )
const;
354 virtual void toData ( JsonStack& );
355 void addHookLink ( Hook*,
unsigned int jsonId,
const std::string& jsonNext );
356 Hook* getHook (
unsigned int jsonId,
const std::string& tname )
const;
357 bool checkRings ()
const;
358 void buildRings ()
const;
359 inline void clearHookLinks ();
361 bool _autoMaterialize;
367 inline void JsonNet::clearHookLinks () { _hooks.clear(); }
377inline std::string getString<const Hurricane::Net::Type::Code*>
386 case Hurricane::Net::Type::BLOCKAGE:
return "BLOCKAGE";
387 case Hurricane::Net::Type::FUSED:
return "FUSED";
393inline Hurricane::Record* getRecord<const Hurricane::Net::Type::Code*>
396 Hurricane::Record* record =
new Hurricane::Record(getString(
object));
397 record->add(getSlot(
"Code", (
unsigned int*)
object));
406inline std::string getString<const Hurricane::Net::Direction::Code*>
409 std::ostringstream s;
415 switch ( (
int)*
object ) {
429inline Hurricane::Record* getRecord<const Hurricane::Net::Direction::Code*>
432 Hurricane::Record* record =
new Hurricane::Record(getString(
object));
433 record->add(getSlot(
"Code", (
unsigned int*)
object));
439INSPECTOR_P_SUPPORT(Hurricane::Net::ComponentSet);
440INSPECTOR_P_SUPPORT(Hurricane::Net::RubberSet);
453 const SlotTemplate<Net*> dummyNetSlot (
string(
"dummyNetSlot"), NULL );
456 typedef std::set<Net*,DBo::CompareById> NetSet;
Box description (API).
Definition Box.h:30
The model (API).
Definition Cell.h:64
std::int64_t Unit
Definition DbU.h:67
virtual Box getBoundingBox() const =0
virtual Cell * getCell() const =0
Hook description (API).
Definition Hook.h:34
virtual std::string getTypeName() const =0
Name description (API).
Definition Name.h:35
@ WOR_OUT
Definition Net.h:98
@ INOUT
Definition Net.h:95
@ DirUndefined
Definition Net.h:89
@ ConnTristate
Definition Net.h:90
@ TRISTATE
Definition Net.h:96
@ DirIn
Definition Net.h:87
@ ConnWiredOr
Definition Net.h:91
@ WOR_INOUT
Definition Net.h:99
@ DirOut
Definition Net.h:88
@ UNDEFINED
Definition Net.h:92
@ TRANSCV
Definition Net.h:97
@ UNDEFINED
Definition Net.h:64
@ POWER
Definition Net.h:64
@ CLOCK
Definition Net.h:64
@ GROUND
Definition Net.h:64
@ LOGICAL
Definition Net.h:64
Net description (API).
Definition Net.h:46
Entity Inherit
Definition Net.h:57
Plugs getConnectedSlavePlugs() const
void setPosition(const Point &position)
RoutingPads getRoutingPads() const
Components getComponents() const
Definition Net.h:185
static NetFilter getIsSupplyFilter()
const Direction & getDirection() const
Definition Net.h:181
static NetFilter getIsExternalFilter()
bool isGlobal() const
Definition Net.h:217
void setGlobal(bool isGlobal)
Net * getClone(Cell *cloneCell)
const Type & getType() const
Definition Net.h:180
const DbU::Unit & getX() const
Definition Net.h:183
const Arity & getArity() const
Definition Net.h:179
void setExternal(bool isExternal)
Rubbers getRubbers() const
Definition Net.h:186
static NetFilter getIsGlobalFilter()
unsigned Arity
Definition Net.h:59
static NetFilter getIsInternalFilter()
void setType(const Type &type)
bool isClock() const
Definition Net.h:223
const DbU::Unit & getY() const
Definition Net.h:184
Verticals getVerticals() const
Contacts getContacts() const
Plugs getSlavePlugs() const
bool isLogical() const
Definition Net.h:222
Plugs getUnconnectedSlavePlugs() const
Segments getSegments() const
bool isSupply() const
Definition Net.h:226
const Point & getPosition() const
Definition Net.h:182
void setDirection(const Direction &direction)
static Net * create(Cell *cell, const Name &name)
Horizontals getHorizontals() const
static NetFilter getIsClockFilter()
const Name & getName() const
Definition Net.h:177
bool isExternal() const
Definition Net.h:218
void setArity(const Arity &arity)
Point description (API).
Definition Point.h:30
Contains Almost Everything.
Definition BasicLayer.h:39
GenericCollection< Vertical * > Verticals
Definition Verticals.h:35
GenericFilter< Net * > NetFilter
Definition Nets.h:51
GenericCollection< Horizontal * > Horizontals
Definition Horizontals.h:35
GenericCollection< Component * > Components
Definition Components.h:35
GenericCollection< Contact * > Contacts
Definition Contacts.h:35
GenericCollection< Pad * > Pads
Definition Pads.h:35
GenericCollection< Plug * > Plugs
Definition Plugs.h:35
GenericCollection< Segment * > Segments
Definition Segments.h:35
GenericCollection< Rubber * > Rubbers
Definition Rubbers.h:35