Repository navigation
get_fanin/get_fanout: flatten the pins of net arguments - #460
NopeCharon wants to merge 1 commit into
Conversation
For net arguments get_fanin appended "net_pins" and get_fanout appended "net_load_pins" to the pin list with lappend, which adds the net's pins as one nested element. When the list is converted to a PinSeq only one of those pins survives, so the traversal started from too few pins. For example, the fanout of a net driving two registers dropped one of them. Use concat so every pin of the net is used. get_fanout also read keys(-from) without checking that it exists, so calling it without -from raised a raw Tcl error. Report the usage message like get_fanin does for a missing -to. Add search_fanin_fanout_nets, which compares net and multi-net fanin and fanout results on a design whose nets have several loads. Fixes The-OpenROAD-Project#457 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
|
|
There was a problem hiding this comment.
Code Review
This pull request adds a new test case fanin_fanout_nets to verify get_fanin and get_fanout behavior on nets connecting to multiple pins, and updates tcl/Sta.tcl to ensure the -from argument is provided for get_fanout. It also changes list appending from lappend to concat. The reviewer pointed out that using concat inside a loop is a performance anti-pattern in Tcl resulting in quadratic complexity, and suggested using lappend with the expansion operator {*} instead for
| set net_pins [net_pins $net] | ||
| if { $net_pins != {} } { | ||
| lappend pins $net_pins | ||
| set pins [concat $pins $net_pins] |
There was a problem hiding this comment.
Using set pins [concat $pins $net_pins] inside a loop is a performance anti-pattern in Tcl. Since concat creates a new list and copies all elements, doing this in a loop results in quadratic lappend with the expansion operator {*} appends the elements in-place, which is significantly faster (
lappend pins {*}$net_pins
| parse_port_pin_net_arg $keys(-from) pins nets | ||
| foreach net $nets { | ||
| lappend pins [net_load_pins $net] | ||
| set pins [concat $pins [net_load_pins $net]] |
There was a problem hiding this comment.
Using set pins [concat $pins [net_load_pins $net]] inside a loop is a performance anti-pattern in Tcl. Since concat creates a new list and copies all elements, doing this in a loop results in quadratic lappend with the expansion operator {*} appends the elements in-place, which is significantly faster (
lappend pins {*}[net_load_pins $net]
…le (The-OpenROAD-Project#460) * Use more reliable mirrors for Bison and TCL in CentOS 7 Dockerfile. ftp.gnu.org and SourceForge prdownloads are flaky in CI; switch to dotsrc and OSUOSL mirrors. Co-authored-by: Cursor <cursoragent@cursor.com> * Use GNU ftpmirror and SourceForge project URLs. Switch CentOS 7 Dockerfile downloads to the reviewer-suggested ftpmirror.gnu.org redirector for Bison and the SourceForge project download URL for TCL. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes #457.
For net arguments,
get_faninandget_fanoutadded the net's pins withlappend pins $net_pinsandlappend pins [net_load_pins $net]. That appends the whole pin list as one nested element. When the list is converted to aPinSeq, only one of those pins survives, so the traversal started from too few pins. For example,get_fanout -from [get_nets n1]dropped a register thatn1drives directly. Both commands now useconcat, so every pin of the net is used.get_fanoutalso readkeys(-from)without checking that it exists. Calling it without-fromraisedcan't read "keys(-from)"; it now reports the usage message, asget_fanindoes for a missing-to.The new
search_fanin_fanout_netstest uses a small design whose nets have several loads. It checks net, multi-net,-only_cells,-flat -endpoints_onlyand-startpoints_onlyresults, plus the missing-fromcase. On current master the net fanouts missreg1/D/reg1,get_fanin -tothe net misses the net's load pins, and the last case raises the Tcl error.ctest -L tclpasses; no existing golden changes.