Skip to main content

Convert VCD signals to sets of time points based on conditions

Project description

SetVCD

Programmatically inspect hardware VCD signals using a high-level functional interface.

Higher-order programming constructs and set operations are a natural fit for inspecting VCD signals, and this Python library allows you to easily specify, in text, what simulation timesteps matter to functional correctness.

Motivating Example

Say you are debugging a streaming input interface (Accelerator.io_input) and you would like to extract only the values when the streaming transaction is valid. Typically when viewing a wavefile in a viewer, the points we care about look like this: img/gtkwave.png

We can write this desired condition, parameterised by simulation timestep t as a formal statement:

(clk(t - 1) == 0 and clk(t) == 1) and
reset(t) == 0 and
input_ready(t) == 1 and
input_valid(t) == 1

This is a very natural fit for higher-order functions and set operations.

This library provides you two important methods:

  • Get set of timesteps with condition:

     SetVCD.get(signal_name: String,
                condition: (ValueType, ValueType, ValueType) -> Bool,
                value_type: Raw or String or FP)
                -> SignalExpression
    
    • SignalExpression represents subset of timesteps of the wavefile that meet the provided condition.
    • Two SignalExpression objects (a and b) be combined with set operations to create a higher SignalExpression
      • c = a & b: c is the intersection of set a and b.
      • c = a | b: c is the union of set a and b.
      • c = a ^ b: c is the difference of set a and b.
  • A SignalExpression object obtained from get and combined with operations can then be evaluated on the wavefile via:

    SetVCD.get_value(signal_name: str,
                     expr: SignalExpression,
                     value_type: Raw or String or FP)
                     -> List(Value)
    SetVCD.get_value_with_t(signal_name: str,
                     expr: SignalExpression,
                     value_type: Raw or String or FP)
                     -> List((Timestep, Value))
    
    • This yields the set of values you would be interested in.

For a practical example, please see our pre-filled notebook: example.ipynb

Overview

SetVCD is a Python package for analyzing Verilog VCD files and extracting time points where specific signal conditions are met. It provides a simple, type-safe interface for working with simulation waveforms using set-based operations.

Installation

The package is available in PyPI:

pip install setVCD

Future Enhancements

Planned for future versions:

  • Higher-order operations for signal conditions
  • Performance optimization for large VCD files
  • Streaming interface for very large files
  • MCP (Model Context Protocol) integration

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setvcd-0.8.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setvcd-0.8.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file setvcd-0.8.0.tar.gz.

File metadata

  • Download URL: setvcd-0.8.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for setvcd-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6bac9884557c0fda5d3d501a4f86a598f61cc31180feda884e48eab23c736786
MD5 fc6edd43314fe839dfe9900ba52c5e80
BLAKE2b-256 084528886e8f812462f1705c89ae7ea70705b3c75df030f4d3d513855870f7b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for setvcd-0.8.0.tar.gz:

Publisher: pypi.yml on mrontio/setVCD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file setvcd-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: setvcd-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for setvcd-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a72f976aa406d60819b92709634162676d5efd3fdaea071cbe37d21af4df3e1
MD5 ed47857bac3d9d8749d640cd25f1cdf2
BLAKE2b-256 8089f4919c43924eca345ec0ba708b2e1d8e9ac4da7a3bb720c5412b9eb414e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for setvcd-0.8.0-py3-none-any.whl:

Publisher: pypi.yml on mrontio/setVCD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page