Add ctx->pack() API
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
parent
45462ef3a7
commit
c05bea12e0
@ -730,6 +730,7 @@ struct Arch : BaseCtx
|
|||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
bool pack();
|
||||||
bool place();
|
bool place();
|
||||||
bool route();
|
bool route();
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "pack.h"
|
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
USING_NEXTPNR_NAMESPACE
|
USING_NEXTPNR_NAMESPACE
|
||||||
@ -147,7 +146,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!parse_json_file(f, filename, ctx.get()))
|
if (!parse_json_file(f, filename, ctx.get()))
|
||||||
log_error("Loading design failed.\n");
|
log_error("Loading design failed.\n");
|
||||||
|
|
||||||
if (!pack_design(ctx.get()) && !ctx->force)
|
if (!ctx->pack() && !ctx->force)
|
||||||
log_error("Packing design failed.\n");
|
log_error("Packing design failed.\n");
|
||||||
if (vm.count("freq"))
|
if (vm.count("freq"))
|
||||||
ctx->target_freq = vm["freq"].as<double>() * 1e6;
|
ctx->target_freq = vm["freq"].as<double>() * 1e6;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pack.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@ -84,8 +83,9 @@ void pack_io(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main pack function
|
// Main pack function
|
||||||
bool pack_design(Context *ctx)
|
bool Arch::pack()
|
||||||
{
|
{
|
||||||
|
Context *ctx = getCtx();
|
||||||
try {
|
try {
|
||||||
log_break();
|
log_break();
|
||||||
pack_io(ctx);
|
pack_io(ctx);
|
||||||
|
31
ecp5/pack.h
31
ecp5/pack.h
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 David Shah <david@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
@ -183,6 +183,7 @@ struct Arch : BaseCtx
|
|||||||
float getDelayNS(delay_t v) const { return v; }
|
float getDelayNS(delay_t v) const { return v; }
|
||||||
uint32_t getDelayChecksum(delay_t v) const { return 0; }
|
uint32_t getDelayChecksum(delay_t v) const { return 0; }
|
||||||
|
|
||||||
|
bool pack() { return true; }
|
||||||
bool place();
|
bool place();
|
||||||
bool route();
|
bool route();
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pack.h"
|
|
||||||
#include "pcf.h"
|
#include "pcf.h"
|
||||||
|
|
||||||
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pack.h"
|
|
||||||
#include "pcf.h"
|
#include "pcf.h"
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
@ -97,7 +96,7 @@ void Worker::pack()
|
|||||||
{
|
{
|
||||||
Q_EMIT taskStarted();
|
Q_EMIT taskStarted();
|
||||||
try {
|
try {
|
||||||
bool res = pack_design(ctx);
|
bool res = ctx->pack();
|
||||||
print_utilisation(ctx);
|
print_utilisation(ctx);
|
||||||
Q_EMIT pack_finished(res);
|
Q_EMIT pack_finished(res);
|
||||||
} catch (WorkerInterruptionRequested) {
|
} catch (WorkerInterruptionRequested) {
|
||||||
|
@ -672,6 +672,7 @@ struct Arch : BaseCtx
|
|||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
|
bool pack();
|
||||||
bool place();
|
bool place();
|
||||||
bool route();
|
bool route();
|
||||||
|
|
||||||
|
@ -58,7 +58,10 @@ void arch_wrap_python()
|
|||||||
|
|
||||||
auto arch_cls = class_<Arch, Arch *, bases<BaseCtx>, boost::noncopyable>("Arch", init<ArchArgs>());
|
auto arch_cls = class_<Arch, Arch *, bases<BaseCtx>, boost::noncopyable>("Arch", init<ArchArgs>());
|
||||||
auto ctx_cls = class_<Context, Context *, bases<Arch>, boost::noncopyable>("Context", no_init)
|
auto ctx_cls = class_<Context, Context *, bases<Arch>, 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<Context, decltype(&Context::getBelType), &Context::getBelType, conv_to_str<BelType>,
|
fn_wrapper_1a<Context, decltype(&Context::getBelType), &Context::getBelType, conv_to_str<BelType>,
|
||||||
conv_from_str<BelId>>::def_wrap(ctx_cls, "getBelType");
|
conv_from_str<BelId>>::def_wrap(ctx_cls, "getBelType");
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "pack.h"
|
|
||||||
#include "pcf.h"
|
#include "pcf.h"
|
||||||
#include "place_legaliser.h"
|
#include "place_legaliser.h"
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
@ -382,7 +381,7 @@ int main(int argc, char *argv[])
|
|||||||
log_error("Loading PCF failed.\n");
|
log_error("Loading PCF failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pack_design(ctx.get()) && !ctx->force)
|
if (!ctx->pack() && !ctx->force)
|
||||||
log_error("Packing design failed.\n");
|
log_error("Packing design failed.\n");
|
||||||
assign_budget(ctx.get());
|
assign_budget(ctx.get());
|
||||||
ctx->check();
|
ctx->check();
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pack.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@ -577,8 +576,9 @@ static void pack_special(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main pack function
|
// Main pack function
|
||||||
bool pack_design(Context *ctx)
|
bool Arch::pack()
|
||||||
{
|
{
|
||||||
|
Context *ctx = getCtx();
|
||||||
try {
|
try {
|
||||||
log_break();
|
log_break();
|
||||||
pack_constants(ctx);
|
pack_constants(ctx);
|
||||||
|
32
ice40/pack.h
32
ice40/pack.h
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Clifford Wolf <clifford@symbioticeda.com>
|
|
||||||
* Copyright (C) 2018 David Shah <david@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
Loading…
Reference in New Issue
Block a user