layer map and gds file writing

edited April 2016 in Ruby Scripting
Hi Matthias,

I have a problem that I cannot find the answer.

I have a ruby script that is run through klayout [version 0.24.2 at the moment].

The script generates an RBA::LayerMap for an RBA::Layout. Then it reads in a file with data that corresponds to the layer map. When I write the information out, it appears that the layers are changing in the written file.

Example of the data:

The layerMap after initializing the layout and before any read operations have been performed:
10/0-63 : x
11/0-63 : y
12/0-63 : z
1/0-63 : a
2/0-63 : b
3/0-29,31-63 : c1
3/30 : c2
4/0-63 : d
5/0-63 : e
6/0-63 : f


The layout data after a RBA::Layout.read in (as output by the following code):
# get list of all layer indices of a layout
layer_indicies = @layout.layer_indices
layer_indicies.sort{|a,b| a <=>b }.each{|indx|
# get layer info for given index
layer_info = @layout.get_info(indx)
STDERR << "Layer::#{layer_info.to_s};#{layer_info.layer}\n"
# get shapes on layer index
layer_cell.each_shape(indx) {|shape|
STDERR << "Shape::#{shape};Index::#{indx}\n"
}
}

Layer::x;10
Layer::y;11
Layer::z;12
Layer::a;1
Shape::box (0,1500;1500,3000);Index::3
Shape::box (0,0;1500,1500);Index::3
Layer::b;2
Layer::c1;3
Layer::c2;3
Layer::d;4
Layer::e;5
Layer::f;6
Layer::136/0;136
Shape::box (1500,0;3000,1500);Index::10
Layer::136/63;136
Shape::box (1500,1500;3000,3000);Index::11


Then, after a write, I read the streamfile into a layout, and the layout has changed. Using the same output method as above:

Layer::x (10/0)
Layer::y (11/0)
Layer::z (12/0)
Layer::a (1/0)
Layer::b (2/0)
Layer::c1 (3/0)
Layer::c2 (3/30)
Layer::d (4/0)
Layer::e (5/0)
Layer::f (6/0)
Layer::136/0
Shape::box (1500,0;3000,1500);Index::10
Layer::136/63
Shape::box (1500,1500;3000,3000);Index::11
Layer::140/0
Shape::box (0,1500;1500,3000);Index::12
Shape::box (0,0;1500,1500);Index::12

The data in the newly written streamfile: layer a (layer 1, datatypes 0 and 63) data was written to layer 140 on the write. Any ideas on what might cause this?

Comments

  • edited November -1

    Hi,

    Lacking a real testcase and the actual code I can only guess.

    But I think what happens is that the mapping cannot produce a valid GDS layer since you map multiple datatypes to one layer. The effect is probably that the datatype number is undefined. If you print #{layer_info.layer} too you may see the datatype number is -1. Such layers cannot be written to GDS and a new number will be assigned.

    To solve this problem you can try to map to a fully qualified GDS layer:

    10/0-63 : x (10/0)
    11/0-63 : y (11/0)
    12/0-63 : z (12/0)
    1/0-63 : a (1/0)
    2/0-63 : b (2/0)
    3/0-29,31-63 : c1 (3/0)
    3/30 : c2 (3/30)
    4/0-63 : d (4/0)
    5/0-63 : e (5/0)
    6/0-63 : f (6/0)
    

    However, this will merge the datatype intervals into single datatypes.

    Matthias

  • edited November -1
    Ahh, after changing my layermap to map to datatype 0, it no longer produces the data on new layers and it correctly puts the data on the correct gds layer. I will attempt to solve our datatype issue, but I may have additional questions.

    Thanks!
Sign In or Register to comment.