Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ titan_release*.tar.gz
vtr_flow/arch/titan/*.xml
vtr_flow/benchmarks/titan_blif/other_benchmarks
vtr_flow/benchmarks/titan_blif/titan23
vtr_flow/benchmarks/titan_blif/titan_new
vtr_flow/benchmarks/titan_blif/titanium


#
Expand Down
44 changes: 37 additions & 7 deletions vpr/src/util/vpr_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1909,17 +1909,47 @@ std::vector<int> get_cluster_netlist_intra_tile_pins_at_loc(const t_physical_til
std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
ClusterBlockId cluster_blk_id,
int abs_cap) {
int max_num_pin = get_tile_total_num_pin(physical_tile) / physical_tile->capacity;
int num_tile_pin_per_inst = physical_tile->num_pins / physical_tile->capacity;
std::vector<int> pin_num_vec(num_tile_pin_per_inst);
std::iota(pin_num_vec.begin(), pin_num_vec.end(), abs_cap * num_tile_pin_per_inst);
// To get the list of pins, we first add the pins on the tile-level, then add the pins on the intra-tile-level.

// A counter to keep track of number of tile-level pins for the sub-tiles before the current sub-tile.
int seen_sub_tiles_num_cluser_pins = 0;
// The number of tile-level pins for the sub-tile instance that the cluster block is mapped to.
int cluster_sub_tile_isnt_num_pins;
// A flag to check if the sub-tile instance that the cluster block is mapped to has been found.
bool found_sub_tile = false;

// Iterate over all the sub-tiles to find the sub-tile instance that the cluster block is mapped to.
for (const t_sub_tile& tmp_sub_tile: physical_tile->sub_tiles) {
if (tmp_sub_tile.capacity.is_in_range(abs_cap)) {
// This sub-tile type is the one that the cluster block is mapped to.
found_sub_tile = true;
// The number of tile-level pins for all isntances of the same sub-tile type is the same. Thus,
// we can the the number of tile-level pins for the sub-tile instance by dividing the total number of pins
// for the given sub-tile type by the number of instances.
cluster_sub_tile_isnt_num_pins = (tmp_sub_tile.num_phy_pins / tmp_sub_tile.capacity.total());
int rel_cap = abs_cap - tmp_sub_tile.capacity.low;
// Add the number of tile-level pins for the instances before the current sub-tile instance to the counter.
seen_sub_tiles_num_cluser_pins += rel_cap * cluster_sub_tile_isnt_num_pins;
break;
} else {
// This sub-tile type is not the one that the cluster block is mapped to.
// Add the number of tile-level pins for this sub-tile type to the counter
// and continue to the next sub-tile type.
seen_sub_tiles_num_cluser_pins += tmp_sub_tile.num_phy_pins;
}
}

pin_num_vec.reserve(max_num_pin);
VTR_ASSERT(found_sub_tile);
std::vector<int> pin_num_vec(cluster_sub_tile_isnt_num_pins);
// Pin numbers are assigned such that each instance’s tile-level pins
// occupy a continuous range equal to the total number of tile-level pins for that instance.
// Since we know the starting index, we use std::iota to generate that range.
std::iota(pin_num_vec.begin(), pin_num_vec.end(), seen_sub_tiles_num_cluser_pins);

auto internal_pins = get_cluster_internal_pins(cluster_blk_id);
// Add the intra-cluster-level pins to the list.
std::vector<int> internal_pins = get_cluster_internal_pins(cluster_blk_id);
pin_num_vec.insert(pin_num_vec.end(), internal_pins.begin(), internal_pins.end());

pin_num_vec.shrink_to_fit();
return pin_num_vec;
}

Expand Down
7 changes: 6 additions & 1 deletion vpr/src/util/vpr_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ std::vector<int> get_cluster_netlist_intra_tile_pins_at_loc(const t_physical_til
const vtr::vector<ClusterBlockId, t_cluster_pin_chain>& pin_chains,
const vtr::vector<ClusterBlockId, std::unordered_set<int>>& pin_chains_num,
t_physical_tile_type_ptr physical_type);

/**
* @brief Returns the list of pins (both cluster-level and intra-cluster-level) of the given cluster block.
* @param physical_tile The physical tile type that the cluster block is mapped to.
* @param cluster_blk_id The cluster block ID.
* @param abs_cap The absolute capacity number of the sub-tile that the cluster block is mapped to.
*/
std::vector<int> get_cluster_block_pins(t_physical_tile_type_ptr physical_tile,
ClusterBlockId cluster_blk_id,
int abs_cap);
Expand Down