aboutsummaryrefslogtreecommitdiffstats
path: root/passes/sat/sim.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2022-01-31 09:19:34 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2022-01-31 09:19:34 +0100
commitcbadfa02689ddbd5e9e75324aeb15b2c797d8cc4 (patch)
tree7ae77841eeeed3d511541addb429d177b4d22048 /passes/sat/sim.cc
parent190e44f0dac1a9c7f2dbf0c3069cd1d646806aaa (diff)
downloadyosys-cbadfa02689ddbd5e9e75324aeb15b2c797d8cc4.tar.gz
yosys-cbadfa02689ddbd5e9e75324aeb15b2c797d8cc4.tar.bz2
yosys-cbadfa02689ddbd5e9e75324aeb15b2c797d8cc4.zip
Updating initial state and checks
Diffstat (limited to 'passes/sat/sim.cc')
-rw-r--r--passes/sat/sim.cc43
1 files changed, 28 insertions, 15 deletions
diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc
index bea8f12b4..e67f8246b 100644
--- a/passes/sat/sim.cc
+++ b/passes/sat/sim.cc
@@ -1016,22 +1016,35 @@ struct SimWorker : SimShared
log_error("Stop time is before start time\n");
}
auto edges = fst->getAllEdges(fst_clock, startCount, stopCount);
- fst->reconstructAllAtTimes(edges);
- bool initial = false;
- for(auto &time : edges) {
- for(auto &item : inputs) {
- std::string v = fst->valueAt(item.second, time);
- top->set_state(item.first, Const::from_string(v));
- }
- if (!initial) {
- top->setInitState(time);
- initial = true;
+
+ if ((startCount == stopCount) && writeback) {
+ log("Update initial state with values from %zu\n",startCount);
+ if (edges.empty())
+ edges.push_back(startCount);
+ fst->reconstructAllAtTimes(edges);
+ top->setInitState(startCount);
+ pool<Module*> wbmods;
+ top->writeback(wbmods);
+ } else {
+ if (edges.empty())
+ log_error("No clock edges found in given time range\n");
+ fst->reconstructAllAtTimes(edges);
+ bool initial = false;
+ for(auto &time : edges) {
+ for(auto &item : inputs) {
+ std::string v = fst->valueAt(item.second, time);
+ top->set_state(item.first, Const::from_string(v));
+ }
+ if (!initial) {
+ top->setInitState(time);
+ initial = true;
+ }
+ update();
+
+ bool status = top->checkSignals(time);
+ if (status)
+ log_error("Signal difference at %zu\n", time);
}
- update();
-
- bool status = top->checkSignals(time);
- if (status)
- log_error("Signal difference at %zu\n", time);
}
}
};