00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <assert.h>
00004 #include "util.h"
00005 #include "vpr_types.h"
00006 #include "globals.h"
00007 #include "graphics.h"
00008 #include "read_netlist.h"
00009 #include "print_netlist.h"
00010 #include "draw.h"
00011 #include "place_and_route.h"
00012 #include "stats.h"
00013 #include "path_delay.h"
00014 #include "OptionTokens.h"
00015 #include "ReadOptions.h"
00016 #include "xml_arch.h"
00017 #include "SetupVPR.h"
00018 #include "rr_graph.h"
00019
00020
00021 int Fs_seed = -1;
00022 boolean WMF_DEBUG = FALSE;
00023
00024 int W_seed = -1;
00025 int binary_search = -1;
00026 char *OutFilePrefix = NULL;
00027
00028 float grid_logic_tile_area = 0;
00029 float ipin_mux_trans_size = 0;
00030
00031
00032
00033 int num_nets = 0;
00034 struct s_net *net = NULL;
00035
00036 int num_blocks = 0;
00037 struct s_block *block = NULL;
00038
00039
00040
00041 int num_types = 0;
00042 struct s_type_descriptor *type_descriptors = NULL;
00043
00044 t_type_ptr IO_TYPE = NULL;
00045 t_type_ptr EMPTY_TYPE = NULL;
00046 t_type_ptr FILL_TYPE = NULL;
00047
00048
00049
00050
00051 int nx = 0;
00052 int ny = 0;
00053
00054
00055
00056
00057
00058
00059
00060
00061 int *chan_width_x = NULL;
00062 int *chan_width_y = NULL;
00063
00064 struct s_grid_tile **grid = NULL;
00065
00066
00067
00068
00069
00070 struct s_trace **trace_head = NULL;
00071 struct s_trace **trace_tail = NULL;
00072
00073
00074
00075
00076 int num_rr_nodes = 0;
00077 t_rr_node *rr_node = NULL;
00078 t_ivec ***rr_node_indices = NULL;
00079
00080 int num_rr_indexed_data = 0;
00081 t_rr_indexed_data *rr_indexed_data = NULL;
00082
00083
00084
00085 int **net_rr_terminals = NULL;
00086
00087
00088
00089
00090 struct s_switch_inf *switch_inf = NULL;
00091
00092
00093
00094 int **rr_blk_source = NULL;
00095
00096
00097
00098
00099 static void PrintUsage();
00100 static void PrintTitle();
00101 static void freeArch(t_arch* Arch);
00102
00103
00104
00105
00106
00107 int
00108 main(int argc,
00109 char **argv)
00110 {
00111 t_options Options;
00112 t_arch Arch = { 0 };
00113
00114 enum e_operation Operation;
00115 struct s_placer_opts PlacerOpts;
00116 struct s_annealing_sched AnnealSched;
00117 struct s_router_opts RouterOpts;
00118 struct s_det_routing_arch RoutingArch;
00119 t_segment_inf *Segments;
00120 t_timing_inf Timing;
00121 t_subblock_data Subblocks;
00122 boolean ShowGraphics;
00123 boolean TimingEnabled;
00124 int GraphPause;
00125
00126
00127
00128 PrintTitle();
00129
00130
00131 if(argc < 2)
00132 {
00133 PrintUsage();
00134 exit(1);
00135 }
00136
00137
00138 ReadOptions(argc, argv, &Options);
00139
00140
00141 TimingEnabled = IsTimingEnabled(Options);
00142
00143
00144 SetupVPR(Options, TimingEnabled, &Arch, &Operation, &PlacerOpts,
00145 &AnnealSched, &RouterOpts, &RoutingArch, &Segments,
00146 &Timing, &Subblocks, &ShowGraphics, &GraphPause);
00147
00148
00149 CheckOptions(Options, TimingEnabled);
00150 CheckArch(Arch, TimingEnabled);
00151
00152
00153 CheckSetup(Operation, PlacerOpts, AnnealSched, RouterOpts,
00154 RoutingArch, Segments, Timing, Subblocks, Arch.Chans);
00155
00156
00157 ShowSetup(Options, Arch, TimingEnabled, Operation, PlacerOpts,
00158 AnnealSched, RouterOpts, RoutingArch, Segments, Timing,
00159 Subblocks);
00160
00161 if(Operation == TIMING_ANALYSIS_ONLY) {
00162 do_constant_net_delay_timing_analysis(
00163 Timing, Subblocks, Options.constant_net_delay);
00164 return 0;
00165 }
00166
00167
00168 set_graphics_state(ShowGraphics, GraphPause, RouterOpts.route_type);
00169 if(ShowGraphics)
00170 {
00171 init_graphics("VPR: Versatile Place and Route for FPGAs");
00172 alloc_draw_structs();
00173 }
00174
00175
00176 place_and_route(Operation, PlacerOpts, Options.PlaceFile,
00177 Options.NetFile, Options.ArchFile, Options.RouteFile,
00178 AnnealSched, RouterOpts, RoutingArch,
00179 Segments, Timing, &Subblocks, Arch.Chans);
00180
00181
00182 if(ShowGraphics)
00183 close_graphics();
00184
00185
00186 free(Options.PlaceFile);
00187 free(Options.NetFile);
00188 free(Options.ArchFile);
00189 free(Options.RouteFile);
00190
00191 freeArch(&Arch);
00192
00193
00194 return 0;
00195 }
00196
00197
00198
00199
00200 static void
00201 PrintUsage()
00202 {
00203 puts("Usage: vpr circuit.net fpga.arch placed.out routed.out [Options ...]");
00204 puts("");
00205 puts("General Options: [-nodisp] [-auto <int>] [-route_only]");
00206 puts("\t[-place_only] [-timing_analyze_only_with_net_delay <float>]");
00207 puts("\t[-fast] [-full_stats] [-timing_analysis on | off] [-outfile_prefix <string>]");
00208 puts("");
00209 puts("Placer Options:");
00210 puts("\t[-place_algorithm bounding_box | net_timing_driven | path_timing_driven]");
00211 puts("\t[-init_t <float>] [-exit_t <float>]");
00212 puts("\t[-alpha_t <float>] [-inner_num <float>] [-seed <int>]");
00213 puts("\t[-place_cost_exp <float>] [-place_cost_type linear | nonlinear]");
00214 puts("\t[-place_chan_width <int>] [-num_regions <int>] ");
00215 puts("\t[-fix_pins random | <file.pads>]");
00216 puts("\t[-enable_timing_computations on | off]");
00217 puts("\t[-block_dist <int>]");
00218 puts("");
00219 puts("Placement Options Valid Only for Timing-Driven Placement:");
00220 puts("\t[-timing_tradeoff <float>]");
00221 puts("\t[-recompute_crit_iter <int>]");
00222 puts("\t[-inner_loop_recompute_divider <int>]");
00223 puts("\t[-td_place_exp_first <float>]");
00224 puts("\t[-td_place_exp_last <float>]");
00225 puts("");
00226 puts("Router Options: [-max_router_iterations <int>] [-bb_factor <int>]");
00227 puts("\t[-initial_pres_fac <float>] [-pres_fac_mult <float>]");
00228 puts("\t[-acc_fac <float>] [-first_iter_pres_fac <float>]");
00229 puts("\t[-bend_cost <float>] [-route_type global | detailed]");
00230 puts("\t[-verify_binary_search] [-route_chan_width <int>]");
00231 puts("\t[-router_algorithm breadth_first | timing_driven]");
00232 puts("\t[-base_cost_type intrinsic_delay | delay_normalized | demand_only]");
00233 puts("");
00234 puts("Routing options valid only for timing-driven routing:");
00235 puts("\t[-astar_fac <float>] [-max_criticality <float>]");
00236 puts("\t[-criticality_exp <float>]");
00237 puts("");
00238 }
00239
00240
00241
00242 static void
00243 PrintTitle()
00244 {
00245 puts("");
00246 puts("VPR FPGA Placement and Routing.");
00247 puts("Version: Version 5.0.2");
00248 puts("Compiled: " __DATE__ ".");
00249 puts("Original VPR by V. Betz.");
00250 puts("Timing-driven placement enhancements by A. Marquardt.");
00251 puts("Single-drivers enhancements by Andy Ye with additions by.");
00252 puts("Mark Fang, Jason Luu, Ted Campbell");
00253 puts("Heterogeneous stucture support by Jason Luu and Ted Campbell.");
00254 puts("This code is licensed only for non-commercial use.");
00255 puts("");
00256 }
00257
00258 static void freeArch(t_arch* Arch)
00259 {
00260 int i;
00261 for(i = 0; i < Arch->num_switches; i++) {
00262 if(Arch->Switches->name != NULL) {
00263 free(Arch->Switches[i].name);
00264 }
00265 }
00266 free(Arch->Switches);
00267 for(i = 0; i < Arch->num_segments; i++) {
00268 if(Arch->Segments->cb != NULL) {
00269 free(Arch->Segments[i].cb);
00270 }
00271 if(Arch->Segments->sb != NULL) {
00272 free(Arch->Segments[i].sb);
00273 }
00274 }
00275 free(Arch->Segments);
00276 }