aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/nextpnr.h21
-rw-r--r--common/place_sa.cc3
-rw-r--r--common/place_sa.h2
-rw-r--r--common/route.cc9
4 files changed, 20 insertions, 15 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index 6d0dab86..2d614058 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -273,6 +273,7 @@ NEXTPNR_NAMESPACE_BEGIN
struct Context : Arch
{
bool verbose = false;
+ bool force = false;
Context(ArchArgs args) : Arch(args) {}
@@ -290,10 +291,7 @@ struct Context : Arch
return rngstate * 0x2545F4914F6CDD1D;
}
- int rng()
- {
- return rng64() & 0x3fffffff;
- }
+ int rng() { return rng64() & 0x3fffffff; }
int rng(int n)
{
@@ -309,22 +307,25 @@ struct Context : Arch
m += 1;
while (1) {
- int x = rng64() & (m-1);
- if (x < n) return x;
+ int x = rng64() & (m - 1);
+ if (x < n)
+ return x;
}
}
void rngseed(uint64_t seed)
{
rngstate = seed ? seed : 0x3141592653589793;
- for (int i = 0; i < 5; i++) rng64();
+ for (int i = 0; i < 5; i++)
+ rng64();
}
- template<typename T>
- void shuffle(std::vector<T> &a) {
+ template <typename T> void shuffle(std::vector<T> &a)
+ {
for (size_t i = 0; i != a.size(); i++) {
size_t j = i + rng(a.size() - i);
- if (j > i) std::swap(a[i], a[j]);
+ if (j > i)
+ std::swap(a[i], a[j]);
}
}
};
diff --git a/common/place_sa.cc b/common/place_sa.cc
index 1178a247..2a56b177 100644
--- a/common/place_sa.cc
+++ b/common/place_sa.cc
@@ -254,7 +254,7 @@ BelId random_bel_for_cell(Context *ctx, CellInfo *cell, SAState &state)
}
}
-void place_design_sa(Context *ctx)
+bool place_design_sa(Context *ctx)
{
SAState state;
@@ -409,6 +409,7 @@ void place_design_sa(Context *ctx)
ctx->getBelName(bel).c_str(ctx), cell_text.c_str());
}
}
+ return true;
}
NEXTPNR_NAMESPACE_END
diff --git a/common/place_sa.h b/common/place_sa.h
index 8eb4fe77..3c49c031 100644
--- a/common/place_sa.h
+++ b/common/place_sa.h
@@ -23,7 +23,7 @@
NEXTPNR_NAMESPACE_BEGIN
-extern void place_design_sa(Context *ctx);
+extern bool place_design_sa(Context *ctx);
NEXTPNR_NAMESPACE_END
diff --git a/common/route.cc b/common/route.cc
index 04f0f4c2..d623b2cf 100644
--- a/common/route.cc
+++ b/common/route.cc
@@ -67,7 +67,8 @@ struct Router
delay_t maxDelay = 0.0;
WireId failedDest;
- Router(Context *ctx, IdString net_name, bool ripup = false, delay_t ripup_penalty = 0)
+ Router(Context *ctx, IdString net_name, bool ripup = false,
+ delay_t ripup_penalty = 0)
{
auto net_info = ctx->nets.at(net_name);
@@ -438,7 +439,8 @@ bool route_design(Context *ctx)
netCnt = 0;
int ripCnt = 0;
- std::vector<IdString> ripupArray(ripupQueue.begin(), ripupQueue.end());
+ std::vector<IdString> ripupArray(ripupQueue.begin(),
+ ripupQueue.end());
ctx->shuffle(ripupArray);
for (auto net_name : ripupArray) {
@@ -447,7 +449,8 @@ bool route_design(Context *ctx)
net_name.c_str(ctx),
int(ctx->nets.at(net_name)->users.size()));
- Router router(ctx, net_name, true, ripup_penalty * (iterCnt - 1));
+ Router router(ctx, net_name, true,
+ ripup_penalty * (iterCnt - 1));
netCnt++;
visitCnt += router.visitCnt;