setInitState can be only one altering values
authorMiodrag Milanovic <mmicko@gmail.com>
Sat, 2 Apr 2022 08:34:11 +0000 (10:34 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Sat, 2 Apr 2022 17:13:15 +0000 (19:13 +0200)
passes/sat/sim.cc

index d74fbcc4ee16bf03ff4c11104a3ac88fb81b39eb..3fb49bbf773f5c7afffc93f748239411f11ef1bc 100644 (file)
@@ -778,8 +778,9 @@ struct SimInstance
                        child.second->register_output_step_values(data);
        }
 
-       void setInitState()
+       bool setInitState()
        {
+               bool did_something = false;
                for (auto &it : ff_database)
                {
                        ff_state_t &ff = it.second;
@@ -792,12 +793,13 @@ struct SimInstance
                                if (id!=0) {
                                        Const fst_val = Const::from_string(shared->fst->valueOf(id));
                                        ff.past_d = fst_val;
-                                       set_state(qsig, fst_val);
+                                       did_something = set_state(qsig, fst_val);
                                }
                        }
                }
                for (auto child : children)
-                       child.second->setInitState();
+                       did_something |= child.second->setInitState();
+               return did_something;
        }
 
        void setState(dict<int, std::pair<SigBit,bool>> bits, std::string values)
@@ -1112,7 +1114,7 @@ struct SimWorker : SimShared
                                }
 
                                if (initial) {
-                                       top->setInitState();
+                                       did_something |= top->setInitState();
                                        initial = false;
                                }
                                if (did_something)