next up previous contents
Next: Netlist Arrays Up: Netlist Representation Arrays Previous: Netlist Representation Arrays

Point Arrays

The four point arrays representing the circuit are shown in Table 3.9. The purpose of the pnt_coords array is fairly straightforward; it allows the implementation to quickly access the coordinates of the center of the diamond-shaped polygon used to represent wire points on the canvas. By storing these coordinates, the implementation relieves itself from having to recalculate the center of the point based upon the canvas coordinates of the polygon. It also makes the implementation more resilient to change should a different shape be used to represent the wire points.

 

 
Point Identifiers pnt_coords pnt_wires pnt_port pnt_label
A 180 250 1 - -
B 180 270 2 - -
C 180 350 3 - id(In3)
D 230 250 1 a -
E 230 270 2 b -
F 310 260 4 c -
G 360 260 4 5 6 - -
H 360 330 6 7 - -
I 410 330 7 d -
J 410 350 3 - -
K 500 340 8 - -
L 520 260 5 - id(Out1)
M 520 340 8 - -
Table: Point Array Values for the Circuit in Figure 3.9

The pnt_wires array contains the identifiers of all the wires adjacent to a given wire point identifier in the netlist. Consequently, the degree of a point can be determined by simply finding the number of elements in the pnt_wires list that corresponds to the point. In Tcl, this can be accomplished with a call to the llength list procedure. For example, $pnt_wires(G) is {4 5 6}; hence llength $pnt_wires(G) is three, so point G has degree three.

The pnt_port array is used to associate a point with a component port when the two have been connected by the user. This array is consulted when the user moves a point which is connected to a component port. In this situation, the array maps the point identifier to the corresponding port identifier to which it is connected. From this, the implementation can determine the unique tag name of the component which is to be moved in unison with the point. The array is also used to map identifiers in the reverse direction when the user moves a component attached to one or more wire points. The procedure net_port_point does this mapping by linearly scanning the elements in the pnt_port array. Notice that if a point is not connected to a component port then the pnt_port element corresponding to the point is undefined. Also, if a component is deleted, then the appropriate elements of the pnt_port array must be updated to ``disconnect'' the points from the ports of the deleted component.

The pnt_label array provides an easy way for the implementation to quickly access the identifier of the textual label canvas item which names a point and its corresponding netlist. Given the identifier of the point, the text label canvas item associated with that point can be obtained, thereby allowing the label to be subsequently modified or deleted by the implementation. Note that because each netlist can only have one name, the number of elements set in the pnt_label array cannot exceed the number of netlists in the circuit. With respect to the sample circuit of Figure 3.9, there are five netlists, therefore, the pnt_label array can have no more than five elements set. Also, if one point in a netlist has been given a label, then no other point in that netlist may be labelled. For example, because wire point L already has a label (Out1), the points F, G, H and I; which belong to the same netlist as L, cannot be given labels. Consequently, the elements in the pnt_label array corresponding to these points are not set. If none of the points in a netlist have their corresponding pnt_label set, then the netlist is unnamed. This is the case with the netlist determined by the points A and D.

There are times when the implementation needs to know the identifiers of the two points at the end of a given wire segment. During early development, this was achieved using an array which was indexed by a wire identifier and stored the two point identifiers associated with the wire. However, this became too clumsy to maintain because this array would have to be kept consistent with the contents of the pnt_wires array. Therefore a simple auxiliary procedure named net_wire_points was written which accepts a wire identifier and scans the pnt_wires array to determine the identifiers of the two end points of the wire. Although this method is slower, the code became much more maintainable. A similar associative array, which was indexed by a port identifier and returned the identifier of the wire point connected to it (if the port was connected), was replaced with the procedure net_port_point, as described above.


next up previous contents
Next: Netlist Arrays Up: Netlist Representation Arrays Previous: Netlist Representation Arrays

Donald Craig
Mon Jul 8 12:05:35 NDT 1996