From 823ceaacbf87aa222f7396891b5018cb00b6e9ef Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 5 Aug 2018 22:31:59 -0700 Subject: Change getBudgetOverride() signature to return bool and modify budget in place --- ice40/arch.cc | 10 ++++++---- ice40/arch.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ice40/arch.cc b/ice40/arch.cc index 0b168383..b8bb13ea 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -637,17 +637,19 @@ std::vector Arch::getGroupGroups(GroupId group) const // ----------------------------------------------------------------------- -delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const +bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const { const auto &driver = net_info->driver; if (driver.port == id_cout) { auto driver_loc = getBelLocation(driver.cell->bel); auto sink_loc = getBelLocation(sink.cell->bel); if (driver_loc.y == sink_loc.y) - return 0; - return 250; + budget = 0; + else + budget = 190; + return true; } - return budget; + return false; } // ----------------------------------------------------------------------- diff --git a/ice40/arch.h b/ice40/arch.h index 236f73f1..328950df 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -766,7 +766,7 @@ struct Arch : BaseCtx delay_t getRipupDelayPenalty() const { return 200; } float getDelayNS(delay_t v) const { return v * 0.001; } uint32_t getDelayChecksum(delay_t v) const { return v; } - delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const; + bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; // ------------------------------------------------- -- cgit v1.2.3 From d0312514bd29fa30d1a214d746ce4f1e176cac32 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 5 Aug 2018 22:33:14 -0700 Subject: Modify getBudgetOverride for generic and ecp5 too --- ecp5/arch.cc | 2 +- ecp5/arch.h | 2 +- generic/arch.cc | 2 +- generic/arch.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ecp5/arch.cc b/ecp5/arch.cc index d72b0085..d2d62241 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -422,7 +422,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const return 200 * (abs(driver_loc.x - sink_loc.x) + abs(driver_loc.y - sink_loc.y)); } -delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const { return budget; } +bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const { return false; } // ----------------------------------------------------------------------- diff --git a/ecp5/arch.h b/ecp5/arch.h index 74f0c4e1..e00e111a 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -805,7 +805,7 @@ struct Arch : BaseCtx delay_t getRipupDelayPenalty() const { return 200; } float getDelayNS(delay_t v) const { return v * 0.001; } uint32_t getDelayChecksum(delay_t v) const { return v; } - delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const; + bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; // ------------------------------------------------- diff --git a/generic/arch.cc b/generic/arch.cc index 7e65d411..0fa93da8 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -408,7 +408,7 @@ delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const return (dx + dy) * grid_distance_to_delay; } -delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const { return budget; } +bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const { return false; } // --------------------------------------------------------------- diff --git a/generic/arch.h b/generic/arch.h index a5b3470f..59fe8d05 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -200,7 +200,7 @@ struct Arch : BaseCtx delay_t getRipupDelayPenalty() const { return 1.0; } float getDelayNS(delay_t v) const { return v; } uint32_t getDelayChecksum(delay_t v) const { return 0; } - delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const; + bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; bool pack() { return true; } bool place(); -- cgit v1.2.3 From 0f3459dbe56619402469897f1857d06b2b3d3bb7 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 6 Aug 2018 08:22:08 -0700 Subject: Fix ice40's getBudgetOverride() to override only for COUT -> CIN --- ice40/arch.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ice40/arch.cc b/ice40/arch.cc index b8bb13ea..1e7a383b 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -640,7 +640,7 @@ std::vector Arch::getGroupGroups(GroupId group) const bool Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const { const auto &driver = net_info->driver; - if (driver.port == id_cout) { + if (driver.port == id_cout && sink.port == id_cin) { auto driver_loc = getBelLocation(driver.cell->bel); auto sink_loc = getBelLocation(sink.cell->bel); if (driver_loc.y == sink_loc.y) -- cgit v1.2.3 From 8e8ba0293ca81e8ad0acc9117ab439827a380591 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 6 Aug 2018 08:34:37 -0700 Subject: Fix use of getBudgetOverride in Timing::follow_net() --- common/timing.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/common/timing.cc b/common/timing.cc index ae5783cd..493cd040 100644 --- a/common/timing.cc +++ b/common/timing.cc @@ -48,22 +48,26 @@ struct Timing delay_t follow_net(NetInfo *net, int path_length, delay_t slack) { - delay_t net_budget = slack / (path_length + 1); + const delay_t default_budget = slack / (path_length + 1); + delay_t net_budget = default_budget; for (auto &usr : net->users) { + auto delay = net_delays ? ctx->getNetinfoRouteDelay(net, usr) : delay_t(); if (crit_path) current_path.push_back(&usr); - // If budget override is less than existing budget, then do not increment - // path length - int pl = path_length + 1; - auto budget = ctx->getBudgetOverride(net, usr, net_budget); - if (budget < net_budget) { - net_budget = budget; - pl = std::max(1, path_length); + // If budget override exists, use that value and do not increment path_length + auto budget = default_budget; + if (ctx->getBudgetOverride(net, usr, budget)) { + if (update) + usr.budget = std::min(usr.budget, budget); + budget = follow_user_port(usr, path_length, slack - budget); + net_budget = std::min(net_budget, budget); + } + else { + budget = follow_user_port(usr, path_length + 1, slack - delay); + net_budget = std::min(net_budget, budget); + if (update) + usr.budget = std::min(usr.budget, delay + budget); } - auto delay = net_delays ? ctx->getNetinfoRouteDelay(net, usr) : delay_t(); - net_budget = std::min(net_budget, follow_user_port(usr, pl, slack - delay)); - if (update) - usr.budget = std::min(usr.budget, delay + net_budget); if (crit_path) current_path.pop_back(); } -- cgit v1.2.3 From c9141262b23b6cbebec0c94deb877fd7cbf2f99a Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 6 Aug 2018 08:39:11 -0700 Subject: Modify doc --- docs/archapi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/archapi.md b/docs/archapi.md index 79562fe6..222b9f78 100644 --- a/docs/archapi.md +++ b/docs/archapi.md @@ -402,9 +402,9 @@ Convert an `delay_t` to an actual real-world delay in nanoseconds. Convert a `delay_t` to an integer for checksum calculations. -### delay\_t getBudgetOverride(const NetInfo \*net\_info, const PortRef &sink, delay\_t budget) const +### bool getBudgetOverride(const NetInfo \*net\_info, const PortRef &sink, delay\_t &budget) const -Overwrite or modify the timing budget for a given arc. Returns the new budget. +Overwrite or modify (in-place) the timing budget for a given arc. Returns a bool to indicate whether this was done. Flow Methods ------------ -- cgit v1.2.3