Add ctx->place() API

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-07-11 18:15:08 +02:00
parent 7df67c91b3
commit 7daa8524c8
12 changed files with 27 additions and 10 deletions

View File

@ -21,7 +21,7 @@
*
*/
#include "place_sa.h"
#include "placer1.h"
#include <algorithm>
#include <cmath>
#include <iostream>
@ -429,7 +429,7 @@ class SAPlacer
const float post_legalise_dia_scale = 2;
};
bool place_design_sa(Context *ctx)
bool placer1(Context *ctx)
{
try {
SAPlacer placer(ctx);

View File

@ -23,7 +23,7 @@
NEXTPNR_NAMESPACE_BEGIN
extern bool place_design_sa(Context *ctx);
extern bool placer1(Context *ctx);
NEXTPNR_NAMESPACE_END

View File

@ -23,6 +23,7 @@
#include <cstring>
#include "log.h"
#include "nextpnr.h"
#include "placer1.h"
#include "router1.h"
#include "util.h"
@ -289,6 +290,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::route()
{
return router1(getCtx());

View File

@ -720,6 +720,7 @@ struct Arch : BaseCtx
// -------------------------------------------------
bool place();
bool route();
// -------------------------------------------------

View File

@ -44,7 +44,6 @@
#include "design_utils.h"
#include "jsonparse.h"
#include "pack.h"
#include "place_sa.h"
#include "timing.h"
USING_NEXTPNR_NAMESPACE
@ -146,7 +145,7 @@ int main(int argc, char *argv[])
if (vm.count("no-tmdriv"))
ctx.timing_driven = false;
if (!place_design_sa(&ctx) && !ctx.force)
if (!ctx.place() && !ctx.force)
log_error("Placing design failed.\n");
ctx.check();
if (!ctx.route() && !ctx.force)

View File

@ -19,6 +19,7 @@
#include <math.h>
#include "nextpnr.h"
#include "placer1.h"
#include "router1.h"
NEXTPNR_NAMESPACE_BEGIN
@ -316,6 +317,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// ---------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::route()
{
return router1(getCtx());

View File

@ -158,6 +158,7 @@ struct Arch : BaseCtx
float getDelayNS(delay_t v) const { return v; }
uint32_t getDelayChecksum(delay_t v) const { return 0; }
bool place();
bool route();
const std::vector<GraphicElement> &getDecalGraphics(DecalId decal) const;

View File

@ -29,7 +29,6 @@
#include "log.h"
#include "pack.h"
#include "pcf.h"
#include "place_sa.h"
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }

View File

@ -25,7 +25,6 @@
#include "log.h"
#include "pack.h"
#include "pcf.h"
#include "place_sa.h"
#include "timing.h"
NEXTPNR_NAMESPACE_BEGIN
@ -123,7 +122,7 @@ void Worker::place(bool timing_driven)
Q_EMIT taskStarted();
try {
ctx->timing_driven = timing_driven;
Q_EMIT place_finished(place_design_sa(ctx));
Q_EMIT place_finished(ctx->place());
} catch (WorkerInterruptionRequested) {
Q_EMIT taskCanceled();
}

View File

@ -21,6 +21,7 @@
#include <cmath>
#include "log.h"
#include "nextpnr.h"
#include "placer1.h"
#include "router1.h"
#include "util.h"
#include "gfx.h"
@ -401,6 +402,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
bool Arch::place()
{
return placer1(getCtx());
}
bool Arch::route()
{
return router1(getCtx());

View File

@ -643,6 +643,7 @@ struct Arch : BaseCtx
// -------------------------------------------------
bool place();
bool route();
// -------------------------------------------------

View File

@ -42,7 +42,6 @@
#include "pack.h"
#include "pcf.h"
#include "place_legaliser.h"
#include "place_sa.h"
#include "timing.h"
#include "version.h"
@ -372,7 +371,7 @@ int main(int argc, char *argv[])
if (vm.count("no-tmdriv"))
ctx.timing_driven = false;
if (!vm.count("pack-only")) {
if (!place_design_sa(&ctx) && !ctx.force)
if (!ctx.place() && !ctx.force)
log_error("Placing design failed.\n");
ctx.check();
if (!ctx.route() && !ctx.force)