3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-29 07:27:58 +00:00

WIP docs: Proto log_help

Define `PrettyHelp` class with methods for declaring different parts of help message.
Currently able to produce standard help messages as expected.
Updates chformal to use (only) the new help_v2.
Currently makes use of a global static to track the current help context, allowing register.h to live in blissful ignorance and instead rely on help_v2 implementations calling `auto *help = PrettyHelp::get_current();` and `return true;` to minimise impact on rebuilds (i.e. not requiring every source file to be recompiled).
This commit is contained in:
Krystine Sherwin 2025-07-21 10:34:11 +12:00
parent 3718f916f3
commit 3bef122a3f
No known key found for this signature in database
6 changed files with 242 additions and 176 deletions

View file

@ -25,30 +25,15 @@
YOSYS_NAMESPACE_BEGIN
struct PassOption {
string keyword;
string description;
};
struct PassUsageBlock {
string signature = "";
string description = "";
vector<PassOption> options = {};
string postscript = "";
};
struct Pass
{
std::string pass_name, short_help;
const vector<std::string> doc_string;
const vector<PassUsageBlock> pass_usages;
Pass(std::string name, std::string short_help = "** document me **",
const vector<std::string> doc_string = {},
const vector<PassUsageBlock> usages = {});
Pass(std::string name, std::string short_help = "** document me **");
// Prefer overriding 'Pass::on_shutdown()' if possible
virtual ~Pass();
virtual void help();
virtual bool help_v2();
virtual void clear_flags();
virtual void execute(std::vector<std::string> args, RTLIL::Design *design) = 0;
@ -60,14 +45,6 @@ struct Pass
experimental_flag = true;
}
bool HasUsages() {
return !pass_usages.empty();
}
bool HasDocstring() {
return !doc_string.empty();
}
struct pre_post_exec_state_t {
Pass *parent_pass;
int64_t begin_ns;