WaveDumper constructor Null safety
Attaches a WaveDumper to record all signal changes in a simulation of module in a VCD file at outputPath.
Implementation
WaveDumper(this.module, {this.outputPath = 'waves.vcd'})
: _outputFile = File(outputPath)..createSync(recursive: true) {
if (!module.hasBuilt) {
throw Exception(
'Module must be built before passed to dumper. Call build() first.');
}
_outFileSink = _outputFile.openWrite();
_collectAllSignals();
_writeHeader();
_writeScope();
Simulator.preTick.listen((args) {
if (Simulator.time != _currentDumpingTimestamp) {
if (_changedLogicsThisTimestamp.isNotEmpty) {
// no need to write blank timestamps
_captureTimestamp(_currentDumpingTimestamp);
}
_currentDumpingTimestamp = Simulator.time;
}
});
Simulator.registerEndOfSimulationAction(() async {
_captureTimestamp(Simulator.time);
await _terminate();
});
}