You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
5.5KB

  1. import pya
  2. import os
  3. base_dir = os.path.dirname(os.path.abspath(__file__))
  4. # init vars
  5. velocity_ratio1 = 1
  6. opening1 = 4000
  7. velocity_ratio2 = 5
  8. opening2 = opening1 * velocity_ratio1 / velocity_ratio2
  9. pixel_size = 20
  10. shift_mult = 5
  11. image_size = 4266 * pixel_size * 100 #calculate this directly (4266 and 4242 for shift_mult 5 and 3, respectively)
  12. image_size_half = image_size / 2
  13. image_dist = (shift_mult * 3 * 2 + 2) * pixel_size * 100
  14. object_border = 0
  15. #print(image_dist)
  16. # create layout
  17. layout = pya.Layout()
  18. layout.dbu = 0.01
  19. top = layout.create_cell("Top")
  20. layer1_index = layout.insert_layer(pya.LayerInfo.new(1, 0))
  21. layer2_index = layout.insert_layer(pya.LayerInfo.new(2, 0))
  22. layer3_index = layout.insert_layer(pya.LayerInfo.new(3, 0))
  23. layer4_index = layout.insert_layer(pya.LayerInfo.new(4, 0))
  24. layer5_index = layout.insert_layer(pya.LayerInfo.new(5, 0))
  25. # verniers
  26. linear_grating_vernier = layout.create_cell("Vernier")
  27. base_period = image_size_half - 500000
  28. revealing_period = image_dist
  29. pitch11 = (base_period * (revealing_period / velocity_ratio1)) / (base_period - (revealing_period / velocity_ratio1))
  30. pitch12 = revealing_period / velocity_ratio1
  31. #print(pitch11)
  32. #print(pitch12)
  33. frame_width = 300000
  34. for i in range(-1 * int((image_size_half) / pitch11), int((image_size_half) / pitch11)):
  35. line = layout.create_cell("Line")
  36. line.shapes(layer2_index).insert(pya.Box(opening1 / 2, -1 * frame_width, pitch11 - opening1 / 2, 0))
  37. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch11, 0)))
  38. for i in range(-1 * int((image_size_half - image_dist) / pitch12), int((image_size_half - image_dist) / pitch12)):
  39. line = layout.create_cell("Line")
  40. line.shapes(layer1_index).insert(pya.Box(opening1 / 2, -1 * frame_width, pitch12 - opening1 / 2, 0))
  41. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch12, 0)))
  42. base_period = -1 * (image_size_half - 500000)
  43. revealing_period = image_dist
  44. pitch21 = (base_period * (revealing_period / velocity_ratio2)) / (base_period - (revealing_period / velocity_ratio2))
  45. pitch22 = revealing_period / velocity_ratio2
  46. for i in range(-1 * int(image_size_half / pitch21), int(image_size_half / pitch21)):
  47. line = layout.create_cell("Line")
  48. line.shapes(layer2_index).insert(pya.Box(opening2 / 2, 0, pitch21 - opening2 / 2, frame_width))
  49. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch21, 0)))
  50. for i in range(-1 * int((image_size_half - image_dist) / pitch22), int((image_size_half - image_dist) / pitch22)):
  51. line = layout.create_cell("Line")
  52. line.shapes(layer1_index).insert(pya.Box(opening2 / 2, 0, pitch22 - opening2 / 2, frame_width))
  53. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch22, 0)))
  54. line = layout.create_cell("Line")
  55. line.shapes(layer2_index).insert(pya.Box(image_size_half - (2 * image_dist), -1 * frame_width, image_size_half, 0))
  56. line.shapes(layer2_index).insert(pya.Box(-1 * (image_size_half - (2 * image_dist)), -1 * frame_width, -1 * (image_size_half), 0))
  57. line.shapes(layer2_index).insert(pya.Box(image_size_half - (2 * image_dist), image_dist, image_size_half, image_dist + frame_width))
  58. line.shapes(layer2_index).insert(pya.Box(-1 * (image_size_half - (2 * image_dist)), image_dist, -1 * (image_size_half), image_dist + frame_width))
  59. #These four lines can be taken away to get rid of the bounding black out
  60. line.shapes(layer2_index).insert(pya.Box(-1 * image_size_half, image_dist, image_size_half, 0 - image_dist))
  61. line.shapes(layer2_index).insert(pya.Box(-1 * image_size_half, -1 * (frame_width - image_dist), image_size_half, -1 * (frame_width + image_dist)))
  62. line.shapes(layer2_index).insert(pya.Box(-1 * image_size_half, 0, image_size_half, image_dist))
  63. line.shapes(layer2_index).insert(pya.Box(-1 * image_size_half, frame_width + (2 * image_dist), image_size_half, frame_width - image_dist))
  64. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  65. line = layout.create_cell("Line")
  66. line.shapes(layer1_index).insert(pya.Box(image_size_half - image_dist, -1 * frame_width, image_size_half - (2 * image_dist), 0))
  67. line.shapes(layer1_index).insert(pya.Box(-1 * (image_size_half - image_dist), -1 * frame_width, -1 * (image_size_half - (2 * image_dist)), 0))
  68. line.shapes(layer1_index).insert(pya.Box(image_size_half - image_dist, 0, image_size_half - (2 * image_dist), frame_width))
  69. line.shapes(layer1_index).insert(pya.Box(-1 * (image_size_half - image_dist), 0, -1 * (image_size_half - (2 * image_dist)), frame_width))
  70. linear_grating_vernier.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  71. top.insert(pya.CellInstArray(linear_grating_vernier.cell_index(), pya.Trans(0,0 )))
  72. top.flatten(1)
  73. top.write(os.path.join(base_dir, "..", "gds", "ud_vernier_test.gds"))
  74. bb_region = pya.Region(pya.Box(-5000000, -1 * (frame_width + image_dist), 5000000, frame_width + (2 * image_dist)))
  75. wafer1 = pya.Region(top.begin_shapes_rec(layer1_index))
  76. wafer2 = pya.Region(top.begin_shapes_rec(layer2_index))
  77. alignment_inv_layout = pya.Layout()
  78. alignment_inv = alignment_inv_layout.create_cell("Alignment_Inverse")
  79. alignment_inv_layout.dbu = 0.01
  80. layer1_index = alignment_inv_layout.insert_layer(pya.LayerInfo.new(1, 0))
  81. layer2_index = alignment_inv_layout.insert_layer(pya.LayerInfo.new(2, 0))
  82. alignment_inv.shapes(layer1_index).insert(bb_region - wafer1)
  83. alignment_inv.shapes(layer2_index).insert(bb_region - wafer2)
  84. alignment_inv_layout.write(os.path.join(base_dir, "..", "gds", "inverted_tonality", "ud_vernier_test_inverse.gds"))