From a82f6f410595de26e82eaf4818e41036f0bc2f9c Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Mon, 30 Jul 2018 19:19:30 -0700 Subject: Modify predictDelay signature --- ice40/arch.cc | 21 +++++++++++++-------- ice40/arch.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'ice40') diff --git a/ice40/arch.cc b/ice40/arch.cc index 91c20b42..107bf56a 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -582,17 +582,19 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const return xscale * abs(xd) + yscale * abs(yd) + offset; } -delay_t Arch::predictDelay(WireId src, WireId dst) const +delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const { - NPNR_ASSERT(src != WireId()); - int x1 = chip_info->wire_data[src.index].x; - int y1 = chip_info->wire_data[src.index].y; + const auto& driver = net_info->driver; + auto driver_loc = getBelLocation(driver.cell->bel); + auto sink_loc = getBelLocation(sink.cell->bel); - NPNR_ASSERT(dst != WireId()); - int x2 = chip_info->wire_data[dst.index].x; - int y2 = chip_info->wire_data[dst.index].y; + if (driver.port == id_cout) { + if (driver_loc.y == sink_loc.y) + return 0; + return 250; + } - int xd = x2 - x1, yd = y2 - y1; + int xd = sink_loc.x - driver_loc.x, yd = sink_loc.y - driver_loc.y; int xscale = 120, yscale = 120, offset = 0; // if (chip_info->wire_data[src.index].type == WIRE_TYPE_SP4_VERT) { @@ -600,6 +602,9 @@ delay_t Arch::predictDelay(WireId src, WireId dst) const // offset = 500; // } + if (driver.port == id_o) offset += 330; + if (sink.port == id_i0 || sink.port == id_i1 || sink.port == id_i2 || sink.port == id_i3) offset += 260; + return xscale * abs(xd) + yscale * abs(yd) + offset; } diff --git a/ice40/arch.h b/ice40/arch.h index 1725d181..57089ed7 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -684,7 +684,7 @@ struct Arch : BaseCtx // ------------------------------------------------- delay_t estimateDelay(WireId src, WireId dst) const; - delay_t predictDelay(WireId src, WireId dst) const; + delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const; delay_t getDelayEpsilon() const { return 20; } delay_t getRipupDelayPenalty() const { return 200; } float getDelayNS(delay_t v) const { return v * 0.001; } -- cgit v1.2.3