Place object at wire crossings

edited April 2014 in Ruby Scripting

Hi,

Would like to detect wire-crossings, and then place an arbitrary object (say, a 10um x 20um box for purposes of this discussion, or it could be a cell) centered on the crossings. All the wires are on the same layer.

I have been experimenting with DRC. This simple script will draw layer 100 wherever two wires cross:

wires = input(1)
wires.merged(2).output(100,0)

If I were just drawing a square I could then just grow those layer 100 boxes and I'd be done. However instead I'd like to place an arbitrary object at these crossings. So I tried playing with report generation, thinking maybe I could feed the detected xy crossing locations into a second ruby script. When I try

wires = input(1)
output_me = wires.merged(2)
report("simple report")
output_me.output("check1", "the first check")

I can see the results in the GUI. Then I try to output to file (so I can read it later via ruby), but

wires = input(1)
output_me = wires.merged(2)
report("simple report", "drc.lyrdb")
output_me.output("check1", "the first check")

gives me the error: Unable to open file drc.lyrdb (errno=13) in ReportDatabase::save (Class RuntimeError).

Anyway, first, am I even going about this the best way? Second, how to export xy positions of wire crossings, so I can then place arbitrary objects there?

Thanks,
David

Comments

  • edited November -1

    (Would prefer to not use DRC, but just to use Ruby which is the more natural approach since my task isn't technically design rule checking. However just mentioning the DRC approach as I thought it might be simpler to implement.)

  • edited November -1

    Hi David,

    error 13 means "permission denied". Maybe there is a file already called "drc.lyrdb" which you are not allowed to write? Or the directory is not writeable?

    Anyway .. The pure Ruby object you're are looking for is "Region". You can populate it from a layer using the RecursiveShapeIterator object provided, i.e.

    ly = ... # layout
    layer = ... # layer index 
    cell_index = ... # top cell index
    
    region = RBA::Region::new(ly.begin_shapes(cell_index, layer))
    region.merge(2)
    region.each do |polygon|
      # ... polygon gives you one crossing
    end
    

    Matthias

Sign In or Register to comment.