From 1dcb683fcb7d67b045b7600fdd28ec354b78632b Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 3 Nov 2013 21:41:39 +0100 Subject: [PATCH] Write yosys version to output files --- backends/blif/blif.cc | 2 ++ backends/edif/edif.cc | 4 ++++ backends/ilang/ilang_backend.cc | 1 + backends/spice/spice.cc | 5 +---- backends/verilog/verilog_backend.cc | 4 ++-- kernel/driver.cc | 3 --- kernel/register.h | 3 +++ 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/backends/blif/blif.cc b/backends/blif/blif.cc index e8909b91a..9379fce54 100644 --- a/backends/blif/blif.cc +++ b/backends/blif/blif.cc @@ -293,6 +293,8 @@ struct BlifBackend : public Backend { } extra_args(f, filename, args, argidx); + fprintf(f, "# Generated by %s\n", yosys_version_str); + std::vector mod_list; for (auto module_it : design->modules) diff --git a/backends/edif/edif.cc b/backends/edif/edif.cc index fe6e7bade..a4d8c1753 100644 --- a/backends/edif/edif.cc +++ b/backends/edif/edif.cc @@ -17,6 +17,9 @@ * */ +// [[CITE]] EDIF Version 2 0 0 Grammar +// http://web.archive.org/web/20050730021644/http://www.edif.org/documentation/BNF_GRAMMAR/index.html + #include "kernel/rtlil.h" #include "kernel/register.h" #include "kernel/sigtools.h" @@ -151,6 +154,7 @@ struct EdifBackend : public Backend { fprintf(f, " (edifVersion 2 0 0)\n"); fprintf(f, " (edifLevel 0)\n"); fprintf(f, " (keywordMap (keywordLevel 0))\n"); + fprintf(f, " (comment \"Generated by %s\")\n", yosys_version_str); fprintf(f, " (external LIB\n"); fprintf(f, " (edifLevel 0)\n"); diff --git a/backends/ilang/ilang_backend.cc b/backends/ilang/ilang_backend.cc index 5d70457e8..9bf0fb0ae 100644 --- a/backends/ilang/ilang_backend.cc +++ b/backends/ilang/ilang_backend.cc @@ -364,6 +364,7 @@ struct IlangBackend : public Backend { extra_args(f, filename, args, argidx); log("Output filename: %s\n", filename.c_str()); + fprintf(f, "# Generated by %s\n", yosys_version_str); ILANG_BACKEND::dump_design(f, design, selected); } } IlangBackend; diff --git a/backends/spice/spice.cc b/backends/spice/spice.cc index e6e4ab4b0..28a91714b 100644 --- a/backends/spice/spice.cc +++ b/backends/spice/spice.cc @@ -172,10 +172,7 @@ struct SpiceBackend : public Backend { } extra_args(f, filename, args, argidx); - fprintf(f, "\n"); - fprintf(f, "*************************************\n"); - fprintf(f, "* SPICE netlist, generated by Yosys *\n"); - fprintf(f, "*************************************\n"); + fprintf(f, "* SPICE netlist generated by %s\n", yosys_version_str); fprintf(f, "\n"); for (auto module_it : design->modules) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 88a48b584..66a497808 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -803,6 +803,7 @@ void dump_module(FILE *f, std::string indent, RTLIL::Module *module) reset_auto_counter(module); active_module = module; + fprintf(f, "\n"); for (auto it = module->processes.begin(); it != module->processes.end(); it++) dump_process(f, indent + " ", it->second, true); @@ -956,6 +957,7 @@ struct VerilogBackend : public Backend { } extra_args(f, filename, args, argidx); + fprintf(f, "/* Generated by %s */\n", yosys_version_str); for (auto it = design->modules.begin(); it != design->modules.end(); it++) { if (it->second->get_bool_attribute("\\placeholder") != placeholders) continue; @@ -964,8 +966,6 @@ struct VerilogBackend : public Backend { log_cmd_error("Can't handle partially selected module %s!\n", RTLIL::id2cstr(it->first)); continue; } - if (it != design->modules.begin()) - fprintf(f, "\n"); log("Dumping module `%s'.\n", it->first.c_str()); dump_module(f, "", it->second); } diff --git a/kernel/driver.cc b/kernel/driver.cc index 1e8b86a36..54f7a2e65 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -31,9 +31,6 @@ #include "kernel/register.h" #include "kernel/log.h" -// from kernel/version_*.o (cc source generated from Makefile) -extern const char *yosys_version_str; - bool fgetline(FILE *f, std::string &buffer) { buffer = ""; diff --git a/kernel/register.h b/kernel/register.h index f66cbfd30..4dd86cf3d 100644 --- a/kernel/register.h +++ b/kernel/register.h @@ -31,6 +31,9 @@ extern Tcl_Interp *yosys_get_tcl_interp(); #endif +// from kernel/version_*.o (cc source generated from Makefile) +extern const char *yosys_version_str; + // implemented in driver.cc extern RTLIL::Design *yosys_get_design(); std::string rewrite_yosys_exe(std::string exe); -- 2.30.2