I'm trying to use Chisel on a "real-world" project and I'm writing the testbench code part in C++. That work well, I can see all my dumped signals in the dump.vcd file with gtkwave.
But I have a problem for timescale, by default, the function module->dump() record signal with timescale at 1ps:
$timescale 1ps $end
Do you know how to change it ?
The only way I found to change it in the testbench C++ code is to re-open the vcd after closing it and modify the first line :
#define CYCLE_PERIOD_NS 10
FILE *f = fopen("./dump.vcd", "w");
module->set_dumpfile(f);
[...]
/*several module->dump() call */
[...]
if (f) {
fclose(f);
std::string line;
std::ifstream input("./dump.vcd");
std::ofstream output("./tmp.vcd");
std::getline(input, line);
output << "$timescale " << CYCLE_PERIOD_NS << "ns $end" << endl;
while(std::getline(input, line)) {
output << line << endl;
}
rename("./tmp.vcd", "./dump.vcd");
}