Chapter 7: Routing


7.1 Introduction

The Router agent server performs all the circuit wiring in the Agents system. The Router server interface and communication aspects were discussed in chapter 4. This chapter focusses on the routing routines used by the server.

The Router server receives, from its clients, circuits in EDIF format [55] with all components already placed. These circuits are then routed and returned to the client.

The Router server basically tries to mimic the way human designers use a simple CAD (Computer Aided Design) system to route circuits. The designer makes all the important decisions about design, such as where the wires are going to and about the quality of the routing. The designer decides if a subnet is well wired or if it needs rewiring (for instance, because it is blocked). CAD offers the designer a tool to represent and manipulate the design. It embeds tools to change the way wires are connected and to calculate important constraints, such as the size of a wire or process rule transgressions. The designer is in charge of the decision making process and the CAD system offers the medium and facilities to implement his or her decisions (fig. 7.1).

In the Router server, the designer's role is carried out by the RouterExpert agent object and the other agents under its supervision, and the CAD role is carried out by the Design objects.

7.2 The CAD role

The Design object (DesignCmp) holds the design medium and the methods to analyse or change it. It carries out the CAD role providing the RouterExpert agent with the means to collect information about the design and to implement its decisions about the routing process.

In addition to holding the design data, the Design object has two groups of methods to performs its other functions: building methods, for changing the design data, and retrieve methods, for collecting information.

7.2.1 Retrieve methods

The methods in this group collect information about the design. Their search can be based on a component's individual characteristic, some spacial relationships among components or some spacial constraint, such as distance. These methods can return boolean statements, references to components and spacial information.

For example, there are three methods for searches based on individual characteristics: The getByNumber and getByReference methods that find a component based on its number or reference value, and the getByWire method that returns the component that owns a particular wire.

The two more important spacial relationships are crash and touch. A crash happens when any section of a new wire breaks any design rule in relation to any section belonging to any wire already in the design. A touch happens when a proposed wire section touches any section belonging to any wire in a list, both sections should be in a wiring layer (poly, metal1 or metal2).

The main methods to test the relationships are:

Finally, the following methods return information based on spacial constraints (fig. 7.5):

7.2.2 Building methods

The Design object's second function, which is to implement the designer decisions on the design, is performed by the building methods. This group of methods adds elements to the design and can conduct construction tasks that are not complex enough to demand the help of an expert system. The methods are:

7.3 The Designer role

The Designer role is carried out by the RouterExpert and Connect agent objects. They are in charge of the decision making process. Their function is to control the way the routing is undertaken using the facilities provided by the Design object.

The combination of the two agents performs an augmented maze route algorithm. Maze routing was first described by Moore [67]. Moore routing is performed over a rectangular grid of cells, with some cells free and others blocked. Basically, the algorithm finds the shortest path between two predefined cells that does not pass through any blocked cell. It begins at a start cell, repeatedly expanding outwards to neighbouring cells until the destination is reached. When the goal is reached the complete path can be tracked back to the start point (fig. 7.7).

Maze routing can be easily generalized, the notion of expanding to neighbours works with any graph, not only with rectangular arrays. The algorithm is almost always enhanced with a cost function, incorporating factors such as preferred routing directions and the cost of layers and vias. Instead of expanding uniformly in all directions, only the most promising, least cost partial path is expanded in each interaction. In place of the shortest path, found in the original form of the algorithm, this enhanced form provides least cost solutions.

Another performance optimization, which can be employed in the algorithm, is expansion directly to the next interesting point [68], where a change in direction or layer is more likely. This saves times skipping over less interesting parts of the layout and, more importantly, by eliminating the need to process data at the costly level of pixels, processing is performed directly on the circuit description held by a Design object.

A point is defined as interesting when it aligns with the goal point, obstacles' edges or crosses obstacles' sides (fig. 7.8). In the case of obstacles, the edge and sides considered are the ones of the area that overlap the obstacle by a margin. This margin is equal to the minimum separation between the layers of the obstacle and the layer of the wire being routed plus half the wire width. In this way, a wire bending in an interesting point does not break any design rule (fig. 7.8). The agents construct wires to the interesting points and analyse the best possibilities from them. They can turn the wire or change layers and then try the next interesting point.

7.4 Router expert

