11#include " constraints_report.h"
22#include " cluster_legalizer.h"
3- #include " globals.h"
43#include " grid_tile_lookup.h"
54
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) {
79 GridTileLookup grid_tiles;
810
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-
1411 // keep record of how many blocks of each type are assigned to each PartitionRegion
1512 std::unordered_map<PartitionRegion, std::vector<int >> pr_count_info;
1613
@@ -22,7 +19,7 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
2219 t_logical_block_type_ptr bt = cluster_legalizer.get_cluster_type (cluster_id);
2320 auto got = pr_count_info.find (pr);
2421 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 );
2623 block_type_counts[bt->index ]++;
2724 pr_count_info.insert ({pr, block_type_counts});
2825 } else {
@@ -35,15 +32,15 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
3532 for (const auto & [pr, block_type_counts] : pr_count_info) {
3633 const std::vector<Region>& regions = pr.get_regions ();
3734
38- for (const t_logical_block_type& block_type : block_types ) {
35+ for (const t_logical_block_type& block_type : logical_block_types ) {
3936 int num_assigned_blocks = block_type_counts[block_type.index ];
4037 int num_tiles = std::accumulate (regions.begin (), regions.end (), 0 , [&grid_tiles, &block_type](int acc, const Region& reg) -> int {
4138 return acc + grid_tiles.region_tile_count (reg, &block_type);
4239 });
4340
4441 if (num_assigned_blocks > num_tiles) {
4542 floorplan_regions_overfull = true ;
46- floorplanning_ctx. overfull_partition_regions .push_back (pr);
43+ overfull_partition_regions.push_back (pr);
4744 VTR_LOG (" \n\n A partition including the following regions has been assigned %d blocks of type %s, "
4845 " but only has %d tiles of that type\n " ,
4946 num_assigned_blocks, block_type.name .c_str (), num_tiles);
@@ -62,3 +59,4 @@ bool floorplan_constraints_regions_overfull(const ClusterLegalizer& cluster_lega
6259
6360 return floorplan_regions_overfull;
6461}
62+
0 commit comments