Skip to content

Commit

Permalink
only make markers if all 4 are available
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinnJuliusson committed Nov 3, 2023
1 parent a6bd84a commit 979d325
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions klayout_package/python/kqcircuits/elements/chip_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ class ChipFrame(Element):
"""

box = Param(pdt.TypeShape, "Border", pya.DBox(pya.DPoint(0, 0), pya.DPoint(10000, 10000)),
docstring="Bounding box of the chip frame")
docstring="Bounding box of the chip frame")
dice_width = Param(pdt.TypeDouble, "Dicing width", 200, unit="μm")
dice_grid_margin = Param(pdt.TypeDouble, "Margin between dicing edge and ground grid", 100,
docstring="Margin of the ground grid avoidance layer for dicing edge")
docstring="Margin of the ground grid avoidance layer for dicing edge")
name_mask = Param(pdt.TypeString, "Name of the mask", "M000")
name_chip = Param(pdt.TypeString, "Name of the chip", "CTest")
name_copy = Param(pdt.TypeString, "Name of the copy", None)
name_brand = Param(pdt.TypeString, "Name of the brand", default_brand)
text_margin = Param(pdt.TypeDouble, "Margin for labels", 100,
docstring="Margin of the ground grid avoidance layer around the text")
docstring="Margin of the ground grid avoidance layer around the text")
marker_dist = Param(pdt.TypeDouble, "Marker distance from edges", 1500,
docstring="Distance of markers from closest edges of the chip face")
docstring="Distance of markers from closest edges of the chip face")
diagonal_squares = Param(pdt.TypeInt, "Number of diagonal squares for the markers", 10)
use_face_prefix = Param(pdt.TypeBoolean, "Use face prefix for chip name label", False)
marker_types = Param(pdt.TypeList, "Marker type for each chip corner, clockwise starting from lower left",
default=[default_marker_type]*4)
default=[default_marker_type] * 4)
chip_dicing_width = Param(pdt.TypeDouble, "Width of the chip dicing reference line", 10.0, unit="µm")
chip_dicing_line_length = Param(pdt.TypeDouble, "Length of the chip dicing reference line", 100.0, unit="µm")
chip_dicing_gap_length = Param(pdt.TypeDouble, "Gap between two chip dicing reference dashes", 50.0, unit="µm")
Expand All @@ -66,7 +66,7 @@ def _produce_labels(self):
if self.use_face_prefix:
face_id = self.face()["id"]
face_prefix = default_chip_label_face_prefixes[face_id].upper() \
if default_chip_label_face_prefixes and (face_id in default_chip_label_face_prefixes)\
if default_chip_label_face_prefixes and (face_id in default_chip_label_face_prefixes) \
else face_id.upper()
chip_name = face_prefix + self.name_chip
else:
Expand Down Expand Up @@ -100,14 +100,17 @@ def _produce_label(self, label, location, origin):

def _produce_markers(self):
x_min, x_max, y_min, y_max = self._box_points()
self._produce_marker(self.marker_types[0], pya.DTrans(x_min + self.marker_dist, y_min + self.marker_dist) \
* pya.DTrans.R180, self.face()["id"] + "_marker_sw")
self._produce_marker(self.marker_types[3], pya.DTrans(x_max - self.marker_dist, y_min + self.marker_dist) \
* pya.DTrans.R270, self.face()["id"] + "_marker_se")
self._produce_marker(self.marker_types[1], pya.DTrans(x_min + self.marker_dist, y_max - self.marker_dist) \
* pya.DTrans.R90, self.face()["id"] + "_marker_nw")
self._produce_marker(self.marker_types[2], pya.DTrans(x_max - self.marker_dist, y_max - self.marker_dist) \
* pya.DTrans.R0, self.face()["id"] + "_marker_ne")
if len(self.marker_types) == 4:
self._produce_marker(self.marker_types[0], pya.DTrans(x_min + self.marker_dist, y_min + self.marker_dist) \
* pya.DTrans.R180, self.face()["id"] + "_marker_sw")
self._produce_marker(self.marker_types[3], pya.DTrans(x_max - self.marker_dist, y_min + self.marker_dist) \
* pya.DTrans.R270, self.face()["id"] + "_marker_se")
self._produce_marker(self.marker_types[1], pya.DTrans(x_min + self.marker_dist, y_max - self.marker_dist) \
* pya.DTrans.R90, self.face()["id"] + "_marker_nw")
self._produce_marker(self.marker_types[2], pya.DTrans(x_max - self.marker_dist, y_max - self.marker_dist) \
* pya.DTrans.R0, self.face()["id"] + "_marker_ne")
else:
print('Warning: chip frame markers need to be for all four corners')

def _produce_marker(self, marker_type, trans, name):
if not marker_type:
Expand All @@ -129,9 +132,9 @@ def _produce_dicing_edge(self):
p2 = pya.DPoint(box_points[1], box_points[2])
p3 = pya.DPoint(box_points[0], box_points[3])
p4 = pya.DPoint(box_points[1], box_points[3])
self._produce_lines_along_edge(p1.y, p3.y, True, p1)
self._produce_lines_along_edge(p1.y, p3.y, True, p1)
self._produce_lines_along_edge(p1.x, p2.x, False, p1)
self._produce_lines_along_edge(p2.y, p4.y, True, p2)
self._produce_lines_along_edge(p2.y, p4.y, True, p2)
self._produce_lines_along_edge(p3.x, p4.x, False, p3)

def _box_points(self):
Expand Down Expand Up @@ -197,9 +200,9 @@ def _add_chip_dicing_line_dash(self, start, end, is_vertical, position):
position: A DPoint that is in the line to which the dash belongs to
"""
if is_vertical:
box = pya.DBox(position.x - self.chip_dicing_width/2, start, position.x + self.chip_dicing_width/2, end)
box = pya.DBox(position.x - self.chip_dicing_width / 2, start, position.x + self.chip_dicing_width / 2, end)
else:
box = pya.DBox(start, position.y - self.chip_dicing_width/2, end, position.y + self.chip_dicing_width/2)
box = pya.DBox(start, position.y - self.chip_dicing_width / 2, end, position.y + self.chip_dicing_width / 2)
self.cell.shapes(self.get_layer("chip_dicing")).insert(box)
if self.chip_dicing_in_base_metal:
self.cell.shapes(self.get_layer("base_metal_addition")).insert(box)

0 comments on commit 979d325

Please sign in to comment.