Skip to content

Commit f37ec16

Browse files
authored
Merge pull request #2623 from verilog-to-routing/3d_constraints
3D Placement Constraints
2 parents cb55d66 + 224c8ac commit f37ec16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+238469
-1978
lines changed

doc/src/vpr/placement_constraints.rst

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ A Placement Constraints File Example
2828
<add_atom name_pattern="n4917"/>
2929
<add_atom name_pattern="n6010"/>
3030
</partition>
31+
32+
<partition name="Part2">
33+
<add_region x_low="3" y_low="3" x_high="85" y_high="85"/> <!-- When the layer is not explicitly specified, layer 0 is assumed. -->
34+
<add_region x_low="8" y_low="5" x_high="142" y_high="29 layer_low="0" layer_high="1"/> <!-- In 3D architectures, the region can span across multiple layers. -->
35+
<add_region x_low="6" y_low="55" x_high="50" y_high="129 layer_low="2" layer_high="2"/> <!-- If the region only covers a non-zero layer, both layer_low and layer_high must be set the same value. -->
36+
<add_atom name_pattern="n135"/>
37+
<add_atom name_pattern="n7016"/>
38+
</partition>
3139
</partition_list>
3240
</vpr_constraints>
3341
@@ -75,7 +83,10 @@ The ``name_pattern`` can be the exact name of the atom from the input atom netli
7583
Region
7684
^^^^^^
7785

78-
An ``<add_region>`` tag is used to add a region to the partition. A ``region`` is a rectangular area on the chip. A partition can contain any number of independent regions - the regions within one partition must not overlap with each other (in order to ease processing when loading in the file). An ``<add_region>`` tag has the following attributes.
86+
An ``<add_region>`` tag is used to add a region to the partition. A ``region`` is a rectangular area or cubic volume
87+
on the chip. A partition can contain any number of independent regions - the regions within one partition **must not**
88+
overlap with each other (in order to ease processing when loading in the file).
89+
An ``<add_region>`` tag has the following attributes.
7990

8091
:req_param x_low:
8192
The x value of the lower left point of the rectangle.
@@ -90,11 +101,30 @@ An ``<add_region>`` tag is used to add a region to the partition. A ``region`` i
90101
The y value of the upper right point of the rectangle.
91102

92103
:opt_param subtile:
93-
Each x, y location on the grid may contain multiple locations known as subtiles. This paramter is an optional value specifying the subtile location that the atom(s) of the partition shall be constrained to.
104+
Each x, y location on the grid may contain multiple locations known as subtiles. This parameter is an optional value specifying the subtile location that the atom(s) of the partition shall be constrained to.
105+
106+
:opt_param layer_low:
107+
The lowest layer number that the region covers. The default value is 0.
108+
109+
:opt_param layer_high:
110+
The highest layer number that the region covers. The default value is 0.
94111

95112
The optional ``subtile`` attribute is commonly used when constraining an atom to a specific location on the chip (e.g. an exact I/O location). It is legal to use with larger regions, but uncommon.
96113

97-
If a user would like to specify an area on the chip with an unusual shape (e.g. L-shaped or T-shaped), they can simply add multiple ``<add_region>`` tags to cover the area specified.
114+
In 2D architectures, ``layer_low`` and ``layer_high`` can be safely ignored as their default value is 0.
115+
In 3D architectures, a region can span across multiple layers or be assigned to a specific layer.
116+
For assigning a region to a specific non-zero layer, the user should set both ``layer_low`` and ``layer_high`` to the
117+
desired layer number. If a layer range is to be covered by the region, the user set ``layer_low`` and ``layer_high`` to
118+
different values.
119+
120+
If a user would like to specify an area on the chip with an unusual shape (e.g. L-shaped or T-shaped),
121+
they can simply add multiple ``<add_region>`` tags to cover the area specified.
122+
123+
It is strongly recommended that different partitions do not overlap. The packing algorithm compares the number clustered
124+
blocks and the number of physical blocks in a region to decide pack atoms inside a partition more aggressively when
125+
there are not enough resources in a partition. Overlapping partitions causes some physical blocks to be counted in more
126+
than one partition.
127+
98128

99129

100130

libs/libarchfpga/src/echo_arch.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
236236
}
237237

