diff options
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/arch.cc | 36 | ||||
-rw-r--r-- | ice40/arch.h | 2 | ||||
-rw-r--r-- | ice40/main.cc | 13 |
3 files changed, 49 insertions, 2 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc index 92b1a2a6..5545ddf4 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -613,14 +613,50 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const int xd = x2 - x1, yd = y2 - y1; int xscale = 120, yscale = 120, offset = 0; + return xscale * abs(xd) + yscale * abs(yd) + offset; +} + +delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const +{ + const auto &driver = net_info->driver; + auto driver_loc = getBelLocation(driver.cell->bel); + auto sink_loc = getBelLocation(sink.cell->bel); + + if (driver.port == id_cout) { + if (driver_loc.y == sink_loc.y) + return 0; + return 250; + } + + 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) { // yd = yd < -4 ? yd + 4 : (yd < 0 ? 0 : yd); // 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; } +delay_t 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; + } + return budget; +} + // ----------------------------------------------------------------------- bool Arch::place() { return placer1(getCtx()); } diff --git a/ice40/arch.h b/ice40/arch.h index d1c70f9a..07a8070a 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -697,10 +697,12 @@ struct Arch : BaseCtx // ------------------------------------------------- delay_t estimateDelay(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; } uint32_t getDelayChecksum(delay_t v) const { return v; } + delay_t getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t budget) const; // ------------------------------------------------- diff --git a/ice40/main.cc b/ice40/main.cc index 67393d41..01576cfd 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -105,6 +105,8 @@ int main(int argc, char *argv[]) options.add_options()("asc", po::value<std::string>(), "asc bitstream file to write"); options.add_options()("read", po::value<std::string>(), "asc bitstream file to read"); options.add_options()("seed", po::value<int>(), "seed value for random number generator"); + options.add_options()("slack_redist_iter", po::value<int>(), + "number of iterations between slack redistribution"); options.add_options()("version,V", "show version"); options.add_options()("tmfuzz", "run path delay estimate fuzzer"); options.add_options()("test", "check architecture database integrity"); @@ -304,6 +306,10 @@ int main(int argc, char *argv[]) ctx->rngseed(vm["seed"].as<int>()); } + if (vm.count("slack_redist_iter")) { + ctx->slack_redist_iter = vm["slack_redist_iter"].as<int>(); + } + if (vm.count("svg")) { std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" " "xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"; @@ -365,8 +371,12 @@ int main(int argc, char *argv[]) } } - if (vm.count("freq")) + if (vm.count("freq")) { ctx->target_freq = vm["freq"].as<double>() * 1e6; + ctx->user_freq = true; + } else { + log_warning("Target frequency not specified. Will optimise for max frequency.\n"); + } ctx->timing_driven = true; if (vm.count("no-tmdriv")) @@ -409,7 +419,6 @@ int main(int argc, char *argv[]) if (!ctx->pack() && !ctx->force) log_error("Packing design failed.\n"); - assign_budget(ctx.get()); ctx->check(); print_utilisation(ctx.get()); if (!vm.count("pack-only")) { |