Download (as "Triangle-Grid-Wide.txt") Triangle-Grid-Wide
#!/usr/bin/perl -w
# ---------------------------------------------------------------
# 200nm の円を 500nm pitch で 500um x 500um の大きさに配置する
# 200nm の円は、 CP (HoleSIPH200nm) を想定しています
# ---------------------------------------------------------------
use GDS2;
use strict;
use Math::Trig; # 三角関数を使う
my $R3 = 1.7320508;
# simulating circle (8 角形)
sub polygon_8($$$$) { # use strict した時には、引数の数を合せておく
# 四つの引数をローカル変数に代入
my ($r) = shift; # 直径
my ($str) = shift; # structure の名前
my ($layer) = shift;
my ($gds2File) = shift;
my ($theta) = 22.5 * 3.141593/180; # get radian for 15 degree
# +
# | + ($b, $a) 67.5 度
# |
# |
# |
# |
# | + ($a, $b) 22.5 度
# |
# +---------------
my ($a) = $r / 2 * cos($theta/2); # 15 度 -> x
my ($b) = 2 * $r / 2 * sin($theta/2); # 15 度 -> y
$gds2File -> printBgnstr(-name => $str);
$gds2File -> printBoundary(
-layer => $layer,
-dataType => 0, # 指定しなくても 0 になるが
-xy => [ $a, $b, $b, $a, # 2 x 8 組の座標を設定
-$b, $a, -$a, $b,
-$a, -$b, -$b, -$a,
$b, -$a, $a, -$b,
]);
$gds2File -> printEndstr;
}
## --------------------------------------------
## 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
# 単に dot(.) と書くと、「何でも文字一つ」にー致するので、
# 「本当に . の文字」の意味で \. としています
# $ は行末を意味します
# --- Add '.gds' to (output) filename
my $span = 500;
my $pitch = 0.5;
my $gds_name = sprintf("%s-%d-%5.3f.gds", $filename, $span, $pitch);
my $gds2File = new GDS2(-fileName=> '>'. $gds_name);
$gds2File -> printInitLib(-name=>'LibraryName');
# Prepare primitive structure
# --------------------------------------------------
# 直径 名前 Layer
my $CPname = 'HoleSIPH120nm';
polygon_8(0.20, $CPname, 0, $gds2File);
my $columns = $span / $pitch; # pitch = 0.16 um
my $rows = $span / ($pitch * $R3); # row
$gds2File -> printBgnstr(-name => 'grid');
$gds2File -> printAref(
-name=> $CPname,
-columns=> $columns,
-rows=> $rows,
-xy=>[0, 0,
$span, 0,
0, $span ]);
$gds2File -> printEndstr;
# 上のような Array の置き方だと、中心が (0, 0) ではないので、
# ちょうど全体の半分を左下にずらす
$gds2File -> printBgnstr(-name => 'TOP');
$gds2File -> printSref(
-name => 'grid',
-xy => [-$span/2, -$span/2]);
$gds2File -> printSref(
-name => 'grid',
-xy => [-$span/2 + $pitch/2, -$span/2 + $pitch * $R3/2]);
$gds2File -> printEndstr;
$gds2File -> printEndlib();
__END__
|