Skip to main content

Pure-Python parser for SPICE-family netlist files (.spi, .cir, .cdl, .scs, .spf)

Project description

eda-netlist-parser

A pure-Python parser for SPICE-family netlist files: .spi, .cir, .cdl, .scs, .spf, .sp, .hsp.

CI Python License: MIT

Installation

pip install eda-netlist-parser
# optional colored terminal output:
pip install eda-netlist-parser[color]

PyPI Python

Quick start

from netlist_parser import NetlistParser, NetlistError

parser = NetlistParser()

try:
    netlist = parser.parse("design.spi")
except NetlistError as e:
    print(f"Error: {e}")

for cell in netlist.cells:
    print(cell.name, cell.ports)
    for inst in cell.instances:
        print("  ", inst.name, inst.code, inst.device_name)

Importing

from netlist_parser import NetlistParser
from netlist_parser import NetlistParser, Netlist, NetlistCell, DeviceInstance

API

NetlistParser(internal=False)

Method Returns Description
parse(filename) Netlist Parse a single file
read(path, data=None) varies Parse file or directory

read() data modes:

data= Returns
None Netlist
'cells' Set[str]
'ports' Dict[str, List[str]]
'devices' Dict[str, Set[str]]
'device-params' Dict[str, Dict]
'resistors' Dict[str, List]
'capacitors' Dict[str, List]

Classes

  • Netlist — full file data: .cells, .version, .resistance, .capacitance, .layer_map
  • NetlistCell — one subckt: .name, .ports, .instances, .substitute
  • DeviceInstance — one line: .name, .code, .nodes, .device_name, .number, .parameters
  • NetlistError — raised on file errors

CLI

netlist-parser sample.spi                   # summary
netlist-parser sample.spi --cells           # list cell names
netlist-parser sample.spi --ports           # cell → ports
netlist-parser sample.spi --devices         # cell → device names
netlist-parser sample.spi --cell inv_x1     # one cell detail
netlist-parser --version

License

MIT

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

eda_netlist_parser-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

eda_netlist_parser-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file eda_netlist_parser-0.1.0.tar.gz.

File metadata

  • Download URL: eda_netlist_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eda_netlist_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3afb04b62c016d665240763c625897a12f55a621a0b3b8c8dc78df9ec760e61c
MD5 ed7cce4540e662eae80b407f72973253
BLAKE2b-256 0e4717382ecaabd2103b1529eb27665841be103a151a2c0bc040dea65c0f01e4

See more details on using hashes here.

File details

Details for the file eda_netlist_parser-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eda_netlist_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdbcc01284baf1d03d7c2f05ba2a5f911aebfd253e67a4eb52e576f49b815726
MD5 ca9073c3bf966b3c774acebd9453bc8a
BLAKE2b-256 aed478aff17ffaffe06dbc06852a2de7bc3e961a83c2c11c67e2b140e264029b

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