Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBA/PYA: Provide event when a net is selected in the netlist browser #588

Closed
klayoutmatthias opened this issue Jun 11, 2020 · 1 comment
Closed
Assignees

Comments

@klayoutmatthias
Copy link
Collaborator

This event will allow driving schematic viewers for example to highlight the selected net an addition to the layout highlights.

A similar extension may be possible for the marker browser for other applications.

klayoutmatthias added a commit that referenced this issue Jul 16, 2020
1. The netlist browser now got events for
   selection and probe events
2. The netlist browser was overhauled to support
   "infinite depth" views
3. Ambiguities are not shown as errors now
4. New classes for support netlist object
   selections and the netlist browser.

Multiple selections for netlist browser.
@klayoutmatthias klayoutmatthias self-assigned this Jul 16, 2020
@klayoutmatthias
Copy link
Collaborator Author

This is request is now implemented together with many other enhancements. The basic problem was that netlist paths have not been supported so far.

  1. The netlist browser now got "infinite depth". This means for example, a subcircuit pin on a net can be expanded to show the net as it's continue inside the circuit. Subcircuits there can also be expanded ... ad infinitum (or at least as there as still subcircuits). Devices show the other terminals which are nets which can also be expanded. Every circuit has a subcircuit list which splits into a list of pins with their connections and the circuit itself.

  2. Probing and highlighting now works with the correct context. If a specific subcircuit's net is selected, the corresponding net is highlighted in the layout, not just "one" instance. You can now also switch the layout to a different cell which makes the nets being hightlighted in the context of this net.

  3. Ambiguous matches which are correct do not show up as fake errors now. For example, if you had a MOS device where S of one device was matched against D from the other and vice versa, the terminal mismatch was indicated with an error marker, but not counted as error. This behaviour is fixed now. Same with swappable pins.

  4. There is a script binding for the netlist browser. In addition, probing and object selection generates every which can be captured to control a schematic view for example. Here is an example how to use these events in Python:

import pya

# NOTE: make this script autorun to have it run initially

# TODO: set this to False before release
debug = True

# Helper for development: print a debug message
def print_debug(msg):
  if debug:
    print(msg)

# called when a net is probed
def probe_event(view, layout_path, schem_path):

  # build the path
  path = schem_path.root.name + "." + ".".join([ sc.expanded_name() for sc in schem_path.path ] + [ schem_path.net.expanded_name() ])
  
  # print the path
  # TODO: send this to XSchem
  print_debug("probed: " + path)

# called when a net is probed
def selection_changed_event(view):

  schem_path = view.netlist_browser().current_path_second()
  if schem_path.net == None:
    print_debug("no net selected")
    return

  # build the path
  path = schem_path.root.name + "." + ".".join([ sc.expanded_name() for sc in schem_path.path ] + [ schem_path.net.expanded_name() ])
  
  # print the path
  # TODO: send this to XSchem
  print_debug("current_changed: " + path)

# called when a layout view is created
def layout_view_created(view_index):

  print_debug("layout_view_created")
  
  # install the "on_probe" and "on_selection_changed" event
  # NOTE: lambda helps us to retrieve the view reference
  view = mw.view(view_index)
  view.netlist_browser().on_probe += lambda layout_path, schem_path : probe_event(view, layout_path, schem_path)
  view.netlist_browser().on_selection_changed += lambda : selection_changed_event(view)

# install the basic event handler for a new view
mw = pya.MainWindow.instance()
if debug:
  # this simplifies debugging because we don't accumulate events on rerunning the macro
  mw.on_view_created = layout_view_created
else:
  mw.on_view_created += layout_view_created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant