From 2248e07b662bb99bbe053e485c5c4d8d10cf234b Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 3 Feb 2020 13:46:05 +0000 Subject: router2: Improve flow and log output Signed-off-by: David Shah --- common/router2.cc | 17 ++++++++++++----- ecp5/arch.cc | 2 +- generic/arch.cc | 2 +- ice40/arch.cc | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/common/router2.cc b/common/router2.cc index 11fa2d68..00760c78 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -36,6 +36,7 @@ #include #include "log.h" #include "nextpnr.h" +#include "router1.h" #include "timing.h" #include "util.h" @@ -1018,6 +1019,9 @@ struct Router2 void operator()() { + log_info("Running router2...\n"); + log_info("Setting up routing resources...\n"); + auto rstart = std::chrono::high_resolution_clock::now(); setup_nets(); setup_wires(); find_all_reserved_wires(); @@ -1031,7 +1035,7 @@ struct Router2 route_queue.push_back(i); bool timing_driven = ctx->setting("timing_driven"); - + log_info("Running main router loop...\n"); do { ctx->sorted_shuffle(route_queue); @@ -1075,7 +1079,7 @@ struct Router2 } for (auto cn : failed_nets) route_queue.push_back(cn); - log_info("iter=%d wires=%d overused=%d overuse=%d archfail=%s\n", iter, total_wire_use, overused_wires, + log_info(" iter=%d wires=%d overused=%d overuse=%d archfail=%s\n", iter, total_wire_use, overused_wires, total_overuse, overused_wires > 0 ? "NA" : std::to_string(arch_fail).c_str()); ++iter; curr_cong_weight *= cfg.curr_cong_mult; @@ -1093,6 +1097,12 @@ struct Router2 nets_by_runtime.at(i).first / 1000.0); } } + auto rend = std::chrono::high_resolution_clock::now(); + log_info("Router2 time %.02fs\n", std::chrono::duration(rend - rstart).count()); + + log_info("Running router1 to check that route is legal...\n"); + + router1(ctx, Router1Cfg(ctx)); } }; } // namespace @@ -1101,10 +1111,7 @@ void router2(Context *ctx, const Router2Cfg &cfg) { Router2 rt(ctx, cfg); rt.ctx = ctx; - auto rstart = std::chrono::high_resolution_clock::now(); rt(); - auto rend = std::chrono::high_resolution_clock::now(); - log_info("Router2 time %.02fs\n", std::chrono::duration(rend - rstart).count()); } Router2Cfg::Router2Cfg(Context *ctx) diff --git a/ecp5/arch.cc b/ecp5/arch.cc index b8abec64..0a44e020 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -633,7 +633,7 @@ bool Arch::route() result = router1(getCtx(), Router1Cfg(getCtx())); } else if (router == "router2") { router2(getCtx(), Router2Cfg(getCtx())); - result = router1(getCtx(), Router1Cfg(getCtx())); + result = true; } else { log_error("ECP5 architecture does not support router '%s'\n", router.c_str()); } diff --git a/generic/arch.cc b/generic/arch.cc index e4227c74..5d60d9c6 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -560,7 +560,7 @@ bool Arch::route() result = router1(getCtx(), Router1Cfg(getCtx())); } else if (router == "router2") { router2(getCtx(), Router2Cfg(getCtx())); - result = router1(getCtx(), Router1Cfg(getCtx())); + result = true; } else { log_error("iCE40 architecture does not support router '%s'\n", router.c_str()); } diff --git a/ice40/arch.cc b/ice40/arch.cc index b429a1cd..a43c4c21 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -703,7 +703,7 @@ bool Arch::route() result = router1(getCtx(), Router1Cfg(getCtx())); } else if (router == "router2") { router2(getCtx(), Router2Cfg(getCtx())); - result = router1(getCtx(), Router1Cfg(getCtx())); + result = true; } else { log_error("iCE40 architecture does not support router '%s'\n", router.c_str()); } -- cgit v1.2.3