mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-12 20:18:20 +00:00
Merge pull request #2995 from georgerennie/cover_precond
chformal: Add -coverenable option
This commit is contained in:
commit
ec94703619
|
@ -55,6 +55,14 @@ struct ChformalPass : public Pass {
|
||||||
log(" -skip <N>\n");
|
log(" -skip <N>\n");
|
||||||
log(" ignore activation of the constraint in the first <N> clock cycles\n");
|
log(" ignore activation of the constraint in the first <N> clock cycles\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -coverenable\n");
|
||||||
|
log(" add cover statements for the enable signals of the constraints\n");
|
||||||
|
log("\n");
|
||||||
|
#ifdef YOSYS_ENABLE_VERIFIC
|
||||||
|
log(" Note: For the Verific frontend it is currently not guaranteed that a\n");
|
||||||
|
log(" reachable SVA statement corresponds to an active enable signal.\n");
|
||||||
|
log("\n");
|
||||||
|
#endif
|
||||||
log(" -assert2assume\n");
|
log(" -assert2assume\n");
|
||||||
log(" -assume2assert\n");
|
log(" -assume2assert\n");
|
||||||
log(" -live2fair\n");
|
log(" -live2fair\n");
|
||||||
|
@ -114,6 +122,10 @@ struct ChformalPass : public Pass {
|
||||||
mode_arg = atoi(args[++argidx].c_str());
|
mode_arg = atoi(args[++argidx].c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (mode == 0 && args[argidx] == "-coverenable") {
|
||||||
|
mode = 'p';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((mode == 0 || mode == 'c') && args[argidx] == "-assert2assume") {
|
if ((mode == 0 || mode == 'c') && args[argidx] == "-assert2assume") {
|
||||||
assert2assume = true;
|
assert2assume = true;
|
||||||
mode = 'c';
|
mode = 'c';
|
||||||
|
@ -263,6 +275,13 @@ struct ChformalPass : public Pass {
|
||||||
cell->setPort(ID::EN, module->LogicAnd(NEW_ID, en, cell->getPort(ID::EN)));
|
cell->setPort(ID::EN, module->LogicAnd(NEW_ID, en, cell->getPort(ID::EN)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if (mode =='p')
|
||||||
|
{
|
||||||
|
for (auto cell : constr_cells)
|
||||||
|
module->addCover(NEW_ID_SUFFIX("coverenable"),
|
||||||
|
cell->getPort(ID::EN), State::S1, cell->get_src_attribute());
|
||||||
|
}
|
||||||
|
else
|
||||||
if (mode == 'c')
|
if (mode == 'c')
|
||||||
{
|
{
|
||||||
for (auto cell : constr_cells)
|
for (auto cell : constr_cells)
|
||||||
|
|
25
tests/various/chformal_coverenable.ys
Normal file
25
tests/various/chformal_coverenable.ys
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
read_verilog -formal <<EOT
|
||||||
|
module top(input a, b, c, d);
|
||||||
|
|
||||||
|
always @* begin
|
||||||
|
if (a) assert (b == c);
|
||||||
|
if (!a) assert (b != c);
|
||||||
|
if (b) assume (c);
|
||||||
|
if (c) cover (d);
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
prep -top top
|
||||||
|
|
||||||
|
select -assert-count 1 t:$cover
|
||||||
|
|
||||||
|
chformal -cover -coverenable
|
||||||
|
select -assert-count 2 t:$cover
|
||||||
|
|
||||||
|
chformal -assert -coverenable
|
||||||
|
select -assert-count 4 t:$cover
|
||||||
|
|
||||||
|
chformal -assume -coverenable
|
||||||
|
select -assert-count 5 t:$cover
|
Loading…
Reference in a new issue