Skip to content

Commit e636d43

Browse files
committed
[vpr][pack] add a method to get root_ipin
1 parent 69ff0b1 commit e636d43

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

vpr/src/pack/prepack.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ static AtomBlockId get_driving_block(const AtomBlockId block_id,
114114
const t_pack_pattern_connections& connections,
115115
const AtomNetlist& atom_nlist);
116116

117+
static t_pb_graph_pin* get_compatible_chain_root_pin(const t_pack_patterns* chain_pattern, const AtomBlockId blk_id);
118+
117119
static void print_chain_starting_points(t_pack_patterns* chain_pattern);
118120

119121
/*****************************************/
@@ -1163,6 +1165,17 @@ static AtomBlockId get_driving_block(const AtomBlockId block_id,
11631165
return AtomBlockId::INVALID();
11641166
}
11651167

1168+
static t_pb_graph_pin* get_compatible_chain_root_pin(const t_pack_patterns* chain_pattern, const AtomBlockId blk_id) {
1169+
for (const auto& chain : chain_pattern->chain_root_pins) {
1170+
for (const auto& tie_off : chain) {
1171+
if (primitive_type_feasible(blk_id, tie_off->parent_node->pb_type)) {
1172+
return tie_off;
1173+
}
1174+
}
1175+
}
1176+
return nullptr;
1177+
}
1178+
11661179
static void print_pack_molecules(const char* fname,
11671180
const std::vector<t_pack_patterns>& list_of_pack_patterns,
11681181
const int num_pack_patterns,
@@ -1324,10 +1337,9 @@ static AtomBlockId find_new_root_atom_for_chain(const AtomBlockId blk_id,
13241337

13251338
VTR_ASSERT(list_of_pack_patterns->is_chain == true);
13261339
VTR_ASSERT(list_of_pack_patterns->chain_root_pins.size());
1327-
root_ipin = list_of_pack_patterns->chain_root_pins[0][0];
1328-
root_pb_graph_node = root_ipin->parent_node;
1340+
root_ipin = get_compatible_chain_root_pin(list_of_pack_patterns, blk_id);
13291341

1330-
if (primitive_type_feasible(blk_id, root_pb_graph_node->pb_type) == false) {
1342+
if (root_ipin == nullptr) {
13311343
return AtomBlockId::INVALID();
13321344
}
13331345

@@ -1622,7 +1634,7 @@ static void init_molecule_chain_info(const AtomBlockId blk_id,
16221634
// pattern assigned to it and the input block should be valid
16231635
VTR_ASSERT(molecule.pack_pattern && blk_id);
16241636

1625-
auto root_ipin = molecule.pack_pattern->chain_root_pins[0][0];
1637+
auto root_ipin = get_compatible_chain_root_pin(molecule.pack_pattern, blk_id);
16261638
auto model_pin = root_ipin->port->model_port;
16271639
auto pin_bit = root_ipin->pin_number;
16281640

0 commit comments

Comments
 (0)