238238
fprintf(Echo, "\tInput Connect Block Switch Name Within a Same Die: %s\n", arch->ipin_cblock_switch_name[ipin_cblock_switch_index_within_die].c_str());
239-
239+
240240
//if there is more than one layer available, print the connection block switch name that is used for connection between two dice
241-
for(const auto& layout : arch->grid_layouts){
241+
for (const auto& layout : arch->grid_layouts) {
242242
int num_layers = (int)layout.layers.size();
243-
if(num_layers > 1){
243+
if (num_layers > 1) {
244244
fprintf(Echo, "\tInput Connect Block Switch Name Between Two Dice: %s\n", arch->ipin_cblock_switch_name[ipin_cblock_switch_index_between_dice].c_str());
245245
}
246246
}
@@ -295,11 +295,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
295295
fprintf(Echo, "\t\t\t\ttype unidir mux_name for within die connections: %s\n",
296296
arch->Switches[seg.arch_wire_switch].name.c_str());
297297
//if there is more than one layer available, print the segment switch name that is used for connection between two dice
298-
for(const auto& layout : arch->grid_layouts){
298+
for (const auto& layout : arch->grid_layouts) {
299299
int num_layers = (int)layout.layers.size();
300-
if(num_layers > 1){
300+
if (num_layers > 1) {
301301
fprintf(Echo, "\t\t\t\ttype unidir mux_name for between two dice connections: %s\n",
302-
arch->Switches[seg.arch_opin_between_dice_switch].name.c_str());
302+
arch->Switches[seg.arch_opin_between_dice_switch].name.c_str());
303303
}
304304
}
305305
} else { //Should be bidir

libs/libvtrutil/src/vtr_geometry.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/**
1414
* @file
15-
* @brief This file include differents different geometry classes
15+
* @brief This file includes different geometry classes
1616
*/
1717

1818
namespace vtr {
@@ -92,11 +92,18 @@ class Point {
9292
///@brief Swap x and y values
9393
void swap();
9494

95+
/// @brief += operator
96+
Point<T>& operator+= (const Point<T>& rhs);
97+
98+
/// @brief += operator
99+
Point<T>& operator-= (const Point<T>& rhs);
100+
95101
private:
96102
T x_;
97103
T y_;
98104
};
99105

106+
100107
/**
101108
* @brief A 2D rectangle
102109
*
@@ -144,6 +151,12 @@ class Rect {
144151
///@brief Return the top right point
145152
Point<T> top_right() const;
146153

154+
/**
155+
* @brief Return the bottom left and top right coordinates
156+
* @return [xmin, ymin, xmax, ymax]
157+
*/
158+
std::tuple<T, T, T, T> coordinates() const;
159+
147160
///@brief Return the rectangle width
148161
T width() const;
149162

@@ -190,6 +203,12 @@ class Rect {
190203
///@brief set ymax to a point
191204
void set_ymax(T ymax_val);
192205

206+
/// @brief += operator
207+
Rect<T>& operator+= (const Point<T>& rhs);
208+
209+
/// @brief -= operator
210+
Rect<T>& operator-= (const Point<T>& rhs);
211+
193212
///@brief Equivalent to `*this = bounding_box(*this, other)`
194213
Rect<T>& expand_bounding_box(const Rect<T>& other);
195214

@@ -302,7 +321,7 @@ class RectUnion {
302321
friend bool operator!= <>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);
303322

304323
private:
305-
// Note that a union of rectanges may have holes and may not be contiguous
324+
// Note that a union of rectangles may have holes and may not be contiguous
306325
std::vector<Rect<T>> rects_;
307326
};
308327

libs/libvtrutil/src/vtr_geometry.tpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ void Point<T>::swap() {
5858
std::swap(x_, y_);
5959
}
6060

61+
template<class T>
62+
Point<T>& Point<T>::operator+=(const Point<T>& rhs) {
63+
x_ += rhs.x_;
64+
y_ += rhs.y_;
65+
return *this;
66+
}
67+
68+
template<class T>
69+
Point<T>& Point<T>::operator-=(const Point<T>& rhs) {
70+
x_ -= rhs.x_;
71+
y_ -= rhs.y_;
72+
return *this;
73+
}
74+
6175
/*
6276
* Rect
6377
*/
@@ -120,6 +134,11 @@ Point<T> Rect<T>::top_right() const {
120134
return top_right_;
121135
}
122136

137+
template<class T>
138+
std::tuple<T, T, T, T> Rect<T>::coordinates() const {
139+
return {xmin(), ymin(), xmax(), ymax()};
140+
}
141+
123142
template<class T>
124143
T Rect<T>::width() const {
125144
return xmax() - xmin();
@@ -224,6 +243,20 @@ void Rect<T>::set_ymax(T ymax_val) {
224243
top_right_.set_y(ymax_val);
225244
}
226245

246+
template<class T>
247+
Rect<T>& Rect<T>::operator+=(const Point<T>& rhs) {
248+
bottom_left_ += rhs;
249+
top_right_ += rhs;
250+
return *this;
251+
}
252+
253+
template<class T>
254+
Rect<T>& Rect<T>::operator-=(const Point<T>& rhs) {
255+
bottom_left_ -= rhs;
256+
top_right_ -= rhs;
257+
return *this;
258+
}
259+
227260
template<class T>
228261
Rect<T>& Rect<T>::expand_bounding_box(const Rect<T>& other) {
229262
*this = bounding_box(*this, other);

0 commit comments

Comments
 (0)