qckbool logo


Comparing Two GDSII Files [3]

Computing a Layer Offset

Now that we know the highest layer used, we will compute a layer offset.

A layer offset must be used since the XOR module actually works only on a single GDSII file - therefore gdsfilt is used to combine the two input files. Since we want to calculate the difference we have to offset the layers in the second file from the first by a known amount. This is called the input_offset and is used when merging the two input files.

To determine the input layer offset, we use an initial offset of 100 and verify that this amount is more than the highest layer. (If not, add another 100 and test again.)

If the user specified an offset for the output we store this for later use.


  input_offset=0
  while [ 1 ]
  do 
    if [ $input_offset -gt $max_layer ]
    then
      break
    fi
    input_offset='expr $input_offset + 100'
  done

  second_input_offset='expr $input_offset + $input_offset'

  if [ "$OFFSET" != "" ]
  then
    xor_offset=$OFFSET
  else
    xor_offset=$second_input_offset
  fi


List of Layers to Compare

If the user has supplied a list of layers to compare, then we call gdsfilt using the user supplied list and produce an intermediate file containing just the specified layers for both input files.

if [ "$LAYERS" != "" ]
  then
    ${REL}${GDSFILT} new.gds new_.gds = $LAYERS
    ${REL}${GDSFILT} bench.gds bench_.gds = $LAYERS
    file1=new_.gds
    file2=bench_.gds

If the user did not specify a layer list (i.e. he wants to compare all of the layers) then we just assign file1 and file2 to the existing input files.

  else
    file1=new.gds
    file2=bench.gds
  fi


Shifting the Layers Prior to Merging

We use GDSFILT to create a temporary GDSII file from the file1 input offsetting its layers as previously calculated. Layers are specified as a range ... i.e. 0-100:100-200.

${REL}${GDSFILT} $file1 new.sf = -lyr0-${input_offset}:${input_offset}-${second_input_offset}

Merging the Two Inputs into a Single File

Now we merge the first file and the second to create a file that XOR can operate on.

${REL}${GDSFILT} new.sf xor_input.gds = -add $file2 -combine xor_input =

Running the XOR Program

Now we call the NEWXOR engine to calculate the difference (layer by layer) making sure the the final output layers are where the user requested. We've broken up a single line into each component so that it can be annotated.


 ${REL}${NEWXOR}                                  the XOR engine 

  xor_input.gds                                   the input to XOR engine

   ${f%.gds}_xor_output.gds                       the output GDSII file 

     xor_input                                     top structure of input file 

      =                                            = use layers in input file

        x                                         current operation (x) = XOR

          -output_layer_offset:${xor_offset}      offset for writing difference
                                                  to the output file 

            -input_layer_offset:${input_offset}   offset for looking for the
                                                  layers to compare .. 

              +nclip:1,1                          use automatic partitioning 


                -postunion                        unionize any polygons that 
                                                  were "cut" by partitioning
                                                  at the very end ...

The resulting file contains just the differences (layer by layer) of the two input files. It can be examined with a GDSII viewer (such as Artwork's Qckvu) and a user can quickly determine what changes were made.




Comparing Two GDSII Files:   1 | 2 | 3 | 4