Cadence techfile import script

edited June 2011 in KLayout Support

Hi all,

triggered by several recent requests I have started to implement a Cadence techfile import script.

The script can be found here. It can be saved as import_tf.rbm into KLayout's installation folder (on Unix don't forget to set $KLAYOUTPATH to that folder).

It will install a new menu item in the "File" menu (above "Load Layer Properties"): "Import Cadence Techfile". When run, this function will first ask for the file name of the Cadence ASCII techfile and then try to locate a *.drf file there. If that fails, it will ask for the path to the *.drf file.

The script clears the layer list and creates a new one from the tech file settings. Only layers with a stream layer and datatype mapping are produced currently.

The script is just a first try. Please give feedback (preferably by mail) if you have problems reading your techfiles.

Best regards,

Matthias

Comments

  • edited November -1
    Hi Matthias,

    Thanks for your effort on developing the Cadence techfile import script, I tried to save this script to a directory and load it when klayout startup, it responsed a Ruby error message "no such file to load -- stringio", the detail command messages are as follow:

    > klayout test.gds
    *** ERROR: /usr/local/klayout/rb/import_tf.rbm:2: Ruby error: 'no such file to load -- stringio' (LoadError)

    The system is RHEL4.

    Best Regards,
    --
    chhung
  • edited July 2011
    Hi Matthias,

    Finally we found that problem was caused by the different dist, the binary was made on Mandrake, and we tried to run it on RHEL4.

    We dirty solved it via "ln -s /usr/lib64/ruby/1.8/x86_64-linux-gnu /usr/lib/ruby/1.8/x86_64-linux" and can't make sure if it would cause other problems, at least it works fine now.

    Best Regards,
    --
    chhung
  • edited November -1

    Hi chhung,

    I had one installation of ruby 1.8 where there was no 64bit version of stringio.so and I had a similar issue myself. Because I did not find a 64bit version, I was solving that problem by switching to ruby 1.9 but your solution is probably a valid one as well.

    Thank you for that hint and best regards,

    Matthias

  • edited November -1
    Hi Matthias,

    Thanks for the code, in my case there is a crash
    (eval):7380: syntax error
    "techId", =, [ "techGetTechFile", "tcCellView", ],
    ^
    (eval):7380: syntax error
    "techId", =, [ "techGetTechFile", "tcCellView", ],
    ^' (SyntaxError)

    Not sure if this is something easy to solve, or if I am doing things not the proper way.

    Nick
  • edited July 2011

    Hi Nick,

    I guess your tech file contains some code like this one:

    techId = techGetTechFile( tcCellView )
    

    Unfortunately the import script does not understand Skill code, neither can it execute these functions. It expects are pure list and converts it into a Ruby expression. That's the reason for the strange error message. It's probably possible to adjust the script so it reads over that piece of code but I doubt the results make much sense then.

    One possible solution may be to export an ASCII techfile. That one should not contain Skill code then.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias,

    Thanks for your reply. Indeed it contains skill code. At least its now clear to me that skill isn't supported with your function. I will try to see if any pure ascii version is available or if I can create that.

    Regards

    Nick
  • edited November -1

    Hi Nick,

    I have uploaded a new version of the script in which I have tried to make the parsing somewhat more robust against Skill expressions.

    In any case, these expressions are still not evaluated. If they appear in sections which are ignored this may be acceptable however.

    Best regards,

    Matthias

  • edited August 2011
    Hi Matthias,

    I am new user of Klayout, and i try to use your script for importing cadence tech file.
    Here is the flow I followed.
    Run Klayout on window (64 bit), open a gds file, copy paste your ruby script on console.
    So now I have acces to import cadence file menu, select this menu and put the path to my tech file.

    After that, Klayout crashes with this message:
    "klayout a cesse de fonctionner" -> klayout stopped abnormally.

    So I would to know what information are necessary on tech file because i would like to try to create a simple tech file to import it correctly
  • edited November -1

    Hi Nicolas,

    it's somewhat hard to tell - I noticed that on Windows, KLayout quits on Ruby errors in some cases. Bascially, the message means that some Ruby runtime error occured. I admit that is not quite helpful.

    I have just downloaded a new version of the script (using the same location), which is somewhat more robust against certain Skill syntax features. If that fails, maybe it's possible to reduce the techfile and thus localize the problem. If it is possible, you can also send to techfile including the .drf file to the contact mail address and I will have a look at it.

    The basic problem is that technically the Techfile is not a simple file but Skill code. That is hard to read without a Skill interpreter. The script tries to convert the Skill list including all the expressions and pick out the interesting parts. That fails if the techfile makes use Skill, for example to dynamically fill the interesting lists. Also, some techfiles come without stream layers (that is part of the PIPO setup) in which case there is no way to correlate the techfile entries with GDS layers.

    Best regards,

    Matthias

  • CMCM
    edited October 2011

    Hi Matthias,

    I wanted to report this following error when reading in a techfile.

    -------------------------------------BEGIN-------------------------------------

    Ruby module loaded '/cad/software/klayout/0.21.13/userware/import_tf.rbm'

    Loading file: 2.2.gds
    Loading file: 2.4.gds

    /cad/software/klayout/0.21.13/userware/import_tf.rbm:227: Ruby error: '(eval):1183compile error
    ( eval ):1183: syntax error
    [ "gate_core1", 10012, [ "gate", 'not", "OD2", ], ],
    ^
    ( eval ):1183: syntax error
    [ "gate_core1", 10012, [ "gate", 'not", "OD2", ], ],
    ^' (SyntaxError)
    /cad/software/klayout/0.21.13/userware/import_tf.rbm:227
    /cad/software/klayout/0.21.13/userware/import_tf.rbm:195:in 'eval'
    /cad/software/klayout/0.21.13/userware/import_tf.rbm:227
    /cad/software/klayout/0.21.13/userware/import_tf.rbm:195:in 'call'´
    /cad/software/klayout/0.21.13/userware/import_tf.rbm:36:in `triggered' (class SyntaxError)

    -------------------------------------END-------------------------------------

    Additional info:

    • CDS version IC6.1.3.500.8
    • Section of techfile where problem occurs: techDerivedLayers

    Please let me know if you need further information.

  • edited November -1

    Hi CM,

    I think the problem is the layer expression for gate_core1. It is not parsed correctly. Maybe you can give the original line from the techfile, so I can have a look at it.

    It may help to export the techfile to an ASCII techfile in CDS. It may be a different format which can be parsed by the script.

    Best regards,

    Matthias

  • CMCM
    edited November -1

    Hi Mathias

    This is the line which is reporting the problem:

    techDerivedLayers(
    ....
    ....
    ( gate_core1 10012 ( gate 'not OD2 ))
    ....
    ....

    )

    Best regards
    CM

  • edited November -1
    Hi Matthias,
    I'm very new to Klayout, so please exuse my (maybe) stupid questions.
    I'm trying to create a (preferably) batch procedure that will import a cadence tech file/display.drf and create .lyp file. I want this procedure to be ran each time we update our Cadence tech file (adding new layers) so that .lyp file will always correspond the cadence's one.
    Is there a easy way to create such a script?
    Thanks,
    Yulia
  • edited April 2014

    Hi Yulia,

    I have provided another version of the import script at http://178.77.72.242/svn-public/klayout-resources/trunk/scripts/import_tf_standalone.rb which can be used in batch mode.

    Instructions how to use the script together with KLayout can be found in the header. Basically, you call KLayout in batch mode (non-GUI, option -z) and pass the script with the -r option. It requires two variables which tell the script where to find the techfile and where to write the output. Both variables are defined with KLayout's -rd option.

    Please note that if there are multiple .drf files, the script will prompt to select one of them. Hence it's not really "batch" mode.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias,
    Thank you very much, this was very helpful. I just changed the script so that is receives display.drf name as external params ( pretty easy) and it fetched perfectly into our flow

    Regards,
    Yulia
  • edited November -1
    Hi,
    Was giving the convert script a try.

    Tried -->
    klayout-r802/bin.linux-64-gcc-release/klayout -z -rd tf_file=in_tf_ascii -rd lyp_file=out_lyp -r import_tf_standalone.rb

    I get the following error-->
    *** ERROR: Unknown option: -rd

    Any feedback on what could be the reason for this>
    Thanks for your help
  • edited November -1

    Hi new2klayout,

    did you compile KLayout with Ruby support?

    Matthias

  • edited November -1
    Hello,

    Thanks very much for your excellent program. I was able to install the program on a Windows 7 machine and view a few gds files. I am now particularly interested in using the script to convert a Cadence techfile to a layer property file (lyp). Following the instructions (at the head of import_tf_standalone.rb ), I inserted the command

    klayout.exe -z -rd tf_file=display2.drf -rd lyp_file=display.lyp -r import_tf_standalone.rb

    in a simple .bat file. The batch file is executed in a command window of the directory that hosts klayout. Into that directory I placed the cadence files display2.drf and the layermap file soi12s0.layermap. The script produces the file display.lyp, but the contents are of the type
    ``<line>....*.....*....*....*.....*....*</line>
    </pattern>
    <order>11</order>
    <name>vZigZag</name>
    </custom-dither-pattern>
    <custom-dither-pattern>
    <pattern> `` . That is, the script does not produce a working lyp file. Is there something that I am missing? The required file 'stringio' is in a sub directory.
  • edited April 2014

    Hello,

    I guess you are missing the actual tech file.

    Basically you need three files: the cadence tech file (preferably exported text), the drf file (can be called anyname.drf, but there has to be one *.drf file) and a layers file. The layers file is optional if you have included the correct stream layers in your tech file.

    To the "tf_file" variable you have to pass the name of the tech text file, not the drf file. The script will then try to locate a *.drf file and a *.layers file at the place where the tech file is stored.

    Matthias

  • edited November -1
    Hi Matthias ,

    The revised script works! And as expected, loading the Layer Properties makes a significant difference in the image of the gds file. Thanks! Like others, I will continue to praise your program.
  • edited November -1
    Hello,

    I recently tried to use this script, but got results like SteveG, except I am passing it the techfile, not the display.drf. I've looked at my Cadence tech.db, and it's binary. I found something in Cadence to dump the file, and have done so. However, whether I pass import_tf_standalone.rb binary or text form of the tech.db, I basically get only dither definitions. Looking at my text-format techfile, it's pretty much a hunk of skill code, so doesn't appear to be the ASCII techfile called for earlier.

    I'm running Virtuoso 12.1, and I'm not that well-versed in Cadence, having mostly used a different toolset. Can someone tell me how to get an ASCII techfile exported? I know we use "compiled context files", so I suspect it can't all come out in cleartext, but I would hope that at least some can.

    Dale
  • edited November -1

    Hi Dale,

    The last time I was using Cadence Design Framework we had version 5 - I don't recall the Virtuoso version employed within that version. There was still a function called "ASCII tech file export", but maybe Cadence changed that part substantially.

    Matthias

  • Update: the techfile script now is a KLayout Package: the name is "tf_import".

  • Hi,
    I added the KLayout Package called tf_import and then tried the Import Cadence Tech File option and it failed with this error.

    uninitialized constant TechfileToKLayout::StringIO
    C:/Users/illam/KLayout/salt/tf_import/ruby/import_tf.rb:70:in read_skill_file_as_ruby_expr' C:/Users/illam/KLayout/salt/tf_import/ruby/import_tf.rb:195:inimport_techfile'
    C:/Users/illam/KLayout/salt/tf_import/macros/import_tf.lym:32:in <module:TechfileToKLayout>' C:/Users/illam/KLayout/salt/tf_import/macros/import_tf.lym:17:in

    '

    Appreciate your help.

    Thanks.
    Illam

  • Looks like more recent Ruby versions need "stringio" explicitly.

    I have updated the package. Please try again.

    Matthias

  • Thank you Matthias. I updated the version and tried and it seems to pass that stage. After reading in the tech.tf file, it prompted for layer map file and I entered that as well, but after that I don't see any layers in the layer palatte. I think I'm doing something wrong. I have KLayout setup with a different technology and want to create a new technology as we are moving to a new technology where only Cadence is supported. So here are the steps I'm doing, correct me if I'm doing something wrong.
    1. Open the KLayout Editor
    2. Read in the gds file corresponding to the new technology. (On completion of this step, I see the layers from the older technology displayed in the layer palatte).
    3. I invoke the translator which prompted for the cadence tech file and the layer map file, and once I ran this step, all the layers in the layer palatte disappeared and no geometries displayed in the layout view window.

    Appreciate your help.
    Thanks.
    Illam

  • Hi Matthias,
    Not sure you had a chance to look into this. I have been trying out alternate ways based on documentations available and also by trial and error but in vain. I'm kind of stuck at this point. Any help will be appreciated.
    Thanks.
    Illam

  • There's a couple of things I think you will need to do.

    One, File>Load Layers selecting the .lyp file may be
    needed to "bring the new layers front and center". Have
    you gotten a clean-loading (if not necessarily as pretty
    as you'd like) .lyp from the technology import, thus far?

    Two, in Tools>Manage_Technologies you will want to
    make a start at a full technology definition, starting
    with hooking up the .lyp file to the technology definition.
    Then you'll bind that technology to the layout and
    should get them to present you proper layers for the
    layout. But when I bounce between technologies I find
    I need to remind klayout of the technology and maybe
    reload .lyp as well (whether this is inherent, or poor
    practice, I dunno).

  • I don't see any .lyp file generated. After the technology import, I don't see any file getting generated. The technology import only prompted for the tf file and then layer map file. No error messages came up and no file were generated.

  • Hi @illamp

    It's kind of difficult to debug without the files, but I may be able to give some hints.

    First you can try the script with the test data here: https://github.com/klayoutmatthias/tf_import/tree/master/ruby/testdata_1 or https://github.com/klayoutmatthias/tf_import/tree/master/ruby/testdata_2. It should work with the files from there.

    The tf_import script does not readily create a .lyp file. The way you use it is to load any layout (any layout will do, can even be an empty one), run the script to import the techfile and then save the layer properties to a .lyp file.

    Basically, the techfile parser is extremely simplistic. It should work on exported techfiles, but does not understand more than basic Skill features. You will also need a .drf file (display resource file) for the stipple pattern. The layer mapping file is optional if your techfile specifies a streamLayers section.

    You can try taking a look at the testdata from the links above and check if your files look similar to those - specifically your files use the same techfile sections and no (active) Skill code.

    If this does not get you further, I'm afraid I can only only help if you can provide access to your files - a stripped-down version will also do if it allows reproducing the problem.

    Matthias

Sign In or Register to comment.