Convert lef-def layout to gds using klayout

57 views Asked by At

I need to convert lef-def based layout to gds format using klayout using ruby script. Not well acquainted with ruby so I have compiled a code from various sources.
The def file is saved in "input" variable; lefs as an array in "lefs" and layer map file in "map*".
The top design name has also been saved in "design_*name"
I am running the following ruby script:

opt = RBA::LoadLayoutOptions::new
opt.lefdef_config.map_file = $map
opt.lefdef_config.read_lef_with_def = false
opt.lefdef_config.lef_files = lefs
opt.lefdef_config.macro_resolution_mode = $lef_macros ? 0 : 2
opt.lefdef_config.dbu = 0.000001

# read and install the substitution layouts
macro_layouts = []
if $macros
  macro_layouts = $macros.split(",").collect do |m|
    lm = RBA::Layout::new
    lm.read(File.absolute_path(m, File.dirname($input)))
    lm
  end
end
opt.lefdef_config.macro_layouts = macro_layouts

# actually read the DEF file
mw = RBA::Application::instance
mw.main_window.load_layout(input, opt, design_name ,2)

wr = RBA::SaveLayoutOptions::new
#wr.format="GDS2"
#wr.gds2_libname = design_name
#wr.dbu = 0.000001
#wr.keep_instances= true
#cur_inst = RBA::Cell::instance

#wr.add_cell(cur_inst.cell_)
#mw.methods
output = "#{design_name}.gds"
layout = RBA::Layout.new

layout.write(output,wr)

I'm not getting anything in the output gds. I'm expecting it to write out all cells by default that are visible in layout into a gds2 file. I have tried many options, some of which are commented out here.

0

There are 0 answers