From 9c6198a8272de1558d9f613d52a23c043e1c928a Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Wed, 21 Dec 2022 14:39:49 +0100 Subject: [PATCH] sim: Internal API to set $initstate This is not yet added to any of the simulation drivers. --- passes/sat/sim.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc index 754fbdf95..86736eeb4 100644 --- a/passes/sat/sim.cc +++ b/passes/sat/sim.cc @@ -153,6 +153,7 @@ struct SimInstance dict ff_database; dict mem_database; pool formal_database; + pool initstate_database; dict mem_cells; std::vector memories; @@ -256,6 +257,8 @@ struct SimInstance if (cell->type.in(ID($assert), ID($cover), ID($assume))) { formal_database.insert(cell); } + if (cell->type == ID($initstate)) + initstate_database.insert(cell); } if (shared->zinit) @@ -708,6 +711,14 @@ struct SimInstance it.second->update_ph3(); } + void set_initstate_outputs(State state) + { + for (auto cell : initstate_database) + set_state(cell->getPort(ID::Y), state); + for (auto child : children) + child.second->set_initstate_outputs(state); + } + void writeback(pool &wbmods) { if (!ff_database.empty() || !mem_database.empty()) {