Download (as "simple-sref.txt") simple-sref
#!/usr/bin/perl -w
# GDSII generation
# ------------------------------------------------------------------------------
# SREF stands for Structure Reference. Structure also called 'cell', small unit
# of drawing.
# ------------------------------------------------------------------------------
# The most simple SREF example, have box-500 structure and it is placed
# at the center of TOP structure
use GDS2; # --- enable GDSII (GDS2) library
# strict checks variable declaration and subroutine argument consistency
use strict;
my $VERSION = "2018-09-03 23:42" ; # written by emacs time-stamp
## --------------------------------------------
## M A I N R O U T I N E
## --------------------------------------------
my $filename = $0; # --- set filename with the same as this script
$filename =~ s/.txt$//; # --- Strip '.txt' part
$filename .= '.gds'; # --- Add '.gds' to (output) filename
# dot(.) connects strings
# $a .= 'xx'; is equivalent to $a = $a . 'xx';
my $gds2File = new GDS2(-fileName=> '>'. $filename); # --- open new GDS2 (object) to write
$gds2File -> printInitLib(-name=>'LibraryName'); # --- always necessary for start
## ---------------------------------------------
## S T R U C T U R E box-500
## ---------------------------------------------
$gds2File -> printBgnstr( -name=> 'box-500'); # --- Start new structure
$gds2File -> printBoundary( # --- Boundary with four coordinate
-xy=> [-250, -250, # unit is in micron, micro meter
250, -250,
250, 250,
-250, 250],
-layer=> 0, # --- layer (0 is really default)
);
$gds2File -> printEndstr(); # --- End of this new structure
## ---------------------------------------------
## S T R U C T U R E TOP
## ---------------------------------------------
$gds2File -> printBgnstr( -name=> 'TOP'); # --- Start another structure
$gds2File -> printSref( # --- Place structure reference
-name => 'box-500', # --- of name 'box-500
-xy => [0,0]); # --- at coordinate (0,0)
$gds2File -> printEndstr; # --- End 'TOP' structure
$gds2File -> printEndlib(); # --- close library
__END__
|