Convert Gowin GAO CSV captures to VCD waveform format.
Project description
gowin2vcd
Convert Gowin GAO CSV captures to VCD waveform format.
Features
- Single-pass streaming parser — opens the file exactly once, no matter how large
- Automatic GAO format detection — handles all known CSV variants
- Real GAO capture validated
- Hierarchical signal reconstruction — scope walker, no tree in memory
- Deterministic VCD output — same input always produces identical output
- Gzip-compressed output — use
.vcd.gzto save space automatically - Signal filtering —
--includeand--excludeoptions - JSON output
- GTKWave save files — generates
.gtkwfiles with groups and expanded scopes - Signal aliases — preserves aliases from
path/to/sig=alias_nameCSV columns - X/Z value propagation — handles unknown and high-impedance states
- Progress callback — for large captures
- Conversion statistics
- Zero runtime dependencies — pure Python 3.10+
- Golden regression tests
Supported outputs
- VCD
- JSON
- GTKWave save files
Installation
pip install gowin2vcd
Or from source:
git clone https://github.com/TSltd/gowin2vcd.git
cd gowin2vcd
pip install .
Usage
Command line
# Basic conversion
gowin2vcd capture.csv output.vcd
# Compressed output
gowin2vcd capture.csv output.vcd.gz
# Include only selected signals
gowin2vcd capture.csv output.vcd \
--include top/clk top/rst
# Exclude selected signals
gowin2vcd capture.csv output.vcd \
--exclude top/debug_state
# Override the VCD timescale
gowin2vcd capture.csv output.vcd \
--timescale ns
# Omit the VCD date/version headers
gowin2vcd capture.csv output.vcd \
--no-date --no-version
# Diagnostic mode
gowin2vcd capture.csv output.vcd \
--verify
# Quiet mode
gowin2vcd capture.csv output.vcd \
--quiet
# Verbose logging
gowin2vcd capture.csv output.vcd \
--verbose
Python library
from gowin2vcd import GowinCSVParser
from gowin2vcd import VCDWriter
# Parse a capture
parser = GowinCSVParser("capture.csv")
# Access metadata
print(f"Time unit: {parser.metadata.time_unit}")
print(f"Signals: {[s.fullname for s in parser.signals]}")
print(f"Groups: {[g.name for g in parser.groups]}")
# Print stats
print(f"Signals: {stats.signals}")
print(f"Samples: {stats.samples}")
print(f"Changes: {stats.value_changes}")
print(f"Runtime: {stats.runtime:.2f}s")
print(f"Output: {stats.output_path}")
# Convert to VCD
writer = VCDWriter("output.vcd")
stats = writer.write(parser)
print(f"Wrote {stats.num_samples} samples with {stats.num_changes} changes")
# Or iterate lazily
for sample in parser.iter_samples():
print(f"t={sample.timestamp} clk={sample.values.get('top/clk')}")
JSON
from gowin2vcd import JSONWriter
writer = JSONWriter("capture.json")
writer.write(parser)
GTKWave save files
from gowin2vcd import GowinCSVParser
from gowin2vcd import GTKWSaveWriter
parser = GowinCSVParser("capture.csv")
capture = parser.parse()
writer = GTKWSaveWriter("output.gtkw")
writer.write(capture)
Architecture
See docs/architecture.md for details.
CSV
│
▼ ┌──────────► VCD
Scanner ─► Parser ─┬──────► JSON
├──────► GTKWave
└──────► FST (planned)
File Format
See docs/file_format.md for the GAO CSV format specification.
Status
The project is feature-complete for VCD conversion and has been validated against real Gowin GAO captures.
Current outputs:
- VCD
- JSON
- GTKWave save files
Python 3.10+ Zero runtime dependencies
Roadmap
Planned for v1.0:
- VCD reader
- Round-trip verification
- Fuzz testing
- Performance benchmarks
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gowin2vcd-0.9.1.tar.gz.
File metadata
- Download URL: gowin2vcd-0.9.1.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf3b8eb456491ea07e042924c94f1a3e5d0f6c30a0e4f1b56384a0abe3891085
|
|
| MD5 |
9c1a7a184c4179f8dfea6272c4c91758
|
|
| BLAKE2b-256 |
a338a0724e79bf5ff70ce023ac23e7f036fb5babdcd5631d7bfa26e1064603f0
|
File details
Details for the file gowin2vcd-0.9.1-py3-none-any.whl.
File metadata
- Download URL: gowin2vcd-0.9.1-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac77a7544a17bdcc09806cc45c8770d6315bcdeb90ba52cf355e83cef3464b64
|
|
| MD5 |
4190691815157d79428faf05cd1cde27
|
|
| BLAKE2b-256 |
d4d867c6fda855342996d7786c28dec71fc34f56d9f4f026ebcdb6b46182c1e0
|