The RouterServer object is in charge of the communications with the outside world. It can interpret EDIF format [55] and the commands accepted by the router. It holds the RouterExpert agent object that undertakes the real routing. When the RouterServer object receives a circuit to be routed it reads it into a Design object and passes it to the RouterExpert agent to carry out the routing. When the routing is finished it converts the resulting design to EDIF format and sends it back to the client.

When the RouterExpert agent receives a circuit, it first performs some simple routing. It connects straight diffusion and polysilicon lines and connects all the unconnected diffusion lines to metal1.

7.4.1 Connect in same layer

The RouterExpert agent uses the Design object's connectInSameLayer method to connect points on the same layer which are close to each other. These connections should lie in a straight line. First, the program tries the points on the diffusion layers (pdiff and ndiff). Only this type of connection will be routed in diffusion, abutted transistors (transistors on the same strip of diffusion) will be connected this way. After routing all diffusion links, the program will try to connect polysilicon points. The placement program tried to align the connected gates of transistors, these will be connected now. If, by chance, the program finds other possible short connections, other than abutted MOSFETs and aligned gates, they will be routed this way too.

7.4.2 Diffusion to metal openings

As the only allowed type of wiring using diffusion has already been carried out (mainly for abutted transistors), any remaining unwired diffusion points have to be connected in metal1. For each unwired diffusion terminal, the Design object's method makeDiffusionToMetal1 will be applied to try to extend it into layer metal1 (fig. 7.9). If this change isn't possible the cell can not be routed and an error condition is returned.

7.4.3 Main connections

After the basic connections have been completed, the connectGeneral method wires all remaining connections. The unwired nodes are put in the Routing Nodes Queue list, ordered by importance and size, smaller nodes coming first. This will help if any rerouting has to take place later. The connectGeneral method uses the connectNode method to connect all members of this list. From this stage on, only the wiring layers, polysilicon, metal1 and metal2, will be used for interconnections.

In a Design object, each node has a list of partially routed subnets (routingNets list). Each list contains at least one wire corresponding to a component terminal. If none of the subnets was wired together all lists will have just this small wire. If they have all been wired, the node will have just one list holding all subnets in its routingNets list.

The connectNode method connects the subnets in a node's routingNets list. It tries to connect each net using the method connectSubnet. If the method can not connect a subnet, the next subnet in the list will be connected and the unconnected subnet will be tried again later. The method returns FALSE if not all subnets are connected together.

7.4.4 Connecting a subnet

The subnets connection is based on the interesting points, discussed in section 7.3. The wiring of a connection is undertaken by the Connect agents by analysing the nearest interesting points, beginning at the wire origin. A Connect agent is created for each interesting point. From its analysis of the point, a number of operations can be performed: it can change layers, connect the wire to the destination, create a new piece of wire, unwire a blocked path, etc (fig. 7.10). The agent's goal is to reach a point in the destination subnet. It can create other agents (reproducing) to analyse other nearby points of interest. These operations go on until two subnets are finally wired together.

The RouterExpert agent controls the population of Connect agents and the way they perform the routing. The idea would be to have a population of Connect agents trying their solutions in parallel. If an individual finds a new interesting point, it reproduces. If it completes a wire it sends it to the RouterExpert agent. If it has exhausted all its options, it dies. The RouterExpert would then take care of this "farm", killing individuals with costly routing and giving more resources to individuals with prospective wires.

Unfortunately parallelism at this level is not available in BSD Unix (Berkeley System Distribution) [70], only in the System V Unix [71] using the threads mechanism. But even in this case, it only would be real parallelism (not just time sharing) if the host machine had more than one processor. For this reason, a system of list queues is used to schedule Connection agent's execution, in a time sharing fashion.

7.4.5 The algorithm

The RouterExpert agent's method connectSubnet controls the process of routing a subnet. Figure 7.11 shows its data structures, its main constituents are:

The main algorithm used by the connectSubnet method is shown in figure 7.12 and described bellow:

When a Connect agent finds a wire it sends it to the RouterExpert agent using the method tryAsBestWire. The method will test whether the cost of this wire is smaller than the current best one (if there is one). If the new one is cheaper, it will become the new best. The method also tests whether the new wire has a cost very near the cost of the minimum wire. If so, the search stops.

