@@ -80,18 +80,11 @@ PartitionRegion update_macro_head_pr(const t_pl_macro& pl_macro, const Partition
80
80
81
81
vtr::Rect<int > reg_rect = block_regions[i].get_region_rect ();
82
82
83
- t_pl_loc min_pl_loc (reg_rect.xmin (), reg_rect.ymin (), block_regions[i]. get_sub_tile () );
83
+ modified_reg. set_region_rect (reg_rect.xmin () - offset. x , reg_rect.ymin () - offset. y , reg_rect. xmax () - offset. x , reg_rect. ymax () - offset. y );
84
84
85
- t_pl_loc modified_min_pl_loc = min_pl_loc - offset;
86
-
87
- t_pl_loc max_pl_loc (reg_rect.xmax (), reg_rect.ymax (), block_regions[i].get_sub_tile ());
88
-
89
- t_pl_loc modified_max_pl_loc = max_pl_loc - offset;
90
-
91
- modified_reg.set_region_rect (modified_min_pl_loc.x , modified_min_pl_loc.y , modified_max_pl_loc.x , modified_max_pl_loc.y );
92
85
// check that subtile is not an invalid value before changing, otherwise it just stays -1
93
86
if (block_regions[i].get_sub_tile () != NO_SUBTILE) {
94
- modified_reg.set_sub_tile (modified_min_pl_loc .sub_tile );
87
+ modified_reg.set_sub_tile (block_regions[i]. get_sub_tile () - offset .sub_tile );
95
88
}
96
89
97
90
modified_pr.add_to_part_region (modified_reg);
@@ -110,13 +103,13 @@ PartitionRegion update_macro_head_pr(const t_pl_macro& pl_macro, const Partition
110
103
111
104
// if the intersection is empty, no way to place macro members together, give an error
112
105
if (macro_head_pr.empty ()) {
113
- VPR_ERROR (VPR_ERROR_PLACE, " \n Feasible floorplanning constraints could not be calculated for the placement macro. \n " );
106
+ print_macro_constraint_error (pl_macro );
114
107
}
115
108
116
109
return macro_head_pr;
117
110
}
118
111
119
- PartitionRegion update_macro_member_pr (PartitionRegion& head_pr, const t_pl_offset& offset, const PartitionRegion& grid_pr) {
112
+ PartitionRegion update_macro_member_pr (PartitionRegion& head_pr, const t_pl_offset& offset, const PartitionRegion& grid_pr, const t_pl_macro& pl_macro ) {
120
113
std::vector<Region> block_regions = head_pr.get_partition_region ();
121
114
PartitionRegion macro_pr;
122
115
@@ -125,34 +118,38 @@ PartitionRegion update_macro_member_pr(PartitionRegion& head_pr, const t_pl_offs
125
118
126
119
vtr::Rect<int > reg_rect = block_regions[i].get_region_rect ();
127
120
128
- t_pl_loc min_pl_loc (reg_rect.xmin (), reg_rect.ymin (), block_regions[i].get_sub_tile ());
129
-
130
- t_pl_loc macro_min_pl_loc = min_pl_loc + offset;
131
-
132
- t_pl_loc max_pl_loc (reg_rect.xmax (), reg_rect.ymax (), block_regions[i].get_sub_tile ());
121
+ modified_reg.set_region_rect (reg_rect.xmin () + offset.x , reg_rect.ymin () + offset.y , reg_rect.xmax () + offset.x , reg_rect.ymax () + offset.y );
133
122
134
- t_pl_loc macro_max_pl_loc = max_pl_loc + offset;
135
-
136
- modified_reg.set_region_rect (macro_min_pl_loc.x , macro_min_pl_loc.y , macro_max_pl_loc.x , macro_max_pl_loc.y );
137
123
// check that subtile is not an invalid value before changing, otherwise it just stays -1
138
124
if (block_regions[i].get_sub_tile () != NO_SUBTILE) {
139
- modified_reg.set_sub_tile (macro_min_pl_loc .sub_tile );
125
+ modified_reg.set_sub_tile (block_regions[i]. get_sub_tile () + offset .sub_tile );
140
126
}
141
127
142
128
macro_pr.add_to_part_region (modified_reg);
143
129
}
144
130
145
- // intersect to ensure the head pr does not go outside of grid dimensions
131
+ // intersect to ensure the macro pr does not go outside of grid dimensions
146
132
macro_pr = intersection (macro_pr, grid_pr);
147
133
148
134
// if the intersection is empty, no way to place macro members together, give an error
149
135
if (macro_pr.empty ()) {
150
- VPR_ERROR (VPR_ERROR_PLACE, " \n Feasible floorplanning constraints could not be calculated for the placement macro. \n " );
136
+ print_macro_constraint_error (pl_macro );
151
137
}
152
138
153
139
return macro_pr;
154
140
}
155
141
142
+ void print_macro_constraint_error (const t_pl_macro& pl_macro) {
143
+ VTR_LOG (
144
+ " Feasible floorplanning constraints could not be calculated for the placement macro. \n "
145
+ " The placement macro contains the following blocks: \n " );
146
+ for (unsigned int i = 0 ; i < pl_macro.members .size (); i++) {
147
+ VTR_LOG (" Block #%zu " , size_t (pl_macro.members [i].blk_index ));
148
+ }
149
+ VTR_LOG (" \n " );
150
+ VPR_ERROR (VPR_ERROR_PLACE, " \n Check that the above-mentioned placement macro blocks have compatible floorplan constraints.\n " );
151
+ }
152
+
156
153
void propagate_place_constraints () {
157
154
auto & place_ctx = g_vpr_ctx.placement ();
158
155
auto & floorplanning_ctx = g_vpr_ctx.mutable_floorplanning ();
@@ -170,7 +167,7 @@ void propagate_place_constraints() {
170
167
for (auto pl_macro : place_ctx.pl_macros ) {
171
168
if (is_macro_constrained (pl_macro)) {
172
169
/*
173
- * Update the PartitionRegion for the head of the macro
170
+ * Get the PartitionRegion for the head of the macro
174
171
* based on the constraints of all blocks contained in the macro
175
172
*/
176
173
PartitionRegion macro_head_pr = update_macro_head_pr (pl_macro, grid_pr);
@@ -180,11 +177,10 @@ void propagate_place_constraints() {
180
177
ClusterBlockId iblk = pl_macro.members [imember].blk_index ;
181
178
auto offset = pl_macro.members [imember].offset ;
182
179
183
- // Update head PR
184
- if (imember == 0 ) {
180
+ if (imember == 0 ) { // Update head PR
185
181
floorplanning_ctx.cluster_constraints [iblk] = macro_head_pr;
186
182
} else { // Update macro member PR
187
- PartitionRegion macro_pr = update_macro_member_pr (macro_head_pr, offset, grid_pr);
183
+ PartitionRegion macro_pr = update_macro_member_pr (macro_head_pr, offset, grid_pr, pl_macro );
188
184
floorplanning_ctx.cluster_constraints [iblk] = macro_pr;
189
185
}
190
186
}
0 commit comments