aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN. Engelhardt <nak@symbioticeda.com>2020-10-22 14:01:24 +0200
committerGitHub <noreply@github.com>2020-10-22 14:01:24 +0200
commit3b86b5da5f37c36e7fd8b4a75ed39418fafdfff2 (patch)
tree051a332fc08a848da19966f4f0107dedd3629171
parenteb76d35e8030f4befb596fee6d7682d39628dc69 (diff)
parent1c96a0b1d5da678a86e9d3b1b1f56390d38600f3 (diff)
downloadyosys-3b86b5da5f37c36e7fd8b4a75ed39418fafdfff2.tar.gz
yosys-3b86b5da5f37c36e7fd8b4a75ed39418fafdfff2.tar.bz2
yosys-3b86b5da5f37c36e7fd8b4a75ed39418fafdfff2.zip
Merge pull request #2403 from nakengelhardt/sim_timescale
sim -vcd: add date, version, and option for timescale
-rw-r--r--passes/sat/sim.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/passes/sat/sim.cc b/passes/sat/sim.cc
index b7085369a..75f922dba 100644
--- a/passes/sat/sim.cc
+++ b/passes/sat/sim.cc
@@ -22,6 +22,8 @@
#include "kernel/celltypes.h"
#include "kernel/mem.h"
+#include <ctime>
+
USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN
@@ -620,6 +622,7 @@ struct SimWorker : SimShared
SimInstance *top = nullptr;
std::ofstream vcdfile;
pool<IdString> clock, clockn, reset, resetn;
+ std::string timescale;
~SimWorker()
{
@@ -631,6 +634,17 @@ struct SimWorker : SimShared
if (!vcdfile.is_open())
return;
+ vcdfile << stringf("$version %s $end\n", yosys_version_str);
+
+ 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 (!timescale.empty())
+ vcdfile << stringf("$timescale %s $end\n", timescale.c_str());
+
int id = 1;
top->write_vcd_header(vcdfile, id);
@@ -770,6 +784,9 @@ struct SimPass : public Pass {
log(" -zinit\n");
log(" zero-initialize all uninitialized regs and memories\n");
log("\n");
+ log(" -timescale <string>\n");
+ log(" include the specified timescale declaration in the vcd\n");
+ log("\n");
log(" -n <integer>\n");
log(" number of cycles to simulate (default: 20)\n");
log("\n");
@@ -820,6 +837,10 @@ struct SimPass : public Pass {
worker.resetn.insert(RTLIL::escape_id(args[++argidx]));
continue;
}
+ if (args[argidx] == "-timescale" && argidx+1 < args.size()) {
+ worker.timescale = args[++argidx];
+ continue;
+ }
if (args[argidx] == "-a") {
worker.hide_internal = false;
continue;