Skip to content

Commit 6e86533

Browse files
committed
[vpr][pack] update prepack get_sink
1 parent f71176c commit 6e86533

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

vpr/src/pack/prepack.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ static void init_molecule_chain_info(const AtomBlockId blk_id,
107107
const AtomNetlist& atom_nlist);
108108

109109
static AtomBlockId get_sink_block(const AtomBlockId block_id,
110-
const t_model_ports* model_port,
111-
const BitIndex pin_number,
110+
const t_pack_pattern_connections& connections,
112111
const AtomNetlist& atom_nlist);
113112

114113
static AtomBlockId get_driving_block(const AtomBlockId block_id,
@@ -1047,9 +1046,7 @@ static bool try_expand_molecule(t_pack_molecule& molecule,
10471046
// this block is the driver of this connection
10481047
if (block_connection->from_block == pattern_block) {
10491048
// find the block this connection is driving and add it to the queue
1050-
auto port_model = block_connection->from_pin->port->model_port;
1051-
auto ipin = block_connection->from_pin->pin_number;
1052-
auto sink_blk_id = get_sink_block(block_id, port_model, ipin, atom_nlist);
1049+
auto sink_blk_id = get_sink_block(block_id, *block_connection, atom_nlist);
10531050
// add this sink block id with its corresponding pattern block to the queue
10541051
pattern_block_queue.push(std::make_pair(block_connection->to_block, sink_blk_id));
10551052
// this block is being driven by this connection
@@ -1076,23 +1073,27 @@ static bool try_expand_molecule(t_pack_molecule& molecule,
10761073
/**
10771074
* Find the atom block in the netlist driven by this pin of the input atom block
10781075
* If doesn't exist return AtomBlockId::INVALID()
1079-
* Limitation: The block should be driving only one sink block
10801076
* block_id : id of the atom block that is driving the net connected to the sink block
1081-
* model_port : the model of the port driving the net
1082-
* pin_number : the pin_number of the pin driving the net (pin index within the port)
1077+
* connections : pack pattern connections from the given block
10831078
*/
10841079
static AtomBlockId get_sink_block(const AtomBlockId block_id,
1085-
const t_model_ports* model_port,
1086-
const BitIndex pin_number,
1080+
const t_pack_pattern_connections& connections,
10871081
const AtomNetlist& atom_nlist) {
1088-
auto port_id = atom_nlist.find_atom_port(block_id, model_port);
1089-
1090-
if (port_id) {
1091-
auto net_id = atom_nlist.port_net(port_id, pin_number);
1092-
if (net_id && atom_nlist.net_sinks(net_id).size() == 1) { /* Single fanout assumption */
1093-
auto net_sinks = atom_nlist.net_sinks(net_id);
1094-
auto sink_pin_id = *(net_sinks.begin());
1095-
return atom_nlist.pin_block(sink_pin_id);
1082+
const t_model_ports* from_port_model = connections.from_pin->port->model_port;
1083+
const int from_pin_number = connections.from_pin->pin_number;
1084+
auto from_port_id = atom_nlist.find_atom_port(block_id, from_port_model);
1085+
1086+
const t_model_ports* to_port_model = connections.to_pin->port->model_port;
1087+
const int to_pin_number = connections.to_pin->pin_number;
1088+
auto to_port_id = atom_nlist.find_atom_port(block_id, to_port_model);
1089+
1090+
if (from_port_id && to_port_id) {
1091+
auto net_id = atom_nlist.port_net(from_port_id, from_pin_number);
1092+
const auto& net_sinks = atom_nlist.net_sinks(net_id);
1093+
for (const auto& sink_pin_id : net_sinks) {
1094+
if (atom_nlist.pin_port(sink_pin_id) == to_port_id && atom_nlist.pin_port_bit(sink_pin_id) == to_pin_number) {
1095+
return atom_nlist.pin_block(sink_pin_id);
1096+
}
10961097
}
10971098
}
10981099

0 commit comments

Comments
 (0)