diff --git a/src/drc/drc/built-in-macros/drc_install.lym b/src/drc/drc/built-in-macros/drc_install.lym index d31b12087..78d1ef3b0 100644 --- a/src/drc/drc/built-in-macros/drc_install.lym +++ b/src/drc/drc/built-in-macros/drc_install.lym @@ -15,33 +15,37 @@ ruby -# Installs the home menu entries (needs to be done on autorun, not autorun-early) +module DRC -if RBA::Application::instance && RBA::Application::instance.main_window + # Installs the home menu entries (needs to be done on autorun, not autorun-early) - cat = "drc" + if RBA::Application::instance && RBA::Application::instance.main_window - name = cat.upcase + cat = "drc" - mw = RBA::Application::instance.main_window - mw.menu.insert_menu("tools_menu.verification_group+", cat, name) + name = cat.upcase + + mw = RBA::Application::instance.main_window + mw.menu.insert_menu("tools_menu.verification_group+", cat, name) + + @new_action = RBA::Action::new + @new_action.title = "New #{name} Script" + @new_action.on_triggered do + mw.show_macro_editor(cat, true) + end + + mw.menu.insert_item("tools_menu.#{cat}.end", "new_script", @new_action) + + @edit_action = RBA::Action::new + @edit_action.title = "Edit #{name} Script" + @edit_action.on_triggered do + mw.show_macro_editor(cat, false) + end + + mw.menu.insert_item("tools_menu.#{cat}.end", "edit_script", @edit_action) - new_action = RBA::Action::new - new_action.title = "New #{name} Script" - new_action.on_triggered do - mw.show_macro_editor(cat, true) end - mw.menu.insert_item("tools_menu.#{cat}.end", "new_script", new_action) - - edit_action = RBA::Action::new - edit_action.title = "Edit #{name} Script" - edit_action.on_triggered do - mw.show_macro_editor(cat, false) - end - - mw.menu.insert_item("tools_menu.#{cat}.end", "edit_script", edit_action) - end diff --git a/src/lay/lay/doc/about/macro_editor.xml b/src/lay/lay/doc/about/macro_editor.xml index e0ad2060e..b7235ba16 100644 --- a/src/lay/lay/doc/about/macro_editor.xml +++ b/src/lay/lay/doc/about/macro_editor.xml @@ -15,6 +15,14 @@ with support by either one of those languages.

+

+ As a special kind of macros, DRC and LVS scripts are available for editing + and debugging too. These scripts are basically Ruby scripts but run in a + customized environment so that specific functions are provided. + For more details on these kind of scripts see + and . +

+

