From: Miodrag Milanovic Date: Fri, 11 Mar 2022 15:01:59 +0000 (+0100) Subject: Add date parameter to enable full date/time and version info X-Git-Tag: yosys-0.16~47^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37de369ba78dd15e40b7fa11b13cea3d2c2ed8d0;p=yosys.git Add date parameter to enable full date/time and version info --- diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc index 6b03235d3..b37bf25cd 100644 --- a/passes/sat/sim.cc +++ b/passes/sat/sim.cc @@ -89,6 +89,7 @@ struct SimShared std::vector> outputfiles; std::vector>> output_data; bool ignore_x = false; + bool date = false; }; void zinit(State &v) @@ -1333,12 +1334,14 @@ struct VCDWriter : public OutputWriter void write(std::map &use_signal) override { if (!vcdfile.is_open()) return; - vcdfile << stringf("$version %s $end\n", yosys_version_str); + vcdfile << stringf("$version %s $end\n", worker->date ? yosys_version_str : "Yosys"); - std::time_t t = std::time(nullptr); - char mbstr[255]; - if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) { - vcdfile << stringf("$date ") << mbstr << stringf(" $end\n"); + if (worker->date) { + std::time_t t = std::time(nullptr); + char mbstr[255]; + if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) { + vcdfile << stringf("$date ") << mbstr << stringf(" $end\n"); + } } if (!worker->timescale.empty()) @@ -1391,8 +1394,11 @@ struct FSTWriter : public OutputWriter { if (!fstfile) return; std::time_t t = std::time(nullptr); - fstWriterSetDate(fstfile, asctime(std::localtime(&t))); - fstWriterSetVersion(fstfile, yosys_version_str); + fstWriterSetVersion(fstfile, worker->date ? yosys_version_str : "Yosys"); + if (worker->date) + fstWriterSetDate(fstfile, asctime(std::localtime(&t))); + else + fstWriterSetDate(fstfile, ""); if (!worker->timescale.empty()) fstWriterSetTimescaleFromString(fstfile, worker->timescale.c_str()); @@ -1563,6 +1569,9 @@ struct SimPass : public Pass { log(" -x\n"); log(" ignore constant x outputs in simulation file.\n"); log("\n"); + log(" -date\n"); + log(" include date and full version info in output.\n"); + log("\n"); log(" -clock \n"); log(" name of top-level clock input\n"); log("\n"); @@ -1759,6 +1768,10 @@ struct SimPass : public Pass { worker.ignore_x = true; continue; } + if (args[argidx] == "-date") { + worker.date = true; + continue; + } break; } extra_args(args, argidx, design);