aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/delay.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-08-04 16:54:12 +0200
committerClifford Wolf <clifford@clifford.at>2018-08-04 16:54:12 +0200
commit31fe52581b34e58189310637ef55b82041c1e04a (patch)
treed389eda9bba44b35d0960706bfee8455f9eaf8c3 /ice40/delay.cc
parentbd36cc12755e4c90cfdaaa593e5af31c5ba38fa5 (diff)
downloadnextpnr-31fe52581b34e58189310637ef55b82041c1e04a.tar.gz
nextpnr-31fe52581b34e58189310637ef55b82041c1e04a.tar.bz2
nextpnr-31fe52581b34e58189310637ef55b82041c1e04a.zip
Add generation of models to tmfuzz
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40/delay.cc')
-rw-r--r--ice40/delay.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/ice40/delay.cc b/ice40/delay.cc
index 8bf8211c..d63af5d1 100644
--- a/ice40/delay.cc
+++ b/ice40/delay.cc
@@ -23,6 +23,8 @@
NEXTPNR_NAMESPACE_BEGIN
+#define NUM_FUZZ_ROUTES 100000
+
void ice40DelayFuzzerMain(Context *ctx)
{
std::vector<WireId> srcWires, dstWires;
@@ -53,17 +55,25 @@ void ice40DelayFuzzerMain(Context *ctx)
int index = 0;
int cnt = 0;
- while (cnt < 1000)
+ while (cnt < NUM_FUZZ_ROUTES)
{
- NPNR_ASSERT(index < int(srcWires.size()));
- NPNR_ASSERT(index < int(dstWires.size()));
+ if (index >= int(srcWires.size()) || index >= int(dstWires.size())) {
+ index = 0;
+ ctx->shuffle(srcWires);
+ ctx->shuffle(dstWires);
+ }
WireId src = srcWires[index];
WireId dst = dstWires[index++];
std::unordered_map<WireId, PipId> route;
+#if NUM_FUZZ_ROUTES <= 1000
if (!ctx->getActualRouteDelay(src, dst, nullptr, &route, false))
continue;
+#else
+ if (!ctx->getActualRouteDelay(src, dst, nullptr, &route, true))
+ continue;
+#endif
WireId cursor = dst;
delay_t delay = 0;
@@ -85,6 +95,9 @@ void ice40DelayFuzzerMain(Context *ctx)
}
cnt++;
+
+ if (cnt % 100 == 0)
+ fprintf(stderr, "Fuzzed %d arcs.\n", cnt);
}
}