Skip to content

Commit 16f9191

Browse files
authored
[ESI][Cosim][Verilator] Switch to FST and dump time (#9031)
- Dump before changing the clock to make waveforms more standard. - Switch to the more efficient FST waveform standard.
1 parent 60546ca commit 16f9191

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/Dialect/ESI/runtime/cosim_dpi_server/driver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include CONCAT3(V,TOP_MODULE,.h)
3131
// clang-format on
3232

33-
#include "verilated_vcd_c.h"
33+
#include "verilated_fst_c.h"
3434

3535
#include "signal.h"
3636
#include <iostream>
@@ -64,12 +64,12 @@ int main(int argc, char **argv) {
6464
}
6565

6666
#ifdef TRACE
67-
VerilatedVcdC *tfp = nullptr;
67+
VerilatedFstC *tfp = nullptr;
6868
#endif
6969

7070
if (waveformFile) {
7171
#ifdef TRACE
72-
tfp = new VerilatedVcdC();
72+
tfp = new VerilatedFstC();
7373
Verilated::traceEverOn(true);
7474
dut.trace(tfp, 99); // Trace 99 levels of hierarchy
7575
tfp->open(waveformFile);
@@ -95,11 +95,11 @@ int main(int argc, char **argv) {
9595
// Run for a few cycles with reset held.
9696
for (timeStamp = 0; timeStamp < 8 && !Verilated::gotFinish(); timeStamp++) {
9797
dut.eval();
98-
dut.clk = !dut.clk;
9998
#ifdef TRACE
10099
if (tfp)
101100
tfp->dump(timeStamp);
102101
#endif
102+
dut.clk = !dut.clk;
103103
}
104104

105105
// Take simulation out of reset.
@@ -108,12 +108,12 @@ int main(int argc, char **argv) {
108108
// Run for the specified number of cycles out of reset.
109109
for (; !Verilated::gotFinish() && !stopSimulation; timeStamp++) {
110110
dut.eval();
111-
dut.clk = !dut.clk;
112-
113111
#ifdef TRACE
114112
if (tfp)
115113
tfp->dump(timeStamp);
116114
#endif
115+
dut.clk = !dut.clk;
116+
117117
if (debugPeriod)
118118
std::this_thread::sleep_for(std::chrono::milliseconds(debugPeriod));
119119
}

lib/Dialect/ESI/runtime/python/esiaccel/cosim/verilator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def compile_commands(self) -> List[List[str]]:
5959
]
6060
if self.debug:
6161
cmd += [
62-
"--trace", "--trace-params", "--trace-structs", "--trace-underscore"
62+
"--trace-fst", "--trace-params", "--trace-structs",
63+
"--trace-underscore"
6364
]
6465
cflags.append("-DTRACE")
6566
if len(cflags) > 0:

0 commit comments

Comments
 (0)