dart_wellen 0.1.1
dart_wellen: ^0.1.1 copied to clipboard
Wellen bindings for ROHD with VCD, FST, and GHW reading and VCD writing.
dart_wellen #
dart_wellen exposes the Rust
Wellen waveform parser to Dart through
Flutter Rust Bridge. It reads VCD, FST, and GHW waveforms and adapts them to
the shared rohd_hierarchy and rohd_waveform contracts.
Capabilities #
| Operation | Native | WebAssembly |
|---|---|---|
| Read VCD, FST, or GHW from a file path | Yes | No |
| Read VCD, FST, or GHW from bytes | Yes | Yes |
| Query hierarchy and selected signal data | Yes | Yes |
| Write VCD | Yes | No |
| Write FST or GHW | No | No |
Writing is deliberately separated from the cross-platform reader because it
uses dart:io.
Installation #
Add the package to a Dart or Flutter package:
dependencies:
dart_wellen: ^0.1.1
The package owns its bridge version and matching artifacts. Prepared local
packages and hosted archives include generated Dart bindings and the browser
runtime under web/pkg. Git dependencies retrieve those same files from a
checksummed CI bundle for the exact selected Git commit, without compiling dependencies:
python3 <resolved-dart_wellen-root>/tool/bridge_artifacts.py install
Python 3 is required. The installer verifies package/bridge versions and SHA-256
checksums. For Git installs it downloads the selected commit's CI-produced JSON
metadata before its archive, checks the commit/version/profile/inventory, then
verifies all downloaded bytes. Hosted and prepared local packages include this
metadata as tool/bridge_artifacts.build.json and verify offline.
Compiled-binary checksums are generated by the producer, not pinned from a
different machine's build in the source contract. Missing metadata or an
unavailable commit bundle fails explicitly.
The same commit-based lookup applies to every branch, tag, and main.
The producer's General workflow distributes bundles automatically after its
build and browser tests succeed. No pub.dev publication or manual release
is needed; GitHub prereleases are only the public file storage for CI output.
Hosts
copy web/pkg, including license notices, into ignored web staging output and
load its JavaScript/WASM pair. They must not pin a separate bridge version or
retain an older runtime when changing dependency sources.
The packaged WASM profile is explicitly release, independent of whether the
embedding Flutter application runs in debug or release mode.
Native applications additionally need a matching native library. Artifact production belongs to this repository, never an embedding application's build. See the consumer artifact release procedure.
Reading a Waveform #
WellenReader is a convenience API for native, file-backed workflows:
import 'package:dart_wellen/dart_wellen.dart';
Future<void> inspectWaveform(String path) async {
await WellenReader.init();
final reader = WellenReader();
try {
final metadata = await reader.loadFile(path);
final structure = await reader.getStructure();
final signals = await reader.getSignalData(
['top.clk', 'top.counter'],
startTime: 0,
endTime: metadata.endTime,
);
print('${structure.modules.length} top-level modules');
for (final waveform in signals) {
print('${waveform.signalId}: ${waveform.data.length} changes');
}
} finally {
await reader.close();
}
}
WellenSignalWaveformApi implements the SignalWaveformApi contract used by
ROHD viewers. Use loadFile on native platforms or loadBytes after the
generated Wellen WebAssembly module has been initialized in a browser:
final api = WellenSignalWaveformApi();
await api.loadBytes(bytes, fileName: 'simulation.fst');
final hierarchy = await api.getModuleStructureOnly();
final waveforms = await api.getWaveformData(
signalIds: ['top.clk'],
);
Only one waveform is held by the Rust bridge at a time. Creating multiple Dart reader or API objects does not create independent Rust waveform stores.
Writing VCD #
Native code that writes waveforms must import the IO-specific library:
import 'package:dart_wellen/dart_wellen_io.dart';
WellenWriterwrites registeredSignalOccurrencevalues directly to a VCD file.WellenWaveDumperprovides a manual adapter that registers signals and records timestamped value changes.
The adapter is not automatically attached to the ROHD simulator. Callers must
register signals and forward simulation changes themselves. Selecting
WaveFormat.fst currently throws an unsupported-format error.
Repository Development #
This package is a member of the ROHD Wave Viewer Pub workspace. From the repository root:
# Resolve the workspace.
flutter pub get
# Generate both Dart and Rust Flutter Rust Bridge bindings.
make dart
# Build native or WebAssembly bridge artifacts.
make rust-native
make wasm
# Run root and workspace-member tests.
make test
The generator configuration is
packages/dart_wellen/flutter_rust_bridge.yaml. Generated Dart bindings are
written to packages/dart_wellen/lib/src/rust/; the generated Rust counterpart
is rust/wellen_bridge/src/frb_generated.rs. Do not invoke the generator with
ad hoc output paths.
See ARCHITECTURE.md for package boundaries and the repository build guide for the complete build matrix.
Copyright (C) 2024-2026 Intel Corporation SPDX-License-Identifier: BSD-3-Clause