# Kite - Detailed Router

NegociateWindow.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@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./kite/NegociateWindow.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef KITE_NEGOCIATE_WINDOW_H
18 #define KITE_NEGOCIATE_WINDOW_H
19
20 #include <set>
21 #include <queue>
22 #include <vector>
23
24 namespace Hurricane {
25 class Cell;
26 }
27
28 #include "katabatic/Grid.h"
29 #include "kite/RoutingEventQueue.h"
30 #include "kite/RoutingEventHistory.h"
31 #include "kite/RoutingEventLoop.h"
32
33
34 namespace Kite {
35
36 class TrackElement;
37 class KiteEngine;
38
39
40 // -------------------------------------------------------------------
41 // Class : "Statistics".
42
43 class Statistics {
44 public:
45 inline Statistics ();
46 inline size_t getGCellsCount () const;
47 inline size_t getSegmentsCount () const;
48 inline size_t getEventsCount () const;
49 inline void setGCellsCount ( size_t );
50 inline void setSegmentsCount ( size_t );
51 inline void setEventsCount ( size_t );
52 inline void incGCellCount ( size_t );
53 inline void incSegmentsCount ( size_t );
54 inline void incEventsCount ( size_t );
55 inline Statistics& operator+= ( const Statistics& );
56 private:
57 size_t _gcellsCount;
58 size_t _segmentsCount;
59 size_t _eventsCount;
60
61 };
62
63
64 inline Statistics::Statistics ()
65 : _gcellsCount (0)
66 , _segmentsCount (0)
67 , _eventsCount (0)
68 { }
69
70 inline size_t Statistics::getGCellsCount () const { return _gcellsCount; }
71 inline size_t Statistics::getSegmentsCount () const { return _segmentsCount; }
72 inline size_t Statistics::getEventsCount () const { return _eventsCount; }
73 inline void Statistics::setGCellsCount ( size_t count ) { _gcellsCount = count; }
74 inline void Statistics::setSegmentsCount ( size_t count ) { _segmentsCount = count; }
75 inline void Statistics::setEventsCount ( size_t count ) { _eventsCount = count; }
76 inline void Statistics::incGCellCount ( size_t count ) { _gcellsCount += count; }
77 inline void Statistics::incSegmentsCount ( size_t count ) { _segmentsCount += count; }
78 inline void Statistics::incEventsCount ( size_t count ) { _eventsCount += count; }
79
80 inline Statistics& Statistics::operator+= ( const Statistics& other )
81 {
82 _gcellsCount += other._gcellsCount;
83 _segmentsCount += other._segmentsCount;
84 _eventsCount += other._eventsCount;
85 return *this;
86 }
87
88
89 // -------------------------------------------------------------------
90 // Class : "Kite::NegociateWindow".
91
92 class NegociateWindow {
93
94 public:
95 enum Stage { Negociation = 1
96 , Packing = 2
97 };
98 public:
99 static NegociateWindow* create ( KiteEngine* );
100 void destroy ();
101 inline bool isInterrupted () const;
102 inline KiteEngine* getKiteEngine () const;
103 Hurricane::Cell* getCell () const;
104 inline const Katabatic::GCellVector& getGCells () const;
105 inline RoutingEventQueue& getEventQueue ();
106 inline RoutingEventHistory& getEventHistory ();
107 inline RoutingEventLoop& getEventLoop ();
108 inline Stage getStage () const;
109 void setGCells ( const Katabatic::GCellVector& );
110 inline void setInterrupt ( bool );
111 inline void setStage ( Stage );
112 double computeWirelength ();
113 TrackElement* createTrackSegment ( AutoSegment*, unsigned int flags );
114 void addRoutingEvent ( TrackElement*, unsigned int level );
115 inline void rescheduleEvent ( RoutingEvent*, unsigned int level );
116 void run ( unsigned int flags );
117 void printStatistics () const;
118 void _createRouting ( Katabatic::GCell* );
119 void _pack ( size_t& count, bool last );
120 size_t _negociate ();
121 Hurricane::Record* _getRecord () const;
122 std::string _getString () const;
123 inline std::string _getTypeName () const;
124
125 private:
126 // Attributes.
127 unsigned int _flags;
128 bool _interrupt;
129 KiteEngine* _kite;
130 Katabatic::GCellVector _gcells;
131 std::vector<TrackElement*> _segments;
132 RoutingEventQueue _eventQueue;
133 RoutingEventHistory _eventHistory;
134 RoutingEventLoop _eventLoop;
135 Statistics _statistics;
136
137 // Constructors.
138 protected:
139 NegociateWindow ( KiteEngine* );
140 ~NegociateWindow ();
141 private:
142 NegociateWindow ( const NegociateWindow& );
143 NegociateWindow& operator= ( const NegociateWindow& );
144 };
145
146
147 // Inline Functions.
148 inline bool NegociateWindow::isInterrupted () const { return _interrupt; }
149 inline KiteEngine* NegociateWindow::getKiteEngine () const { return _kite; }
150 inline const Katabatic::GCellVector& NegociateWindow::getGCells () const { return _gcells; }
151 inline RoutingEventQueue& NegociateWindow::getEventQueue () { return _eventQueue; }
152 inline RoutingEventHistory& NegociateWindow::getEventHistory () { return _eventHistory; }
153 inline void NegociateWindow::setInterrupt ( bool state ) { _interrupt = state; }
154 inline void NegociateWindow::rescheduleEvent ( RoutingEvent* event, unsigned int level ) { event->reschedule(_eventQueue,level); }
155 inline std::string NegociateWindow::_getTypeName () const { return "NegociateWindow"; }
156
157
158 } // Kite namespace.
159
160
161 #endif // KITE_NEGOCIATE_WINDOW_H
Kite::RoutingEvent
Atomic Placement Request for a TrackSegment.
Definition: RoutingEvent.h:55
Katabatic::GCell
Kite::NegociateWindow::setInterrupt
void setInterrupt(bool)
Definition: NegociateWindow.h:153
Kite::NegociateWindow::Negociation
Definition: NegociateWindow.h:95
Kite::NegociateWindow::Packing
Definition: NegociateWindow.h:96
Kite::NegociateWindow::getEventQueue
RoutingEventQueue & getEventQueue()
Definition: NegociateWindow.h:151
Kite::NegociateWindow::rescheduleEvent
void rescheduleEvent(RoutingEvent *, unsigned int level)
Definition: NegociateWindow.h:154
Kite::NegociateWindow::getGCells
const Katabatic::GCellVector & getGCells() const
Definition: NegociateWindow.h:150
Kite::NegociateWindow::getEventLoop
RoutingEventLoop & getEventLoop()
Kite::NegociateWindow::destroy
void destroy()
Definition: NegociateWindow.cpp:185
Kite::NegociateWindow::run
void run(unsigned int flags)
Definition: NegociateWindow.cpp:557
Hurricane::Cell
Kite::NegociateWindow::getEventHistory
RoutingEventHistory & getEventHistory()
Definition: NegociateWindow.h:152
Kite::NegociateWindow::createTrackSegment
TrackElement * createTrackSegment(AutoSegment *, unsigned int flags)
Definition: NegociateWindow.cpp:226
Katabatic::AutoSegment
Kite::NegociateWindow::computeWirelength
double computeWirelength()
Definition: NegociateWindow.cpp:317
Kite::RoutingEventLoop
Simple loop dectector for RoutingEvent.
Definition: RoutingEventLoop.h:32
Kite::NegociateWindow::addRoutingEvent
void addRoutingEvent(TrackElement *, unsigned int level)
Definition: NegociateWindow.cpp:212
Kite::NegociateWindow::getKiteEngine
KiteEngine * getKiteEngine() const
Definition: NegociateWindow.h:149
Kite::NegociateWindow::isInterrupted
bool isInterrupted() const
Definition: NegociateWindow.h:148
Kite::NegociateWindow
Perform the routing, main RoutingEvent manager.
Definition: NegociateWindow.h:92
Kite::KiteEngine
The Kite Tool.
Definition: KiteEngine.h:60
Kite::RoutingEventHistory
History of RoutingEvent.
Definition: RoutingEventHistory.h:35
Kite::NegociateWindow::setGCells
void setGCells(const Katabatic::GCellVector &)
Definition: NegociateWindow.cpp:193
Kite::TrackElement
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
Kite::NegociateWindow::getStage
Stage getStage() const
Kite::NegociateWindow::Stage
Stage
Definition: NegociateWindow.h:95
Kite::RoutingEventQueue
The priority Queue of RoutingEvent.
Definition: RoutingEventQueue.h:35
Kite::NegociateWindow::setStage
void setStage(Stage)
Hurricane
Kite::NegociateWindow::getCell
Hurricane::Cell * getCell() const
Definition: NegociateWindow.cpp:189
Kite
The namespace dedicated to Kite.
Definition: Constants.h:22
Kite::NegociateWindow::create
static NegociateWindow * create(KiteEngine *)
Definition: NegociateWindow.cpp:174
Kite::NegociateWindow::printStatistics
void printStatistics() const
Definition: NegociateWindow.cpp:602