IP Manager Reference

PDK Building

ip_manager.pdk.inspect(path_to_pdk, engine='visualizer', pdk_name=None, missing_gds_numbers='generate', verbose=True, **kwargs)

Inspects a PDK by visualizing its core components.

This function inspects a PDK, and extracts all Components, Trace Templates, and Layers. It then displays this content based on the chosen engine. The engine parameter controls the output format: “visualizer” (default) opens an interactive viewer, while “gds” writes the content to GDSII files. The PDK can be provided as a path to a folder or a zip file.

Parameters:
path_to_pdk: str

Path to the PDK zip file or PDK folder.

engine: Literal[“gds”, “visualizer”, “klayout”]

Which inspection tool to use, defaults to “visualizer”.

pdk_name: str

Name of the PDK python package to inspect, only required if there is more than one, defaults to None.

missing_gds_numbers: Literal[“error”, “ignore”, “generate”]

Action to take when using “gds” engine, and layers that don’t have gds numbers defined are written * error: raise an error * ignore: layers are not visualized * generate: unique gds numbers are generated Defaults to generate.

Examples

To do a basic visualisation of a pdk mypdk.zip with only a single package:

from ip_manager.pdk import inspect inspect(path_to_pdk=”mypdk.zip”)

ip_manager.pdk.build(src_path, dest_dir, config_path=None, force=False, clean_tmp_dirs=True, verbose=False)

Builds a distributable library from a PDK-source.

By default, this will look for configuration file with the same name as the directory name. For example:

my_lib/my_lib.cfg

If you want to specify another configuration file, you can do this with the config_path keyword argument.

Parameters:
src_path: (string)

The path to PDK-source directory

dest_dir: (string)

The path to destination directory

config_path: (string)

Optional path to the configuration file to use.

force: (bool, default=False)

When set to True, this enables you to overwrite an existing build. Otherwise the build will fail, warning you that the destination directory already exists.

clean_tmp_dirs: (bool, default=True)

Temporary directories are created to write intermediate files during building. When True, clean up temp directories after a successful build.

verbose: (bool, default=False)

Enable detailed output during building

ip_manager.pdk.create_pdk(pdk_name, display_name, company_name, location, initial_version='1.0')

Builds a distributable library from a PDK-source.

Parameters:
pdk_name: (string)

The name of the python package containing the PDK. Can only contain lower case characters, underscores, and numbers (but not as first character)

display_name: (string)

The full name of the PDK as used in the documentation. Can contain most characters.

company_name: (string)

Name of the company that creates the PDK

location: (string | Path)

Directory under which the new pdk directory (named <pdk_name> will be created)

initial_version: (string)

Version of the created PDK. Should follow semver.

ip_manager.pdk.zip_pdk(pdk_path, cleanup=False)

Create a zip of a PDK.

If the unzipped PDK lives in builds/my_pdk, the zip file will be builds/my_pdk.zip.

If desired the unzipped version can be removed.

Parameters:
pdk_path: str

The path of the pdk. Typically something like builds/<my_pdk>.

cleanup: bool

Whether to delete pdk_path afterwards.

Test classes

The following classes can be inherited to perform the described tests:

ComponentReferenceTest

Test LayoutView, NetlistView and CircuitModelView of a component against known-good reference files.

CircuitModelTest

Abstract base class for testing the CircuitModelView

VFab2DReferenceTest

Test a 2D virtual fabrication material result against a known-good reference file.

LayoutToNetlistTest

Test that the netlist (terms, instances, nets) extracted from the LayoutView matches the NetlistView.

CanvasLibraryTest

Generate an IPKISS Canvas library file (.iclib extension) from a library and compare it against the library's built-in reference.

SampleTest

Easily configure which sample files to automatically test with pytest.

Component reference tests

ip_manager.testing.ComponentReferenceTest groups a range of different tests against known-good reference files. The tests to need to be selected by marking the class with the tests to run using pytest.mark.comparisons:

from ip_manager.testing import ComponentReferenceTest, Compare

@pytest.mark.comparisons([Compare.LayoutToGds, Compare.GdsToGds, Compare.LayoutToXML, Compare.LayoutDrawingToXML])
class TestMyComponent(testing.ComponentReferenceTest):

    @pytest.fixture
    def component(self):
        # create component here

The available test configurations in the Compare object are:

  • Compare.LayoutToGds: compare the LayoutView to a reference GDSII file, without GDSII filters (TECH.GDISI.FILTER) applied.

  • Compare.GdsToGds: export a GDSII of the LayoutView, read it back in and compare with a reference GDS.

  • Compare.LayoutToXML: export the LayoutView to an XML and compare with a reference XML.

  • Compare.LayoutDrawingToXML: export the Layout elements to XML file, without port information and without the GDSII filters applied, and compare with a reference XML.

  • Compare.NetlistToXML: export the NetlistView to an XML and compare with a reference XML.

  • Compare.SMatrix: compare the S-matrix from a CircuitModelView in a given wavelength range to a reference S-matrix file.

Helper classes

The SMatrixTester class is useful for performing behavioral checks on the S-matrix resulting of a component’s circuit model. To get started, check out Add your own circuit checks.

SMatrixTester

Tools for conveniently testing an S-matrix as part of regression tests.

Functions

generate_reference_files([path, match_tests])

Generate or regenerate the reference files for the specified ComponentReferenceTest tests.