Skip to content

Commit d1e78af

Browse files
committed
[vpr][place] add a link between IOs during initial placement
1 parent 43f2a94 commit d1e78af

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

libs/libarchfpga/src/physical_types_util.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,10 @@ bool is_io_type(t_physical_tile_type_ptr type) {
652652
|| is_output_type(type);
653653
}
654654

655+
bool is_io_type(t_logical_block_type_ptr logical_block) {
656+
return is_io_type(pick_physical_type(logical_block));
657+
}
658+
655659
std::string block_type_pin_index_to_name(t_physical_tile_type_ptr type, int pin_physical_num, bool is_flat) {
656660
int max_ptc = get_tile_pin_max_ptc(type, is_flat);
657661
VTR_ASSERT(pin_physical_num < max_ptc);

libs/libarchfpga/src/physical_types_util.h

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ bool is_input_type(t_physical_tile_type_ptr type);
126126
bool is_output_type(t_physical_tile_type_ptr type);
127127
///@brief Returns true if the given physical tile type can implement either a .input or .output block type
128128
bool is_io_type(t_physical_tile_type_ptr type);
129+
bool is_io_type(t_logical_block_type_ptr logical_block);
129130

130131
/**
131132
* @brief Returns the corresponding physical pin based on the input parameters:

vpr/src/place/initial_placement.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
472472
find_layer = true;
473473
}
474474
std::vector<ClusterBlockId> connected_blocks_to_update;
475+
std::unordered_set<ClusterBlockId> seen_blocks;
475476

476477
//iterate over the from block pins
477478
for (ClusterPinId pin_id : cluster_ctx.clb_nlist.block_pins(head_blk)) {
@@ -510,6 +511,7 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
510511
VTR_ASSERT(tile_loc.layer_num != OPEN);
511512
layer_count[tile_loc.layer_num]++;
512513
}
514+
seen_blocks.insert(cluster_ctx.clb_nlist.pin_block(sink_pin_id));
513515
acc_x += tile_loc.x;
514516
acc_y += tile_loc.y;
515517
acc_weight++;
@@ -530,12 +532,31 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
530532
VTR_ASSERT(tile_loc.layer_num != OPEN);
531533
layer_count[tile_loc.layer_num]++;
532534
}
535+
seen_blocks.insert(cluster_ctx.clb_nlist.pin_block(source_pin));
533536
acc_x += tile_loc.x;
534537
acc_y += tile_loc.y;
535538
acc_weight++;
536539
}
537540
}
538541

542+
if (is_io_type(cluster_ctx.clb_nlist.block_type(head_blk)) && acc_weight != 0) {
543+
for (const auto& block : cluster_ctx.clb_nlist.blocks()) {
544+
if (seen_blocks.find(block) == seen_blocks.end()) {
545+
continue;
546+
}
547+
if (block == head_blk) {
548+
continue;
549+
}
550+
if (is_io_type(cluster_ctx.clb_nlist.block_type(block))) {
551+
if (is_block_placed(block, block_locs)) {
552+
acc_x += block_locs[block].loc.x;
553+
acc_y += block_locs[block].loc.y;
554+
acc_weight++;
555+
}
556+
}
557+
}
558+
}
559+
539560
//Calculate the centroid location
540561
if (acc_weight > 0) {
541562
centroid.x = acc_x / acc_weight;

0 commit comments

Comments
 (0)