vcd icon indicating copy to clipboard operation
vcd copied to clipboard

Migrate from C to Zig

Open Copilot opened this issue 2 months ago • 0 comments

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.zig for native Zig builds
    • Updated Makefile to invoke zig build-exe
    • .gitignore for 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:

Original prompt

migrate to zig


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Nov 09 '25 18:11 Copilot