DRC : some bad allocation errors

edited December 2013 in KLayout Support

Matthias,

I use the version 0.23.1 on Windows XP, and my DRC file is :

# Simple metal-1 check
M1_drawing = input(31,0)
M1_dummy = input(31,1)

M1 = M1_drawing + M1_dummy

As my GDS does not include M1_dummy, I got an error on that "+" command : bad allocation in Region::+ in MacroInterpreter::execute

ME1_3_1 = M1.sized(-0.15).sized(0.15) 

I want to select all the shapes that are larger than 0.15um, but this line gives an error that I don't understand.

M1_EDGE_45 = M1.with_angle(45) + M1.with_angle(135)

I want to select all the shapes that have a 45degree angle, because their width and space should be larger than orthogonal shapes.
But this command line gives me an error : bad allocation in Region::with_angle in MacroInterpreter::execute

M1.ongrid(0.005).output("M1_offgrid", "Offgrid vertex on M1")

I want to check the off gridd shapes with a grid at 0.005um, but this command gives me an error: bad allocation in Region::grid_check in MacroInterpreter::execute

M1.with_angle(0 .. 45).output("M1_angle", "Non 45 degree angle M1")

I want to check the non-diagonal shapes, but this command gives me an error: bad allocation in Region::with_angle in MacroInterpreter::execute

M1.holes.with_area(0.2 ..).output("M1_2_area", "Rule M1.A.2: Enclosed area: 0.20")

I want to check the maximum size of the holes, but it again give me an error.

It seems to be always the same error : how to solve it ?

Thanks, Regards,

Laurent

Comments

  • edited December 2013

    Matthias,

    I found out that the "bad allocation" problem happens when I run the DRC several times.

    I have to close KLAYOUT before to re-run the script after any modification.

    My 2 remaining problems are :

    M1.with_angle(0 .. 45).output("M1_angle", "Non 45 degree angle M1")
    M1.holes.with_area(0.2 ..).output("M1_2_area", "Rule M1.A.2: Enclosed area: 0.20")
    

    For the first one I want to select all the shapes with a 45degrees angles to check their width.
    For the second one I want to check a maximum size, the turn around I currently use is to set 999.

    By the way, would it be possible to get a way to know the time spent for each test ?

    Thanks, Regards,

    Laurent

  • edited November -1

    Hi Laurent,

    "bad allocation" indicates that the DRC runs out of memory. Can you reproduce the error on a small layout as well? KLayout's DRC is a flat engine and that means it can use a considerable amount of memory. If you want to run the runset on a big layout, you should consider using the tiling option, which cuts the layout into rectangular pieces (tiles) and runs the script on every tile. That results in a lower memory requirement and allows to distribute the task on multiple cores.

    In general, when you write a rule it is important that the units for distances and areas should be given. The default unit is database unit and 0.005 is not a valid value. You should write:

    ME1_3_1 = M1.sized(-0.15.um).sized(0.15.um) 
    

    or

    ME1_3_1 = M1.sized(-0.15.micron).sized(0.15.micron) 
    

    or

    ME1_3_1 = M1.sized(-150.nm).sized(150.nm) 
    

    For areas you should use

    M1.holes.with_area(0.2.um2 ..).
    

    A missing layer should not be an issue, but I'll check that.

    Regards,

    Matthias

  • edited November -1
    Matthias,

    The missing layer is no more an issue, it was only the bad allocation that run only if I close KLayout and re-open.
    What is the difference between : sized(1.0) and size(1.0.um) ? It seems that the default assume um, isn't it ?

    Another point on DRC : I have put my DRC file in a subdirectory, but to get I have always to refresh the directory, even the first time. Could you make the first refresh automatic ?

    Thanks for the great DRC feature!

    Laurent
  • edited December 2013

    Hi Laurent,

    yes, sorry, you're right. I stand corrected. Micrometer is the default unit, but in order to make sure you get what you want, I'd suggest to add the unit explicitly.

    But about the bad allocation: are you saying that also happens on a small layout? I'll have to look into that in that case. I create a small sample and was not able to reproduce that issue right away.

    Matthias

  • edited December 2013

    Matthias,

    The larger the layout, the faster the bad allocation happens. On very small layout, I can run the DRC many times.
    On a small test chip, it happens after 2 or 3 DRC runs. I did not try on large chip.

    My remaining problem is to select all the shapes with a 45degrees angles to check their width:

    M1_EDGE_45 = M1.with_angle(45) + M1.with_angle(135) + M1.with_angle(225) + M1.with_angle(315)
    M1_EDGE_45.width(0.3,euclidian).output("M1_EDGE_45_width", "Width for 45deg metal1 lines : 0.3um")
    

    Thanks, Best regards,

    Laurent

  • edited November -1

    Hi Laurent,

    maybe the allocation problem is not because of too much input but because of too much output.

    Let me explain: if you produce output to a report database, the memory requirements are much bigger. The report database is expected to receive little data because typically it should contain just a few spots where DRC rules are violated. The RDB is not optimized for memory footprint but on a generic data model. If you feed a lot of data into a report database (i.e intermediate layers or runaway rules), that could explain the bad allocation issue. In addition, RDB data is not deleted but each time you run a DRC you'll create a new RDB. To unload RDB's goto the marker browser (Tools/Marker Browser) and unload all RDB's using the "Unload All" function from the "File" menu in the upper right corner. Maybe the removes the bad allocation error.

    If you want to produce large output data sets, consider using output layers or an output layout object to store the results. That is much more efficient and the accumulation does not happen.

    Matthias

  • edited December 2013

    Hi Laurent,

    regarding the DRC runset issue, the following might be the solution you look for:

    M1 = input(31, 0)
    M1_EDGES = M1.edges
    
    M1_EDGE_45 = M1_EDGES.with_angle(45) + M1_EDGES.with_angle(135)
    M1_EDGE_45.width(0.3,euclidian).output("M1_EDGE_45_width", "Width for 45deg metal1 lines : 0.3um")
    

    The trick is to derive the edges from the M1 input (a polygon layer). "with_angle" on an edge layer selects the edges having the given angle to the horizontal (45 and 135 select both possible versions of 45 degree edges). "width" will check these edges vs. other edges in that edge set. If I understood your intention correctly that should give the results you look for.

    The reason why you get the error message when you don't use "edges" is, that "with_angle" on polygons creates edge pairs on each corner with the given angle. Edge pair collections cannot be combined using "+" (there is no technical reason for that, it's just not there). Corner detection is probably not the target of your efforts, so I assume the above solution is what you look for.

    Best regards,

    Matthias

  • edited November -1
    Thanks Matthias,

    I had solved it through the command : .polygons
    I don't know which one is the most efficient.

    Rgds,
    Laurent
Sign In or Register to comment.