7.4.6 Rewiring

When the path of a wire is totally blocked by an already routed wire, the program unwires the old wire to allow the wiring of the new. After that the old wire is rewired. Unwiring is a very expensive operation. The unwiring of a section of wire can lead to the complete unwiring of many nodes. Unfortunately it has to be carried out when previous wires completely block the path of a new one.

When a Connect object has the path of its wire obstructed by a wire belonging to a node different from the one it is currently routing, it creates a new Connect agent, which asks for that wire to be removed, and sends it to the RouterExpert agent. This new agent is sent to the AgentsQueue (fig. 7.11). The agents in the AgentsQueue are used only if a wire that does not need any unwiring is not found, or if this wire is very costly (at least twice the cost for the subnets' average wire). Because rewiring is so expensive it is only tried when all agents that do not ask for it (the ones in the agentsList) have been tried.

When a new Connect agent is added to the AgentsQueue, the program determines which nodes will have to be unwired as a result of the removal of the wire that is blocking that particular agent path. The node, that the wire belongs to, and all nodes wired after it, that share any common area with it, have to be completely unwired. Nodes sharing areas with these unwired nodes have to be unwired as well. For instance, if the nodes were wired in the order A, B and C; A had to be unwired and B occupies an area that overlaps A's. B will have to be unwired and C will be left intact only if it shares area with neither A nor B. The Connect agents are added to the AgentsQueue ordered by the number of nodes that they are asking to be unwired, the smaller numbers (cheaper ones) coming first.

All this care has to be taken because the wiring of a node reflects in the wiring of the other nodes connected after it. If only the wire that is blocking a path is taken out, other wires, in the same node or from other nodes, could have had their shape heavily influenced by that wire. For instance, they could have changed layers to avoid the wire, and if this wire is then deleted and rewired, it can now follow another route and leave an unnecessary change of layer in the design. The only way to ensure that such situations do not take place is to unwire not only the blocking wire but all wires that could have had any topological conflicts with it. Some other less "radical" methods, such as recursive rerouting [48], would fail when using more than two layers for routing.

Figure 7.12 shows a possible error due to partial rewiring. The Net #3 wire, left side of the figure, was fully blocked by Net #1 and Net #2 wires. The program then removes the piece of Net #1 wire that is blocking the way (marked by dotted lines). The routing of Net #3 proceeds to completion, and Net #1 is rewired (right side of the figure). What happens then is that Net #1 rewires the removed piece in another layer, to cross over Net #2 and Net #3 layers. This leaves Net #2 with a useless piece of wire (marked by dotted lines), making a bridge over a no-existing obstruction. In this case, the two nets, Net #1 and Net #3, have to be rewired to avoid the mistake.

After unwiring a node, the RouterExpert moves it from its original position in the Routing Nodes Queue, to a position after the current node being routed. In this way, the node will eventually be rewired. To avoid loops where A asks B to be unwired and then some time later, when B is being rewired, it asks A to be unwired, a node that unwires another during its routing, can not be unwired.

7.5 Connection object agent

The Connection agent is at the core of the routing process, it carries out the actual routing of the subnets. It is created to analyse interesting points. It finds the next interesting points, extends its wire to reach them, and creates new Connection agents to analyse them. If it finds a connection with the target subnet, it extends its wire to it and proposes it as the best wire to the RouterExpert agent.

When a Connection agent is created it receives data from its parent about its "mission". This data includes: where the Connection agent is in the design, where it should go and the wire segment it already holds. The agent then remains dormant, either in the RouterExpert's agentsQueue or agentsList, until the RouterExpert runs it.

When the Connection agent begins to run, it first checks out its environment and finds out in what direction the target point for its wire is. With this information it plans which of its four operators will be activated first. It feeds them into the Options list, a list that holds operators to be applied, and applies the operators in the list until it is emptied. The applied operators can trigger other operators to be applied (adding them to the Options list). As a result of the operators actions, the agent can extend its wire to other interesting points, create new Connect agents and propose new best wires to the RouterExpert agent. When the agent has tried all possibilities (it emptied the Options list), constrained by its environment and knowledge base, it halts and its run method returns.

7.5.1 The Connect agent operators

The Connect agent expert applies four operators to probe its design options. The most important is the Change Layer operator, which is the only one to do the final connection to the target net. This operator will be introduced in a separate section, the other three are:

If successful all three operators add the new section to their wires and create a new Connect agent to work on this new interesting point. When they create new Connect agents they send them to the RouterExpert to the agentsList. They do not create agents that ask for nets to be unwired. If unsuccessful all operators return messages that can be used by the Connect agent to trigger the activation of other operators.

7.5.2 The Change Direction operator

The Change Direction operator is Connect agent's most important object because it probes the space in defined directions, looking for a connection in the target net or for obstructions. It gathers information that can be used to activate other operators.

When this operator is used it receives a pointer with the direction it should probe into, its vector direction. It then uses the Design object method getWiringLayersTouchPointer (fig. 7.3) to test if a pointer, with the same width and layer type as its last wire segment and pointing in its vector direction, touches any wire in the target subnets (or any other subnet belonging to the same node). If the result of this test is negative, the operator uses the Design method getCrashesPointer, to detect any crash in the operator's vector direction. If there is a crash the operator will add to the Options list the operator Goto XY in the crash's direction up to the crash's point edge (fig. 7.14, middle). If the operator's vector aligns with the Goal point (fig. 7.8, left) it adds another operator Goto XY to the Options list, to add a new segment extending the wire up to the alignment point (fig. 7.14, left). The operator returns the message "No touch".

If there is a touch in one of the target subnets the operator uses the Design object method makeConnection to try to make a connection. If there is a connection, the resulting wire is sent to the RouterExpert agent as a possible best wire (fig. 7.14, right).

If there is no connection the operator uses the Design method getCrashesPointer, to detect any crash in the operator's vector direction. If there are no crashes it returns the message "Can't make connection" and, as before, if the operator's vector aligns with the Goal point (fig. 7.8, left) it will add an operator Goto XY to the Options list. If there are crashes the operator tries the following series of operations to overcome the obstructions between its position and the target subnet:

If the operator Change Direction manages to make a connection it returns the message "Success".

7.5.3 The general operation

In the Connect agents all the wire building and interesting points analyses take place when the operators are applied. Operators are applied from the Options list. One way of adding operators to the list is through the operator Change Direction, as explained in the last subsection.

The other way, as explained earlier, is when the Connect agent begins to run and survey its environment. The operators chosen, to be added to the Options list, depend mainly on the last operation performed by the parent of the Connect agent prior to its creation. For instance, if the last action was an operator Goto XY to approach a obstruction, Get Round operators will be added to the Options list to try to overcome the obstruction.

In addition to any operator dictated by the surrounding environment, on all occasions, the algorithm will add to the Options list: Change Layers operators to the agent's wire adjacent layers (for instance poly to metal1), and at least two Change Direction operators going each to one of the possible directions (north, south, east and west).

The rules in the Connect agent knowledge base try to strike a balance between the number of particular cases they take into consideration and the likelihood of any of the particular cases leading to a perfect wire. Here, some examples of the special circumstances the knowledge base analyses have been illustrated, but there are others. Many more will be added as the program matures.

In summary, the basic behaviour of each Connect agent is to try to extend the wire it has inherited from its parent. This continues until no operators are available in the Options list. The agent's job is to try all reasonable possibilities for expanding the wire. The task of the RouterExpert agent is to restrain the Connect agents, promoting the ones that found a good path, in such a way that the program finds a good solution in a reasonable amount of time.

The interaction of these two types of agents creates the final routing, as shown in figure 7.16. This routing is subsequently sent back to the Router server's client. Similar to the Placer server, the Router on success sends back the design, as an EDIF command, otherwise it sends the message (LIST SORRY).

7.1 - Introduction
7.2 - The CAD role
7.2.1 - Retrieve methods
7.2.2 - Building methods
7.3 - The Designer role
7.4 - Router expert
7.4.1 - Connect in same layer
7.4.2 - Diffusion to metal openings
7.4.3 - Main connections
7.4.4 - Connecting a subnet
7.4.5 - The algorithm
7.4.6 - Rewiring
7.5 - Connection object agent
7.5.1 - The Connect agent operators
7.5.2 - The Change Direction operator
7.5.3 - The general operation

Next Contents Talk to me