Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_btor: Include $assert and $assume cells in -ywmap output #4320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions backends/btor/btor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ struct BtorWorker
vector<ywmap_btor_sig> ywmap_states;
dict<SigBit, int> ywmap_clock_bits;
dict<SigBit, int> ywmap_clock_inputs;
vector<Cell *> ywmap_asserts;
vector<Cell *> ywmap_assumes;


PrettyJson ywmap_json;
Expand Down Expand Up @@ -1277,6 +1279,8 @@ struct BtorWorker
btorf("%d or %d %d %d\n", nid_a_or_not_en, sid, nid_a, nid_not_en);
btorf("%d constraint %d\n", nid, nid_a_or_not_en);

if (ywmap_json.active()) ywmap_assumes.emplace_back(cell);

btorf_pop(log_id(cell));
}

Expand All @@ -1301,6 +1305,8 @@ struct BtorWorker
} else {
int nid = next_nid++;
btorf("%d bad %d%s\n", nid, nid_en_and_not_a, getinfo(cell, true).c_str());

if (ywmap_json.active()) ywmap_asserts.emplace_back(cell);
}
}

Expand Down Expand Up @@ -1458,6 +1464,7 @@ struct BtorWorker
log_assert(cursor == 0);
log_assert(GetSize(todo) == 1);
btorf("%d bad %d\n", nid, todo[cursor]);
// What do we do with ywmap_asserts when using single_bad?
}
}

Expand Down Expand Up @@ -1523,6 +1530,18 @@ struct BtorWorker
emit_ywmap_btor_sig(entry);
ywmap_json.end_array();

ywmap_json.name("asserts");
ywmap_json.begin_array();
for (Cell *cell : ywmap_asserts)
ywmap_json.value(witness_path(cell));
ywmap_json.end_array();

ywmap_json.name("assumes");
ywmap_json.begin_array();
for (Cell *cell : ywmap_assumes)
ywmap_json.value(witness_path(cell));
ywmap_json.end_array();

ywmap_json.end_object();
}
}
Expand Down
Loading