Skip to content

Commit f4c6ee8

Browse files
committed
[vpr][pack] consider nets with fan-out of more than one only if pack pattern is chain
1 parent a777170 commit f4c6ee8

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

vpr/src/pack/prepack.cpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ static void init_molecule_chain_info(const AtomBlockId blk_id,
108108

109109
static AtomBlockId get_sink_block(const AtomBlockId block_id,
110110
const t_pack_pattern_connections& connections,
111-
const AtomNetlist& atom_nlist);
111+
const AtomNetlist& atom_nlist,
112+
bool is_chain_pattern);
112113

113114
static AtomBlockId get_driving_block(const AtomBlockId block_id,
114115
const t_pack_pattern_connections& connections,
@@ -1045,7 +1046,7 @@ static bool try_expand_molecule(t_pack_molecule& molecule,
10451046
// this block is the driver of this connection
10461047
if (block_connection->from_block == pattern_block) {
10471048
// find the block this connection is driving and add it to the queue
1048-
auto sink_blk_id = get_sink_block(block_id, *block_connection, atom_nlist);
1049+
auto sink_blk_id = get_sink_block(block_id, *block_connection, atom_nlist, molecule.is_chain());
10491050
// add this sink block id with its corresponding pattern block to the queue
10501051
pattern_block_queue.push(std::make_pair(block_connection->to_block, sink_blk_id));
10511052
// this block is being driven by this connection
@@ -1075,7 +1076,8 @@ static bool try_expand_molecule(t_pack_molecule& molecule,
10751076
*/
10761077
static AtomBlockId get_sink_block(const AtomBlockId block_id,
10771078
const t_pack_pattern_connections& connections,
1078-
const AtomNetlist& atom_nlist) {
1079+
const AtomNetlist& atom_nlist,
1080+
bool is_chain_pattern) {
10791081
const t_model_ports* from_port_model = connections.from_pin->port->model_port;
10801082
const int from_pin_number = connections.from_pin->pin_number;
10811083
auto from_port_id = atom_nlist.find_atom_port(block_id, from_port_model);
@@ -1086,19 +1088,24 @@ static AtomBlockId get_sink_block(const AtomBlockId block_id,
10861088

10871089
if (from_port_id) {
10881090
auto net_id = atom_nlist.port_net(from_port_id, from_pin_number);
1089-
// Iterate over all net sinks and find the one corresponding
1090-
// to the to_pin specified in the pack pattern connection
10911091
if (net_id.is_valid()) {
10921092
const auto& net_sinks = atom_nlist.net_sinks(net_id);
1093-
for (const auto& sink_pin_id : net_sinks) {
1094-
auto sink_block_id = atom_nlist.pin_block(sink_pin_id);
1095-
if (primitive_type_feasible(sink_block_id, to_pb_type)) {
1096-
auto to_port_id = atom_nlist.find_atom_port(sink_block_id, to_port_model);
1097-
auto to_pin_id = atom_nlist.find_pin(to_port_id, BitIndex(to_pin_number));
1098-
if (to_pin_id == sink_pin_id) {
1099-
return sink_block_id;
1093+
if (is_chain_pattern) {
1094+
for (const auto& sink_pin_id : net_sinks) {
1095+
auto sink_block_id = atom_nlist.pin_block(sink_pin_id);
1096+
if (primitive_type_feasible(sink_block_id, to_pb_type)) {
1097+
auto to_port_id = atom_nlist.find_atom_port(sink_block_id, to_port_model);
1098+
auto to_pin_id = atom_nlist.find_pin(to_port_id, BitIndex(to_pin_number));
1099+
if (to_pin_id == sink_pin_id) {
1100+
return sink_block_id;
1101+
}
11001102
}
11011103
}
1104+
} else {
1105+
if (net_sinks.size() == 1) {
1106+
auto sink_pin_id = *(net_sinks.begin());
1107+
return atom_nlist.pin_block(sink_pin_id);
1108+
}
11021109
}
11031110
}
11041111
}
@@ -1122,7 +1129,7 @@ static AtomBlockId get_driving_block(const AtomBlockId block_id,
11221129

11231130
if (to_port_id) {
11241131
auto net_id = atom_nlist.port_net(to_port_id, to_pin_number);
1125-
if (net_id) {
1132+
if (net_id && atom_nlist.net_sinks(net_id).size() == 1) { /* Single fanout assumption */
11261133
auto driver_blk_id = atom_nlist.net_driver_block(net_id);
11271134

11281135
if (to_port_model->is_clock) {

0 commit comments

Comments
 (0)