1
1
#include " constraints_report.h"
2
2
#include " cluster_legalizer.h"
3
- #include " globals.h"
4
3
#include " grid_tile_lookup.h"
5
4
6
- bool floorplan_constraints_regions_overfull (const ClusterLegalizer& cluster_legalizer) {
5
+ bool floorplan_constraints_regions_overfull (
6
+ std::vector<PartitionRegion>& overfull_partition_regions,
7
+ const ClusterLegalizer& cluster_legalizer,
8
+ const std::vector<t_logical_block_type>& logical_block_types) {
7
9
GridTileLookup grid_tiles;
8
10
9
- auto & floorplanning_ctx = g_vpr_ctx.mutable_floorplanning ();
10
- auto & device_ctx = g_vpr_ctx.device ();
11
-
12
- const std::vector<t_logical_block_type>& block_types = device_ctx.logical_block_types ;
13
-
14
11
// keep record of how many blocks of each type are assigned to each PartitionRegion
15
12
std::unordered_map<PartitionRegion, std::vector<int >> pr_count_info;
16
13
@@ -22,7 +19,7 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
22
19
t_logical_block_type_ptr bt = cluster_legalizer.get_cluster_type (cluster_id);
23
20
auto got = pr_count_info.find (pr);
24
21
if (got == pr_count_info.end ()) {
25
- std::vector<int > block_type_counts (block_types .size (), 0 );
22
+ std::vector<int > block_type_counts (logical_block_types .size (), 0 );
26
23
block_type_counts[bt->index ]++;
27
24
pr_count_info.insert ({pr, block_type_counts});
28
25
} else {
@@ -35,15 +32,15 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
35
32
for (const auto & [pr, block_type_counts] : pr_count_info) {
36
33
const std::vector<Region>& regions = pr.get_regions ();
37
34
38
- for (const t_logical_block_type& block_type : block_types ) {
35
+ for (const t_logical_block_type& block_type : logical_block_types ) {
39
36
int num_assigned_blocks = block_type_counts[block_type.index ];
40
37
int num_tiles = std::accumulate (regions.begin (), regions.end (), 0 , [&grid_tiles, &block_type](int acc, const Region& reg) -> int {
41
38
return acc + grid_tiles.region_tile_count (reg, &block_type);
42
39
});
43
40
44
41
if (num_assigned_blocks > num_tiles) {
45
42
floorplan_regions_overfull = true ;
46
- floorplanning_ctx. overfull_partition_regions .push_back (pr);
43
+ overfull_partition_regions.push_back (pr);
47
44
VTR_LOG (" \n\n A partition including the following regions has been assigned %d blocks of type %s, "
48
45
" but only has %d tiles of that type\n " ,
49
46
num_assigned_blocks, block_type.name .c_str (), num_tiles);
@@ -62,3 +59,4 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
62
59
63
60
return floorplan_regions_overfull;
64
61
}
62
+
0 commit comments