qckbool logo


BoolCompare2Files: A Script for Comparing Two Files

Usage

The script takes as input the names of two GDSII files.

You don't need to specify the structures since the program will automatically use the top level structure of each file -- this is why one of the assumptions mentioned requires that both files have each only a single top level structure.)

The user can optionally supply a list of layers; if no list is supplied, then all layers are compared.

The user can also supply a layer number "offset" so that the layers used for the output differences are offset by the value. Why? This makes it easier to then overlay the differences over one of the input files.


BoolCompare2Files  [ -layers l,m,n,...L,M,N ] [ -output_offset L ] file1 file2


Script Annotation

We will skip over the first lines that echo to the user the script usage and which check for existence of the various executables. Comments are in italics.

echo Begin BoolCompare2Files
echo
echo The path to BoolCompare2Files is
echo
echo $bindir                              the binary directory containing the script
                                          and the gdsfilt,gscan and newxor execs.
echo

AWKF=$bindir/BoolCompare2Files.awk        an awk script that will parse gscan's
                                           output and pick out highest layer

SUMF=$bindir/BoolCompareSummary.awk       an awk script that will produce a 
                                          summary text file

GSCAN=$bindir/gscan                       gscan scans a GDSII file and returns
                                          the cell hierarchy and list of layers

GDSFILT=$bindir/gdsfilt                   gdsfilt splits and combines files

NEWXOR=$bindir/newxor                     newxor is the incremental xor engine.

check_engine ${GSCAN}                     check to make sure everything we're going
check_engine ${GDSFILT}                   to use is really there ...
check_engine ${NEWXOR}
check_file ${AWKF}
check_file ${SUMF}

rm -rf work                               work is a subdirectory used to hold
mkdir work                                output and logs. If it is already there,
cd work                                   remove and create it. Then switch to it


if [ $path_is_relative = 1 ]              set up path to binaries ...
then
  REL=../
else
  REL=
fi

  f=$1
  rm -f bench.gds new.gds                to simplify the script the first GDSII input file
                                         will always be called bench and the second
                                         file is called new
  ln -s ../$1 bench.gds
  ln -s ../$2 new.gds

Determining the Highest Layer Number Used in the Input Files

The next lines are used to compute the highest GDSII layer used in the input files. We do this in order to "shift" layers when combining* the two input files prior to the XOR operation. The output from the gscan program includes a list of layers containing data and the AWKF code is used to pull out the highest layer


bench_max_layer=`${REL}${GSCAN} bench.gds | awk -f ${REL}${AWKF}`
  new_max_layer=`${REL}${GSCAN} new.gds   | awk -f ${REL}${AWKF}`

  if [ "$bench_max_layer" = "" ]
  then
    echo
    echo could not extract layer info for ../$1
    echo
    echo
    exit
  fi
  
  if [ "$new_max_layer" = "" ]
  then
    echo
    echo could not extract layer info for ../$2
    echo
    echo
    exit
  fi

  max_layer=$bench_max_layer
  if [ $new_max_layer -gt $max_layer ]
  then
    max_layer=$new_max_layer
  fi


* Qckbool requires that the two layers being XOR'd are in the same GDSII file. So we will be combining the two input files into one prior to running the XOR. If we don't shift the layer numbers for one of the files we will not be able to do the XOR.



Next Up - Computing a Layer Offset ...




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