Package: pylibfst
Pylibfst: HandleFast Signal Traces(fst) in PythonFst, likevcd, is an open format for dumpfiles generated by EDA logic simulation tools.
Unlike vcd, fst is a compressed binary format that offers much better performance for very large dumpfiles.
Fst was originally developed as part ofgtkwave.
For more details on the format, seeGTKWave 3.3 Wave Analyzer User's Guide.Pylibfst is a python cffi wrapper for a slightly extended version of the fst C library contained in gtkwave.
It was initially created to add support for fst toWAL(Waveform Analysis Language), developed at theInstitute for Complex Systemsat Johannes Kepler University, Linz.More details on WAL can be found athttps://wal-lang.org.The latest development version of pylibfst is available ongithub.Build & InstallDependenciesAdditional packages that need to be installed on the system:cmake build environment (cmake, gcc, ...)zlib-devInstall using PyPi (pip)Pylibfst is available fromPyPi!pip install pylibfstBuild & Install from SourceThe latest development version of pylibfst is available ongithub.There are various ways to build and/or install pylibfst:Build from Source usingPythonpython -m pip install --upgrade build
python -m buildBuild from Source usingmakemake allBuild & Install from Source usingmakemake installUsageA documentation on how to handle the cffi-style interface (calls, arguments, return values, ...) can be found in theCFFI documentation.Although the fst format and library are widely used, there is unfortunately no documentation for the libfst library.
(more details on this:FST API documentation · Issue #70 · gtkwave/gtkwave · GitHub).
However, to support development, pylibfst comes with some documented extensions, helper functions and examples.Extensions: seefst/fstext.hHelper functions:string(..).. Converts ffi cdata to a python stringget_scopes_signals2(..).. Iterates the hierarchy and returns a list containing all scope names and a named tuple containing two dictionaries which describe the signals:
Theby_namedictionary maps from signal names, theby_handlefrom signal handles to a corresponding named tuple containing signal name, length and handle.
Note that signals with different name may have the same handle, thereforeby_handlemay have less entries thanby_name.fstReaderIterBlocks(..)andfstReaderIterBlocks2(..): Wrapped versions of corresponding libfst functions. Allow the use of any normal Python function as a callback (with slight overhead).Examplesdumpfst.py.. Demonstrates the main calls required to implement an fst reader.IterBlocks_callback.py.. Demonstrates the use offstReaderIterBlocksandfstReaderIterBlocks2using cffi-style callbacksAdvantage: Most efficientDisadvantage: Only one callback function per program possibleIterBlocks_wrapped_callback.py.. Demonstrates the use offstReaderIterBlocksandfstReaderIterBlocks2using pythonic callbacks (helper functions above)Advantage: "Normal" Python functions as callbacks (as many as you want)Disadvantage: Slightly more overhead due to wrapper functionKnown Problems and TODOsWindows and Mac untestedlibfst SourcesLocation: fstTaken fromRepo:https://github.com/gtkwave/gtkwavePath: gtkwave4/src/helpers/fstCommit: 49a2a53caee83890dff503c15815fb53d5ccde74Licenses: see COPYINGHow to upgrade libfst?Copy most recent sources from gtkwave to directoryfstCheck and updatefst/CMakeLists.txt(see comments in file)Update above section (e.g. commit hash)Updatepylibfst/libfstapi_build.pyandpylibfst/libfstapi.cdefaccording tofst/fstapi.hCheck and update LICENSE filesCheck and updatefst/fstext.handfst/fstext.cCheck and updatepylibfst/helpers.pyCheck build and installCheck and update examplesCommit: Must contain the information from section above