In a simple scenario, scripts can be stored in simple text files and loaded by KLayout using the "-rm" or "-r" command-line option. "-rm" will run a script and then execute the normal application. "-r" will run a script and then exit the @@ -82,6 +90,9 @@ search paths. This makes those folders useful for keeping plain Ruby or Python libraries. Generic ".lym" files cannot reside there and those locations are not scanned for autorun macros. +

  • + DRC and LVS scripts are kept inside "drc" and "lvs" folders respectively. +
  • In addition, further repositories can be given on the command line with the "-j" option. This allows adding development repositories which are under configuration management and contain the latest code diff --git a/src/lay/lay/layMacroEditorDialog.cc b/src/lay/lay/layMacroEditorDialog.cc index c10fafcd7..81e4a5fa8 100644 --- a/src/lay/lay/layMacroEditorDialog.cc +++ b/src/lay/lay/layMacroEditorDialog.cc @@ -685,27 +685,22 @@ BEGIN_PROTECTED } } - if (cat == "drc") { - TipDialog td (this, - tl::to_string (QObject::tr ("To get started with the DRC feature, read the documentation provided: Design Rule Checks (DRC).")), - "macro-editor-drc-tips"); - td.exec_dialog (); - } else { - TipDialog td (this, - tl::to_string (QObject::tr ("To get started with the macro development feature, read the documentation provided: About Macro Development.")), - "macro-editor-basic-tips"); - td.exec_dialog (); - } + TipDialog td (this, + tl::to_string (QObject::tr ("To get started with the macro development feature, read the documentation provided: About Macro Development.")), + "macro-editor-basic-tips"); + td.exec_dialog (); - } else if (force_add) { + } else { if (! cat.empty ()) { select_category (cat); } - lym::Macro *m = new_macro (); - if (force_add && m) { - set_run_macro (m); + if (force_add) { + lym::Macro *m = new_macro (); + if (m) { + set_run_macro (m); + } } } diff --git a/src/lvs/lvs/built-in-macros/lvs_install.lym b/src/lvs/lvs/built-in-macros/lvs_install.lym index c3fc68d57..d2b17657f 100644 --- a/src/lvs/lvs/built-in-macros/lvs_install.lym +++ b/src/lvs/lvs/built-in-macros/lvs_install.lym @@ -15,33 +15,37 @@ ruby -# Installs the home menu entries (needs to be done on autorun, not autorun-early) +module LVS -if RBA::Application::instance && RBA::Application::instance.main_window + # Installs the home menu entries (needs to be done on autorun, not autorun-early) - cat = "lvs" + if RBA::Application::instance && RBA::Application::instance.main_window - name = cat.upcase + cat = "lvs" - mw = RBA::Application::instance.main_window - mw.menu.insert_menu("tools_menu.verification_group+", cat, name) + name = cat.upcase + + mw = RBA::Application::instance.main_window + mw.menu.insert_menu("tools_menu.verification_group+", cat, name) + + @new_action = RBA::Action::new + @new_action.title = "New #{name} Script" + @new_action.on_triggered do + mw.show_macro_editor(cat, true) + end + + mw.menu.insert_item("tools_menu.#{cat}.end", "new_script", @new_action) + + @edit_action = RBA::Action::new + @edit_action.title = "Edit #{name} Script" + @edit_action.on_triggered do + mw.show_macro_editor(cat, false) + end + + mw.menu.insert_item("tools_menu.#{cat}.end", "edit_script", @edit_action) - new_action = RBA::Action::new - new_action.title = "New #{name} Script" - new_action.on_triggered do - mw.show_macro_editor(cat, true) end - mw.menu.insert_item("tools_menu.#{cat}.end", "new_script", new_action) - - edit_action = RBA::Action::new - edit_action.title = "Edit #{name} Script" - edit_action.on_triggered do - mw.show_macro_editor(cat, false) - end - - mw.menu.insert_item("tools_menu.#{cat}.end", "edit_script", edit_action) - end diff --git a/src/lvs/lvs/built-in-macros/lvs_interpreters.lym b/src/lvs/lvs/built-in-macros/lvs_interpreters.lym index 9fe876348..150471eb8 100644 --- a/src/lvs/lvs/built-in-macros/lvs_interpreters.lym +++ b/src/lvs/lvs/built-in-macros/lvs_interpreters.lym @@ -70,9 +70,19 @@ module LVS # create a template for the macro editor: mt = create_template("lvs") mt.text = <<"END" +# Try this sample script with this layout: +# https://github.com/KLayout/klayout/tree/master/samples/lvs/ringo.gds +# and this schematic: +# https://github.com/KLayout/klayout/tree/master/samples/lvs/schematic.cir + # Reference schematic (if not absolute: path relative to original layout) schematic("schematic.cir") +# Tip: you can also use: +# schematic(source.path.sub(/\.(oas|gds)/, ".cir")) +# to derive the schematic name from the layout file's name +# by substituting .oas or .gsd with .cir. + # Enable hierarchical mode deep @@ -88,12 +98,10 @@ active = input(2, 0) pplus = input(3, 0) nplus = input(4, 0) poly = input(5, 0) -contact = input(6, 0) -metal1 = input(7, 0) -metal1_lbl = labels(7, 1) -via1 = input(8, 0) -metal2 = input(9, 0) -metal2_lbl = labels(9, 1) +contact = input(8, 0) +metal1 = input(9, 0) # includes labels +via1 = input(10, 0) +metal2 = input(11, 0) # includes labels # Bulk layer for terminal provisioning bulk = polygon_layer @@ -133,10 +141,8 @@ connect(ntie, contact) connect(nwell, ntie) connect(ptie, contact) connect(contact, metal1) -connect(metal1, metal1_lbl) # attaches labels connect(metal1, via1) connect(via1, metal2) -connect(metal2, metal2_lbl) # attaches labels # Global connect_global(bulk, "SUBSTRATE")