sim: Only check formal cells during gclk simulation updates

This is required for compatibility with non-multiclock formal semantics.
This commit is contained in:
Jannis Harder 2022-12-21 14:40:58 +01:00
parent 9c6198a827
commit f6458bab70
1 changed files with 19 additions and 16 deletions

View File

@ -653,7 +653,7 @@ struct SimInstance
return did_something; return did_something;
} }
void update_ph3() void update_ph3(bool check_assertions)
{ {
for (auto &it : ff_database) for (auto &it : ff_database)
{ {
@ -688,27 +688,30 @@ struct SimInstance
} }
} }
for (auto cell : formal_database) if (check_assertions)
{ {
string label = log_id(cell); for (auto cell : formal_database)
if (cell->attributes.count(ID::src)) {
label = cell->attributes.at(ID::src).decode_string(); string label = log_id(cell);
if (cell->attributes.count(ID::src))
label = cell->attributes.at(ID::src).decode_string();
State a = get_state(cell->getPort(ID::A))[0]; State a = get_state(cell->getPort(ID::A))[0];
State en = get_state(cell->getPort(ID::EN))[0]; State en = get_state(cell->getPort(ID::EN))[0];
if (cell->type == ID($cover) && en == State::S1 && a != State::S1) if (cell->type == ID($cover) && en == State::S1 && a != State::S1)
log("Cover %s.%s (%s) reached.\n", hiername().c_str(), log_id(cell), label.c_str()); log("Cover %s.%s (%s) reached.\n", hiername().c_str(), log_id(cell), label.c_str());
if (cell->type == ID($assume) && en == State::S1 && a != State::S1) if (cell->type == ID($assume) && en == State::S1 && a != State::S1)
log("Assumption %s.%s (%s) failed.\n", hiername().c_str(), log_id(cell), label.c_str()); log("Assumption %s.%s (%s) failed.\n", hiername().c_str(), log_id(cell), label.c_str());
if (cell->type == ID($assert) && en == State::S1 && a != State::S1) if (cell->type == ID($assert) && en == State::S1 && a != State::S1)
log_warning("Assert %s.%s (%s) failed.\n", hiername().c_str(), log_id(cell), label.c_str()); log_warning("Assert %s.%s (%s) failed.\n", hiername().c_str(), log_id(cell), label.c_str());
}
} }
for (auto it : children) for (auto it : children)
it.second->update_ph3(); it.second->update_ph3(check_assertions);
} }
void set_initstate_outputs(State state) void set_initstate_outputs(State state)
@ -1116,7 +1119,7 @@ struct SimWorker : SimShared
if (debug) if (debug)
log("\n-- ph3 --\n"); log("\n-- ph3 --\n");
top->update_ph3(); top->update_ph3(gclk);
} }
void initialize_stable_past() void initialize_stable_past()
@ -1126,7 +1129,7 @@ struct SimWorker : SimShared
top->update_ph1(); top->update_ph1();
if (debug) if (debug)
log("\n-- ph3 (initialize) --\n"); log("\n-- ph3 (initialize) --\n");
top->update_ph3(); top->update_ph3(false);
} }
void set_inports(pool<IdString> ports, State value) void set_inports(pool<IdString> ports, State value)