Density DRC checks

Foundry DRC decks often include density checks. Calibre decks often define this as density in regions of a certain size.
Although I found some topics discussing density it's not clear to me how to best handle density checks in a klayout drc script.
I would like them to be part of a drc script that can be run in batch.


  • Hi,

    there is no out-of-the-box DRC command yet, but a bare metal feature is there (the TilingProcessor class). You can wrap it inside your DRC script like this:

    # Provides a density check feature: include this code at the beginning of your DRC script def dens_check(output, input, tile_size, threads, min, max) tp = RBA::TilingProcessor::new tp.tile_size(tile_size, tile_size) tp.output("res", tp.input("input", tp.dbu = 1.dbu # establish the real database unit tp.var("vmin", min) tp.var("vmax", max) tp.threads = threads tp.queue("_tile && (var d = to_f(input.area(_tile.bbox)) / to_f(_tile.bbox.area); (d < vmin || d > vmax) && _output(res, _tile.bbox))") tp.execute("Density check") end # -- this is the actual DRC script -- report("Metal density DRC check") metal = input(1, 0) # that is one use case. It checks between 10% and 90% on 30µm tiles and with 4 CPU's: dens = polygon_layer dens_check(dens, metal,, 4, 0.1, 0.9) dens.output("Dens", "Metal density between 10 and 90%")


  • I was rummaging around in some of the examples repositories
    and I ran across two macro scripts which, together, look like
    they might do a density check:

    cell_bbox.lym gives the bounding box info for the layout
    calc_area_hier.lym gives the total area of a specified layer

    So you could (I guess) stack 'em up, harvest the output and
    do the arithmetic to get your density numbers. I'd assume
    they could be put all together in a "check 'em all" macro
    (one bounding box, and each layer of interest). Limit check
    I suppose would be another effort.

    But looks like there's a cleaner approach in the works.

Sign In or Register to comment.