1
- #ifndef PLACE_DELAY_MODEL_H
2
- #define PLACE_DELAY_MODEL_H
1
+ /* *
2
+ * @file place_delay_model.h
3
+ * @brief This file contains all the class and function declarations related to
4
+ * the placer delay model. For implementations, see place_delay_model.cpp.
5
+ */
3
6
7
+ #pragma once
4
8
#include " vtr_ndmatrix.h"
5
9
#include " vtr_flat_map.h"
6
10
#include " vpr_types.h"
20
24
# define ALWAYS_INLINE inline
21
25
#endif
22
26
23
- // Abstract interface to a placement delay model
27
+ // /@brief Forward declarations.
28
+ class PlaceDelayModel ;
29
+
30
+ // /@brief Initialize the placer delay model.
31
+ std::unique_ptr<PlaceDelayModel> alloc_lookups_and_delay_model (t_chan_width_dist chan_width_dist,
32
+ const t_placer_opts& place_opts,
33
+ const t_router_opts& router_opts,
34
+ t_det_routing_arch* det_routing_arch,
35
+ std::vector<t_segment_inf>& segment_inf,
36
+ const t_direct_inf* directs,
37
+ const int num_directs);
38
+
39
+ // /@brief Returns the delay of one point to point connection.
40
+ float comp_td_single_connection_delay (const PlaceDelayModel* delay_model, ClusterNetId net_id, int ipin);
41
+
42
+ // /@brief Recompute all point to point delays, updating `connection_delay` matrix.
43
+ void comp_td_connection_delays (const PlaceDelayModel* delay_model);
44
+
45
+ // /@brief Abstract interface to a placement delay model.
24
46
class PlaceDelayModel {
25
47
public:
26
48
virtual ~PlaceDelayModel () = default ;
27
49
28
- // Computes place delay model.
50
+ // /@brief Computes place delay model.
29
51
virtual void compute (
30
52
RouterDelayProfiler& route_profiler,
31
53
const t_placer_opts& placer_opts,
32
54
const t_router_opts& router_opts,
33
55
int longest_length)
34
56
= 0;
35
57
36
- // Returns the delay estimate between the specified block pins
37
- //
38
- // Either compute or read methods must be invoked before invoking
39
- // delay.
58
+ /* *
59
+ * @brief Returns the delay estimate between the specified block pins.
60
+ *
61
+ * Either compute or read methods must be invoked before invoking delay.
62
+ */
40
63
virtual float delay (int from_x, int from_y, int from_pin, int to_x, int to_y, int to_pin) const = 0;
41
64
42
- // Dumps the delay model to an echo file
65
+ // /@brief Dumps the delay model to an echo file.
43
66
virtual void dump_echo (std::string filename) const = 0;
44
67
45
- // Write place delay model to specified file.
46
- // May be unimplemented, in which case method should throw an exception.
68
+ /* *
69
+ * @brief Write place delay model to specified file.
70
+ *
71
+ * May be unimplemented, in which case method should throw an exception.
72
+ */
47
73
virtual void write (const std::string& file) const = 0;
48
74
49
- // Read place delay model from specified file.
50
- // May be unimplemented, in which case method should throw an exception.
75
+ /* *
76
+ * @brief Read place delay model from specified file.
77
+ *
78
+ * May be unimplemented, in which case method should throw an exception.
79
+ */
51
80
virtual void read (const std::string& file) = 0;
52
81
};
53
82
54
- // A simple delay model based on the distance (delta) between block locations
83
+ // /@brief A simple delay model based on the distance (delta) between block locations.
55
84
class DeltaDelayModel : public PlaceDelayModel {
56
85
public:
57
86
DeltaDelayModel () {}
@@ -101,6 +130,21 @@ class OverrideDelayModel : public PlaceDelayModel {
101
130
void compute_override_delay_model (RouterDelayProfiler& router,
102
131
const t_router_opts& router_opts);
103
132
133
+ /* *
134
+ * @brief Structure that allows delays to be queried from the delay model.
135
+ *
136
+ * Delay is calculated given the origin physical tile, the origin
137
+ * pin, the destination physical tile, and the destination pin.
138
+ * This structure encapsulates all these information.
139
+ *
140
+ * @param from_type, to_type
141
+ * Physical tile index (for easy array access)
142
+ * @param from_class, to_class
143
+ * The class that the pins belongs to.
144
+ * @param to_x, to_y
145
+ * The horizontal and vertical displacement
146
+ * between two physical tiles.
147
+ */
104
148
struct t_override {
105
149
short from_type;
106
150
short to_type;
@@ -109,10 +153,19 @@ class OverrideDelayModel : public PlaceDelayModel {
109
153
short delta_x;
110
154
short delta_y;
111
155
112
- // A combination of ALWAYS_INLINE attribute and std::lexicographical_compare
113
- // is required for operator< to be inlined by compiler.
114
- // Proper inlining of the function reduces place time by around 5%.
115
- // For more information: https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1225
156
+ /* *
157
+ * @brief Comparison operator designed for performance.
158
+ *
159
+ * Operator< is important since t_override serves as the key into the
160
+ * map structure delay_overrides_. A default comparison operator would
161
+ * not be inlined by the compiler.
162
+ *
163
+ * A combination of ALWAYS_INLINE attribute and std::lexicographical_compare
164
+ * is required for operator< to be inlined by compiler. Proper inlining of
165
+ * the function reduces place time by around 5%.
166
+ *
167
+ * For more information: https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1225
168
+ */
116
169
friend ALWAYS_INLINE bool operator <(const t_override& lhs, const t_override& rhs) {
117
170
const short * left = reinterpret_cast <const short *>(&lhs);
118
171
const short * right = reinterpret_cast <const short *>(&rhs);
@@ -121,10 +174,20 @@ class OverrideDelayModel : public PlaceDelayModel {
121
174
}
122
175
};
123
176
177
+ /* *
178
+ * @brief Map data structure that returns delay values according to
179
+ * specific delay model queries.
180
+ *
181
+ * Delay model queries are provided by the t_override structure, which
182
+ * encapsulates the information regarding the origin and the destination.
183
+ */
124
184
vtr::flat_map2<t_override, float > delay_overrides_;
125
185
126
- // operator< treats memory layout of t_override as an array of short
127
- // this requires all members of t_override are shorts and there is no padding between members of t_override
186
+ /* *
187
+ * operator< treats memory layout of t_override as an array of short.
188
+ * This requires all members of t_override are shorts and there is no
189
+ * padding between members of t_override.
190
+ */
128
191
static_assert (sizeof (t_override) == sizeof (t_override::from_type) + sizeof (t_override::to_type) + sizeof (t_override::from_class) + sizeof (t_override::to_class) + sizeof (t_override::delta_x) + sizeof (t_override::delta_y), " Expect t_override to have a memory layout equivalent to an array of short (no padding)" );
129
192
static_assert (sizeof (t_override::from_type) == sizeof (short ), " Expect all t_override data members to be shorts" );
130
193
static_assert (sizeof (t_override::to_type) == sizeof (short ), " Expect all t_override data members to be shorts" );
@@ -133,5 +196,3 @@ class OverrideDelayModel : public PlaceDelayModel {
133
196
static_assert (sizeof (t_override::delta_x) == sizeof (short ), " Expect all t_override data members to be shorts" );
134
197
static_assert (sizeof (t_override::delta_y) == sizeof (short ), " Expect all t_override data members to be shorts" );
135
198
};
136
-
137
- #endif
0 commit comments