@@ -516,7 +516,7 @@ int NocCostHandler::check_noc_placement_costs(const t_placer_costs& costs,
516
516
double error_tolerance,
517
517
const t_noc_opts& noc_opts) const {
518
518
int error = 0 ;
519
- NocCostTerms cost_check{0.0 , 0.0 , 0.0 , 0.0 };;
519
+ NocCostTerms cost_check{0.0 , 0.0 , 0.0 , 0.0 };
520
520
521
521
auto & noc_ctx = g_vpr_ctx.noc ();
522
522
const NocStorage& noc_model = noc_ctx.noc_model ;
@@ -529,9 +529,6 @@ int NocCostHandler::check_noc_placement_costs(const t_placer_costs& costs,
529
529
std::unique_ptr<NocRouting> temp_noc_routing_algorithm = NocRoutingAlgorithmCreator::create_routing_algorithm (noc_opts.noc_routing_algorithm ,
530
530
noc_model);
531
531
532
- // stores a temporarily found route for a traffic flow
533
- std::vector<NocLinkId> temp_found_noc_route;
534
-
535
532
// go through all the traffic flows and find a route for them based on where the routers are placed within the NoC
536
533
for (const auto & traffic_flow_id : noc_traffic_flows_storage.get_all_traffic_flow_id ()) {
537
534
// get the traffic flow with the current id
@@ -545,6 +542,9 @@ int NocCostHandler::check_noc_placement_costs(const t_placer_costs& costs,
545
542
NocRouterId source_router_block_id = noc_model.get_router_at_grid_location (block_locs_ref[logical_source_router_block_id].loc );
546
543
NocRouterId sink_router_block_id = noc_model.get_router_at_grid_location (block_locs_ref[logical_sink_router_block_id].loc );
547
544
545
+ // stores a temporarily found route for a traffic flow
546
+ std::vector<NocLinkId> temp_found_noc_route;
547
+
548
548
// route the current traffic flow
549
549
temp_noc_routing_algorithm->route_flow (source_router_block_id, sink_router_block_id, traffic_flow_id, temp_found_noc_route, noc_model);
550
550
@@ -561,14 +561,13 @@ int NocCostHandler::check_noc_placement_costs(const t_placer_costs& costs,
561
561
temp_noc_link_bw_usage[link_id] += curr_traffic_flow.traffic_flow_bandwidth ;
562
562
VTR_ASSERT (temp_noc_link_bw_usage[link_id] >= 0.0 );
563
563
}
564
-
565
- // clear the current traffic flow route, so we can route the next traffic flow
566
- temp_found_noc_route.clear ();
567
564
}
568
565
569
566
// Iterate over all NoC links and accumulate congestion cost
570
567
for (const NocLink& link : noc_model.get_noc_links ()) {
571
- cost_check.congestion += get_link_congestion_cost (link );
568
+ double link_bw = link .get_bandwidth ();
569
+ double used_link_bw = temp_noc_link_bw_usage[link .get_link_id ()];
570
+ cost_check.congestion += std::max (used_link_bw - link_bw, 0 .) / link_bw;
572
571
}
573
572
574
573
// check whether the aggregate bandwidth placement cost is within the error tolerance
0 commit comments