Often one of the first steps when working on a layout is to import a reference library of artwork cells. This provides a set of pre-made correct cells to base the layout design. To import a library the first step is to determine the file system path to the library file. Once we have the path we can quickly write a program to import the library into the current project:
' Code Module Sub Main Dim cellLib As CellLibrary Set cellLib = Project.CellLibraries.Import("MyLib", "C:\ReferenceLibs\ccadc.gds", mwCLT_GDSII) End Sub
In this code we'll be importing the cell library "C:\ReferenceLibs\ccadc.gds" giving it the name "MyLib". Figure 1 below shows the layout tab of the project after importing the cell library:
Figure 1 AWR Design Environment after importing a new artwork cell library.
Here you can see the library "MyLib" listed in the CellLibraries branch of the project tree and just below that the name "CCADC" is the name of the top-level cell. By default the project browser only displays the top level cell however the Environment Options, Layout tab contains an option to control how the cell libraries are display, either top-level cell only or flat with all cells displayed. Once the library has been imported we can write code to access and list the cells in this library:
' Code Module Sub Main Dim cellLib As CellLibrary Dim libCell As Cell Debug.Clear Set cellLib = Project.CellLibraries("MyLib") Debug.Print cellLib.Name & " cells: " For Each libCell In cellLib.Cells Debug.Print " " & libCell.Name Next libCell End Sub
When we run this code we get the following listing of library cells in the MyLib library:
MyLib cells: CCADC I1_I2$$30015532 I1_I2$$30013484 I1_I2$$30012460 I1_I2$$30011436 BJT2CMOS AND2 COMPARATOR DAC4BIT COUNTER CMOS2BJT P1_I1$$30009388
So programmatically importing a library for use in a design is as simple as determining the file path to the desired library and writing a single line to import the library into the current project.