[engine] now pb_fixup can also accept vtr's post-routing-clustering sync up results

This commit is contained in:
tangxifan 2022-09-28 12:17:16 -07:00
parent 3285af4107
commit 36b3e64b35
4 changed files with 28 additions and 9 deletions

View File

@ -29,14 +29,13 @@ bool annotate_post_routing_cluster_sync_results(const DeviceContext& device_ctx,
}
auto logical_block = clustering_ctx.clb_nlist.block_type(cluster_blk_id);
for (int ipin = 0; ipin < logical_block->pb_type->num_pins; ++ipin) {
ClusterNetId pre_routing_net_id = clustering_ctx.clb_nlist.block_net(cluster_blk_id, ipin);
ClusterNetId post_routing_net_id = ClusterNetId::INVALID();
auto search_result = clustering_ctx.post_routing_clb_pin_nets.at(cluster_blk_id).find(ipin);
if (search_result != clustering_ctx.post_routing_clb_pin_nets.at(cluster_blk_id).end()) {
post_routing_net_id = search_result->second;
}
if (post_routing_net_id) {
clustering_annotation.rename_net(cluster_blk_id, ipin, post_routing_net_id);
/* Update pin remapping from vtr data storage */
auto blk_search_result = clustering_ctx.post_routing_clb_pin_nets.find(cluster_blk_id);
if (blk_search_result != clustering_ctx.post_routing_clb_pin_nets.end()) {
auto pin_search_result = blk_search_result->second.find(ipin);
if (pin_search_result != blk_search_result->second.end()) {
clustering_annotation.rename_net(cluster_blk_id, ipin, pin_search_result->second);
}
}
}
}

View File

@ -92,4 +92,8 @@ PhysicalPb& VprClusteringAnnotation::mutable_physical_pb(const ClusterBlockId& b
return physical_pbs_.at(block_id);
}
void VprClusteringAnnotation::clear_net_remapping() {
net_names_.clear();
}
} /* End namespace openfpga*/

View File

@ -42,6 +42,8 @@ class VprClusteringAnnotation {
void adapt_truth_table(t_pb* pb, const AtomNetlist::TruthTable& tt);
void add_physical_pb(const ClusterBlockId& block_id, const PhysicalPb& physical_pb);
PhysicalPb& mutable_physical_pb(const ClusterBlockId& block_id);
public: /* Clean-up */
void clear_net_remapping();
private: /* Internal data */
/* Pair a regular pb_type to its physical pb_type */
std::map<ClusterBlockId, std::map<int, ClusterNetId>> net_names_;

View File

@ -93,8 +93,19 @@ void update_cluster_pin_with_post_routing_results(const DeviceContext& device_ct
/* Get the cluster net id which has been mapped to this net */
ClusterNetId routing_net_id = vpr_routing_annotation.rr_node_net(rr_node);
/* Find the net mapped to this pin in clustering results*/
/* Find the net mapped to this pin in clustering results. There are two sources:
* - The original clustering netlist, where the pin mapping is based on pre-routing
* - The post-routing pin mapping, where the pin mapping is based on post-routing
* We always check the original clustering netlist first, if there is any remapping, check the remapping data
*/
ClusterNetId cluster_net_id = clustering_ctx.clb_nlist.block_net(blk_id, j);
auto blk_search_result = clustering_ctx.post_routing_clb_pin_nets.find(blk_id);
if (blk_search_result != clustering_ctx.post_routing_clb_pin_nets.end()) {
auto pin_search_result = blk_search_result->second.find(j);
if (pin_search_result != blk_search_result->second.end()) {
cluster_net_id = pin_search_result->second;
}
}
/* Ignore those net have never been routed: this check is valid only
* when both packer has mapped a net to the pin and the router leaves the pin to be unmapped
@ -181,6 +192,9 @@ void update_pb_pin_with_post_routing_results(const DeviceContext& device_ctx,
const VprRoutingAnnotation& vpr_routing_annotation,
VprClusteringAnnotation& vpr_clustering_annotation,
const bool& verbose) {
/* Ensure a clean start: remove all the remapping results from VTR's post-routing clustering result sync-up */
vpr_clustering_annotation.clear_net_remapping();
/* Update the core logic (center blocks of the FPGA) */
for (size_t x = 1; x < device_ctx.grid.width() - 1; ++x) {
for (size_t y = 1; y < device_ctx.grid.height() - 1; ++y) {