Skip to content

Commit 37de369

Browse files
committed
Add date parameter to enable full date/time and version info
1 parent be32de1 commit 37de369

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

passes/sat/sim.cc

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct SimShared
8989
std::vector<std::unique_ptr<OutputWriter>> outputfiles;
9090
std::vector<std::pair<int,std::map<int,Const>>> output_data;
9191
bool ignore_x = false;
92+
bool date = false;
9293
};
9394

9495
void zinit(State &v)
@@ -1333,12 +1334,14 @@ struct VCDWriter : public OutputWriter
13331334
void write(std::map<int, bool> &use_signal) override
13341335
{
13351336
if (!vcdfile.is_open()) return;
1336-
vcdfile << stringf("$version %s $end\n", yosys_version_str);
1337+
vcdfile << stringf("$version %s $end\n", worker->date ? yosys_version_str : "Yosys");
13371338

1338-
std::time_t t = std::time(nullptr);
1339-
char mbstr[255];
1340-
if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) {
1341-
vcdfile << stringf("$date ") << mbstr << stringf(" $end\n");
1339+
if (worker->date) {
1340+
std::time_t t = std::time(nullptr);
1341+
char mbstr[255];
1342+
if (std::strftime(mbstr, sizeof(mbstr), "%c", std::localtime(&t))) {
1343+
vcdfile << stringf("$date ") << mbstr << stringf(" $end\n");
1344+
}
13421345
}
13431346

13441347
if (!worker->timescale.empty())
@@ -1391,8 +1394,11 @@ struct FSTWriter : public OutputWriter
13911394
{
13921395
if (!fstfile) return;
13931396
std::time_t t = std::time(nullptr);
1394-
fstWriterSetDate(fstfile, asctime(std::localtime(&t)));
1395-
fstWriterSetVersion(fstfile, yosys_version_str);
1397+
fstWriterSetVersion(fstfile, worker->date ? yosys_version_str : "Yosys");
1398+
if (worker->date)
1399+
fstWriterSetDate(fstfile, asctime(std::localtime(&t)));
1400+
else
1401+
fstWriterSetDate(fstfile, "");
13961402
if (!worker->timescale.empty())
13971403
fstWriterSetTimescaleFromString(fstfile, worker->timescale.c_str());
13981404

@@ -1563,6 +1569,9 @@ struct SimPass : public Pass {
15631569
log(" -x\n");
15641570
log(" ignore constant x outputs in simulation file.\n");
15651571
log("\n");
1572+
log(" -date\n");
1573+
log(" include date and full version info in output.\n");
1574+
log("\n");
15661575
log(" -clock <portname>\n");
15671576
log(" name of top-level clock input\n");
15681577
log("\n");
@@ -1759,6 +1768,10 @@ struct SimPass : public Pass {
17591768
worker.ignore_x = true;
17601769
continue;
17611770
}
1771+
if (args[argidx] == "-date") {
1772+
worker.date = true;
1773+
continue;
1774+
}
17621775
break;
17631776
}
17641777
extra_args(args, argidx, design);

0 commit comments

Comments
 (0)