Skip to content

Commit 3ac0d07

Browse files
authored
Merge pull request #3338 from verilog-to-routing/intra_cluster_pins
[Router] Fix intra-cluster pin handling for tiles with heterogeneous subtiles
2 parents 17cc491 + bc81406 commit 3ac0d07

File tree

4 files changed

+58
-22
lines changed

4 files changed

+58
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ titan_release*.tar.gz
3535
vtr_flow/arch/titan/*.xml
3636
vtr_flow/benchmarks/titan_blif/other_benchmarks
3737
vtr_flow/benchmarks/titan_blif/titan23
38-
vtr_flow/benchmarks/titan_blif/titan_new
38+
vtr_flow/benchmarks/titan_blif/titanium
3939

4040

4141
#

vpr/src/route/rr_graph_generation/rr_graph_intra_cluster.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
#include "rr_graph_switch_utils.h"
1313
#include "check_rr_graph.h"
1414

15+
/**
16+
* @brief Returns the list of pins (both cluster-level and intra-cluster-level) of the given cluster block.
17+
* @param physical_tile The physical tile type that the cluster block is mapped to.
18+
* @param cluster_blk_id The cluster block ID.
19+
* @param sub_tile_index The sub-tile absolute index (in comparison to relative index which is the index among sub-tiles of the same type) in the physical tile type.
20+
*/
21+
static std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
22+
ClusterBlockId cluster_blk_id,
23+
int sub_tile_index);
24+
1525
static void set_clusters_pin_chains(const ClusteredNetlist& clb_nlist,
1626
vtr::vector<ClusterBlockId, t_cluster_pin_chain>& pin_chains,
1727
bool is_flat);
@@ -179,6 +189,53 @@ static void add_pin_chain(const std::vector<int>& pin_chain,
179189
std::vector<std::vector<t_pin_chain_node>>& all_chains,
180190
bool is_new_chain);
181191

192+
static std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
193+
ClusterBlockId cluster_blk_id,
194+
int sub_tile_index) {
195+
// To get the list of pins, we first add the pins on the tile-level, then add the pins on the intra-tile-level.
196+
197+
// A counter to keep track of number of tile-level pins for the sub-tiles before the current sub-tile.
198+
int seen_sub_tiles_num_cluser_pins = 0;
199+
// The number of tile-level pins for the sub-tile instance that the cluster block is mapped to.
200+
int cluster_sub_tile_inst_num_pins;
201+
// A flag to check if the sub-tile instance that the cluster block is mapped to has been found.
202+
bool found_sub_tile = false;
203+
204+
// Iterate over all the sub-tiles to find the sub-tile instance that the cluster block is mapped to.
205+
for (const t_sub_tile& sub_tile: physical_tile->sub_tiles) {
206+
if (sub_tile.capacity.is_in_range(sub_tile_index)) {
207+
// This sub-tile type is the one that the cluster block is mapped to.
208+
found_sub_tile = true;
209+
// The number of tile-level pins for all isntances of the same sub-tile type is the same. Thus,
210+
// we can the the number of tile-level pins for the sub-tile instance by dividing the total number of pins
211+
// for the given sub-tile type by the number of instances.
212+
cluster_sub_tile_inst_num_pins = (sub_tile.num_phy_pins / sub_tile.capacity.total());
213+
int rel_cap = sub_tile_index - sub_tile.capacity.low;
214+
// Add the number of tile-level pins for the instances before the current sub-tile instance to the counter.
215+
seen_sub_tiles_num_cluser_pins += rel_cap * cluster_sub_tile_inst_num_pins;
216+
break;
217+
} else {
218+
// This sub-tile type is not the one that the cluster block is mapped to.
219+
// Add the number of tile-level pins for this sub-tile type to the counter
220+
// and continue to the next sub-tile type.
221+
seen_sub_tiles_num_cluser_pins += sub_tile.num_phy_pins;
222+
}
223+
}
224+
225+
VTR_ASSERT(found_sub_tile);
226+
std::vector<int> pin_num_vec(cluster_sub_tile_inst_num_pins);
227+
// Pin numbers are assigned such that each instance’s tile-level pins
228+
// occupy a continuous range equal to the total number of tile-level pins for that instance.
229+
// Since we know the starting index, we use std::iota to generate that range.
230+
std::iota(pin_num_vec.begin(), pin_num_vec.end(), seen_sub_tiles_num_cluser_pins);
231+
232+
// Add the intra-cluster-level pins to the list.
233+
std::vector<int> internal_pins = get_cluster_internal_pins(cluster_blk_id);
234+
pin_num_vec.insert(pin_num_vec.end(), internal_pins.begin(), internal_pins.end());
235+
236+
return pin_num_vec;
237+
}
238+
182239
static void set_clusters_pin_chains(const ClusteredNetlist& clb_nlist,
183240
vtr::vector<ClusterBlockId, t_cluster_pin_chain>& pin_chains,
184241
bool is_flat) {

vpr/src/util/vpr_utils.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,23 +1906,6 @@ std::vector<int> get_cluster_netlist_intra_tile_pins_at_loc(const t_physical_til
19061906
return pin_num_vec;
19071907
}
19081908

1909-
std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
1910-
ClusterBlockId cluster_blk_id,
1911-
int abs_cap) {
1912-
int max_num_pin = get_tile_total_num_pin(physical_tile) / physical_tile->capacity;
1913-
int num_tile_pin_per_inst = physical_tile->num_pins / physical_tile->capacity;
1914-
std::vector<int> pin_num_vec(num_tile_pin_per_inst);
1915-
std::iota(pin_num_vec.begin(), pin_num_vec.end(), abs_cap * num_tile_pin_per_inst);
1916-
1917-
pin_num_vec.reserve(max_num_pin);
1918-
1919-
auto internal_pins = get_cluster_internal_pins(cluster_blk_id);
1920-
pin_num_vec.insert(pin_num_vec.end(), internal_pins.begin(), internal_pins.end());
1921-
1922-
pin_num_vec.shrink_to_fit();
1923-
return pin_num_vec;
1924-
}
1925-
19261909
t_arch_switch_inf create_internal_arch_sw(float delay) {
19271910
t_arch_switch_inf arch_switch_inf;
19281911
arch_switch_inf.set_type(e_switch_type::MUX);

vpr/src/util/vpr_utils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,6 @@ std::vector<int> get_cluster_netlist_intra_tile_pins_at_loc(const t_physical_til
329329
const vtr::vector<ClusterBlockId, std::unordered_set<int>>& pin_chains_num,
330330
t_physical_tile_type_ptr physical_type);
331331

332-
std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
333-
ClusterBlockId cluster_blk_id,
334-
int abs_cap);
335-
336332
t_arch_switch_inf create_internal_arch_sw(float delay);
337333

338334
void add_pb_child_to_list(std::list<const t_pb*>& pb_list, const t_pb* parent_pb);

0 commit comments

Comments
 (0)