Skip to content

Commit 6eb1001

Browse files
committed
equivalent: fixed physical-logical pin bug
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent bcda27d commit 6eb1001

File tree

2 files changed

+39
-36
lines changed

2 files changed

+39
-36
lines changed

vpr/src/base/read_netlist.cpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -949,45 +949,45 @@ static void load_external_nets_and_cb(ClusteredNetlist& clb_nlist) {
949949
* and blocks point back to net pins */
950950
for (auto blk_id : clb_nlist.blocks()) {
951951
block_type = clb_nlist.block_type(blk_id);
952-
// XXX Use pin mapping here! To check that all the possible pins can be used in the correct tile!
953-
for (const auto& tile_type : block_type->equivalent_tiles) {
954-
for (j = 0; j < tile_type->num_pins; j++) {
955-
//Iterate through each pin of the block, and see if there is a net allocated/used for it
956-
clb_net_id = clb_nlist.block_net(blk_id, j);
957-
958-
if (clb_net_id != ClusterNetId::INVALID()) {
959-
//Verify old and new CLB netlists have the same # of pins per net
960-
if (RECEIVER == tile_type->class_inf[tile_type->pin_class[j]].type) {
961-
count[clb_net_id]++;
962-
963-
if (count[clb_net_id] > (int)clb_nlist.net_sinks(clb_net_id).size()) {
964-
VPR_FATAL_ERROR(VPR_ERROR_NET_F,
965-
"net %s #%d inconsistency, expected %d terminals but encountered %d terminals, it is likely net terminal is disconnected in netlist file.\n",
966-
clb_nlist.net_name(clb_net_id).c_str(), size_t(clb_net_id), count[clb_net_id],
967-
clb_nlist.net_sinks(clb_net_id).size());
968-
}
969-
970-
//Asserts the ClusterBlockId is the same when ClusterNetId & pin BitIndex is provided
971-
VTR_ASSERT(blk_id == clb_nlist.pin_block(*(clb_nlist.net_pins(clb_net_id).begin() + count[clb_net_id])));
972-
//Asserts the block's pin index is the same
973-
VTR_ASSERT(j == clb_nlist.pin_physical_index(*(clb_nlist.net_pins(clb_net_id).begin() + count[clb_net_id])));
974-
VTR_ASSERT(j == clb_nlist.net_pin_physical_index(clb_net_id, count[clb_net_id]));
952+
auto tile_type = pick_random_physical_type(block_type);
953+
for (j = 0; j < block_type->pb_type->num_pins; j++) {
954+
int phy_pin = get_physical_pin(tile_type, block_type, j);
955+
956+
//Iterate through each pin of the block, and see if there is a net allocated/used for it
957+
clb_net_id = clb_nlist.block_net(blk_id, j);
958+
959+
if (clb_net_id != ClusterNetId::INVALID()) {
960+
//Verify old and new CLB netlists have the same # of pins per net
961+
if (RECEIVER == tile_type->class_inf[tile_type->pin_class[phy_pin]].type) {
962+
count[clb_net_id]++;
963+
964+
if (count[clb_net_id] > (int)clb_nlist.net_sinks(clb_net_id).size()) {
965+
VPR_FATAL_ERROR(VPR_ERROR_NET_F,
966+
"net %s #%d inconsistency, expected %d terminals but encountered %d terminals, it is likely net terminal is disconnected in netlist file.\n",
967+
clb_nlist.net_name(clb_net_id).c_str(), size_t(clb_net_id), count[clb_net_id],
968+
clb_nlist.net_sinks(clb_net_id).size());
969+
}
975970

976-
// nets connecting to global pins are marked as global nets
977-
if (tile_type->is_pin_global[j]) {
978-
clb_nlist.set_net_is_global(clb_net_id, true);
979-
}
971+
//Asserts the ClusterBlockId is the same when ClusterNetId & pin BitIndex is provided
972+
VTR_ASSERT(blk_id == clb_nlist.pin_block(*(clb_nlist.net_pins(clb_net_id).begin() + count[clb_net_id])));
973+
//Asserts the block's pin index is the same
974+
VTR_ASSERT(j == clb_nlist.pin_physical_index(*(clb_nlist.net_pins(clb_net_id).begin() + count[clb_net_id])));
975+
VTR_ASSERT(j == clb_nlist.net_pin_physical_index(clb_net_id, count[clb_net_id]));
980976

981-
if (tile_type->is_ignored_pin[j]) {
982-
clb_nlist.set_net_is_ignored(clb_net_id, true);
983-
}
984-
/* Error check performed later to ensure no mixing of ignored and non ignored signals */
977+
// nets connecting to global pins are marked as global nets
978+
if (tile_type->is_pin_global[phy_pin]) {
979+
clb_nlist.set_net_is_global(clb_net_id, true);
980+
}
985981

986-
} else {
987-
VTR_ASSERT(DRIVER == tile_type->class_inf[tile_type->pin_class[j]].type);
988-
VTR_ASSERT(j == clb_nlist.pin_physical_index(*(clb_nlist.net_pins(clb_net_id).begin())));
989-
VTR_ASSERT(j == clb_nlist.net_pin_physical_index(clb_net_id, 0));
982+
if (tile_type->is_ignored_pin[phy_pin]) {
983+
clb_nlist.set_net_is_ignored(clb_net_id, true);
990984
}
985+
/* Error check performed later to ensure no mixing of ignored and non ignored signals */
986+
987+
} else {
988+
VTR_ASSERT(DRIVER == tile_type->class_inf[tile_type->pin_class[phy_pin]].type);
989+
VTR_ASSERT(j == clb_nlist.pin_physical_index(*(clb_nlist.net_pins(clb_net_id).begin())));
990+
VTR_ASSERT(j == clb_nlist.net_pin_physical_index(clb_net_id, 0));
991991
}
992992
}
993993
}

vpr/src/util/vpr_utils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,11 @@ std::vector<AtomPinId> find_clb_pin_connected_atom_pins(ClusterBlockId clb, int
317317
auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
318318

319319
auto logical_block = clb_nlist.block_type(clb);
320+
auto physical_tile = pick_random_physical_type(logical_block);
320321

321-
if (is_opin(log_pin, pick_random_physical_type(logical_block))) {
322+
int phy_pin = get_physical_pin(physical_tile, logical_block, log_pin);
323+
324+
if (is_opin(phy_pin, physical_tile)) {
322325
//output
323326
AtomPinId driver = find_clb_pin_driver_atom_pin(clb, log_pin, pb_gpin_lookup);
324327
if (driver) {

0 commit comments

Comments
 (0)