On IC layout, swapping two instances with the same type can improve routing quality and timing. GOF has an API to support this, swap_inst.
Figure 1: Swap two instances by swap_inst
Put the two instance names as the arguments for swap_inst, the tool will swap the connections of the two instances.
From the layout view below, with two AND gate being marked by stars, the routing quality has been improved after swapping, hence timing would be improved.
Figure 2: Layout view after swapping
The API can greatly increase the efficiency of logic modification. If using TCL script to swap the instances, it will involve many lines. For comparison, the content of written out TCL file swapping_inst.tcl:
current_instance current_instance uge/udp/upcs/urx/upcs_sd disconnect_net [get_nets n_11] [get_pins cnt_reg_2/D] connect_net [get_nets n_8] [get_pins cnt_reg_2/D] disconnect_net [get_nets n_10] [get_pins p2680A/B] connect_net [get_nets n_4] [get_pins p2680A/B] disconnect_net [get_nets n_8] [get_pins cnt_reg_1/D] connect_net [get_nets n_11] [get_pins cnt_reg_1/D] disconnect_net [get_nets n_4] [get_pins p2685A/B] connect_net [get_nets n_10] [get_pins p2685A/B]