VPR-6.0

vpr/SRC/base/vpr_types.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * This file contains the major data types used by VPR
00005  *
00006  * This document is divided into generally 4 major sections:
00007  *
00008  * 1.  Global data types and constants
00009  * 2.  Packing specific data types
00010  * 3.  Placement specific data types
00011  * 4.  Routing specific data types
00012  */
00013 
00014 
00015 #ifndef VPR_TYPES_H
00016 #define VPR_TYPES_H
00017 
00018 #include "arch_types.h"
00019 
00020 /*******************************************************************************
00021  * Global data types and constants
00022  ******************************************************************************/
00023 
00024 #ifndef SPEC
00025 #define DEBUG 1                 /** Echoes input & checks error conditions 
00026                                  Only causes about a 1% speed degradation in V 3.10 */
00027 #endif
00028 
00029 
00030 /*#define CREATE_ECHO_FILES*/ /* prints echo files */
00031 /*#define DEBUG_FAILED_PACKING_CANDIDATES*//*Displays candidates during packing that failed */
00032 /*#define PRINT_SINK_DELAYS*//*prints the sink delays to files */
00033 /*#define PRINT_NET_SLACKS*//*prints out all slacks in the circuit */
00034 /*#define PRINT_PLACE_CRIT_PATH*//*prints out placement estimated critical path */
00035 /*#define PRINT_NET_DELAYS*//*prints out delays for all connections */
00036 /*#define PRINT_TIMING_GRAPH*//*prints out the timing graph */
00037 /*#define PRINT_REL_POS_DISTR *//*prints out the relative distribution graph for placements */
00038 /*#define DUMP_BLIF_ECHO *//*dump blif of internal representation of user circuit.  Useful for ensuring functional correctness via logical equivalence with input blif*/
00039 
00040 
00041 #ifdef SPEC
00042 #define NO_GRAPHICS             /**< Rips out graphics (for non-X11 systems)      */
00043 #define NDEBUG                  /**< Turns off assertion checking for extra speed */
00044 #endif
00045 
00046 #define TOKENS " \t\n"          /**< Input file parsing. */
00047 
00048 /*#define VERBOSE 1*/ /**< Prints all sorts of intermediate data */
00049 
00050 typedef size_t bitfield;
00051 
00052 #define MINOR 0                 /**< For update_screen.  Denotes importance of update. */
00053 #define MAJOR 1
00054 
00055 #define HUGE_FLOAT 1.e30
00056 
00057 #define MAX_SHORT 32767
00058 
00059 #define EQUAL_DEF 1e-6            /**< used in some if == equations to allow very       
00060                                    * close values to be considered equal              */
00061 
00062 #define HIGH_FANOUT_NET_LIM 64 /**< All nets with this number of sinks or more are considered high fanout nets */
00063 
00064 #define FIRST_ITER_WIRELENTH_LIMIT 0.85 /**< If used wirelength exceeds this value in first iteration of routing, do not route */
00065 
00066 #define EMPTY -1
00067 
00068 /*******************************************************************************
00069  * Packing specific data types and constants
00070  * Packing takes the circuit described in the technology mapped user netlist
00071  * and maps it to the complex logic blocks found in the arhictecture
00072  ******************************************************************************/
00073 
00074 #define NO_CLUSTER -1
00075 #define NEVER_CLUSTER -2
00076 #define NOT_VALID -10000  /**< Marks gains that aren't valid */
00077                                                   /**< Ensure no gain can ever be this negative! */
00078 #ifndef UNDEFINED                                                
00079 #define UNDEFINED -1    
00080 #endif
00081 
00082 
00083 /** netlist blocks are assigned one of these types */
00084 enum logical_block_types {
00085         VPACK_INPAD = -2, 
00086         VPACK_OUTPAD, 
00087         VPACK_COMB, 
00088         VPACK_LATCH, 
00089         VPACK_EMPTY};
00090 
00091 /** Selection algorithm for selecting next seed  */
00092 enum e_cluster_seed {
00093         VPACK_TIMING, 
00094         VPACK_MAX_INPUTS};
00095 
00096 /** Data structure to track nets during blif parsing */
00097 struct hash_logical_nets {
00098         char *name; /**< net name */
00099         int index; /**< Array index for net */
00100         int count; /**< count is the number of pins on this vpack_net so far. */
00101         struct hash_logical_nets *next; /**< Linked list pointer for net */
00102 }; 
00103 
00104 
00105 enum e_block_pack_status {BLK_PASSED, BLK_FAILED_FEASIBLE, BLK_FAILED_ROUTE, BLK_STATUS_UNDEFINED};
00106 
00107 struct s_rr_node; /** defined later, but need to declare here because it is used */
00108 
00109 /** Stores statistical information for pb such as cost information */
00110 struct s_pb_stats {
00111         /**@{*/
00112         /** Packing statistics. */
00113         float *gain; /**< Attraction (inverse of cost) function */
00114 
00115         /** [0..num_logical_blocks-1]. The timing criticality score of this logical_block. Determined by the most 
00116         critical vpack_net between this logical_block and any logical_block in the current pb */
00117         float *lengthgain;
00118         float *connectiongain; /**< [0..num_logical_blocks-1] Weighted sum of connections to attraction function */
00119         float *prevconnectiongainincr; /**< [0..num_logical_blocks-1] Prev sum to weighted sum of connections to attraction function */
00120         float *sharinggain; /**< [0..num_logical_blocks-1]. How many nets on this logical_block are already in the pb under consideration */
00121 
00122         /** [0..num_logical_blocks-1]. This is the gain used for hill-climbing. It stores
00123          * the reduction in the number of pins that adding this logical_block to the the
00124          * current pb will have. This reflects the fact that sometimes the 
00125          * addition of a logical_block to a pb may reduce the number of inputs     
00126          * required if it shares inputs with all other BLEs and it's output is  
00127          * used by all other child pbs in this parent pb.                               */
00128         float *hillgain;
00129 
00130         /** [0..num_marked_nets] and [0..num_marked_blocks] respectively.  List  
00131          * the indices of the nets and blocks that have had their num_pins_of_  
00132          * net_in_pb and gain entries altered.                             */
00133         int *marked_nets, *marked_blocks;
00134         int num_marked_nets, num_marked_blocks;
00135 
00136         /** [0..num_logical_nets-1].  How many pins of each vpack_net are contained in the 
00137          * currently open pb?                                          */
00138         int *num_pins_of_net_in_pb;
00139 
00140         /** [0..num_logical_nets-1].  Is the driver for this vpack_net in the open pb? */
00141         boolean *net_output_in_pb;
00142         /**@}*/
00143 
00144         /**@{*/
00145         /** Basic constraint checking */
00146         int inputs_avail;
00147         int outputs_avail;
00148         int clocks_avail;
00149         /**@}*/
00150 
00151         /* Array of feasible blocks to select from [0..num_marked_models-1][0..num_blocks-1] 
00152            Sorted in ascending gain order so that the last block is the most desirable (this makes it easy to pop blocks off the list
00153         */
00154         int **feasible_blocks;
00155         int *num_feasible_blocks; /**< [0..num_marked_models-1] */
00156         int num_marked_models;
00157         int cur_marked_model; /**< current model to consider, if NOT_VALID, refresh list */
00158 }; 
00159 typedef struct s_pb_stats t_pb_stats;
00160 
00161 /** An FPGA complex block is represented by a hierarchy of physical blocks.  
00162  *  These include leaf physical blocks that a netlist block can map to (such as LUTs, flip-flops, memory slices, etc),
00163  *  parent physical blocks that contain children physical blocks (such as a BLE) that may be leaves or parents of other physical blocks,
00164  *  and the top-level phyiscal block which represents the complex block itself (such as a clustered logic block).
00165  *
00166  *  All physical blocks are represented by this s_pb data structure.
00167  */
00168 struct s_pb
00169 {
00170     char *name;                                         /**< Name of this physical block */
00171         t_pb_graph_node *pb_graph_node; /**< pointer to pb_graph_node this pb corresponds to */
00172         int logical_block;                              /**< If this is a terminating pb, gives the logical (netlist) block that it contains */
00173 
00174         int mode;                                               /**< mode that this pb is set to */
00175         
00176         struct s_pb **child_pbs;                /**< children pbs attached to this pb [0..num_child_pb_types - 1][0..child_type->num_pb - 1] */
00177         struct s_pb *parent_pb;                 /**< pointer to parent node */
00178 
00179         struct s_rr_node *rr_graph;             /**< pointer to rr_graph connecting pbs of cluster */
00180         struct s_pb_stats pb_stats;             /**< statistics for current pb */
00181 
00182         struct s_net *local_nets;               /**< Records post-packing connections, valid only for top-level */
00183         int num_local_nets;                             /**< Records post-packing connections, valid only for top-level */
00184 };
00185 typedef struct s_pb t_pb;
00186 
00187 struct s_tnode;
00188 
00189 
00190 /** Technology-mapped user netlist block */
00191 struct s_logical_block {
00192         char *name;                                             /**< Taken from the first vpack_net which it drives. */
00193         enum logical_block_types type;  /**< I/O, combinational logic, or latch */
00194         t_model* model;                 /**< Technology-mapped type (eg. LUT, Flip-flop, memory slice, inpad, etc) */
00195 
00196         int **input_nets;                               /**< [0..num_input_ports-1][0..num_port_pins-1] List of input nets connected to this logical_block. */
00197         int **output_nets;                              /**< [0..num_output_ports-1][0..num_port_pins-1] List of output nets connected to this logical_block. */
00198         int clock_net;                                  /**< List of clock net connected to this logical_block.                 */
00199 
00200         int used_input_pins;                    /**< Number of used input pins */
00201 
00202         int clb_index;                                  /**< Complex block index that this logical block got mapped to */
00203 
00204         int index;                                              /**< Index in array that this block can be found */
00205         t_pb* pb;                                               /**<  pb primitive that this block is packed into */
00206 
00207         /**@{*/
00208         /** timing information */
00209         struct s_tnode ***input_net_tnodes;      /**< [0..num_input_ports-1][0..num_pins -1] correspnding input net tnode */
00210         struct s_tnode ***output_net_tnodes; /**< [0..num_output_ports-1][0..num_pins -1] correspnding output net tnode */
00211         struct s_tnode *clock_net_tnode;         /**< correspnding clock net tnode */
00212         /**@}*/
00213 
00214         struct s_linked_vptr *truth_table;   /**< If this is a LUT (.names), then this is the logic that the LUT implements */
00215 };
00216 typedef struct s_logical_block t_logical_block;
00217 
00218 /**@{*/
00219 /** Built-in library models */
00220 #define MODEL_LOGIC "names"
00221 #define MODEL_LATCH "latch"
00222 #define MODEL_INPUT "input"
00223 #define MODEL_OUTPUT "output"
00224 /**@}*/
00225 
00226 
00227 /******************************************************************
00228 * Timing data structures begin 
00229 *******************************************************************/
00230 
00231 /** Timing graph information 
00232  * - to_node: index of node at the sink end of this edge.                      
00233  * - Tdel: delay to go to to_node along this edge.                            
00234  */
00235 typedef struct
00236 {
00237     int to_node;
00238     float Tdel;
00239 }
00240 t_tedge;
00241 
00242 
00243 /** - type:  What is this tnode? (Pad pin, clb pin, subblock pin, etc.)         
00244  * - ipin:  Number of the CLB or subblock pin this tnode represents, if        
00245  *        applicable.                                                        
00246  * - isubblk: Number of the subblock this tnode is part of, if applicable.     
00247  * - iblk:  Number of the block (CLB or PAD) this tnode is part of.            
00248  */
00249 typedef enum
00250 { INPAD_SOURCE, INPAD_OPIN, OUTPAD_IPIN, OUTPAD_SINK,
00251     CB_IPIN, CB_OPIN, INTERMEDIATE_NODE, PRIMITIVE_IPIN, PRIMITIVE_OPIN, 
00252         FF_IPIN, FF_OPIN,
00253         FF_SINK, FF_SOURCE,
00254     CONSTANT_GEN_SOURCE
00255 }
00256 t_tnode_type;
00257 
00258 /** tnode data structure for a node in a timing graph
00259  * - out_edges: [0..num_edges - 1].  Array of the edges leaving this tnode.    
00260  * - num_edges: Number of edges leaving this node.                             
00261  * - T_arr:  Arrival time of the last input signal to this node.               
00262  * - T_req:  Required arrival time of the last input signal to this node if    
00263  *         the critical path is not to be lengthened.                        
00264  * - type:  What is this tnode? (Pad pin, clb pin, subblock pin, etc.)         
00265  * - pb_graph_pin:  pb pin that this block is connected to                     
00266  * - block: Which block this pin is connected to
00267  * - index: index of array this tnode belongs to
00268  * - num_critical_input_paths, num_critical_output_paths: Count total number of near critical paths that go through this node *
00269  */
00270 struct s_tnode
00271 {
00272     t_tedge *out_edges;
00273     int num_edges;
00274     float T_arr;
00275     float T_req;        
00276         int block;
00277 
00278         /**@{*/
00279         /** post-packing timing graph */
00280         t_tnode_type type;
00281         t_pb_graph_pin *pb_graph_pin;
00282         /**@}*/
00283         
00284         /**@{*/
00285         /** pre-packing timing graph */
00286         int model_port, model_pin;                                                                      /**< technology mapped model port/pin */
00287         long num_critical_input_paths, num_critical_output_paths;   /**< count of critical paths passing through this tnode */
00288         float normalized_slack;                                                                         /**< slack (normalized with respect to max slack) */
00289         float normalized_total_critical_paths;                                          /**< critical path count (normalized with respect to max count) */
00290         float normalized_T_arr;                                                                         /**< arrival time (normalized with respect to max time) */
00291         /**@}*/
00292 
00293         int index;
00294 };
00295 typedef struct s_tnode t_tnode;
00296 
00297 
00298 /***************************************************************************
00299 * Placement and routing data types
00300 ****************************************************************************/
00301 
00302 /* Timing data structures end */
00303 /** Annealing schedule */
00304 enum sched_type
00305 { AUTO_SCHED, USER_SCHED };     
00306 
00307 /** What's on screen? */
00308 enum pic_type
00309 { NO_PICTURE, PLACEMENT, ROUTING };     
00310 
00311 /** For the placer.  Different types of cost functions that can be used. */
00312 /** Nonlinear placement is deprecated */
00313 enum place_c_types
00314 { LINEAR_CONG, NONLINEAR_CONG }; 
00315 
00316 /** Map netlist to FPGA or timing analyze only */
00317 enum e_operation
00318 { RUN_FLOW, TIMING_ANALYSIS_ONLY
00319 };
00320 
00321 enum pfreq
00322 { PLACE_NEVER, PLACE_ONCE, PLACE_ALWAYS };
00323 
00324 
00325 /** Are the pads free to be moved, locked in a random configuration, or 
00326  * locked in user-specified positions?                                 
00327  */
00328 enum e_pad_loc_type
00329 { FREE, RANDOM, USER };
00330 
00331 /** - name:  ASCII net name for informative annotations in the output.          
00332  * - num_sinks:  Number of sinks on this net.                                  
00333  * - node_block: [0..num_sinks]. Contains the blocks to which the nodes of this 
00334  *         net connect.  The source block is node_block[0] and the sink blocks
00335  *         are the remaining nodes.
00336  * - node_block_port: [0..num_sinks]. Contains port index (on a block) to 
00337  *          which each net terminal connects. 
00338  * - node_block_pin: [0..num_sinks]. Contains the index of the pin (on a block) to 
00339  *          which each net terminal connects. 
00340  * - is_global: not routed
00341  * - is_const_gen: constant generator (does not affect timing) 
00342  */
00343 struct s_net
00344 {
00345     char *name;
00346     int num_sinks;
00347     int *node_block;
00348         int *node_block_port;
00349     int *node_block_pin;
00350     boolean is_global;
00351         boolean is_const_gen;
00352 };
00353 
00354 /** s_grid_tile is the minimum tile of the fpga                         
00355  * - type:  Pointer to type descriptor, NULL for illegal, IO_TYPE for io 
00356  * - offset: Number of grid tiles above the bottom location of a block 
00357  * - usage: Number of blocks used in this grid tile
00358  * - blocks[]: Array of logical blocks placed in a physical position, EMPTY means
00359  *            no block at that index 
00360  */
00361 struct s_grid_tile
00362 {
00363     t_type_ptr type;
00364     int offset;
00365     int usage;
00366     int *blocks;
00367 };
00368 
00369 /** Stores the bounding box of a net in terms of the minimum and  
00370  * maximum coordinates of the blocks forming the net, clipped to 
00371  * the region (1..nx, 1..ny).                                    
00372  */
00373 struct s_bb
00374 {
00375     int xmin;
00376     int xmax;
00377     int ymin;
00378     int ymax;
00379 };
00380 
00381 
00382 /** - capacity:   Capacity of this region, in tracks.               
00383  * - occupancy:  Expected number of tracks that will be occupied.  
00384  * - cost:       Current cost of this usage.                       
00385  */
00386 struct s_place_region
00387 {
00388     float capacity;
00389     float inv_capacity;
00390     float occupancy;
00391     float cost;
00392 };
00393 
00394 
00395 /**
00396  * Represents a clustered logic block of a user circuit that fits into one unit of space in an FPGA grid block
00397  * - name: identifier for this block
00398  * - type: the type of physical block this user circuit block can map into
00399  * - nets: nets that connect to other user circuit blocks
00400  * - x: x-coordinate
00401  * - y: y-coordinate
00402  * - z: occupancy coordinate
00403  * - pb: Physical block representing the clustering of this CLB
00404  */
00405 struct s_block
00406 {
00407     char *name;
00408     t_type_ptr type;
00409     int *nets;
00410     int x;
00411     int y;
00412     int z;
00413 
00414         t_pb *pb;
00415         
00416 };
00417 typedef struct s_block t_block;
00418 
00419 /** Names of various files */
00420 struct s_file_name_opts
00421 {
00422     char *ArchFile;
00423         char *CircuitName;
00424         char *BlifFile;
00425         char *NetFile;
00426         char *PlaceFile;
00427         char *RouteFile;
00428         char *OutFilePrefix;    
00429 };
00430 
00431 /* Options for packing
00432  * TODO: document each packing parameter         
00433  */
00434 enum e_packer_algorithm
00435 { PACK_GREEDY, PACK_BRUTE_FORCE};
00436 
00437 struct s_packer_opts
00438 {
00439     char *blif_file_name;
00440         char *output_file;
00441         boolean global_clocks;
00442         int clocks_per_cluster;
00443         boolean hill_climbing_flag;
00444         boolean sweep_hanging_nets_and_inputs;
00445         boolean timing_driven;
00446         enum e_cluster_seed cluster_seed_type;
00447         float alpha;
00448         float beta;
00449         int recompute_timing_after;
00450         float block_delay;
00451         float intra_cluster_net_delay;
00452         float inter_cluster_net_delay;
00453         boolean skip_clustering;
00454         boolean allow_unrelated_clustering;
00455         boolean allow_early_exit;
00456         boolean connection_driven;
00457         boolean doPacking;
00458         boolean hack_no_legal_frac_lut;
00459         boolean hack_safe_latch;
00460         enum e_packer_algorithm packer_algorithm;
00461         float aspect;
00462 };
00463 
00464 
00465 /** Annealing schedule information for the placer.  The schedule type      
00466  * is either USER_SCHED or AUTO_SCHED.  Inner_num is multiplied by        
00467  * num_blocks^4/3 to find the number of moves per temperature.  The       
00468  * remaining information is used only for USER_SCHED, and have the        
00469  * obvious meanings.                                                      
00470  */
00471 struct s_annealing_sched
00472 {
00473     enum sched_type type;
00474     float inner_num;
00475     float init_t;
00476     float alpha_t;
00477     float exit_t;
00478 };
00479 
00480 
00481 enum e_place_algorithm
00482 { BOUNDING_BOX_PLACE, NET_TIMING_DRIVEN_PLACE,
00483     PATH_TIMING_DRIVEN_PLACE
00484 };
00485 
00486 /** Various options for the placer.                                           
00487  * - place_algorithm:  BOUNDING_BOX_PLACE or NET_TIMING_DRIVEN_PLACE, or       
00488  *                   PATH_TIMING_DRIVEN_PLACE                                
00489  * - timing_tradeoff:  When TIMING_DRIVEN_PLACE mode, what is the tradeoff *
00490  *                   timing driven and BOUNDING_BOX_PLACE.                   
00491  * - block_dist:  Initial guess of how far apart blocks on the critical path   
00492  *              This is used to compute the initial slacks and criticalities 
00493  * - place_cost_type:  LINEAR_CONG or NONLINEAR_CONG.                          
00494  * - place_cost_exp:  Power to which denominator is raised for linear_cong.    
00495  * - place_chan_width:  The channel width assumed if only one placement is     
00496  *                    performed.                                             
00497  * - pad_loc_type:  Are pins FREE, fixed randomly, or fixed from a file.  *
00498  * - pad_loc_file:  File to read pin locations form if pad_loc_type  *
00499  *                     is USER.                                              
00500  * - place_freq:  Should the placement be skipped, done once, or done for each 
00501  *              channel width in the binary search.                          
00502  * - num_regions:  Used only with NONLINEAR_CONG; in that case, congestion is  
00503  *               computed on an array of num_regions x num_regions basis.    
00504  * - recompute_crit_iter: how many temperature stages pass before we recompute 
00505  *               criticalities based on average point to point delay         
00506  * - enable_timing_computations: in bounding_box mode, normally, timing        
00507  *               information is not produced, this causes the information    
00508  *               to be computed. in *_TIMING_DRIVEN modes, this has no effect
00509  * - inner_loop_crit_divider: (move_lim/inner_loop_crit_divider) determines how
00510  *               many inner_loop iterations pass before a recompute of       
00511  *               criticalities is done.                                      
00512  * - td_place_exp_first: exponent that is used on the timing_driven criticlity 
00513  *               it is the value that the exponent starts at.                
00514  * - td_place_exp_last: value that the criticality exponent will be at the end 
00515  * - doPlacement: TRUE if placement is supposed to be done in the CAD flow, FALSE otherwise 
00516  */
00517 struct s_placer_opts
00518 {
00519     enum e_place_algorithm place_algorithm;
00520     float timing_tradeoff;
00521     int block_dist;
00522     enum place_c_types place_cost_type;
00523     float place_cost_exp;
00524     int place_chan_width;
00525     enum e_pad_loc_type pad_loc_type;
00526     char *pad_loc_file;
00527     enum pfreq place_freq;
00528     int num_regions;
00529     int recompute_crit_iter;
00530     boolean enable_timing_computations;
00531     int inner_loop_recompute_divider;
00532     float td_place_exp_first;
00533     int seed;
00534     float td_place_exp_last;
00535         boolean doPlacement;
00536 };
00537 
00538 enum e_route_type
00539 { GLOBAL, DETAILED };
00540 enum e_router_algorithm
00541 { BREADTH_FIRST, TIMING_DRIVEN, DIRECTED_SEARCH };
00542 enum e_base_cost_type
00543 { INTRINSIC_DELAY, DELAY_NORMALIZED, DEMAND_ONLY };
00544 
00545 #define NO_FIXED_CHANNEL_WIDTH -1
00546 
00547 /** All the parameters controlling the router's operation are in this        
00548  * structure.                                                               
00549  * - first_iter_pres_fac:  Present sharing penalty factor used for the        
00550  *                 very first (congestion mapping) Pathfinder iteration.    
00551  * - initial_pres_fac:  Initial present sharing penalty factor for            
00552  *                    Pathfinder; used to set pres_fac on 2nd iteration.    
00553  * - pres_fac_mult:  Amount by which pres_fac is multiplied each              
00554  *                 routing iteration.                                       
00555  * - acc_fac:  Historical congestion cost multiplier.  Used unchanged         
00556  *           for all iterations.                                            
00557  * - bend_cost:  Cost of a bend (usually non-zero only for global routing).   
00558  * - max_router_iterations:  Maximum number of iterations before giving       
00559  *                up.                                                       
00560  * - bb_factor:  Linear distance a route can go outside the net bounding      
00561  *             box.                                                         
00562  * - route_type:  GLOBAL or DETAILED.                                         
00563  * - fixed_channel_width:  Only attempt to route the design once, with the    
00564  *                       channel width given.  If this variable is          
00565  *                       == NO_FIXED_CHANNEL_WIDTH, do a binary search      
00566  *                       on channel width.                                  
00567  * router_algorithm:  BREADTH_FIRST or TIMING_DRIVEN.  Selects the desired  
00568  *                    routing algorithm.                                    
00569  * - base_cost_type: Specifies how to compute the base cost of each type of   
00570  *                 rr_node.  INTRINSIC_DELAY -> base_cost = intrinsic delay 
00571  *                 of each node.  DELAY_NORMALIZED -> base_cost = "demand"  
00572  *                 x average delay to route past 1 CLB.  DEMAND_ONLY ->     
00573  *                 expected demand of this node (old breadth-first costs).  
00574  *                                                                          
00575  * The following parameters are used only by the timing-driven router.      
00576  *                                                                          
00577  * - astar_fac:  Factor (alpha) used to weight expected future costs to       
00578  *             target in the timing_driven router.  astar_fac = 0 leads to  
00579  *             an essentially breadth-first search, astar_fac = 1 is near   
00580  *             the usual astar algorithm and astar_fac > 1 are more         
00581  *             aggressive.                                                  
00582  * - max_criticality: The maximum criticality factor (from 0 to 1) any sink   
00583  *                  will ever have (i.e. clip criticality to this number).  
00584  * - criticality_exp: Set criticality to (path_length(sink) / longest_path) ^ 
00585  *                  criticality_exp (then clip to max_criticality).         
00586  * - doRouting: True if routing is supposed to be done, FALSE otherwise 
00587  */
00588 struct s_router_opts
00589 {
00590     float first_iter_pres_fac;
00591     float initial_pres_fac;
00592     float pres_fac_mult;
00593     float acc_fac;
00594     float bend_cost;
00595     int max_router_iterations;
00596     int bb_factor;
00597     enum e_route_type route_type;
00598     int fixed_channel_width;
00599     enum e_router_algorithm router_algorithm;
00600     enum e_base_cost_type base_cost_type;
00601     float astar_fac;
00602     float max_criticality;
00603     float criticality_exp;
00604         boolean verify_binary_search;
00605         boolean full_stats;
00606         boolean doRouting;
00607 };
00608 
00609 
00610 /** Defines the detailed routing architecture of the FPGA.  Only important   
00611  * if the route_type is DETAILED.                                           
00612  * - directionality: Should the tracks be uni-directional or     
00613  *                            bi-directional? (UDSD by AY)                              
00614  * - Fc_type:   Are the Fc values below absolute numbers, or fractions of W?  
00615  * - Fc_output:  Number of tracks to which each clb output pin connect in     
00616  *             each channel to which it is adjacent.                        
00617  * - Fc_input:  Number of tracks to which each clb input pin connects.        
00618  * - Fc_pad:    Number of tracks to which each I/O pad connects.              
00619  * - switch_block_type:  Pattern of switches at each switch block.  I         
00620  *           assume Fs is always 3.  If the type is SUBSET, I use a         
00621  *           Xilinx-like switch block where track i in one channel always   
00622  *           connects to track i in other channels.  If type is WILTON,     
00623  *           I use a switch block where track i does not always connect     
00624  *           to track i in other channels.  See Steve Wilton, Phd Thesis,   
00625  *           University of Toronto, 1996.  The UNIVERSAL switch block is    
00626  *           from Y. W. Chang et al, TODAES, Jan. 1996, pp. 80 - 101.       
00627  * - num_segment:  Number of distinct segment types in the FPGA.              
00628  * - num_switch:  Number of distinct switch types (pass transistors or        
00629  *              buffers) in the FPGA.                                       
00630  * - delayless_switch:  Index of a zero delay switch (used to connect things  
00631  *                    that should have no delay).                           
00632  * - wire_to_ipin_switch:  Index of a switch used to connect wire segments    
00633  *                       to clb or pad input pins (IPINs).                  
00634  * - R_minW_nmos:  Resistance (in Ohms) of a minimum width nmos transistor.   
00635  *               Used only in the FPGA area model.                          
00636  * - R_minW_pmos:  Resistance (in Ohms) of a minimum width pmos transistor.   
00637  */
00638 struct s_det_routing_arch
00639 {
00640     enum e_directionality directionality;       /* UDSD by AY */
00641     int Fs;
00642     enum e_switch_block_type switch_block_type;
00643     int num_segment;
00644     short num_switch;
00645     short global_route_switch;
00646     short delayless_switch;
00647     short wire_to_ipin_switch;
00648     float R_minW_nmos;
00649     float R_minW_pmos;
00650 };
00651 
00652 
00653 
00654 
00655 enum e_drivers
00656 { MULTI_BUFFERED, SINGLE }; /* legacy routing drivers by Andy Ye (remove or integrate in future) */
00657 
00658 enum e_direction
00659 {
00660     INC_DIRECTION = 0,
00661     DEC_DIRECTION = 1,
00662     BI_DIRECTION = 2
00663 };                              /* UDSD by AY */
00664 
00665 /** Lists detailed information about segmentation.  [0 .. W-1].              
00666  * - length:  length of segment.                                              
00667  * - start:  index at which a segment starts in channel 0.                    
00668  * - longline:  TRUE if this segment spans the entire channel.                
00669  * - sb:  [0..length]:  TRUE for every channel intersection, relative to the  
00670  *      segment start, at which there is a switch box.                      
00671  * - cb:  [0..length-1]:  TRUE for every logic block along the segment at     
00672  *      which there is a connection box.                                    
00673  * - wire_switch:  Index of the switch type that connects other wires *to*    
00674  *               this segment.                                              
00675  * - opin_switch:  Index of the switch type that connects output pins (OPINs) 
00676  *               *to* this segment.                                         
00677  * - Cmetal: Capacitance of a routing track, per unit logic block length.     
00678  * - Rmetal: Resistance of a routing track, per unit logic block length.      
00679  * - direction: The direction of a routing track. (UDSD by AY)                 
00680  * - drivers: How do signals driving a routing track connect to  
00681  *                       the track? (UDSD by AY)                                         
00682  * - index: index of the segment type used for this track.                    
00683  */
00684 typedef struct s_seg_details
00685 {
00686     int length;
00687     int start;
00688     boolean longline;
00689     boolean *sb;
00690     boolean *cb;
00691     short wire_switch;
00692     short opin_switch;
00693     float Rmetal;
00694     float Cmetal;
00695     boolean twisted;
00696     enum e_direction direction; /* UDSD by AY */
00697     enum e_drivers drivers;     /* UDSD by AY */
00698     int group_start;
00699     int group_size;
00700     int index;
00701 }
00702 t_seg_details;
00703 
00704 /** A linked list of float pointers.  Used for keeping track of   
00705  * which pathcosts in the router have been changed.              
00706  */
00707 struct s_linked_f_pointer
00708 {
00709     struct s_linked_f_pointer *next;
00710     float *fptr;
00711 };
00712 
00713 
00714 /* Uncomment lines below to save some memory, at the cost of debugging ease. */
00715 /*enum e_rr_type {SOURCE, SINK, IPIN, OPIN, CHANX, CHANY}; */
00716 /* typedef short t_rr_type */
00717 
00718 /** Type of a routing resource node.  x-directed channel segment,   
00719  * y-directed channel segment, input pin to a clb to pad, output   
00720  * from a clb or pad (i.e. output pin of a net) and:               
00721  * - SOURCE:  A dummy node that is a logical output within a block   
00722  *          -- i.e., the gate that generates a signal.             
00723  * - SINK:    A dummy node that is a logical input within a block    
00724  *          -- i.e. the gate that needs a signal.                  
00725  */
00726 typedef enum e_rr_type
00727 { SOURCE = 0, SINK, IPIN, OPIN, CHANX, CHANY, INTRA_CLUSTER_EDGE, NUM_RR_TYPES }
00728 t_rr_type;
00729 
00730 
00731 /** Basic element used to store the traceback (routing) of each net.        
00732  * - index:   Array index (ID) of this routing resource node.                
00733  * - iswitch:  Index of the switch type used to go from this rr_node to      
00734  *           the next one in the routing.  OPEN if there is no next node   
00735  *           (i.e. this node is the last one (a SINK) in a branch of the   
00736  *           net's routing).                                               
00737  * - next:    pointer to the next traceback element in this route.           
00738  */
00739 struct s_trace
00740 {
00741     int index;
00742     short iswitch;
00743     struct s_trace *next;
00744 };
00745 
00746 
00747 
00748 #define NO_PREVIOUS -1
00749 
00750 /** Main structure describing one routing resource node.  Everything in      
00751  * this structure should describe the graph -- information needed only       
00752  * to store algorithm-specific data should be stored in one of the           
00753  * parallel rr_node_?? structures.                                           
00754  *                                                                           
00755  * - xlow, xhigh, ylow, yhigh:  Integer coordinates (see route.c for           
00756  *       coordinate system) of the ends of this routing resource.            
00757  *       xlow = xhigh and ylow = yhigh for pins or for segments of           
00758  *       length 1.  These values are used to decide whether or not this      
00759  *       node should be added to the expansion heap, based on things         
00760  *       like whether it's outside the net bounding box or is moving         
00761  *       further away from the target, etc.                                  
00762  * - type:  What is this routing resource?                                     
00763  * - ptc_num:  Pin, track or class number, depending on rr_node type.          
00764  *           Needed to properly draw.                                        
00765  * - cost_index: An integer index into the table of routing resource indexed   
00766  *             data (this indirection allows quick dynamic changes of rr     
00767  *             base costs, and some memory storage savings for fields that   
00768  *             have only a few distinct values).                             
00769  * - occ:        Current occupancy (usage) of this node.                       
00770  * - capacity:   Capacity of this node (number of routes that can use it).     
00771  * - num_edges:  Number of edges exiting this node.  That is, the number       
00772  *             of nodes to which it connects.                                
00773  * - edges[0..num_edges-1]:  Array of indices of the neighbours of this        
00774  *                         node.                                             
00775  * - switches[0..num_edges-1]:  Array of switch indexes for each of the        
00776  *                            edges leaving this node.                       
00777  *                                                                           
00778  * The following parameters are only needed for timing analysis.             
00779  * - R:  Resistance to go through this node.  This is only metal               
00780  *     resistance (end to end, so conservative) -- it doesn't include the    
00781  *     switch that leads to another rr_node.                                 
00782  * - C:  Total capacitance of this node.  Includes metal capacitance, the      
00783  *     input capacitance of all switches hanging off the node, the           
00784  *     output capacitance of all switches to the node, and the connection    
00785  *     box buffer capacitances hanging off it.                               
00786  * - direction: if the node represents a track, this field        
00787  *                         indicates the direction of the track. Otherwise   
00788  *                         the value contained in the field should be        
00789  *                         ignored. (UDSD by AY)                                           
00790  * - drivers: if the node represents a track, this field          
00791  *                       indicates the driving architecture of the track.    
00792  *                       Otherwise the value contained in the field should   
00793  *                       be ignored. (UDSD by AY)                                        
00794  */
00795 typedef struct s_rr_node
00796 {
00797     short xlow;
00798     short xhigh;
00799     short ylow;
00800     short yhigh;
00801 
00802     short ptc_num;
00803 
00804     short cost_index;
00805     short occ;
00806     short capacity;
00807     short fan_in;
00808     short num_edges;
00809     t_rr_type type;
00810     int *edges;
00811     short *switches;
00812 
00813     float R;
00814     float C;
00815 
00816     enum e_direction direction; /* UDSD by AY */
00817     enum e_drivers drivers;     /* UDSD by AY */
00818     int num_wire_drivers;       /* UDSD by WMF */
00819     int num_opin_drivers;       /* UDSD by WMF (could use "short") */
00820 
00821         /* Used by clustering only (TODO, may wish to extend to regular router) */
00822         int prev_node;
00823         int prev_edge; 
00824         int net_num;
00825         t_pb_graph_pin *pb_graph_pin;
00826         t_tnode *tnode;
00827         float pack_intrinsic_cost;
00828 }
00829 t_rr_node;
00830 
00831 /** Data that is pointed to by the .cost_index member of t_rr_node.  It's    
00832  * purpose is to store the base_cost so that it can be quickly changed       
00833  * and to store fields that have only a few different values (like           
00834  * seg_index) or whose values should be an average over all rr_nodes of a    
00835  * certain type (like T_linear etc., which are used to predict remaining     
00836  * delay in the timing_driven router).                                       
00837  *                                                                           
00838  * - base_cost:  The basic cost of using an rr_node.                           
00839  * - ortho_cost_index:  The index of the type of rr_node that generally        
00840  *                    connects to this type of rr_node, but runs in the      
00841  *                    orthogonal direction (e.g. vertical if the direction   
00842  *                    of this member is horizontal).                         
00843  * - seg_index:  Index into segment_inf of this segment type if this type of   
00844  *             rr_node is an CHANX or CHANY; OPEN (-1) otherwise.            
00845  * - inv_length:  1/length of this type of segment.                            
00846  * - T_linear:  Delay through N segments of this type is N * T_linear + N^2 *  
00847  *            T_quadratic.  For buffered segments all delay is T_linear.     
00848  * - T_quadratic:  Dominant delay for unbuffered segments, 0 for buffered      
00849  *               segments.                                                   
00850  * - C_load:  Load capacitance seen by the driver for each segment added to    
00851  *          the chain driven by the driver.  0 for buffered segments.        
00852  */
00853 typedef struct s_rr_indexed_data
00854 {
00855     float base_cost;
00856     float saved_base_cost;
00857     int ortho_cost_index;
00858     int seg_index;
00859     float inv_length;
00860     float T_linear;
00861     float T_quadratic;
00862     float C_load;
00863 }
00864 t_rr_indexed_data;
00865 
00866 /** Gives the index of the SOURCE, SINK, OPIN, IPIN, etc. member of           
00867  * rr_indexed_data.                                                          
00868  */
00869 enum e_cost_indices
00870 { SOURCE_COST_INDEX = 0, SINK_COST_INDEX, OPIN_COST_INDEX,
00871     IPIN_COST_INDEX, CHANX_COST_INDEX_START
00872 };
00873 
00874 /** Type to store our list of token to enum pairings */
00875 struct s_TokenPair
00876 {
00877     char *Str;
00878     int Enum;
00879 };
00880 
00881 
00882 #endif
00883