Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Net tracer script problem

I use the following ruby script to save my net trace result with specified layer to a new cell, but I face some problem.
Its layer id saved in class NetElement is not a valid layer index in the layout I parse in.
The layer id would be 10^9+1.
I guess the reason is the net trace result is built from the LOP NOT(i.e., "MetalDown_NOT_CutMetal") defined in the symbol, not the original layer in the layout.
And I haven't found any function to get the layer/datattype # or naming in the symbol of this layer yet.
Is there any way to do such a thing?
The Klayout version I used is 0.25.8

The script:
layout = RBA::Layout::new
layout.read("trace.gds")

tech = RBA::NetTracerTechnology::new
tech.symbol( "MetalDown_NOT_CutMetal", "1/0-4/0")
tech.connection( "MetalDown_NOT_CutMetal" , "2/0", "3/0")

MetalDown: 1/0

MetalUp: 3/0

VIA: 2/0

CutMetal: 4/0

tracer = RBA::NetTracer::new
tracer.trace(tech, layout , layout .top_cell, RBA::Point::new(0/layout.dbu, 0/layout.dbu), layout.find_layer(1, 0) )
trace_result_cell = layout.create_cell("trace_result")
tracer.each_element do |e|
###try to save MetalDown_NOT_CutMetal only, but failed
e_layer_info = layout.get_info(e.layer)
if e_layer_info.layer == 1 && e_layer_info.layer == 0
trace_result_cell .shpaes(e.layer).insert(e.shape,e.trans)
end

###trace_result_cell.shapes(layout.layer(5,0) ).insert(e.shape,e.trans)

end
layout.write("check_result.gds")

Comments

  • Hi,

    any chance to get this code formatted as Markdown? It very difficult to read. Use triple backticks before and after the code.

    Does the example work in the user interface?

    At least there is one typo ("shpaes"), so I don't think this code every worked.

    Matthias

  • Sorry for the hard-to-read pure text format.
    I hope this time it would be better.

    layout = RBA::Layout::new
    layout.read("trace.gds")
    tracer = RBA::NetTracer::new
    
    tech = RBA::NetTracerTechnology::new
    ###MetalDown: 1/0
    ###MetalUp: 3/0
    ###VIA: 2/0
    ###CutMetal: 4/0
    
    tech.symbol( "MetalDown_NOT_CutMetal", "1/0-4/0")
    tech.connection( "MetalDown_NOT_CutMetal" , "2/0", "3/0")
    
    tracer.trace(tech, layout , layout .top_cell, RBA::Point::new(0/layout.dbu, 0/layout.dbu), layout.find_layer(1, 0) )
    
    trace_result_cell = layout.create_cell("trace_result")
    
    
    tracer.each_element do |e| 
        e_layer_info = layout.get_info(e.layer)
        if e_layer_info.layer == 1 && e_layer_info.layer == 0
            trace_result_cell .shpaes(e.layer).insert(e.shape,e.trans)
        end  
        ###trace_result_cell.shapes(layout.layer(5,0) ).insert(e.shape,e.trans)
    
    
    end
    
    layout.write("check_result.gds")
    
  • edited July 7

    More readable, but the typo is still there.

    The issue is that symbolic layers aren't original layers. They are computed internally. In order to store such shapes you'll need to create new layers in the layout and use these for output.

    Like (not tested):

    layer_ids = {}
    gds_layer = 100
    ...
    
    tracer.each_element do |e| 
        if e.layer not in symbolic_layers:
            symbolic_layers[e.layer] = layout.insert_layer(start_layer, 0)
            gds_layer += 1
        trace_result_cell.shapes(layer_ids[e.layer]).insert(e.shape, e.trans)
    

    Matthias

Sign In or Register to comment.