Kite - Detailed Router


SegmentFsm.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | K i t e - D e t a i l e d R o u t e r |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./kite/SegmentFsm.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #ifndef KITE_SEGMENT_FSM_H
18 #define KITE_SEGMENT_FSM_H
19 
20 #include "kite/TrackCost.h"
21 
22 namespace Kite {
23 
24  class TrackElement;
25  class DataNegociate;
26  class RoutingEvent;
27  class RoutingEventQueue;
28  class RoutingEventHistory;
29 
30 
31 // -------------------------------------------------------------------
32 // Class : "SegmentAction".
33 
34  class SegmentAction {
35  public:
36  enum Type { Self = (1<< 0)
37  , Other = (1<< 1)
38  , Perpandicular = (1<< 2)
39  , Insert = (1<< 3)
40  , Ripup = (1<< 4)
41  , RipedByLocal = (1<< 5)
42  , ResetRipup = (1<< 6)
43  , ToRipupLimit = (1<< 7)
44  , MoveToAxis = (1<< 8)
45  , AxisHint = (1<< 9)
46  , PackingMode = (1<<10)
47  , ToState = (1<<11)
48  , EventLevel1 = (1<<12)
49  , EventLevel2 = (1<<13)
50  , EventLevel3 = (1<<14)
51  , EventLevel4 = (1<<15)
52  , EventLevel5 = (1<<16)
60  };
61  public:
63  , unsigned int type
64  , DbU::Unit axisHint=0
65  , unsigned int toState =0
66  );
67  inline TrackElement* getSegment () const;
68  inline unsigned int getType () const;
69  inline void setAxisHint ( DbU::Unit );
70  inline unsigned int setFlag ( unsigned int );
71  bool doAction ( RoutingEventQueue& );
72  private:
73  TrackElement* _segment;
74  unsigned int _type;
75  DbU::Unit _axisHint;
76  unsigned int _toState;
77  };
78 
79 
80  inline TrackElement* SegmentAction::getSegment () const { return _segment; }
81  inline unsigned int SegmentAction::getType () const { return _type; }
82  inline void SegmentAction::setAxisHint ( DbU::Unit axis ) { _axisHint = axis; }
83  inline unsigned int SegmentAction::setFlag ( unsigned int flag ) { _type |= flag; return _type; }
84 
85 
86 // -------------------------------------------------------------------
87 // Class : "SegmentFsm".
88 
89  class SegmentFsm {
90 
91  public:
92  enum State { MissingData = (1<<0)
93  , EmptyTrackList = (1<<1)
94  , Inserted = (1<<2)
95  , Self = (1<<3)
96  , Other = (1<<4)
97  , Ripup = (1<<5)
98  , MaximumSlack = (1<<6)
102  };
103  enum SlackenFlags { NoRecursive = (1<<0)
104  , NoTransition = (1<<1)
105  };
106 
107  public:
108  SegmentFsm ( RoutingEvent*
109  , RoutingEventQueue&
110  , RoutingEventHistory&
111  );
112  inline bool isFullBlocked () const;
113  inline RoutingEvent* getEvent () const;
114  inline RoutingEventQueue& getQueue () const;
115  inline RoutingEventHistory& getHistory () const;
116  inline unsigned int getState () const;
117  inline DataNegociate* getData ();
118  inline Interval& getConstraint ();
119  inline Interval& getOptimal ();
120  inline vector<TrackCost>& getCosts ();
121  inline TrackCost& getCost ( size_t );
122  inline Track* getTrack ( size_t );
123  inline size_t getBegin ( size_t );
124  inline size_t getEnd ( size_t );
125  inline vector<SegmentAction>& getActions ();
126  inline void setState ( unsigned int );
127  void addAction ( TrackElement*
128  , unsigned int type
129  , DbU::Unit axisHint=0
130  , unsigned int toState =0
131  );
132  void doActions ();
133  inline void clearActions ();
134  bool insertInTrack ( size_t );
135  bool conflictSolveByHistory ();
136  bool conflictSolveByPlaceds ();
137  bool solveTerminalVsGlobal ();
138  bool desaturate ();
139  bool slackenTopology ( unsigned int flags=0 );
140  bool solveFullBlockages ();
141  private:
142  bool _slackenStrap ( TrackElement*&
143  , DataNegociate*&
144  , unsigned int flags );
145  bool _slackenLocal ( TrackElement*&
146  , DataNegociate*&
147  , unsigned int flags );
148  bool _slackenGlobal ( TrackElement*&
149  , DataNegociate*&
150  , unsigned int flags );
151  private:
152  RoutingEvent* _event;
153  RoutingEventQueue& _queue;
154  RoutingEventHistory& _history;
155  unsigned int _state;
156  DataNegociate* _data;
157  Interval _constraint;
158  Interval _optimal;
159  vector<TrackCost> _costs;
160  vector<SegmentAction> _actions;
161  bool _fullBlocked;
162  };
163 
164 
165  inline bool SegmentFsm::isFullBlocked () const { return _fullBlocked and _costs.size(); }
166  inline RoutingEvent* SegmentFsm::getEvent () const { return _event; }
167  inline RoutingEventQueue& SegmentFsm::getQueue () const { return _queue; }
168  inline RoutingEventHistory& SegmentFsm::getHistory () const { return _history; }
169  inline unsigned int SegmentFsm::getState () const { return _state; }
170  inline DataNegociate* SegmentFsm::getData () { return _data; }
171  inline Interval& SegmentFsm::getConstraint () { return _constraint; }
172  inline Interval& SegmentFsm::getOptimal () { return _optimal; }
173  inline vector<TrackCost>& SegmentFsm::getCosts () { return _costs; }
174  inline TrackCost& SegmentFsm::getCost ( size_t i ) { return _costs[i]; }
175  inline Track* SegmentFsm::getTrack ( size_t i ) { return _costs[i].getTrack(); }
176  inline size_t SegmentFsm::getBegin ( size_t i ) { return _costs[i].getBegin(); }
177  inline size_t SegmentFsm::getEnd ( size_t i ) { return _costs[i].getEnd(); }
178  inline vector<SegmentAction>& SegmentFsm::getActions () { return _actions; }
179  inline void SegmentFsm::setState ( unsigned int state ) { _state = state; }
180  inline void SegmentFsm::clearActions () { _actions.clear(); }
181 
182 
183 } // Kite namespace.
184 
185 #endif // KITE_SEGMENT_FSM_H
Atomic Placement Request for a TrackSegment.
Definition: RoutingEvent.h:55
void doActions()
Definition: SegmentFsm.cpp:583
Definition: SegmentFsm.h:41
Definition: SegmentFsm.h:54
unsigned int getState() const
Definition: SegmentFsm.h:169
Definition: SegmentFsm.h:57
TrackElement * getSegment() const
Definition: SegmentFsm.h:80
Definition: SegmentFsm.h:40
Definition: SegmentFsm.h:99
bool insertInTrack(size_t)
Definition: SegmentFsm.cpp:612
DataNegociate * getData()
Definition: SegmentFsm.h:170
Pseudo-decorator to process a RoutingEvent.
Definition: SegmentFsm.h:89
RoutingEventQueue & getQueue() const
Definition: SegmentFsm.h:167
unsigned int setFlag(unsigned int)
Definition: SegmentFsm.h:83
std::int64_t Unit
Type
Definition: SegmentFsm.h:36
bool desaturate()
Definition: SegmentFsm.cpp:939
Definition: SegmentFsm.h:98
Definition: SegmentFsm.h:53
Definition: SegmentFsm.h:93
void setAxisHint(DbU::Unit)
Definition: SegmentFsm.h:82
Definition: SegmentFsm.h:95
bool slackenTopology(unsigned int flags=0)
Definition: SegmentFsm.cpp:1205
Definition: SegmentFsm.h:101
Structure managing one routing track.
Definition: Track.h:42
State
Definition: SegmentFsm.h:92
TrackCost & getCost(size_t)
Definition: SegmentFsm.h:174
RoutingEvent * getEvent() const
Definition: SegmentFsm.h:166
Definition: SegmentFsm.h:45
vector< SegmentAction > & getActions()
Definition: SegmentFsm.h:178
SegmentAction(TrackElement *, unsigned int type, DbU::Unit axisHint=0, unsigned int toState=0)
Definition: SegmentFsm.cpp:349
unsigned int getType() const
Definition: SegmentFsm.h:81
Definition: SegmentFsm.h:50
Interval & getOptimal()
Definition: SegmentFsm.h:172
Definition: SegmentFsm.h:52
Definition: SegmentFsm.h:51
Definition: SegmentFsm.h:97
Definition: SegmentFsm.h:100
Track * getTrack(size_t)
Definition: SegmentFsm.h:175
bool doAction(RoutingEventQueue &)
Definition: SegmentFsm.cpp:361
History of RoutingEvent.
Definition: RoutingEventHistory.h:35
void clearActions()
Definition: SegmentFsm.h:180
bool solveFullBlockages()
Definition: SegmentFsm.cpp:893
Definition: SegmentFsm.h:38
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
Definition: SegmentFsm.h:48
bool conflictSolveByHistory()
Definition: SegmentFsm.cpp:633
void setState(unsigned int)
Definition: SegmentFsm.h:179
Definition: SegmentFsm.h:36
Definition: SegmentFsm.h:96
SegmentFsm(RoutingEvent *, RoutingEventQueue &, RoutingEventHistory &)
Definition: SegmentFsm.cpp:442
Definition: SegmentFsm.h:49
RoutingEventHistory & getHistory() const
Definition: SegmentFsm.h:168
The priority Queue of RoutingEvent.
Definition: RoutingEventQueue.h:35
bool isFullBlocked() const
Definition: SegmentFsm.h:165
Store request for an event to be generated on a TrackElement.
Definition: SegmentFsm.h:34
The namespace dedicated to Kite.
Definition: Constants.h:22
bool conflictSolveByPlaceds()
Definition: SegmentFsm.cpp:718
Definition: SegmentFsm.h:94
Definition: SegmentFsm.h:37
Definition: SegmentFsm.h:92
vector< TrackCost > & getCosts()
Definition: SegmentFsm.h:173
Definition: SegmentFsm.h:43
Algorimthmic datas associated the TrackSegment.
Definition: DataNegociate.h:50
Definition: SegmentFsm.h:42
Definition: SegmentFsm.h:55
Interval & getConstraint()
Definition: SegmentFsm.h:171
size_t getEnd(size_t)
Definition: SegmentFsm.h:177
Definition: SegmentFsm.h:39
void addAction(TrackElement *, unsigned int type, DbU::Unit axisHint=0, unsigned int toState=0)
Definition: SegmentFsm.cpp:571
Definition: SegmentFsm.h:47
Definition: SegmentFsm.h:46
size_t getBegin(size_t)
Definition: SegmentFsm.h:176


Generated by doxygen 1.8.14 on Mon Feb 3 2020 Return to top of page
Kite - Detailed Router Copyright © 2008-2016 UPMC. All rights reserved