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.

157 lines
8.5KB

  1. import pya
  2. import os
  3. base_dir = os.path.dirname(os.path.abspath(__file__))
  4. # init vars
  5. velocity_ratio1 = 2
  6. opening1 = 8000
  7. velocity_ratio2 = 3
  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. y_offset = 0
  26. # verniers md course
  27. linear_grating_vernier_md_course = layout.create_cell("Vernier_md_course")
  28. square_size = 650000
  29. fray = 0
  30. line_length = square_size / 2 + fray
  31. pitch11 = ((square_size * 1) * (image_dist / velocity_ratio1)) / ((square_size * 1) - (image_dist / velocity_ratio1))
  32. pitch12 = image_dist / velocity_ratio1
  33. for i in range(-1 * int(square_size / 2 / pitch11) - 0, int(square_size / 2 / pitch11) + 0):
  34. line = layout.create_cell("Line")
  35. line.shapes(layer2_index).insert(pya.Box(opening1 / 2, -1 * line_length, pitch11 - opening1 / 2, line_length))
  36. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch11, 0)))
  37. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, (i * pitch11))))
  38. for i in range(-1 * int(square_size / 2 / pitch12) - 0, int(square_size / 2 / pitch12) + 0):
  39. line = layout.create_cell("Line")
  40. line.shapes(layer1_index).insert(pya.Box(opening1 / 2, -1 * line_length, pitch12 - opening1 / 2, line_length))
  41. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch12, 0)))
  42. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, (i * pitch12))))
  43. line = layout.create_cell("Line")
  44. line.shapes(layer2_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2 - image_dist, square_size / 2 + (1 * image_dist), square_size / 2 + (1 * image_dist)))
  45. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  46. line = layout.create_cell("Line")
  47. line.shapes(layer2_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2 - image_dist, square_size / 2 + (0 * image_dist), square_size / 2 + (1 * image_dist)))
  48. #linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  49. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, 0)))
  50. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(2, False, 0, 0)))
  51. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, True, 0, 0)))
  52. line = layout.create_cell("Line")
  53. line.shapes(layer1_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2, square_size / 2 + (1 * image_dist), square_size / 2 + (0 * image_dist)))
  54. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  55. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, 0)))
  56. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(2, False, 0, 0)))
  57. linear_grating_vernier_md_course.insert(pya.CellInstArray(line.cell_index(), pya.Trans(3, False, 0, 0)))
  58. triangle = layout.create_cell("Triangle")
  59. triangle.shapes(layer2_index).insert(pya.Polygon([pya.Point(-45000, -1 * image_dist), pya.Point(45000, -1 * image_dist), pya.Point(0, 0)]))
  60. linear_grating_vernier_md_course.insert(pya.CellInstArray(triangle.cell_index(), pya.Trans(0, False, 0, -1 * (square_size / 2 + (image_dist * 1)))))
  61. linear_grating_vernier_md_course.insert(pya.CellInstArray(triangle.cell_index(), pya.Trans(1, False, (square_size / 2 + (image_dist * 1)), 0)))
  62. y_offset = y_offset + (square_size / 2) + (image_dist * 3)
  63. grid_extent = 0
  64. top.insert(pya.CellInstArray(linear_grating_vernier_md_course.cell_index(), pya.Trans(0, False, (grid_extent + fray), (y_offset + fray))))
  65. # verniers md fine
  66. linear_grating_vernier_md_fine = layout.create_cell("Vernier_md_fine")
  67. square_size = 650000
  68. fray = 0
  69. line_length = square_size / 2 + fray
  70. pitch21 = ((square_size * -1) * (image_dist / velocity_ratio2)) / ((square_size * -1) - (image_dist / velocity_ratio2))
  71. pitch22 = image_dist / velocity_ratio2
  72. for i in range(-1 * int(square_size / 2 / pitch21) - 0, int(square_size / 2 / pitch21) + 0):
  73. line = layout.create_cell("Line")
  74. line.shapes(layer2_index).insert(pya.Box(opening2 / 2, -1 * line_length, pitch21 - opening2 / 2, line_length))
  75. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch21, 0)))
  76. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, (i * pitch21))))
  77. for i in range(-1 * int(square_size / 2 / pitch22) - 0, int(square_size / 2 / pitch22) + 0):
  78. line = layout.create_cell("Line")
  79. line.shapes(layer1_index).insert(pya.Box(opening2 / 2, -1 * line_length, pitch22 - opening2 / 2, line_length))
  80. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(i * pitch22, 0)))
  81. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, (i * pitch22))))
  82. line = layout.create_cell("Line")
  83. line.shapes(layer2_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2 - image_dist, square_size / 2 + (1 * image_dist), square_size / 2 + (1 * image_dist)))
  84. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  85. line = layout.create_cell("Line")
  86. line.shapes(layer2_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2 - image_dist, square_size / 2 + (0 * image_dist), square_size / 2 + (1 * image_dist)))
  87. #linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  88. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, 0)))
  89. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(2, False, 0, 0)))
  90. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, True, 0, 0)))
  91. line = layout.create_cell("Line")
  92. line.shapes(layer1_index).insert(pya.Box(-1 * (square_size / 2 + (1 * image_dist)), square_size / 2, square_size / 2 + (1 * image_dist), square_size / 2 + (0 * image_dist)))
  93. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(0, 0)))
  94. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(1, False, 0, 0)))
  95. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(2, False, 0, 0)))
  96. linear_grating_vernier_md_fine.insert(pya.CellInstArray(line.cell_index(), pya.Trans(3, False, 0, 0)))
  97. triangle = layout.create_cell("Triangle")
  98. triangle.shapes(layer2_index).insert(pya.Polygon([pya.Point(-45000, -1 * image_dist), pya.Point(45000, -1 * image_dist), pya.Point(0, 0)]))
  99. linear_grating_vernier_md_fine.insert(pya.CellInstArray(triangle.cell_index(), pya.Trans(0, False, 0, -1 * (square_size / 2 + (image_dist * 1)))))
  100. linear_grating_vernier_md_fine.insert(pya.CellInstArray(triangle.cell_index(), pya.Trans(1, False, (square_size / 2 + (image_dist * 1)), 0)))
  101. y_offset = y_offset + square_size + (image_dist * 1)
  102. grid_extent = 0
  103. top.insert(pya.CellInstArray(linear_grating_vernier_md_fine.cell_index(), pya.Trans(0, True, (grid_extent + fray), (y_offset + fray))))
  104. top.flatten(1)
  105. top.write(os.path.join(base_dir, "..", "gds", "md_vernier_test.gds"))
  106. bb_region = pya.Region(pya.Box(-650000, -300000, 650000, 2000000))
  107. wafer1 = pya.Region(top.begin_shapes_rec(layer1_index))
  108. wafer2 = pya.Region(top.begin_shapes_rec(layer2_index))
  109. alignment_inv_layout = pya.Layout()
  110. alignment_inv = alignment_inv_layout.create_cell("Alignment_Inverse")
  111. alignment_inv_layout.dbu = 0.01
  112. layer1_index = alignment_inv_layout.insert_layer(pya.LayerInfo.new(1, 0))
  113. layer2_index = alignment_inv_layout.insert_layer(pya.LayerInfo.new(2, 0))
  114. alignment_inv.shapes(layer1_index).insert(bb_region - wafer1)
  115. alignment_inv.shapes(layer2_index).insert(bb_region - wafer2)
  116. alignment_inv_layout.write(os.path.join(base_dir, "..", "gds", "inverted_tonality", "md_vernier_test_inverse.gds"))