3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-10 17:25:49 +00:00

driver: add --no-version to suppress writing Yosys version in command outputs

This commit is contained in:
Emil J. Tywoniak 2025-05-05 13:12:08 +02:00
parent f60bbe64ac
commit d7affb8821
14 changed files with 31 additions and 13 deletions

View file

@ -662,7 +662,7 @@ struct AigerWriter
f << std::endl; f << std::endl;
} }
} }
if (yosys_write_versions)
f << stringf("c\nGenerated by %s\n", yosys_version_str); f << stringf("c\nGenerated by %s\n", yosys_version_str);
} }

View file

@ -671,6 +671,7 @@ struct XAigerWriter
//f.write(reinterpret_cast<const char*>(&buffer_size_be), sizeof(buffer_size_be)); //f.write(reinterpret_cast<const char*>(&buffer_size_be), sizeof(buffer_size_be));
//f.write(buffer_str.data(), buffer_str.size()); //f.write(buffer_str.data(), buffer_str.size());
if (yosys_write_versions)
f << stringf("Generated by %s\n", yosys_version_str); f << stringf("Generated by %s\n", yosys_version_str);
design->scratchpad_set_int("write_xaiger.num_ands", and_map.size()); design->scratchpad_set_int("write_xaiger.num_ands", and_map.size());

View file

