Skip to content

Commit d999a1e

Browse files
committed
equivalent tiles: changed pin mapping retrieval
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 83cbcbb commit d999a1e

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

vpr/src/util/vpr_utils.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -584,27 +584,23 @@ int find_clb_pb_pin(ClusterBlockId clb, int clb_pin) {
584584

585585
auto& clb_nlist = cluster_ctx.clb_nlist;
586586

587-
t_type_ptr equivalent_type = clb_nlist.block_type(clb);
588-
t_type_ptr original_type = clb_nlist.block_type(clb, false);
589-
590-
bool eq_type_selected = original_type == equivalent_type ? false : true;
591-
592-
VTR_ASSERT_MSG(clb_pin < equivalent_type->num_pins, "Must be a valid top-level pin");
587+
int eq_type_index = clb_nlist.block_eq_type_index(clb);
588+
auto type = clb_nlist.block_type(clb);
593589

594590
int pin = clb_pin;
595591

596-
if(eq_type_selected) {
597-
int equivalent_type_index = clb_nlist.block_eq_type_index(clb);
598-
VTR_ASSERT(equivalent_type_index != OPEN);
599-
pin = original_type->equivalent_tile_inverse_pin_mapping[equivalent_type_index][clb_pin];
592+
// In case an equivalent tile is selected, the CLB block type will be different (e.g. CLB logic type is LAB, CLB physical type is MLAB).
593+
// Therefore, I need to retrieve the pin mapping from the LAB type by setting the `false` flag when calling block_type.
594+
if(eq_type_index != OPEN) {
595+
pin = clb_nlist.block_type(clb, false)->equivalent_tile_inverse_pin_mapping[eq_type_index][clb_pin];
600596
}
601597

602-
int pb_pin = -1;
598+
int pb_pin = OPEN;
603599
if(place_ctx.block_locs[clb].nets_and_pins_synced_to_z_coordinate) {
604600
//Pins have been offset by z-coordinate, need to remove offset
605601

606-
VTR_ASSERT(equivalent_type->num_pins % equivalent_type->capacity == 0);
607-
int num_basic_block_pins = equivalent_type->num_pins / equivalent_type->capacity;
602+
VTR_ASSERT(type->num_pins % type->capacity == 0);
603+
int num_basic_block_pins = type->num_pins / type->capacity;
608604
/* Logical location and physical location is offset by z * max_num_block_pins */
609605

610606
pb_pin = pin + place_ctx.block_locs[clb].z * num_basic_block_pins;
@@ -624,24 +620,22 @@ int find_pb_pin_clb_pin(ClusterBlockId clb, int pb_pin) {
624620

625621
auto& clb_nlist = cluster_ctx.clb_nlist;
626622

627-
t_type_ptr equivalent_type = clb_nlist.block_type(clb);
628-
t_type_ptr original_type = clb_nlist.block_type(clb, false);
629-
630-
bool eq_type_selected = original_type == equivalent_type ? false : true;
623+
int eq_type_index = clb_nlist.block_eq_type_index(clb);
624+
auto type = clb_nlist.block_type(clb);
631625

632626
int pin = pb_pin;
633627

634-
if(eq_type_selected) {
635-
int equivalent_type_index = clb_nlist.block_eq_type_index(clb);
636-
VTR_ASSERT(equivalent_type_index != OPEN);
637-
pin = original_type->equivalent_tile_pin_mapping[equivalent_type_index][pb_pin];
628+
// In case an equivalent tile is selected, the CLB block type will be different (e.g. CLB logic type is LAB, CLB physical type is MLAB).
629+
// Therefore, I need to retrieve the pin mapping from the LAB type by setting the `false` flag when calling block_type.
630+
if(eq_type_index != OPEN) {
631+
pin = clb_nlist.block_type(clb, false)->equivalent_tile_pin_mapping[eq_type_index][pb_pin];
638632
}
639633

640-
int clb_pin = -1;
634+
int clb_pin = OPEN;
641635
if(place_ctx.block_locs[clb].nets_and_pins_synced_to_z_coordinate) {
642636
//Pins have been offset by z-coordinate, need to remove offset
643-
VTR_ASSERT(equivalent_type->num_pins % equivalent_type->capacity == 0);
644-
int num_basic_block_pins = equivalent_type->num_pins / equivalent_type->capacity;
637+
VTR_ASSERT(type->num_pins % type->capacity == 0);
638+
int num_basic_block_pins = type->num_pins / type->capacity;
645639
/* Logical location and physical location is offset by z * max_num_block_pins */
646640

647641
clb_pin = pin + place_ctx.block_locs[clb].z * num_basic_block_pins;

0 commit comments

Comments
 (0)