Class RouteTracks - RouteTracks.h, RouteTracks.cc
Definition:
Route tracks are a set of RouteEdges arranged
in a rectagular fashion. The edges can be indexed in two ways.
First you must specify whether the edge is a vertical or horizontal edge.
We allow only rectilinar routing i.e. very edge must be vertical or horizontal.
Then you can find the edge according to it's x,y coordinate or its track
and edge number. For vertical edges, the track number indictates
which vertical track it is located on (similar to x axis value).
The edge number indictates the edge within that track (similar to y axis
value). For horizontal edges, the track number indictates the horizontal
track in which it is located (similar to the y axis value). The edge
number specifies the edge within that track (similar to the x axis value).
There are functions for address the edges in both manners. RouteTracks
is one of the main data structures used by the maze router (see Maze).
Typedefs:
typedef vector<RouteEdge *> RouteEdgeVector;
typedef RouteEdgeVector::iterator RouteEdgeVectorItr;
typedef vector<RouteEdgeVector *> RouteTrackVector;
typedef RouteTrackVector::iterator RouteTrackVectorItr;
typedef list<MazePoint *> MazeList;
typedef MazeList::iterator MazeListItr;
Included:
#include "RouteEdge.h"
#include "MazePoint.h"
#include "PrimMST.h"
#include <vector>
#include <list>
#include <limits.h>
#include <iostream.h>
#include <fstream.h>
RouteTrackVector * horizontalTracks
A vector which holds the horizontal edges. If you directly index
into the vector you will get a pointer to another vector which holds the
edges on that "track". Methods are provided to mask the somewhat
hairy underbelly of this structure. Unless you have a strong
stomach and a lot of time, I suggest using the given methods. NOTE:
due to my extensive background in Java, I think of coordinates as they
exist in the third quadrant. Thus, the y-axis (or track number in
this case) is inverted. The track at location 1 is actually located
at -1, though this shouldn't matter at all as long as you use a consistent
quadrant throughout.
RouteTrackVector * verticalTracks
A vector which holds the vertical edges. The comments listed in horizontalTracks
apply
here.
int verticalCapacity
The capacity of the vertical edges. As of now, you can only have
two capacities, one for the vertical edges and one for the horizontal edges.
This should change soon when I adopt the GSRC bookshelf routing input format.
int horizontalCapacity
The capacity of the vertical edges. As of now, you can only have
two capacities, one for the vertical edges and one for the horizontal edges.
This should change soon when I adopt the GSRC bookshelf routing input format.
int routeLength
The sum of all of the length of the routes over every routed net.
RouteTracks(int
xNum, int yNum)
Acts a default constructor. Initailizes the set of rectagular vertical
and horizontal edges as specified.
~RouteTracks()
Deconstructor
int isValid(int
x, int y)
Returns 'true' if the specified value falls within the range. Should
be used in order to prevent memory faults.
RouteEdge * getHorizontalEdgeAt(int
x, int y)
Returns the specifed horizontal route edge. The edge is specified
according to it coordinate.
RouteEdge * getVerticalEdgeAt(int
x, int y)
Returns the specified vertical edge. The edge is specified according
to it coordinate.
RouteEdge * getEdgeAt(int
x, int y, bool horiz)
Returns the specified route edge. The edge is specified according
to it coordinate. If 'horiz' is true, it returns the horizontal edge
at the specifed position. Otherwise it returns the vertical edge.
RouteEdge * getHorizontalEdgeWith(int
trackNumber, int edgeNumber)
Returns the specified horizontal route edge. The edge is specifed
according to its track number and edge number.
RouteEdge * getVerticalEdgeWith(int
trackNumber, int edgeNumber)
Returns the specified vertical route edge. The edge is specified
according to its track number and edge number.
RouteEdge * getEdgeWith(int
trackNumber, int edgeNumber, bool horiz)
Returns the specified route edge. The edges is specified according
to its track number and edge number.
int getWidth()
Returns the width of this RouteTracks object.
int getHeight()
Returns the height of thsi RouteTracks object.
int getCongestionAt(int
x, int y, bool horizontal)
Returns the congestion (number of nets routed) at the specified edge.
Edge is specified according to its coordinate.
int getVerticalCongestionBetween(int
trackNum, int begin, int end)
Returns the congestion (number of nets routed) between the specified set
of edges. NOTE: a net will be counted more than once if it is routed
on multiple tracks between 'begin' and 'end'.
int getHorizontalCongestionBeween(int
trackNum, int begin, int end)
Returns the congestion (number of nets routed) between the specified set
of edges. NOTE: a net will be counted more than once if it is routed
on multiple tracks between 'begin' and 'end'.
int getRouteLength()
Returns the variable routeLength -- the total
amount of routing resources used in this object.
int getHorizontalCapacity()
Returns the horizontal capacity of this object.
int getVerticalCapacity()
Returns the vertical capacity of this object.
int getOverflow()
Returns the overflow of this object. Overflow of an edge is defined
as the number of nets routed over the edge minus the capacity of the edge.
The number must be non-negitive (i.e. if negitive, the overflow is zero).
int getWireLength()
Returns the total wire length of all the nets routed in this object.
NOTE: this is the same as the route length.
bool isOverflown(int
x, int y, bool horiz)
Returns 'true' if the specified edge has more nets routed over it than
the capacity of the edge. The edge is speciified by the given coordinate.
bool isDensityOneBendRoutable(Net
*aNet, int density)
Returns 'true' if the specified nets is routable (routing is restricted
to upper-L or lower-L) according to the given density. In other words,
the function returns 'true' if for at least one of the L routings of the
nets, the edges which the routing pass have a no more than 'density - 1'
edges routed over them. If this is true, then we can route the net
without going over the 'density' restriction on the RouteEdges.
bool isVerticalOneBendRoutableBetween(int
trackNum, int begin, int end, int density)
A function used by isDensityOneBendRoutable(). Determines whether
the vertical specified edges have less than 'density' - 1 nets routed over
them.
bool isHorizontalOneBendRoutableBetween(int
trackNum, int begin, int end, int density)
A function used by isDensityOneBendRoutable(). Determines whether
the horizontal specified edges have less than 'density' - 1 nets routed
over them.
void addNetToEdge(int
x, int y, bool horiz, Net * aNet)
Adds the specifed net to the specified edge. Edge is specified according
to its coordinate.
void removeNetFromEdge(int
x, int y, bool horiz, Net * aNet)
Removes the specified net from the specified edge. Edge is specified
according to its coordinate.
void addNetToEdgeWith(int
track, int edge, bool horiz, Net * aNet)
Adds the specified net to the specified edge. Edge is specified according
to it track and edge location.
void removeNetFromEdgeWith(int
track, int edge, bool horiz, Net * aNet)
Removes the specified net from the specified edge. Edge is specified
according to its track and edge location.
void setVerticalCapacity(int
cap)
Sets the vertical capacity verticalCapacity
to the specified value.
void setHorizontalCapacity(int
cap)
Sets the horizontal capacity horizontalCapacity
to the specified value.
void addHorizontalSegment(Net
*, int trackNum, int begin, int end)
Adds the specified net to the specified set of horizontal tracks.
void addVerticalSegment(Net
*, int trackNum, int begin, int end)
Adds the specified net to the specified set of vertical tracks.
NetList * ripNets()
Returns a list of nets which are good canidates for the ripup and reroute
procedure. The nets are choosen based on overflown edges. The
edges are sequentially searched until an overflown edge is found.
Once the edge is found, every net passing over this edge is unrouted and
these nets are returned. The function has memory, in that if it is
called successive times, it will start from the last found overflown edge
and not the first edge.
NetList *oldRipNets()
This is the old function for finding nets to ripup and reroute. The
new function is well tested and this function probably will no longer work.
It should probably be removed.
void printVerticalTracks()
Debugging function which will print the number of nets that cross over
the vertical tracks.
void printHorizontalTracks()
Debugging function which will print the number of nets that cross over
the horizontal tracks.
void print()
Debugging function which prints the number of nets that cross over the
vertical and horizontal tracks.
void printCongestionDisplayFile(ofstream
& stream)
Prints the congestion information to a file which can then be used by my
Java program to display the congestion.
void routeOneBendNet(Net
*aNet)
Takes a net and routes in a one bend fashion. The net is first split
into a set of two-terminal one bend routes according to the Prim's MST function
(see PrimMST). The one bend route is choosen
according to the function findOneBendRoute(). NOTE: the routings
are not checked for overlap, hence the net could have redundant route edges.
void findOneBendRoute(Net
* aNet, Pin *, Pin *)
Routes the specified pins of the net in a one bend fashion. The route
is choosen according to amount of overflow along its path. The route
with the least overflow (there are at most two one bend routes) is choosen.
void findZRoute(Net
*)
Takes a net and routes in a Z route fashion. A Z route (only works
when talking about two terminals) are the set of route which have two bends
and are restricted to be within the bounding box. This function breaks
the net into a set of two-terminal nets using Prim's MST algorithm
(see PrimMST). It then calls the function
findZRoute() on each two-terminal net. NOTE: the routings are
not checked for overlap, hence the net could have redundant route edges.
void findZRoute(Net*,
Pin *, Pin *)
Takes two terminals of a net and routes them in a Z route manner.
The function will choose the route whose path has the least amount of overflow.
void routeBBNet(Net *)
Takes a net and routes it as it's bounding box. This is not an exact
routing of the net i.e. all of the pins are not guaranteed to be connected.
It was created to be used for estiimation purposes.