Add a layer parameter

edited July 1 in Verification

In a DRC-LVS file, I need to define the height/bottom/top for several layers, I tried to define those parameters for each layers with a default of 1.um, but I probably missed a simple definition :

POLY  = polygons(66, 20)

# Define a new custom function that defines the height Z of the layer
class DRC::DRCLayer
  def z_height()
    z_height = 1.um
  end
end 
# Define a new custom function that defines the bottom Z of the layer
class DRC::DRCLayer
  def z_bot()
    z_bot = 1.um
  end
end 
# Define a new custom function that defines the top Z of the layer
class DRC::DRCLayer
  def z_top()
    z_top = 1.um
  end
end 

POLY.z_height = 250.nm
POLY.z_bot = 5.nm
POLY.z_top = POLY.z_bot + POLY.z_height

Can you help me to define those 3 layer parameters ?

Thanks, Regards,

Laurent

Comments

  • I've not fully digested what you want to do.
    However, I hope the sample below is close to it.

    Code

    #----------------------------------------------------------------
    # Ref: https://www.klayout.de/forum/discussion/2539/
    # Sub: Add a layer parameter
    # Posted by: laurent_c
    #
    # File: F2539.drc
    # Author: Kazzz-S
    # Last modified: 2024-07-02
    #----------------------------------------------------------------
    
    ##
    ## @brief   This class defines the Z dimensions of a set of layers.
    ##
    class LayerZDic
      attr_reader :fabProcess, :mapLD, :dicZ
    
      def initialize(pname)
        # set the fab process name
        @fabProcess = pname
    
        # key="layer name"; val = [layer, data_type]
        @mapLD = {
          "layer1" => [1, 0],
          "layer2" => [2, 0],
          "layer3" => [3, 0]
        }
    
        # key="layer name"; val = [bot, height, top] values in [um]
      @dicZ = {
          "layer1" => [0.1, 0.1, 0.2],
          "layer2" => [0.2, 0.1, 0.3],
          "layer3" => [0.3, 0.1, 0.4]
      }
      end
    
      def AddData(layername, l, d, bot, height)
        @mapLD[layername] = [l, d]
        @dicZ[layername]  = [bot, height, bot+height]
      end
    
      def GetLD(layername)
        return @mapLD[layername]
      end
    
      def GetBot(layername)
        return @dicZ[layername][0]
      end
    
      def GetHeight(layername)
        return @dicZ[layername][1]
      end
    
      def GetTop(layername)
        return @dicZ[layername][2]
      end
    end
    
    # [1] Construct and populate an instance of class LayerZDic
    myZdic = LayerZDic::new("laurent_c")
    myZdic.AddData( "layer4", 4, 0, 0.4, 0.1 )
    myZdic.AddData( "POLY", 66, 20, 0.005, 0.25 )
    
    # [2] Retrieve the dictionary (hash)
    puts "A1)    L/D of \"layer1\" = #{myZdic.GetLD("layer1")}"
    puts "A2)    Bot of \"layer2\" = #{myZdic.GetBot("layer2")}"
    puts "A3) Height of \"layer3\" = #{myZdic.GetHeight("layer3")}"
    puts "A4)    Top of \"layer4\" = #{myZdic.GetTop("layer4")}"
    puts ""
    puts "B1)    L/D of \"POLY\" = #{myZdic.GetLD("POLY")}"
    puts "B2)    Bot of \"POLY\" = #{myZdic.GetBot("POLY")}"
    puts "B3) Height of \"POLY\" = #{myZdic.GetHeight("POLY")}"
    puts "B4)    Top of \"POLY\" = #{myZdic.GetTop("POLY")}"
    puts ""
    puts "C1)    Fab. = #{myZdic.fabProcess}"
    puts "C2)   LDMap = #{myZdic.mapLD}"
    puts "C3) ZDimDic = #{myZdic.dicZ}"
    

    Output

    A1)    L/D of "layer1" = [1, 0]
    A2)    Bot of "layer2" = 0.2
    A3) Height of "layer3" = 0.1
    A4)    Top of "layer4" = 0.5
    
    B1)    L/D of "POLY" = [66, 20]
    B2)    Bot of "POLY" = 0.005
    B3) Height of "POLY" = 0.25
    B4)    Top of "POLY" = 0.255
    
    C1)    Fab. = laurent_c
    C2)   LDMap = {"layer1"=>[1, 0], "layer2"=>[2, 0], "layer3"=>[3, 0], "layer4"=>[4, 0], "POLY"=>[66, 20]}
    C3) ZDimDic = {"layer1"=>[0.1, 0.1, 0.2], "layer2"=>[0.2, 0.1, 0.3], "layer3"=>[0.3, 0.1, 0.4], "layer4"=>[0.4, 0.1, 0.5], "POLY"=>[0.005, 0.25, 0.255]}
    
  • edited July 2

    Thank you Sekigawa for your very complete and very instructive method.
    However, my goal is to extend the KLAYOUT DRC::DRCLayer class with 3 parameters, because I already used that class for other purpose.
    Best regards,
    Laurent

  • OK, then, how about this?

    Code

    #----------------------------------------------------------------
    # Ref: https://www.klayout.de/forum/discussion/2539/
    # Sub: Add a layer parameter
    # Posted by: laurent_c
    #
    # File: F2539A.drc
    # Author: Kazzz-S
    # Last modified: 2024-07-03
    #----------------------------------------------------------------
    
    ##
    ## @brief   To extend the DRC::DRCLayer class
    ##
    class DRC::DRCLayer
      attr_accessor :z_bot, :z_height, :z_top
    
      def myInit()
        @z_bot = 1.um
        @z_height = 1.um
        @z_top = 1.um
      end
    end
    
    # [1] Get the polygons, then call myInit() against POLY
    #       design data: klayout/testdata/lvs/ringo.gds (copying L/D=5/0 to 66/20) ===> ringo.oas
    POLY = polygons(66, 20)
    POLY.myInit()
    
    # [2] Access the instance
    puts "A1) Current Design Data File  = #{RBA::CellView::active.filename}"
    puts "A2) Initial values:"
    puts "      z_bot    = #{POLY.z_bot}"
    puts "      z_height = #{POLY.z_height}"
    puts "      z_top    = #{POLY.z_top}"
    puts ""
    POLY.z_height = 250.nm
    POLY.z_bot = 5.nm
    POLY.z_top = POLY.z_bot + POLY.z_height
    puts "B1) Modified values:"
    puts "      z_bot    = #{POLY.z_bot}"
    puts "      z_height = #{POLY.z_height}"
    puts "      z_top    = #{POLY.z_top}"
    puts "B2) POLY contains #{POLY.count} polygons"
    puts ""
    

    Output

    A1) Current Design Data File  = /home/sekigawa/GitWork/ForumKLayout/Forum/Forum2539/ringo.oas
    A2) Initial values:
          z_bot    = 1.0
          z_height = 1.0
          z_top    = 1.0
    
    B1) Modified values:
          z_bot    = 0.005
          z_height = 0.25
          z_top    = 0.255
    B2) POLY contains 52 polygons
    

  • Thank you very much Sekigawa, it is exactly what I was looking for :)
    I would have never found by myself the syntax of this macro : thank you for your help !
    Regards,
    Laurent

Sign In or Register to comment.