Skip to content

a fundamental Python package for digital circuit waveform analysis

License

Notifications You must be signed in to change notification settings

cxzzzz/wavekit

Repository files navigation

wavekit

Wavekit is a fundamental Python package for digital circuit waveform analysis that provides convenient batch processing of signals and a wide range of mathematical operations for waveforms.

Features

  • Read various waveform files (VCD, FSDB, etc.), especially optimized for large FSDB files.
  • Extract waveforms in batches using absolute paths, brace expansions, and regular expressions.
  • Perform arithmetic, bitwise, functional, and other operations on waveforms.

Installation

Install Wavekit with Python 3.9 or later.

If you want to read FSDB files, please ensure that "VERDI_HOME" environment variable is set before installing the library.

Using PIP

You can install the library using pip:

pip3 install wavekit

From Source

To install the library from the source, follow these steps:

Clone the repository:

git clone https://github.com/cxzzzz/wavekit.git

Navigate to the project directory:

cd wavekit

Install the library using pip:

pip install .

Quick Start

Here is a simple example demonstrating how to use the library to read a VCD file and calculate the average occupancy level of the FIFO :

import numpy as np
from wavekit import VcdReader


with VcdReader("fifo_tb.vcd") as f: # open the VCD file
    clock = "fifo_tb.s_fifo.clk"
    depth = 8

    #calculate the average FIFO occupancy level.
    w_ptr = f.load_wave("fifo_tb.s_fifo.w_ptr[2:0]", clock=clock)   # load fifo write pointer signal
    r_ptr = f.load_wave("fifo_tb.s_fifo.r_ptr[2:0]", clock=clock)   # load fifo read pointer signal
    fifo_water_level = (w_ptr + depth - r_ptr) % depth              # calculate the occupancy level
    average_fifo_water_level = np.mean(fifo_water_level.value)      # calculate the average occupancy level using numpy
    print( f"average fifo occupancy level: {average_fifo_water_level}" )

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

a fundamental Python package for digital circuit waveform analysis

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published