Skip to main content

Liberty format parser.

Project description

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

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'):
    cell_name = cell_group.args[0]
    print(cell_name)

    # Loop through all pins of the cell.
    for pin_group in cell_group.get_groups('pin'):
        pin_name = pin_group.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 Groups, has a name, a list of arguments and attributes.

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:

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 .

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

liberty_parser-0.0.25.tar.gz (16.9 kB view details)

Uploaded Source

File details

Details for the file liberty_parser-0.0.25.tar.gz.

File metadata

  • Download URL: liberty_parser-0.0.25.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for liberty_parser-0.0.25.tar.gz
Algorithm Hash digest
SHA256 536876e5e4efe0f2e2a57135dd42cecacfb57dde8c39c7b3c5b86c4f5bfa4df6
MD5 a342450ba9f1adaa66203a954d4b9c94
BLAKE2b-256 84a1ba1436c18e431131653627cb97dc5d04a3f6a7a12fcedda0cfc416ff70f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page