new_title.gif

Extracting Entities by Layer

Every entity in a GDSII file (i.e. boundary, path or text entity) has a layer property and a datatype property associated with it. In the original GDSII specification, the layers and datatypes ranged from 0-63 but most programs today support layers and datatypes from 0 to anywhere as high as 8191. This layer/datatype property is independent of the entity's position in the cell or hierarchy.

  extract a layer from a GDSII file

One can direct GDSFILT to pass only entities whose layer and datatype match a list of layer/datatypes. This is very useful for example when you wish to examine only a particular layer or when your file is extremely large and you wish to reduce it by creating a file for each layer.



Include vs. Exclude

There are two directives for extracting by layer: include and exclude.

    Include is followed by a list of layers and datatypes to "include" into the output file. Use this option when you need only a "few" layers. For example the argument:

             -i2,20     
    

    would pass only enitites on layers 2 and 20 to the output file.


    Exclude is followed by a list of layers and datatypes to "exclude" from the output file. Use this option when it is more efficient to list the layers you don't want to appear in the output. For example

              -x3,5
    

    would pass all entities except for those on layers 3 and 5.


You cannot, of course, use both options at the same time.


Datatype vs. Layer

Most GDSII files are organized by layer so each entity has been assigned the proper layer number. The datatype property has been used for a variety of purposes -- sometimes as a way to get more than 64 layers and other times as a way to mark revisions to a drawing. Not every GDSII file uses the datatype property - often it is set to 0 when not used.

    Layer Filter Only

    user lower case -i and -x to specify a list of layers to include or exclude. Datatypes are not used as a criteria.

    Datatype Filter Only

    user upper case -I and -X to specify a list of datatypes to include or exclude. Layers are not used as a criteria.



Remapping Layers and Datatypes

Sometimes it is useful to shift the GDSII layer numbers. Imagine that you wish to combine two GDSII files that have the same set of layers but you want to avoid "collisions" in the entity data. You could first run one of the files through GDSFILT and shift the layer property on this file up by 100 so that when the two files are combined there will still be a way to differentiate entities based on which file they originated from.


layer mapping dialog  

In GDFILT/W check the layer mapping box to get to this dialog which allows you to map an input layer to a different output layer. You can also use an "advanced rule builder" as shown below:

advanced layer mapping


Layer Mapping from the Command Line

GDSFILT can shift layers either individually or as a large block. For example, if your design has layers in the range from 0-63 and you would like to shift these up by 100 you could use a directive such as:

 gdsfilt original.gds shifted.gds = -lyr0-99:100-200

this would shift all layers in the range 0 to 99 (in the input file) up to 100-200 in the output file: shifted.gds.


Shifting Selected Layers

you could also shift selected layers if for some reason shifting the entire block is not desired. Consider the example below where the user only includes certain layers and shifts them by 100.


gdsfilt.exe                                     program executable

 original.gds                                   source gdsii file

   shifted.gds                                  output file
    
    =                                           use top structure from source

      -i1,2,4,5,6,7,8,9,10,13                   list of layers to include

        -lyr1-2:101-102,4-10:104-110,13:113     list of layer shifts


Pruning and Flattening the Output File

There are two other GDSFILT directives that are often used together with a layer extraction: pruning and flattening (or exploding) the output file.


    Pruning - if you extract data on only a few layers, some of the structure definitions within the resulting GDSII file may be empty - that is they will not contain any entities and structures that they reference may be empty of entities. In such case, these "empty" cells are not useful and can be safely delete (or pruned) away. If the -prune option is used, after the entities have been removed, any empty parts of the tree will be removed from the output file. For details, see the page Prune Empty Structures.


    Flattening - it is possible to completely flatten (explode) the hierarchy using the -explode directive on the command line or by checking the explode checkbox in the Configuration dialog.

    In this case the output file will have only one structure and all entities will be part of that structure. This can be quite useful when extracting a single layer: A package designer who is extracting the pad openings doesn't need the original GDSII database hierarchy in his output file -- in fact, for large chips the amount of data used to represent the hierarchy can be enormous and would make the output GDSII file quite large and unwieldy.