Layer Source Specification - Boolean combinations?


As per the title, is it possible to specify a boolean source specification for a layer entry. Something like:

"255/0@1 - 1/0@1" where the '-' would be a boolean subtraction of one layer from another.

I have a file where I would like to view the inverse of the data (i.e. negative), where I have the data extents on layer 255. This is useful when reviewing returned data from a mask shop, who may have inverted the layers. I had a look at which is very useful for geometric transformations of the data, but I couldn't see a way to combine multiple data layers into one view. Hopefully my question makes sense?

Thank you,


  • Hi Dan,

    yes, your question makes sense. I though of that a couple of times, but the problem is about the frame lines. They cannot be inverted by a simple pixel operation. A true boolean operation is too expensive for display.

    And having two or more layers in a source specification will raise manifold basic questions about the meaning of "layer" - a single-source layer can be used as a drawing target for example while a multiple-source layer can't. And the API needs to be extended considerably raising questions about backward compatibility and so forth.

    A plain "inverse" flag is probably possible. But it will look something like this (no frame lines):

    Another option which avoids all of this is a DRC script which performs the boolean operation. If you use tiling mode this is reasonably fast without taking too much memory.


  • Hello,

    If you just want to "view" simple Boolean operations (OR and NOT) you can simulate it by duplicating your layer tab and play with the colors, stipple, layer order (and deleting some layer entries). see screenshots below for a simple example. It's super fast :-)



    Layer tab: ALL LAYERS

    Layer tab: M1 MASK

    Layer tab: M1 MASK INVERSE

  • Thank you both for the feedback, that makes a lot of sense - I believe a DRC script is probably the best approach - since I eventually want to do an XOR check between the data sent to the mask manufacturer and the data received it is probably the better option anyway! Thanks again, and many thanks for such excellent software!

  • I've attempted the DRC approach (apologies if I should start another thread for this), but there doesn't appear to be a way to specify the source layout in the DRC script language. What I would like is something like input(1,0,1) to select 1/0@1, but that doesn't seem to be an option.

  • Hi Dan,

    Looking at the documentation, I'm not sure this is implemented...
    As a workaround, you can merge the two gds files into one file but first make sure the layer numbers are different in both gds files...



  • edited June 2021


    The way to use two different layouts for DRC is:

    a = source("@1")
    b = source("@2")
    (a.input(1, 0) - b.input(2, 0)).output(1000, 0)

    This example will read layer 1/0 of layout @1, subtract 2/0 of layout @2 from that and send the results to 1000/0 of layout @1 (indicated by target("@1")).


Sign In or Register to comment.