Net Tracer Debug Issue

I am attempting to develop a ruby script to isolate where shorts are occurring between nets by probing the initial net locations
until the results in a different net name ( i.e. the location of the short )

The initial prototype code worked correctly :(

However after adding support for buried/blind vias and other code cleanup it no longer works :(

In the latest version it's reporting the short on the incorrect layer and I can't see why that is happening...

the attached zip file contains the simple test-case design, the .lym script and the Klayout log file showing
the shorts being reported on layer 2 while the short is actually on layer 1

Your assistance is greatly appreciated


  • Hi @mtnhomecad,

    I tried your script and can see the effect you mention.

    But it is hard to understand what you're trying to do and where the actual bug is.

    I'd start with structuring the code with functions - there are too many loops nested into one flat piece of code.

    One basic issue of your code is that you confuse database units with micrometer units.

    Like here:

                     _x =*_layout.dbu
                     _y =*_layout.dbu
                     _x = _x.round
                     _y = _y.round
                     _pts <<,_y)

    "Point" is a class that holds - by convention - database-unit coordinates.
    By multiplying with the DBU value you convert to micrometers which violates this convention.
    Later you pass this object to "trace":

                  _tracer.trace(_tech, _layout, _cell, _pt, _layout.find_layer(_layptr, 0) )

    which expected database-unit points, not micrometer ones, and the trace fails.

    So you should replace the code above by simply:

                     _pts <<

    But I don't know if that already fixes all issues.

    The approach you're using is based on the net name, but that is not made from all labels - just from one. It is not specified which label is used for the net name, hence you may not see the foreign label that indicates the short. As a solution, you could analyze all labels (texts) in the net elements to collect all labels along the net.


  • Thank you for your feedback, after updating the the code per your feedback the label locations are probed correctly :)

    I added the following code to help isolate where the short is occurring:

                  _tracer.trace(_tech, _layout, _cell, _pt, _layout.find_layer(_layptr, 0) )
                  _tracer.each_element do |_e| 
                     if _e.shape.is_text
                        unless _netA.eql?(_e.shape.text_string)
                           _bbox = _e.shape.bbox.transformed(_e.trans)
                           _pt =
                           _x = _pt.x*_layout.dbu
                           _y = _pt.y*_layout.dbu
                           _x = _x.round
                           _y = _y.round
                           _ShortCnt += 1
                           _string =sprintf("Short between Net:%s and Net:%s on Layer %s location: %.0f,%.0f",_netA,_e.shape.text_string,_layname,_x,_y)
                           puts _string
Sign In or Register to comment.