Skip to content

Commit

Permalink
Merge pull request #169 from mabrains/updating_klayout_menues
Browse files Browse the repository at this point in the history
modifying menues
  • Loading branch information
FaragElsayed2 authored Aug 8, 2023
2 parents 654fb8c + 240efce commit 7bd2d87
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 190 deletions.
16 changes: 7 additions & 9 deletions rules/klayout/macros/drc_options.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
drc_mode: ''
run_mode: "--run_mode=flat"
variant: "--variant=C"
run_mode: flat
variant: C
top_cell_name: ''
run_dir: ''
verbose: ''
feol: ''
beol: ''
offgrid: ''
connectivity: ''
verbose: 'false'
feol: true
beol: true
offgrid: 'true'
connectivity: 'false'
81 changes: 45 additions & 36 deletions rules/klayout/macros/gf180mcu_drc.lydrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,56 +30,65 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'yaml'


## reading the parent directory of the current file
run_dir = File.expand_path("..", __dir__)
require "yaml"

## reading the loaded gds file path
layout_path = Pathname.new(RBA::CellView.active.filename)
layout_dir = layout_path.split()[0]

## read saved options from yaml file
options = YAML.load(File.read(__dir__ + "/drc_options.yml"))

## create options passed to run_drc.py
options_str = "#{options["drc_mode"]} #{options["run_mode"]} #{options["variant"]} #{options["top_cell_name"]} #{options["verbose"]} #{options["feol"]} #{options["beol"]} #{options["offgrid"]} #{options["connectivity"]} #{options["run_dir"]}"
dir_path = File.dirname(File.expand_path(__FILE__))
options = YAML.load(File.read(dir_path + "/drc_options.yml"))

## run_drc command line
cmd = "python3 #{run_dir}/drc/run_drc.py --path=#{layout_path} #{options_str}"

## start running drc
puts "######### running #{cmd}"
drc_res = `#{cmd}`
## reading the parent directory of the current file
run_dir = File.expand_path("..", dir_path)

## read the log of drc run to get output lydb file paths if run_dir option is disables
gds_name = layout_path.split()[1].to_s.split(".")[0]

if options["run_dir"] == ""
File.open(__dir__ + "/drc_res.txt", "w") { |file| file.write(drc_res) }
lydb_path = File.readlines(__dir__ + "/drc_res.txt")[3].split(/ /)[-1]
File.delete(__dir__ + "/drc_res.txt")
lydb_dir = lydb_path.to_s().split("/#{gds_name}")[0]
else
lydb_dir = options["run_dir"].split("=")[1]

## pass options to main.drc
$run_mode = options["run_mode"]

if options["variant"] == "A"
$metal_top = "30K"
$metal_level = "3LM"
$mim_option = "A"
elsif options["variant"] == "B"
$metal_top = "11K"
$metal_level = "4LM"
$mim_option = "B"
elsif options["variant"] == "C"
$metal_top = "9K"
$metal_level = "5LM"
$mim_option = "B"
elsif options["variant"] == "D"
$metal_top = "9K"
$metal_level = "6LM"
$mim_option = "B"
elsif options["variant"] == "E"
$metal_top = "9K"
$metal_level = "6LM"
$mim_option = "A"
end

$topcell = options["top_cell_name"]

$verbose = options["verbose"]

$feol = options["feol"]

$beol = options["beol"]

$offgrid = options["offgrid"]

$conn_drc = options["connectivity"]

## include run files

## choose the displayed database file
if options["drc_mode"] == "--antenna_only"
lydb_file = "#{gds_name}_antenna.lyrdb"

elsif options["drc_mode"] == "--density_only"
lydb_file = "#{gds_name}_density.lyrdb"

else
lydb_file = "#{gds_name}_main.lyrdb"

end
#%include ../drc/rule_decks/antenna.drc
#%include ../drc/rule_decks/density.drc
#%include ../drc/main.drc

## open a klayout window with database loaded
`klayout #{layout_path} -m #{lydb_dir}/#{lydb_file}`

</text>
</klayout-macro>
73 changes: 51 additions & 22 deletions rules/klayout/macros/gf180mcu_lvs.lylvs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
require 'yaml'

## reading the parent directory of the current file
run_dir = File.expand_path("..", __dir__)
dir_path = File.dirname(File.expand_path(__FILE__))
run_dir = File.expand_path("..", dir_path)

## reading the loaded gds file path
layout_path = Pathname.new(RBA::CellView.active.filename)

## read saved options from yaml file
options = YAML.load(File.read(__dir__ + "/lvs_options.yml"))
options = YAML.load(File.read(dir_path + "/lvs_options.yml"))

## reading netlist option to get netlist_path
if options["netlist"] == ""
Expand All @@ -53,33 +54,61 @@ else

end

## create options passed to run_drc.py
options_str = "--lvs_sub=#{options["sub_name"]} #{options["run_mode"]} #{options["variant"]} #{options["top_cell_name"]} #{options["spice_net"]} #{options["spice_comment"]} #{options["verbose"]} #{options["schematic_simple"]} #{options["net_only"]} #{options["top_lvl_pins"]} #{options["combine"]} #{options["purge"]} #{options["purge_nets"]} #{options["run_dir"]}"

## run_drc command line
cmd = "python3 #{run_dir}/lvs/run_lvs.py --layout=#{layout_path} --netlist=#{net_dir} #{options_str}"

## start running drc
puts "######### running #{cmd}"
lvs_res = `#{cmd}`

## read the log of lvs run to get output lydb file paths if run_dir option is disables
gds_name = layout_path.split()[1].to_s.split(".")[0]

if options["run_dir"] == ""
File.open(__dir__ + "/lvs_res.txt", "w") { |file| file.write(lvs_res) }
lydb_path = File.readlines(__dir__ + "/lvs_res.txt")[3].split(/ /)[-1]
File.delete(__dir__ + "/lvs_res.txt")
lydb_dir = lydb_path.to_s().split("/#{gds_name}")[0]
else
lydb_dir = options["run_dir"].split("=")[1]

## passing options to lvs run file
$schematic = net_dir

$lvs_sub = options["sub_name"]

$run_mode = options["run_mode"]

if options["variant"] == "A"
$metal_top = "30K"
$metal_level = "3LM"
$mim_option = "A"
elsif options["variant"] == "B"
$metal_top = "11K"
$metal_level = "4LM"
$mim_option = "B"
elsif options["variant"] == "C"
$metal_top = "9K"
$metal_level = "5LM"
$mim_option = "B"
elsif options["variant"] == "D"
$metal_top = "9K"
$metal_level = "6LM"
$mim_option = "B"
end

lydb_file = "#{gds_name}.lvsdb"
unless options["top_cell_name"] == ""
$topcell = options["top_cell_name"]
end

$spice_net_names = options["spice_net"]

$spice_comments = options["spice_comment"]

$scale = options["scale"]

$verbose = options["verbose"]

$schematic_simplify = options["schematic_simple"]

$net_only = options["net_only"]

$top_lvl_pins = options["top_lvl_pins"]

$combine = options["combine"]

$purge = options["purge"]

$purge_nets = options["purge_nets"]

## open a klayout window with database loaded
`klayout #{layout_path} -mn #{lydb_dir}/#{lydb_file}`
## include lvs run file
#%include ../lvs/gf180mcu.lvs

</text>
</klayout-macro>
Loading

0 comments on commit 7bd2d87

Please sign in to comment.