liberty-parser


Nameliberty-parser JSON
Version 0.0.23 PyPI version JSON
download
home_page
SummaryLiberty format parser.
upload_time2024-02-22 10:42:55
maintainer
docs_urlNone
author
requires_python>=3.7
licenseGPL-3.0-or-later
keywords liberty library parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
SPDX-FileCopyrightText: 2022 Thomas Kramer

SPDX-License-Identifier: CC-BY-SA-4.0
-->

# Liberty Parser

This library provides functions to parse, manipulate and format 'Liberty' files.
The liberty format is a common standard to describe certain aspects of standard-cell libraries such as timing, power, cell pin types, etc.

## Example


```python
from liberty.parser import parse_liberty

# Read and parse a library.
library = parse_liberty(open(liberty_file).read())

}

# Format the library.
print(str(library))

# Loop through all cells.
for cell_group in library.get_groups('cell'):
    name = cell_group.args[0]
    print(cell_name)

    # Loop through all pins of the cell.
    for pin_group in library.get_groups('pin'):
        pin_name = pin_gropu.args[0]
        print(pin_name)

        # Access a pin attribute.
        some_attribute = pin_group['some_attribute']

```

## Library structure.

The liberty library is made of `Group` objects.
The library itself is a `Group` object. A `Group` contains
other nested `Group`s, has a name, a list of arguments and
attributes.

```liberty
group_name(args) {
    simple_attribute: 1.23;
    other_group_name(args) {
        other_simple_attribute: 2.34;
        complex_attribute (1.23, 2.34);
    }
}
```

## Reading arrays and timing tables.

Timing tables are stored in the liberty format as attributes which holds a string with comma-separated values.

This string can be converted into a Numpy array with `get_array`:
```python
some_group.get_array('attribute_name')
```

## More examples

Example scripts can be found under `./examples`.

## Install for development

Run the following command to install the liberty parser using symlinks. This allows to edit the parser with immediate effect on the installed package.
```
pip install --upgrade --editable .
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "liberty-parser",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "liberty,library,parser",
    "author": "",
    "author_email": "\"T. Kramer\" <code@tkramer.ch>",
    "download_url": "https://files.pythonhosted.org/packages/77/c9/89c6900f143275b667f9c53906ba87024ede4783a3d8ccd8a86f171fc7d2/liberty-parser-0.0.23.tar.gz",
    "platform": null,
    "description": "<!--\nSPDX-FileCopyrightText: 2022 Thomas Kramer\n\nSPDX-License-Identifier: CC-BY-SA-4.0\n-->\n\n# Liberty Parser\n\nThis library provides functions to parse, manipulate and format 'Liberty' files.\nThe liberty format is a common standard to describe certain aspects of standard-cell libraries such as timing, power, cell pin types, etc.\n\n## Example\n\n\n```python\nfrom liberty.parser import parse_liberty\n\n# Read and parse a library.\nlibrary = parse_liberty(open(liberty_file).read())\n\n}\n\n# Format the library.\nprint(str(library))\n\n# Loop through all cells.\nfor cell_group in library.get_groups('cell'):\n    name = cell_group.args[0]\n    print(cell_name)\n\n    # Loop through all pins of the cell.\n    for pin_group in library.get_groups('pin'):\n        pin_name = pin_gropu.args[0]\n        print(pin_name)\n\n        # Access a pin attribute.\n        some_attribute = pin_group['some_attribute']\n\n```\n\n## Library structure.\n\nThe liberty library is made of `Group` objects.\nThe library itself is a `Group` object. A `Group` contains\nother nested `Group`s, has a name, a list of arguments and\nattributes.\n\n```liberty\ngroup_name(args) {\n    simple_attribute: 1.23;\n    other_group_name(args) {\n        other_simple_attribute: 2.34;\n        complex_attribute (1.23, 2.34);\n    }\n}\n```\n\n## Reading arrays and timing tables.\n\nTiming tables are stored in the liberty format as attributes which holds a string with comma-separated values.\n\nThis string can be converted into a Numpy array with `get_array`:\n```python\nsome_group.get_array('attribute_name')\n```\n\n## More examples\n\nExample scripts can be found under `./examples`.\n\n## Install for development\n\nRun the following command to install the liberty parser using symlinks. This allows to edit the parser with immediate effect on the installed package.\n```\npip install --upgrade --editable .\n```\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Liberty format parser.",
    "version": "0.0.23",
    "project_urls": {
        "Homepage": "https://codeberg.org/tok/liberty-parser",
        "Issue Tracker": "https://codeberg.org/tok/liberty-parser/issues",
        "Repository": "https://codeberg.org/tok/liberty-parser"
    },
    "split_keywords": [
        "liberty",
        "library",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77c989c6900f143275b667f9c53906ba87024ede4783a3d8ccd8a86f171fc7d2",
                "md5": "d6076569e315f6598b19302c11ad3e17",
                "sha256": "058197dc38c33f3d815d09da42d29ff42b13a706354304b494e2b95c067f2409"
            },
            "downloads": -1,
            "filename": "liberty-parser-0.0.23.tar.gz",
            "has_sig": false,
            "md5_digest": "d6076569e315f6598b19302c11ad3e17",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16542,
            "upload_time": "2024-02-22T10:42:55",
            "upload_time_iso_8601": "2024-02-22T10:42:55.883459Z",
            "url": "https://files.pythonhosted.org/packages/77/c9/89c6900f143275b667f9c53906ba87024ede4783a3d8ccd8a86f171fc7d2/liberty-parser-0.0.23.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 10:42:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": true,
    "codeberg_user": "tok",
    "codeberg_project": "liberty-parser",
    "lcname": "liberty-parser"
}
        
Elapsed time: 0.18693s