• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - TCL
  3. SysCap - "Swap" Net Name"

Stats

  • State Verified Answer
  • Replies 9
  • Subscribers 14
  • Views 5342
  • Members are here 0
More Content

SysCap - "Swap" Net Name"

JohnFr38
JohnFr38 over 2 years ago

Hi Everyone,

I'm having a problem using SysCapture. I would like to swap "net name" of a FPGA 

On VHD designer -> Texte/swap

On SysCap -> Swap PIN

But the function modifies the PIN name and not the associated NET.

  • Sign in to reply
  • Cancel
  • CadAP
    +1 CadAP over 2 years ago in reply to JohnFr38

    Thanks for reply JohnFr38

    #I have made little changes to the code. Please copy the below tcl code.

    You have to select pins of components whose nets need to be interchanged.

    #Please follow below steps:

    1.Copy the below code in a notepad and save with .tcl extension.
    2. Please select the two Pins of component whose nets need to be interchanged. See the below attached screenshot

    3.Source the tcl code in System Capture command window.

    Please take a backup of your project and then run the tcl.

    Hope this helps!


    proc swapNetsName {} {


    set pageId [sch::dbGetActivePage]
    set pageSpath [sch::dbGetActivePageSpath]
    set selectedItems [sch::dbGetSelectedItems $pageId]

    if { [llength $selectedItems] > 0 } {

    foreach item $selectedItems {

    set itemId [sch::dbGetConnectedItems $item]
    # puts $itemId
    set itemType [sch::dbGetType $itemId]
    # puts $itemType
    if {$itemType eq $sch::DBTRoute} {

    set name [sch::dbGetItemName $itemId]
    set netpos [sch::dbGetPos $item]
    set netXY [ sch::dbConvertToUserUnits $netpos]
    lappend netlist $name
    lappend netXYPos $netXY

    }
    }

    # return $netlist
    # return $netXYPos

    if {[llength $netlist] == 2} {

    # puts "$netlist"
    # puts "$netXYPos"
    set net0 [lindex $netlist 0]
    # puts $net0
    set net1 [lindex $netlist 1]
    # puts $net1
    set net0Xpos [lindex [lindex $netXYPos 0] 0]
    # puts $net0Xpos
    set net0Ypos [lindex [ lindex $netXYPos 0] 1]
    # puts $net0Ypos
    set net1Xpos [lindex [lindex $netXYPos 1 ] 0]
    # puts $net1Xpos
    set net1Ypos [lindex [lindex $netXYPos 1] 1]
    # puts $net1Ypos

    renameSignal -pg $pageSpath -net [list $net0Xpos $net0Ypos $net0 $net1]
    renameSignal -pg $pageSpath -net [list $net1Xpos $net1Ypos $net1 $net0]

    puts "Successfully interchange selected instances of $net0 with $net1"
    selectObject none

    }

    if { [llength $selectedItems] <= 1 } {

    puts "Net Interchange tcl Does Not Run For Single Net. Please Select Two Pins whose nets need to be interchanged "

    }

    if {[llength $selectedItems] > 2} {

    puts "More than two Pins are selected, Please select two Pins"}


    } else {puts "No Object Is Selected On The Schematic!"}

    }
    swapNetsName

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • JohnFr38
    0 JohnFr38 over 2 years ago in reply to CadAP

    Thanks a lot, the script works great! And exactly as I want it to!

    Can I turn the script into a button? Or do I have to run it every time from the command line?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP over 2 years ago in reply to JohnFr38

    #After sourcing the below tcl code "CustomMenu" will be added and active till the System Capture is open. If you closed the system capture then you need to source the tcl file again. See the below attached screenshot.

    # For AutoLoading tcl in System Capture you can follow the below link:

    support.cadence.com/.../ArticleAttachmentPortal


    proc callMenu {} {

    set menu {CustomMenu}

    addMenuToMenuBar $menu {} 1 {} sch
    addActionToMenu $menu "Swap_Net" swapNetsName {} {} {} sch


    }


    proc swapNetsName {} {


    set pageId [sch::dbGetActivePage]
    set pageSpath [sch::dbGetActivePageSpath]
    set selectedItems [sch::dbGetSelectedItems $pageId]

    if { [llength $selectedItems] > 0 } {

    foreach item $selectedItems {

    set itemId [sch::dbGetConnectedItems $item]
    # puts $itemId
    set itemType [sch::dbGetType $itemId]
    # puts $itemType
    if {$itemType eq $sch::DBTRoute} {

    set name [sch::dbGetItemName $itemId]
    set netpos [sch::dbGetPos $item]
    set netXY [ sch::dbConvertToUserUnits $netpos]
    lappend netlist $name
    lappend netXYPos $netXY

    }
    }

    # return $netlist
    # return $netXYPos

    if {[llength $netlist] == 2} {

    # puts "$netlist"
    # puts "$netXYPos"
    set net0 [lindex $netlist 0]
    # puts $net0
    set net1 [lindex $netlist 1]
    # puts $net1
    set net0Xpos [lindex [lindex $netXYPos 0] 0]
    # puts $net0Xpos
    set net0Ypos [lindex [ lindex $netXYPos 0] 1]
    # puts $net0Ypos
    set net1Xpos [lindex [lindex $netXYPos 1 ] 0]
    # puts $net1Xpos
    set net1Ypos [lindex [lindex $netXYPos 1] 1]
    # puts $net1Ypos

    renameSignal -pg $pageSpath -net [list $net0Xpos $net0Ypos $net0 $net1]
    renameSignal -pg $pageSpath -net [list $net1Xpos $net1Ypos $net1 $net0]

    puts "Successfully interchange selected instances of $net0 with $net1"
    selectObject none

    }

    if { [llength $selectedItems] <= 1 } {

    puts "Net Interchange tcl Does Not Run For Single Net. Please Select Two Pins whose nets need to be interchanged "

    }

    if {[llength $selectedItems] > 2} {

    puts "More than two Pins are selected, Please select two Pins"}


    } else {puts "No Object Is Selected On The Schematic!"}

    }

    callMenu

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • JohnFr38
    0 JohnFr38 over 2 years ago in reply to CadAP

    It's the best solution! Thank you so much!


    This solution is 100% functional and even allows you to add a keyboard shortcut! 

    I had read another guide that asked you to put scripts in "canvas/resources/sda" Now I understand where the mistake was

    Thanks again

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
<
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information