Deletion of netlist elements is more complicated due to the variety of potential circumstances which may arise. The procedure net_delete_point takes care of point deletion by first determining if the point to be deleted has degree two. If so, then the point and its adjacent wires will be deleted and the two points adjacent to the deleted point will be joined together. Note that deleting a point of degree two does not change the netlist connectivity; therefore, the netlist tags remain unchanged. If the user is deleting a point with degree one or degree greater than two, then the net_delete_point procedure will cycle through all the wires connected to the point and delete them. In addition, the identifiers of the deleted wires are removed from the entries of the pnt_wires array corresponding to the points adjacent to the deleted point. If an adjacent point had degree one before the deletion, then that point will be removed. The deletion of a wire is handled similarly by the procedure net_delete_wire.
The deletion of a wire point or a wire which connects two or more netlists results in netlist splitting. Consequently, retagging of the netlist elements must occur so as to implement the dynamic netlist identification strategy. In order to retag the split netlists, a simple traversal algorithm was written which is called for each new netlist created as a result of the split. For example, in Figure 3.10, consider the deletion of the point indicated by the arrow in the netlist on the left. After the point is deleted, the netlists shown on the right are produced, each of which have had their respective elements uniquely retagged. Note that the deletion of the point caused the deletion of an adjacent point which had a degree of one.
Figure 3.10: Splitting a Netlist
The retagging of the netlist elements in each of the resulting netlists is performed by the procedure net_list_traverse as shown in Figure 3.11. The arguments to this procedure include the identifier of the point at which the traversal is to start (pid) and the old and new netlist tag name (nid1 and nid2, respectively). The procedure performs a depth-first traversal starting at the supplied point and retags all netlist elements that had the tag nid1 with the new tag nid2.
Figure 3.11: Traversing and Retagging a Netlist
Note that traversing a netlist after it has been split is somewhat expensive, especially considering the interpretive nature of Tcl. However, it was discovered during development that occasionally traversing and retagging a subset of the netlists was preferable over continually extracting all the netlists each time the user wanted to highlight netlists or simulate the circuit. Such extractions almost inevitably lead to a traversal of all the netlists.