• 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 5344
  • 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
Parents
  • srish09
    0 srish09 over 2 years ago

    Hello John, 

    Are you swapping the pins in pcb editor and then importing the layout into System Capture? As per the flow, pins within the same pin group can be swapped in pcb editor. These changes can be back-annotated to SysCap schematic using the File > Import > Layout option.

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

    Thank you for answer. 

    With this method on the schematic -> the numbering changes. On chip : 10-9-8-7-6 i want swap net label of 8 & 7. If I use the command swap pin, on the  graphic representation chip : 10-9-7-8-6

    I would like just swap the net no swap pin

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

    # When pins are swapped in PCB Editor and back annotated in System Capture, the design swap information gets updated on the schematic where the pin text and pin numbers are interchanged.
    #This is the intended behavior of the swap pin command.


    # But if you want to swap the net name not the pin text and pin number. Please use the below tcl script.

    #Please copy the below code in notepad/notepad++ and save file with .tcl extension.
    #Please select the two wires(nets) which net names you want to interchange and source the below tcl code.

    #For example: Save the notepad as net_interchange.tcl and source {c:\tcl\net.interchange.tcl} where tcl is folder created in c directory.


    proc swapNetsName {} {

    set pageId [sch::dbGetActivePage]
    set pageSpath [sch::dbGetActivePageSpath]
    set selectedItems [sch::dbGetSelectedItems $pageId]
    if { [llength $selectedItems] > 0 } {

    foreach item $selectedItems {

    set itemType [sch::dbGetType $item]

    if {$itemType eq $sch::DBTRoute} {

    set name [sch::dbGetItemName $item]
    set netpos [sch::dbGetSegments $item]
    set netXY [ sch::dbConvertToUserUnits [lindex [lindex $netpos 0] 0] ]
    lappend netlist $name
    lappend netXYPos $netXY

    } else {puts "SelectedItem Is Not Net! or One Of The Selected Item Is Not A Net!"; set netlist {} }

    }

    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 "Sucessfully interchanged nets $net0 with $net1"

    } else { if {[llength $netlist] >= 1 } {puts "Net Interchange tcl Does Not Run For Single Net. Please Select Two Nets" } }


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

    }
    swapNetsName

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

    # When pins are swapped in PCB Editor and back annotated in System Capture, the design swap information gets updated on the schematic where the pin text and pin numbers are interchanged.
    #This is the intended behavior of the swap pin command.


    # But if you want to swap the net name not the pin text and pin number. Please use the below tcl script.

    #Please copy the below code in notepad/notepad++ and save file with .tcl extension.
    #Please select the two wires(nets) which net names you want to interchange and source the below tcl code.

    #For example: Save the notepad as net_interchange.tcl and source {c:\tcl\net.interchange.tcl} where tcl is folder created in c directory.


    proc swapNetsName {} {

    set pageId [sch::dbGetActivePage]
    set pageSpath [sch::dbGetActivePageSpath]
    set selectedItems [sch::dbGetSelectedItems $pageId]
    if { [llength $selectedItems] > 0 } {

    foreach item $selectedItems {

    set itemType [sch::dbGetType $item]

    if {$itemType eq $sch::DBTRoute} {

    set name [sch::dbGetItemName $item]
    set netpos [sch::dbGetSegments $item]
    set netXY [ sch::dbConvertToUserUnits [lindex [lindex $netpos 0] 0] ]
    lappend netlist $name
    lappend netXYPos $netXY

    } else {puts "SelectedItem Is Not Net! or One Of The Selected Item Is Not A Net!"; set netlist {} }

    }

    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 "Sucessfully interchanged nets $net0 with $net1"

    } else { if {[llength $netlist] >= 1 } {puts "Net Interchange tcl Does Not Run For Single Net. Please Select Two Nets" } }


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

    }
    swapNetsName

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

    Thank you very much for the script.

    I can't find the information to run the script from Cadence System Capture. I found where to execute TCL commands but not how to add a button or something to execute the script.

    Thanks for your answer.

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

    I've finally managed to run the script! But I have a problem with this one:
    1) low priority transforming the script into a button
    2) high priority: the script switches the NETs but not where I select



    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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
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