| <?xml version="1.0" encoding="utf-8"?> |
| <klayout-macro> |
| <description/> |
| <version/> |
| <category>drc</category> |
| <prolog/> |
| <epilog/> |
| <doc/> |
| <autorun>false</autorun> |
| <autorun-early>false</autorun-early> |
| <shortcut/> |
| <show-in-menu>true</show-in-menu> |
| <group-name>drc_scripts</group-name> |
| <menu-path>tools_menu.drc.end</menu-path> |
| <interpreter>dsl</interpreter> |
| <dsl-interpreter-name>drc-dsl-xml</dsl-interpreter-name> |
| <text> |
| |
| source($input) |
| report("Density Checks", $report) |
| |
| verbose(true) |
| |
| diff_wildcard = "65/20" |
| tap_wildcard = "65/44" |
| fomfill_wildcard = "65,23/28" |
| fommk_wildcard = "23/0" |
| |
| chip_boundary = input(235,4) |
| pl = polygon_layer |
| pl.insert(box(0, 0, 700, 700)) |
| pl & chip_boundary |
| |
| threads(4) |
| |
| bbox = chip_boundary.bbox |
| |
| window_size = 700 |
| |
| step_size = 70 |
| |
| llx, lly, urx, ury = bbox.left, bbox.bottom, bbox.right, bbox.top |
| |
| cnt = 0 |
| tot = ((urx-window_size-llx) / step_size).ceil() * ((ury-window_size-lly) / step_size ).ceil() |
| for x in (llx..urx-window_size).step(step_size) |
| for y in (lly..ury-window_size).step(step_size) |
| pl = polygon_layer |
| pl.insert(box(x, y, x+window_size, y+window_size)) |
| box_within_boundary = pl & chip_boundary |
| m_area_within_seal = (box_within_boundary & source.touching(box_within_boundary.bbox).polygons(diff_wildcard, tap_wildcard, fomfill_wildcard, fommk_wildcard)).area |
| m_density = m_area_within_seal / box_within_boundary.area |
| |
| cnt = cnt + 1 |
| # Needed for interfacing with other scripts |
| # puts does not print to stdout but rather to tty |
| # which can not be captured in python |
| system 'echo %d/%d'%[cnt, tot.round] |
| if m_density < 0.33 |
| box_within_boundary.output("cfom.pd.1d", "0.33 min FOM pattern density #{box_within_boundary.bbox}") |
| end |
| if m_density > 0.57 |
| box_within_boundary.output("cfom.pd.1e", "0.57 max FOM pattern density #{box_within_boundary.bbox}") |
| |
| end |
| # m_density < 0.33 && box_within_boundary.output("cfom.pd.1d", "0.33 min FOM pattern density") |
| # m_density > 0.57 && box_within_boundary.output("cfom.pd.1e", "0.57 max FOM pattern density") |
| end |
| end |
| |
| </text> |
| </klayout-macro> |