DRC - Testing for existance of a cell in a layout

Hey everyboday,

I am currently working on a Klayout DRC script and I want to test for the existance/presence of a specific cell in a given layout (gds file).
Is there a specific function for that? and/or is there a way to use a conditional operator, for example if/else?

What I tried to do was selecting the targeted cell and layer using the cell("name") and layer functions. This worked, when the cell was present; DRC reported it in the Macro Database Browser. But what I am obiously trying to achieve is, to have the DRC notify me in the case wheret the specified cell is not present in the layout at hand.

Regards

Comments

  • Hi,

    You can use if/else in the DRC script. It's a Ruby script.

    You can ask whether a cell exists this way:

    if source.layout.has_cell?("THE_CELL_NAME")
      ... executed if a cell called "THE_CELL_NAME" exists ...
    else
      ... otherwise
    end
    

    Matthias

  • Hi Matthias,

    thank you for your response.

    I implemented this into my script as follows:
    _if source.input(#,#).has_cell?("The_cell_name")

    else
    puts "The_cell_name is missing"
    end_

    but I am getting an error when running the DRC:
    undefined method 'has_cell?' for #<DRC::DRCLayer:0x00000116e62f0

    was my implementation faulty? or did I misunderstand what you wrote above?

    Thank you again.
    Regards,

  • It says "source.layout", not "source.input(...)" :-)

    Matthias

  • Thank you very much! It seems to work.
    But unfortunately I'm facing another problem. I cannot print out a message onto the marker browser. When using the variable.output("message") function I am getting the error (output is not defined) and I cannot find any other method to print out messages in the klayout documentation or in the forum. I also tried: puts "message" and no luck.
    Could you help me out with this one?

    Regards

  • You can't print into the marker browser, but you can print to the log window (File/Log Viewer) using log("your message")

    Matthias

  • Thank you!

    Best regards

Sign In or Register to comment.