Skip to content
Snippets Groups Projects
Commit 8cb9dc05 authored by David Lanzendörfer's avatar David Lanzendörfer
Browse files

updating script

parent 4ea1a588
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,10 @@
import gdspy
import numpy
spacing=1000
#spacing=1000
spacing=500
frame_width=200
square_middle=18750
darkfield_masks = [
["nwell","pwell","pbase","nbase"],
......@@ -17,10 +19,10 @@ brightfield_masks = [
]
def get_offset(idx):
x0=30000
y0=30000
x1=x0+34000
y1=y0+34000
x0=20000
y0=20500
x1=95000
y1=95500
if(idx==0):
return [x0,y1]
......@@ -33,6 +35,25 @@ def get_offset(idx):
else:
return [0,0]
def get_layer_location(idx,w,h):
ret=get_offset(idx)
#18750
ret[0]=ret[0]-w/2
ret[1]=ret[1]-h/2
if(idx==0):
ret[0]=ret[0]+square_middle
ret[1]=ret[1]-square_middle
elif(idx==1):
ret[0]=ret[0]-square_middle
ret[1]=ret[1]-square_middle
elif(idx==2):
ret[0]=ret[0]+square_middle
ret[1]=ret[1]+square_middle
elif(idx==3):
ret[0]=ret[0]-square_middle
ret[1]=ret[1]+square_middle
return ret
def get_frame(bb):
ret=[]
......@@ -63,11 +84,21 @@ def get_frame(bb):
def mirrored_polygons(cell):
bb=cell.get_bounding_box()
zeroing_offset=[0,0]
zeroing_offset[0]=bb[0][0]
zeroing_offset[1]=bb[0][1]
width=bb[1][0]-bb[0][0]
pgs=cell.get_polygons()
for pg in pgs:
for tp in pg:
tp[0]=tp[0]-zeroing_offset[0]
tp[1]=tp[1]-zeroing_offset[1]
tp[0]=width-tp[0]
return pgs
def make_masks(frame,mask_type,mask_mappings):
......@@ -78,58 +109,67 @@ def make_masks(frame,mask_type,mask_mappings):
gdsii=gdspy.GdsLibrary("top")
gdsii.read_gds(frame, units='skip', rename={}, layers={}, datatypes={}, texttypes={})
if(len(gdsii.top_level())==1):
for c in gdsii.top_level():
topcell=c.flatten(single_layer=1)
toppgs=topcell.get_polygons()
#we have four tiles ready to be filled
for idx in range(4):
if(len(m)>idx):
cellname="mask_"+m[idx]
tp=get_offset(idx)
fs=2000
tp[1]=97800
if((idx==2)or(idx==3)):
tp[1]=16000
text=gdspy.Text(cellname, fs, tp)
#text=text.fillet(radius=45, points_per_2pi=256, max_points=199, precision=0.001)
toppgs=gdspy.fast_boolean(toppgs,text,"xor")
topcell=gdspy.Cell(mask_type+str(i))
topcell.add(toppgs)
for idx in range(4):
if(len(m)>idx):
cellname="mask_"+m[idx]
print("Adding "+cellname)
ngdsii=gdspy.GdsLibrary(cellname)
ngdsii.read_gds("Layout/gds/"+cellname+".gds", units='skip', rename={}, layers={}, datatypes={}, texttypes={})
for c in ngdsii.top_level():
cell=c.flatten(single_layer=1)
try:
pgs = mirrored_polygons(cell)
except:
print("No polygons found")
bb=cell.get_bounding_box()
bb=bb*5
bb[0]=bb[0]+get_offset(idx)
bb[1]=bb[1]+get_offset(idx)
for stripe in get_frame(bb):
topcell.add(stripe)
for pg in pgs:
pg=5*pg
pg=pg+get_offset(idx)
if((idx>=0) and (idx<=3)):
topcell.add(gdspy.Polygon(pg))
topcell=topcell.flatten(single_layer=1)
outgdsii.add(topcell)
outgdsii.write_gds("Vendors/HKUST/Masks/"+mask_type+str(i)+".gds")
i=i+1
else:
print("Error! Wrong about of top cells!")
topcell=gdspy.Cell("mask_"+mask_type+str(i))
for c in gdsii.top_level():
topcell.add(c.flatten(single_layer=1))
topcell=topcell.flatten(single_layer=1)
toppgs=topcell.get_polygons()
#we have four tiles ready to be filled
for idx in range(4):
if(len(m)>idx):
cellname="mask_"+m[idx]
tp=get_offset(idx)
fs=2000
tp[1]=97800
if((idx==2)or(idx==3)):
tp[1]=16000
if((idx==1)or(idx==3)):
tp[0]=tp[0]-(75000/2)
text=gdspy.Text(cellname, fs, tp)
toppgs=gdspy.fast_boolean(toppgs,text,"xor", precision=0.001, max_points=800, layer=0)
topcell=gdspy.Cell(mask_type+str(i))
topcell.add(toppgs)
for idx in range(4):
if(len(m)>idx):
cellname="mask_"+m[idx]
ngdsii=gdspy.GdsLibrary(cellname)
ngdsii.read_gds("Layout/gds/"+cellname+".gds", units='skip', rename={}, layers={}, datatypes={}, texttypes={})
cell=gdspy.Cell(cellname)
for c in ngdsii.top_level():
cell.add(c.flatten(single_layer=1))
cell=cell.flatten(single_layer=1)
pgs = mirrored_polygons(cell)
bb=cell.get_bounding_box()
zeroing_offset=[0,0]
zeroing_offset[0]=bb[0][0]
zeroing_offset[1]=bb[0][1]
bb[0]=bb[0]-zeroing_offset
bb[1]=bb[1]-zeroing_offset
bb=bb*5
w=bb[1][0]-bb[0][0]
h=bb[1][1]-bb[0][1]
offset=get_layer_location(idx,w,h)
for pg in pgs:
pg=pg*5
pg=pg+offset
topcell.add(gdspy.Polygon(pg))
bb[0]=bb[0]+offset
bb[1]=bb[1]+offset
for stripe in get_frame(bb):
topcell.add(stripe)
topcell=topcell.flatten(single_layer=1)
outgdsii.add(topcell)
outgdsii.write_gds("Vendors/HKUST/Masks/"+mask_type+str(i)+".gds")
i=i+1
make_masks("Vendors/HKUST/GDS/stepperMK_15mm_Dark.gds","darkfield",darkfield_masks)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment