3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-09 12:50:33 +00:00

driver: allow --no-version still write things like Generated by Yosys

This commit is contained in:
Emil J. Tywoniak 2025-05-07 11:34:23 +02:00
parent d7affb8821
commit 90a2c92370
21 changed files with 36 additions and 40 deletions

View file

@ -252,7 +252,7 @@ int main(int argc, char **argv)
options.add_options("logging")
("Q", "suppress printing of banner (copyright, disclaimer, version)")
("T", "suppress printing of footer (log hash, version, timing statistics)")
("no-version", "suppress writing Yosys version in command outputs")
("no-version", "suppress writing out Yosys version anywhere excluding -V, --version")
("q,quiet", "quiet operation. Only write warnings and error messages to console. " \
"Use this option twice to also quiet warning messages")
("v,verbose", "print log headers up to <level> to the console. " \
@ -693,7 +693,7 @@ int main(int argc, char **argv)
stats_divider.c_str(), ru_buffer.ru_utime.tv_sec + 1e-6 * ru_buffer.ru_utime.tv_usec,
ru_buffer.ru_stime.tv_sec + 1e-6 * ru_buffer.ru_stime.tv_usec, meminfo.c_str());
#endif
log("%s\n", yosys_version_str);
log("%s\n", yosys_maybe_version());
int64_t total_ns = 0;
std::set<tuple<int64_t, int, std::string>> timedat;
@ -733,7 +733,7 @@ int main(int argc, char **argv)
log_error("Can't open performance log file for writing: %s\n", strerror(errno));
fprintf(f, "{\n");
fprintf(f, " \"generator\": \"%s\",\n", yosys_version_str);
fprintf(f, " \"generator\": \"%s\",\n", yosys_maybe_version());
fprintf(f, " \"total_ns\": %" PRIu64 ",\n", total_ns);
fprintf(f, " \"passes\": {");

View file

@ -860,7 +860,7 @@ struct HelpPass : public Pass {
// init json
json.begin_object();
json.entry("version", "Yosys internal cells");
json.entry("generator", yosys_version_str);
json.entry("generator", yosys_maybe_version());
dict<string, vector<string>> groups;
dict<string, pair<SimHelper, CellType>> cells;

View file

@ -82,6 +82,13 @@ YOSYS_NAMESPACE_BEGIN
int autoidx = 1;
int yosys_xtrace = 0;
bool yosys_write_versions = true;
const char* yosys_maybe_version() {
if (yosys_write_versions)
return yosys_version_str;
else
return "Yosys";
}
RTLIL::Design *yosys_design = NULL;
CellTypes yosys_celltypes;
@ -145,7 +152,7 @@ void yosys_banner()
log(" | Copyright (C) 2012 - 2025 Claire Xenia Wolf <claire@yosyshq.com> |\n");
log(" | Distributed under an ISC-like license, type \"license\" to see terms |\n");
log(" \\----------------------------------------------------------------------------/\n");
log(" %s\n", yosys_version_str);
log(" %s\n", yosys_maybe_version());
}
#if !defined(YOSYS_DISABLE_SPAWN)

View file

@ -81,6 +81,7 @@ extern std::set<std::string> yosys_input_files, yosys_output_files;
// from kernel/version_*.o (cc source generated from Makefile)
extern const char *yosys_version_str;
const char* yosys_maybe_version();
// from passes/cmds/design.cc
extern std::map<std::string, RTLIL::Design*> saved_designs;