diff --git a/ecp5/arch.h b/ecp5/arch.h index bbc7c561..930c488e 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -730,6 +730,7 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool pack(); bool place(); bool route(); diff --git a/ecp5/main.cc b/ecp5/main.cc index 734ae560..4cb2f10d 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -43,7 +43,6 @@ #include "bitstream.h" #include "design_utils.h" #include "jsonparse.h" -#include "pack.h" #include "timing.h" USING_NEXTPNR_NAMESPACE @@ -147,7 +146,7 @@ int main(int argc, char *argv[]) if (!parse_json_file(f, filename, ctx.get())) log_error("Loading design failed.\n"); - if (!pack_design(ctx.get()) && !ctx->force) + if (!ctx->pack() && !ctx->force) log_error("Packing design failed.\n"); if (vm.count("freq")) ctx->target_freq = vm["freq"].as() * 1e6; diff --git a/ecp5/pack.cc b/ecp5/pack.cc index 7f54c231..e3ddc07d 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -17,7 +17,6 @@ * */ -#include "pack.h" #include #include #include @@ -84,8 +83,9 @@ void pack_io(Context *ctx) } // Main pack function -bool pack_design(Context *ctx) +bool Arch::pack() { + Context *ctx = getCtx(); try { log_break(); pack_io(ctx); diff --git a/ecp5/pack.h b/ecp5/pack.h deleted file mode 100644 index cc051a41..00000000 --- a/ecp5/pack.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 David Shah - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef PACK_H -#define PACK_H - -#include "nextpnr.h" - -NEXTPNR_NAMESPACE_BEGIN - -bool pack_design(Context *ctx); - -NEXTPNR_NAMESPACE_END - -#endif // ROUTE_H diff --git a/generic/arch.h b/generic/arch.h index f6243404..5d7ac540 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -183,6 +183,7 @@ struct Arch : BaseCtx float getDelayNS(delay_t v) const { return v; } uint32_t getDelayChecksum(delay_t v) const { return 0; } + bool pack() { return true; } bool place(); bool route(); diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index b7f08104..bea5fce7 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -27,7 +27,6 @@ #include "design_utils.h" #include "jsonparse.h" #include "log.h" -#include "pack.h" #include "pcf.h" static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index 16f5fb89..09093ec8 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -23,7 +23,6 @@ #include "design_utils.h" #include "jsonparse.h" #include "log.h" -#include "pack.h" #include "pcf.h" #include "timing.h" @@ -97,7 +96,7 @@ void Worker::pack() { Q_EMIT taskStarted(); try { - bool res = pack_design(ctx); + bool res = ctx->pack(); print_utilisation(ctx); Q_EMIT pack_finished(res); } catch (WorkerInterruptionRequested) { diff --git a/ice40/arch.h b/ice40/arch.h index b6c64de4..34797442 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -672,6 +672,7 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool pack(); bool place(); bool route(); diff --git a/ice40/arch_pybindings.cc b/ice40/arch_pybindings.cc index ac8c189a..fd5109b4 100644 --- a/ice40/arch_pybindings.cc +++ b/ice40/arch_pybindings.cc @@ -58,7 +58,10 @@ void arch_wrap_python() auto arch_cls = class_, boost::noncopyable>("Arch", init()); auto ctx_cls = class_, boost::noncopyable>("Context", no_init) - .def("checksum", &Context::checksum); + .def("checksum", &Context::checksum) + .def("pack", &Context::pack) + .def("place", &Context::place) + .def("route", &Context::route); fn_wrapper_1a, conv_from_str>::def_wrap(ctx_cls, "getBelType"); diff --git a/ice40/main.cc b/ice40/main.cc index 53cd7164..e77bdd34 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -39,7 +39,6 @@ #include "jsonparse.h" #include "log.h" #include "nextpnr.h" -#include "pack.h" #include "pcf.h" #include "place_legaliser.h" #include "timing.h" @@ -382,7 +381,7 @@ int main(int argc, char *argv[]) log_error("Loading PCF failed.\n"); } - if (!pack_design(ctx.get()) && !ctx->force) + if (!ctx->pack() && !ctx->force) log_error("Packing design failed.\n"); assign_budget(ctx.get()); ctx->check(); diff --git a/ice40/pack.cc b/ice40/pack.cc index d1be4a29..76a52be0 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -18,7 +18,6 @@ * */ -#include "pack.h" #include #include #include @@ -577,8 +576,9 @@ static void pack_special(Context *ctx) } // Main pack function -bool pack_design(Context *ctx) +bool Arch::pack() { + Context *ctx = getCtx(); try { log_break(); pack_constants(ctx); diff --git a/ice40/pack.h b/ice40/pack.h deleted file mode 100644 index cdebdd79..00000000 --- a/ice40/pack.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Clifford Wolf - * Copyright (C) 2018 David Shah - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef PACK_H -#define PACK_H - -#include "nextpnr.h" - -NEXTPNR_NAMESPACE_BEGIN - -bool pack_design(Context *ctx); - -NEXTPNR_NAMESPACE_END - -#endif // ROUTE_H