Skip to main content

A pure-python parser for Cadence's PSF format.

Project description

psf-parser

psf-parser is a lightweight, dependency-free Python parser for Cadence's proprietary PSF (Parameter Storage Format) files. It supports both the ASCII (psfascii) and binary (psfbin) formats.

Note: While Spectre uses psfbin as the default output format for most simulations, transient simulations typically use the psfxl format, which this parser does not support. To avoid issues, set the output format explicitly to psfbin.


Installation

Install psf-parser directly via pip:

pip install psf-parser

Usage

The psf-parser package provides a simple API for parsing and accessing PSF file contents. It automatically detects the file format (ASCII or binary), but you can also specify it manually.

from psf_parser import PsfFile

psf = PsfFile("path/to/psf")
print(psf.header, psf.sweeps, psf.traces, psf.values)

If you prefer lower-level access to the raw registry data, you can work directly with the parser classes:

from psf_parser import PsfParser

parser = PsfParser("path/to/ascii/psf", format="ascii").parse()
print(parser.header)
print(parser.registry.types)

Notes:

  • PsfParser acts as a factory and dispatches to the correct format-specific parser.
  • PsfAsciiParser and PsfBinParser handle the ASCII and binary formats respectively (for internal or advanced usage).

License

This project is licensed under the MIT License.


Acknowledgements

This project was made possible by the excellent prior work of:

  • psf_utils — a psfascii parser built with PLY.
  • libpsf — the original reverse-engineering project for the binary PSF format.

Contributing

This project is still in its early stages. Since Cadence has never published a specification for the PSF format, the parser is built entirely by reverse-engineering test files and observing patterns.

Currently, the parser is verified against output from:

  • Oppoint analyses
  • DC sweeps
  • AC simulations
  • Transient simulations
  • Monte Carlo
  • Nested sweeps
  • Various info analysis statements

If you encounter a PSF or PSFBIN file that fails to parse or produces incorrect output, please contribute by:

  1. Adding the problematic file to the test suite.
  2. Creating a minimal test case that demonstrates the issue.

This way, we can ensure continued support for more variations and edge cases over time. PRs, bug reports, and examples are all welcome!

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

psf_parser-0.2.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

psf_parser-0.2.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file psf_parser-0.2.1.tar.gz.

File metadata

  • Download URL: psf_parser-0.2.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for psf_parser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4ee6fe4116cc4b9496090ed1d2b627b5a2d97290f09bfad16c394d62125a7277
MD5 4997a352cd50871bc2c284daf3ce3785
BLAKE2b-256 44f5caa508f9ff5cc23fd74615cbf4cfef127ff1dc3deb0b76d665f0c7ed6613

See more details on using hashes here.

File details

Details for the file psf_parser-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: psf_parser-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for psf_parser-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd1a6e64ef7b861a27c7419e52a59f760082ef437aac6ba7f948ca5c3f0a81d
MD5 044981544682b0c35eab71d4cb72286e
BLAKE2b-256 e61f5553b3913385143ccfbb8cbe77950721768d6b3520a97775197b79538826

See more details on using hashes here.

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