It looks like you're new here. If you want to get involved, click one of these buttons!
Hi all,
I want to combine several cif files in one layout without merging the layers together, even if the layer names are the same.
For this, layermapping with offsets exists and worked fine if I set cif_keep_layer_names=false.
However, the original layer names are then lost. (And I haven't found a way to get the names from anywhere).
If I keep cif_keep_layer_names=true the layermapping with offsets does not work anymore (or I use the wrong syntax).
Is there any workaround?
Best regards
Frank
Comments
Hi Frank,
Can you give an example for the layer mapping you use?
Matthias
Hi Matthias,
First of all, a big thank you for the great support you give here on the forum and the fantastic Klayout program.
I've simplified my problem (I used the same file twice for import; in reality these are different files and I have a loop for the files):
with test1.cif:
If I change the Layernames in the cif File to something else (e.g. L0 -> Layername0), they are always imported using the name.
In order to work with every file, I should always import the layers with cif_keep_layer_names=true.
However, I haven't found any working syntax for the map string that works with names and wildcards.
So if I don't want to mix the layers of different files while reading,
maybe the best way is to create new (layout)layers for all layers after importing with a unique name or number and move the content there and the delete old one?
(I didn't find a command to rename the (layout.)layers after they were created. Is this correct?)
Best regards
Frank
Hi Frank,
a general comment first: names and layer/datatype numbers are contrary definitions. A layer inside the database is either numbered or named or both. In any case, a layer is primarily identified by layer/datatype number and if there is none, by name.
Layer mapping works by providing a match and target expression. A match expression can be a number + number/number pair or a layer name or both. numbers will match to input layer numbers, names to input layer names. Only for numbers, wildcards and ranges are allowed.
As CIF has names only, the usual use case for layer mapping is to supply name-to-number translation for saving to GDS. So a typical CIF (or DXF, LEF/DEF ...) mapping will look like:
Which assigns layer 17, datatype 0 to a CIF layer called "metal1". No wildcards possible in the layer names.
If however, your CIF file uses "pseudo-numeric" layer names such as "17", these "names" will be converted into layer/datatype numbers. "17" is converted to 17/0, "L17D3" to 17/3. The "cif_keep_layer_names" option controls whether this happens (false) or the names stay names even if they are numeric (true).
So if you use "cif_keep_layer_names = false", then the CIF reader may convert names to numbers. In this case, a mapping like
*/* : *+200/*
may have the desired effect, but the layer name is lost. Except for layers which have a non-numeric text like "metal1". I'd use this option only if your CIF file is guaranteed to have only numerical layer names. In that case, it's not a loss if the layer names are gone.Otherwise, I'd try to work with a expanded layer map such as the one above. Such a layer map is quite common in PDKs to map between name-only and number-only formats. You can basically generate such a table inside your script and use different numbers for each pass.
One comment about reading multiple layout files into the same layout: while this is very simple, it's also highly dangerous: if you use the same cell name in both files, the content of these cells will be mixed. This may have extreme consequences such as hierarchy complexity explosion and loss of layout features. For this reason, the next major release will have an option to mitigate the risk of this case by creating cell variants.
Regards,
Matthias