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.
- 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.
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.
You can install the library using pip:
pip3 install wavekit
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 .
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}" )
This project is licensed under the MIT License. See the LICENSE file for details.