@ -649,6 +649,7 @@ struct BlifBackend : public Backend {
if (module->get_bool_attribute(ID::top)) if (module->get_bool_attribute(ID::top))
top_module_name = module->name.str(); top_module_name = module->name.str();
if (yosys_write_versions)
*f << stringf("# Generated by %s\n", yosys_version_str); *f << stringf("# Generated by %s\n", yosys_version_str);
std::vector<RTLIL::Module*> mod_list; std::vector<RTLIL::Module*> mod_list;

View file

@ -231,6 +231,8 @@ struct EdifBackend : public Backend {
*f << stringf(" (edifVersion 2 0 0)\n"); *f << stringf(" (edifVersion 2 0 0)\n");
*f << stringf(" (edifLevel 0)\n"); *f << stringf(" (edifLevel 0)\n");
*f << stringf(" (keywordMap (keywordLevel 0))\n"); *f << stringf(" (keywordMap (keywordLevel 0))\n");
if (yosys_write_versions)
*f << stringf(" (comment \"Generated by %s\")\n", yosys_version_str); *f << stringf(" (comment \"Generated by %s\")\n", yosys_version_str);
*f << stringf(" (external LIB\n"); *f << stringf(" (external LIB\n");

View file

@ -291,6 +291,7 @@ struct JsonWriter
design->sort(); design->sort();
f << stringf("{\n"); f << stringf("{\n");
if (yosys_write_versions)
f << stringf(" \"creator\": %s,\n", get_string(yosys_version_str).c_str()); f << stringf(" \"creator\": %s,\n", get_string(yosys_version_str).c_str());
f << stringf(" \"modules\": {\n"); f << stringf(" \"modules\": {\n");
vector<Module*> modules = use_selection ? design->selected_modules() : design->modules(); vector<Module*> modules = use_selection ? design->selected_modules() : design->modules();

View file

@ -459,6 +459,8 @@ struct RTLILBackend : public Backend {
design->sort(); design->sort();
log("Output filename: %s\n", filename.c_str()); log("Output filename: %s\n", filename.c_str());
if (yosys_write_versions)
*f << stringf("# Generated by %s\n", yosys_version_str); *f << stringf("# Generated by %s\n", yosys_version_str);
RTLIL_BACKEND::dump_design(*f, design, selected, true, false); RTLIL_BACKEND::dump_design(*f, design, selected, true, false);
} }

View file

@ -1289,6 +1289,7 @@ class MkVcd:
assert t >= self.t assert t >= self.t
if t != self.t: if t != self.t:
if self.t == -1: if self.t == -1:
# TODO if (yosys_write_versions) equivalent?
print("$version Generated by Yosys-SMTBMC $end", file=self.f) print("$version Generated by Yosys-SMTBMC $end", file=self.f)
print("$timescale 1ns $end", file=self.f) print("$timescale 1ns $end", file=self.f)
print("$var integer 32 t smt_step $end", file=self.f) print("$var integer 32 t smt_step $end", file=self.f)

View file

@ -2596,7 +2596,9 @@ struct VerilogBackend : public Backend {
design->sort(); design->sort();
if (yosys_write_versions)
*f << stringf("/* Generated by %s */\n", yosys_version_str); *f << stringf("/* Generated by %s */\n", yosys_version_str);
for (auto module : design->modules()) { for (auto module : design->modules()) {
if (module->get_blackbox_attribute() != blackboxes) if (module->get_blackbox_attribute() != blackboxes)
continue; continue;

View file

@ -252,6 +252,7 @@ int main(int argc, char **argv)
options.add_options("logging") options.add_options("logging")
("Q", "suppress printing of banner (copyright, disclaimer, version)") ("Q", "suppress printing of banner (copyright, disclaimer, version)")
("T", "suppress printing of footer (log hash, version, timing statistics)") ("T", "suppress printing of footer (log hash, version, timing statistics)")
("no-version", "suppress writing Yosys version in command outputs")
("q,quiet", "quiet operation. Only write warnings and error messages to console. " \ ("q,quiet", "quiet operation. Only write warnings and error messages to console. " \
"Use this option twice to also quiet warning messages") "Use this option twice to also quiet warning messages")
("v,verbose", "print log headers up to <level> to the console. " \ ("v,verbose", "print log headers up to <level> to the console. " \
@ -318,6 +319,7 @@ int main(int argc, char **argv)
if (result.count("A")) call_abort = true; if (result.count("A")) call_abort = true;
if (result.count("Q")) print_banner = false; if (result.count("Q")) print_banner = false;
if (result.count("T")) print_stats = false; if (result.count("T")) print_stats = false;
if (result.count("no-version")) yosys_write_versions = false;
if (result.count("V")) { if (result.count("V")) {
std::cout << yosys_version_str << std::endl; std::cout << yosys_version_str << std::endl;
exit(0); exit(0);

View file

@ -81,6 +81,7 @@ YOSYS_NAMESPACE_BEGIN
int autoidx = 1; int autoidx = 1;
int yosys_xtrace = 0; int yosys_xtrace = 0;
bool yosys_write_versions = true;
RTLIL::Design *yosys_design = NULL; RTLIL::Design *yosys_design = NULL;
CellTypes yosys_celltypes; CellTypes yosys_celltypes;

View file

@ -274,6 +274,7 @@ inline int GetSize(RTLIL::Wire *wire);
extern int autoidx; extern int autoidx;
extern int yosys_xtrace; extern int yosys_xtrace;
extern bool yosys_write_versions;
RTLIL::IdString new_id(std::string file, int line, std::string func); RTLIL::IdString new_id(std::string file, int line, std::string func);
RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix); RTLIL::IdString new_id_suffix(std::string file, int line, std::string func, std::string suffix);

View file

@ -99,6 +99,7 @@ struct InternalStatsPass : public Pass {
if (json_mode) { if (json_mode) {
log("{\n"); log("{\n");
if (yosys_write_versions)
log(" \"creator\": %s,\n", json11::Json(yosys_version_str).dump().c_str()); log(" \"creator\": %s,\n", json11::Json(yosys_version_str).dump().c_str());
std::stringstream invocation; std::stringstream invocation;
std::copy(args.begin(), args.end(), std::ostream_iterator<std::string>(invocation, " ")); std::copy(args.begin(), args.end(), std::ostream_iterator<std::string>(invocation, " "));

View file

@ -444,6 +444,7 @@ struct StatPass : public Pass {
if (json_mode) { if (json_mode) {
log("{\n"); log("{\n");
if (yosys_write_versions)
log(" \"creator\": %s,\n", json11::Json(yosys_version_str).dump().c_str()); log(" \"creator\": %s,\n", json11::Json(yosys_version_str).dump().c_str());
std::stringstream invocation; std::stringstream invocation;
std::copy(args.begin(), args.end(), std::ostream_iterator<std::string>(invocation, " ")); std::copy(args.begin(), args.end(), std::ostream_iterator<std::string>(invocation, " "));

View file

@ -690,9 +690,11 @@ struct SatHelper
fprintf(f, "$date\n"); fprintf(f, "$date\n");
fprintf(f, " %s\n", stime); fprintf(f, " %s\n", stime);
fprintf(f, "$end\n"); fprintf(f, "$end\n");
if (yosys_write_versions) {
fprintf(f, "$version\n"); fprintf(f, "$version\n");
fprintf(f, " Generated by %s\n", yosys_version_str); fprintf(f, " Generated by %s\n", yosys_version_str);
fprintf(f, "$end\n"); fprintf(f, "$end\n");
}
fprintf(f, "$comment\n"); fprintf(f, "$comment\n");
fprintf(f, " Generated from SAT problem in module %s (declared at %s)\n", fprintf(f, " Generated from SAT problem in module %s (declared at %s)\n",
module->name.c_str(), module_fname.c_str()); module->name.c_str(), module_fname.c_str());