aboutsummaryrefslogtreecommitdiffstats
path: root/passes/pmgen/test_pmgen.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-08-17 13:53:55 +0200
committerClifford Wolf <clifford@clifford.at>2019-08-17 13:53:55 +0200
commit318ae0351cdce550cd2f7bf8f5cccc3ecf97cb60 (patch)
tree98a23656867671578dfbe1bd96cb9edf7c672eeb /passes/pmgen/test_pmgen.cc
parentf95853c8228ec8310a1142fe29eea85b765ea3b4 (diff)
downloadyosys-318ae0351cdce550cd2f7bf8f5cccc3ecf97cb60.tar.gz
yosys-318ae0351cdce550cd2f7bf8f5cccc3ecf97cb60.tar.bz2
yosys-318ae0351cdce550cd2f7bf8f5cccc3ecf97cb60.zip
Improvements in "test_pmgen -generate"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/pmgen/test_pmgen.cc')
-rw-r--r--passes/pmgen/test_pmgen.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/passes/pmgen/test_pmgen.cc b/passes/pmgen/test_pmgen.cc
index 94e59f62e..9f42a95d0 100644
--- a/passes/pmgen/test_pmgen.cc
+++ b/passes/pmgen/test_pmgen.cc
@@ -150,6 +150,8 @@ void generate_pattern(std::function<void(pm&,std::function<void()>)> run, const
int modcnt = 0;
int maxsubcnt = 4;
+ int timeout = 0;
+ vector<Module*> mods;
while (modcnt < 100)
{
@@ -158,6 +160,9 @@ void generate_pattern(std::function<void(pm&,std::function<void()>)> run, const
while (modcnt < 100 && submodcnt < maxsubcnt && itercnt++ < 1000)
{
+ if (timeout++ > 10000)
+ log_error("pmgen generator is stuck: 10000 iterations an no matching module generated.\n");
+
pm matcher(mod, mod->cells());
matcher.rng(1);
@@ -174,25 +179,40 @@ void generate_pattern(std::function<void(pm&,std::function<void()>)> run, const
{
bool found_match = false;
run(matcher, [&](){ found_match = true; });
+ cellcnt = GetSize(mod->cells());
if (found_match) {
Module *m = design->addModule(stringf("\\pmtest_%s_%s_%05d",
pmclass, pattern, modcnt++));
+ log("Creating module %s with %d cells.\n", log_id(m), cellcnt);
mod->cloneInto(m);
pmtest_addports(m);
+ mods.push_back(m);
submodcnt++;
+ timeout = 0;
}
-
- cellcnt = GetSize(mod->cells());
}
matcher.generate_mode = true;
run(matcher, [](){});
}
+ if (submodcnt)
+ maxsubcnt *= 2;
+
design->remove(mod);
- maxsubcnt *= 2;
}
+
+ Module *m = design->addModule(stringf("\\pmtest_%s_%s", pmclass, pattern));
+ log("Creating module %s with %d cells.\n", log_id(m), GetSize(mods));
+ for (auto mod : mods) {
+ Cell *c = m->addCell(mod->name, mod->name);
+ for (auto port : mod->ports) {
+ Wire *w = m->addWire(NEW_ID, GetSize(mod->wire(port)));
+ c->setPort(port, w);
+ }
+ }
+ pmtest_addports(m);
}
struct TestPmgenPass : public Pass {