diff --git a/kernel/log_help.cc b/kernel/log_help.cc index fe9829af1..a6c6ad778 100644 --- a/kernel/log_help.cc +++ b/kernel/log_help.cc @@ -84,13 +84,14 @@ void PrettyHelp::usage(const string &usage) log("\n"); } -void PrettyHelp::option(const string &option, const string &description) +void PrettyHelp::option(const string &text, const string &description) { - log_pass_str(option, current_indent); + open_option(text); if (description.length()) { - log_pass_str(description, current_indent+1); + log_pass_str(description, current_indent); log("\n"); } + close(1); } void PrettyHelp::codeblock(const string &code, const string &) @@ -104,13 +105,19 @@ void PrettyHelp::paragraph(const string &text) log("\n"); } -void PrettyHelp::optiongroup(const string &) +void PrettyHelp::open_optiongroup(const string &) { current_indent += 1; } -void PrettyHelp::endgroup() +void PrettyHelp::open_option(const string &text) { - current_indent -= 1; + log_pass_str(text, current_indent); + current_indent += 1; +} + +void PrettyHelp::close(int levels) +{ + current_indent -= levels; log_assert(current_indent >= 0); } diff --git a/kernel/log_help.h b/kernel/log_help.h index bc62b20a6..850c1516d 100644 --- a/kernel/log_help.h +++ b/kernel/log_help.h @@ -38,12 +38,13 @@ public: bool has_content(); void usage(const string &usage); - void option(const string &option, const string &description = ""); + void option(const string &text, const string &description = ""); void codeblock(const string &code, const string &language = "none"); void paragraph(const string &text); - void optiongroup(const string &group = ""); - void endgroup(); + void open_optiongroup(const string &group = ""); + void open_option(const string &text); + void close(int levels = 1); }; YOSYS_NAMESPACE_END diff --git a/passes/cmds/chformal.cc b/passes/cmds/chformal.cc index e2f1e0406..1f3f8fe11 100644 --- a/passes/cmds/chformal.cc +++ b/passes/cmds/chformal.cc @@ -82,7 +82,7 @@ struct ChformalPass : public Pass { "given, the command will operate on all constraint types:" ); - help->optiongroup("[types]"); + help->open_optiongroup("[types]"); help->option("-assert", "`$assert` cells, representing ``assert(...)`` constraints"); help->option("-assume", "`$assume` cells, representing ``assume(...)`` constraints"); help->option("-live", "`$live` cells, representing ``assert(s_eventually ...)``"); @@ -92,11 +92,11 @@ struct ChformalPass : public Pass { "Additionally chformal will operate on `$check` cells corresponding to the " "selected constraint types." ); - help->endgroup(); + help->close(); help->paragraph("Exactly one of the following modes must be specified:"); - help->optiongroup("[mode]"); + help->open_optiongroup("[mode]"); help->option("-remove", "remove the cells and thus constraints from the design"); help->option("-early", "bypass FFs that only delay the activation of a constraint. When inputs " @@ -105,14 +105,17 @@ struct ChformalPass : public Pass { ); help->option("-delay ", "delay activation of the constraint by clock cycles"); help->option("-skip ", "ignore activation of the constraint in the first clock cycles"); - help->option("-coverenable", + help->open_option("-coverenable"); + help->paragraph( "add cover statements for the enable signals of the constraints" + ); #ifdef YOSYS_ENABLE_VERIFIC - "\n\n" + help->paragraph( "Note: For the Verific frontend it is currently not guaranteed that a " "reachable SVA statement corresponds to an active enable signal." -#endif ); +#endif + help->close(); help->option("-assert2assume"); help->option("-assume2assert"); help->option("-live2fair"); @@ -122,6 +125,7 @@ struct ChformalPass : public Pass { "$cover cell. If the $check cell contains a message, also produce a " "$print cell." ); + help->close(); return true; } void execute(std::vector args, RTLIL::Design *design) override