vcd
vcd copied to clipboard
Migrate from C to Zig
Complete rewrite of the VCD viewer in Zig, replacing the C implementation.
Changes
-
Core implementation (
vcd.zig): Direct port of C parsing and formatting logic using Zig's standard library- Adapted to Zig 0.15.2 API changes (unmanaged ArrayLists, File I/O patterns)
- Added padding helpers to replace C-style format width specifiers
- Enhanced timescale parser to handle both "1 fs" and "1ps" formats (ROHD compatibility)
-
Build system:
build.zigfor native Zig builds- Updated
Makefileto invokezig build-exe .gitignorefor build artifacts
-
Documentation: Updated README with Zig installation requirements
Technical notes
Built in debug mode due to optimizer issues with complex ArrayList operations in the current Zig version. All functionality preserved including environment variable support and Unicode waveform rendering.
// Zig 0.15.2 uses unmanaged ArrayLists requiring explicit allocator passing
samples: ArrayList(Sample, null) // Managed variant stores allocator
try ch.samples.append(.{ .state = 0, .val = 0 })
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/ziglang/zig/releases/latest
- Triggering command:
curl -s REDACTED(http block)ziglang.org
- Triggering command:
wget -q REDACTED(dns block)- Triggering command:
wget REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
migrate to zig
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.