Skip to content

get_nets should not return NULL when querying nets of unconnected pins #3572

@chaufe

Description

@chaufe

Description

get_nets would normally return an empty list when querying non-existent nets.
But when querying nets of an unconnected pin, it would return NULL as the net for every unconnected pin.
This seems inconsistent to me, especially when querying nets for cells with connected and unconnected pins.

Here is an example of a cell with unconnected pins:

make_inst dummy_buffer gf180mcu_fd_sc_mcu7t5v0__buf_4
set any_cell [get_cell dummy_buffer]
puts "Querying nets of cell pins (all unconnected):"
puts "get_pins of cell: [get_pins -of_object $any_cell]"
puts "get_nets of pins: [get_nets -of_objects [get_pins -of_object $any_cell]]"
puts "get_nets of cell: [get_nets -of_object $any_cell]"

puts "Querying nets of cell pins (input connected, output unconnected):"
make_net dummy_net
connect_pin dummy_net dummy_buffer/I
puts "get_pins of cell: [get_pins -of_object $any_cell]"
puts "get_nets of pins: [get_nets -of_objects [get_pins -of_object $any_cell]]"
puts "get_nets of cell: [get_nets -of_object $any_cell]"

As long a the cell is fully unconnected, this will return:
Querying nets of cell pins (all unconnected):
get_pins of cell: _009a6a0800000000_p_Pin _509a6a0800000000_p_Pin
get_nets of pins: NULL NULL
get_nets of cell: NULL NULL

Once the input pin of that cell is connected to a net, the output changes to:
Querying nets of cell pins (input connected, output unconnected):
get_pins of cell: _009a6a0800000000_p_Pin _509a6a0800000000_p_Pin
get_nets of pins: _80d96b0800000000_p_Net NULL
get_nets of cell: _80d96b0800000000_p_Net NULL

This make traversing the design hierarchy (net list) using get_*-procedures unnecessary complicated, as at least for get_nets, the result needs to be checked for

  • empty list
  • NULL
  • list with mixed NULL and non-NULL
  • list with all non-NULL

Other procedures like get_ports -of_object <a-net> would return an empty list if no object was found.

Here is a an ipython notebook for Google Colab to reproduce the issue.
OpenRoad__get_nets_of_unconnected_pins.ipynb.gz

/cc @proppy
/cc @dhaentz1

Suggested Solution

get_nets should not include NULL-nets inside its return value, but handle the nets of unconnected pins just as if not net matches the query. It should just return existent nets, or an empty list.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions