00001 #include <assert.h> 00002 #include "util.h" 00003 #include "vpr_types.h" 00004 #include "globals.h" 00005 #include "OptionTokens.h" 00006 #include "ReadOptions.h" 00007 #include "xml_arch.h" 00008 #include "SetupVPR.h" 00009 00010 /* Checks that options don't conflict and that 00011 * options aren't specified that may conflict */ 00012 void 00013 CheckOptions(IN t_options Options, 00014 IN boolean TimingEnabled) 00015 { 00016 int i; 00017 boolean Placer; 00018 boolean TimingPlacer; 00019 boolean Router; 00020 boolean TimingRouter; 00021 const struct s_TokenPair *Cur; 00022 enum e_OptionBaseToken Yes; 00023 00024 /* Check that all filenames were given */ 00025 if((NULL == Options.NetFile) || 00026 (NULL == Options.ArchFile) || 00027 (NULL == Options.PlaceFile) || (NULL == Options.RouteFile)) 00028 { 00029 printf(ERRTAG "Not enough args. Need at least 'vpr " 00030 "<netfile> <archfile> <placefile> <routefile>'\n"); 00031 exit(1); 00032 } 00033 00034 /* Check that options aren't over specified */ 00035 Cur = OptionBaseTokenList; 00036 while(Cur->Str) 00037 { 00038 if(Options.Count[Cur->Enum] > 1) 00039 { 00040 printf(ERRTAG "Parameter '%s' was specified more than " 00041 "once on command line.\n", Cur->Str); 00042 exit(1); 00043 } 00044 ++Cur; 00045 } 00046 00047 /* Check for conflicting parameters and determine if placer and 00048 * router are on. */ 00049 i = 0; 00050 Placer = TRUE; /* On by default */ 00051 Router = TRUE; /* On by default */ 00052 if(Options.Count[OT_ROUTE_ONLY]) 00053 { 00054 ++i; 00055 Placer = FALSE; 00056 } 00057 if(Options.Count[OT_PLACE_ONLY]) 00058 { 00059 ++i; 00060 Router = FALSE; 00061 } 00062 if(Options.Count[OT_TIMING_ANALYZE_ONLY_WITH_NET_DELAY]) 00063 { 00064 ++i; 00065 Placer = FALSE; 00066 Router = FALSE; 00067 } 00068 if(i > 1) 00069 { 00070 printf(ERRTAG "'route_only', 'place_only', and " 00071 "'timing_analysis_only_with_net_delay' are mutually " 00072 "exclusive flags\n"); 00073 exit(1); 00074 } 00075 00076 /* If placing and timing is enabled, default to a timing placer */ 00077 TimingPlacer = (Placer && TimingEnabled); 00078 if(Options.Count[OT_PLACE_ALGORITHM] > 0) 00079 { 00080 if((PATH_TIMING_DRIVEN_PLACE != Options.PlaceAlgorithm) && 00081 (NET_TIMING_DRIVEN_PLACE != Options.PlaceAlgorithm)) 00082 { 00083 /* Turn off the timing placer if they request a different placer */ 00084 TimingPlacer = FALSE; 00085 } 00086 } 00087 00088 /* If routing and timing is enabled, default to a timing router */ 00089 TimingRouter = (Router && TimingEnabled); 00090 if(Options.Count[OT_ROUTER_ALGORITHM] > 0) 00091 { 00092 if(TIMING_DRIVEN != Options.RouterAlgorithm) 00093 { 00094 /* Turn off the timing router if they request a different router */ 00095 TimingRouter = FALSE; 00096 } 00097 } 00098 00099 Yes = OT_BASE_UNKNOWN; 00100 if(Options.Count[OT_SEED] > 0) 00101 { 00102 Yes = OT_SEED; 00103 } 00104 if(Options.Count[OT_INNER_NUM] > 0) 00105 { 00106 Yes = OT_INNER_NUM; 00107 } 00108 if(Options.Count[OT_INIT_T] > 0) 00109 { 00110 Yes = OT_INIT_T; 00111 } 00112 if(Options.Count[OT_ALPHA_T] > 0) 00113 { 00114 Yes = OT_ALPHA_T; 00115 } 00116 if(Options.Count[OT_EXIT_T] > 0) 00117 { 00118 Yes = OT_EXIT_T; 00119 } 00120 if(Options.Count[OT_FIX_PINS] > 0) 00121 { 00122 Yes = OT_FIX_PINS; 00123 } 00124 if(Options.Count[OT_PLACE_ALGORITHM] > 0) 00125 { 00126 Yes = OT_PLACE_ALGORITHM; 00127 } 00128 if(Options.Count[OT_PLACE_COST_TYPE] > 0) 00129 { 00130 Yes = OT_PLACE_COST_TYPE; 00131 } 00132 if(Options.Count[OT_PLACE_COST_EXP] > 0) 00133 { 00134 Yes = OT_PLACE_COST_EXP; 00135 } 00136 if(Options.Count[OT_PLACE_CHAN_WIDTH] > 0) 00137 { 00138 Yes = OT_PLACE_CHAN_WIDTH; 00139 } 00140 if(Options.Count[OT_NUM_REGIONS] > 0) 00141 { 00142 Yes = OT_NUM_REGIONS; 00143 } 00144 if(Options.Count[OT_ENABLE_TIMING_COMPUTATIONS] > 0) 00145 { 00146 Yes = OT_ENABLE_TIMING_COMPUTATIONS; 00147 } 00148 if(Options.Count[OT_BLOCK_DIST] > 0) 00149 { 00150 Yes = OT_BLOCK_DIST; 00151 } 00152 /* Make sure if place is off none of those options were given */ 00153 if((FALSE == Placer) && (Yes < OT_BASE_UNKNOWN)) 00154 { 00155 Cur = OptionBaseTokenList; 00156 while(Cur->Str) 00157 { 00158 if(Yes == Cur->Enum) 00159 { 00160 printf(ERRTAG 00161 "Option '%s' is not allowed when placement is " 00162 "not run.\n", Cur->Str); 00163 exit(1); 00164 } 00165 ++Cur; 00166 } 00167 } 00168 00169 Yes = OT_BASE_UNKNOWN; 00170 if(Options.Count[OT_TIMING_TRADEOFF] > 0) 00171 { 00172 Yes = OT_TIMING_TRADEOFF; 00173 } 00174 if(Options.Count[OT_RECOMPUTE_CRIT_ITER] > 0) 00175 { 00176 Yes = OT_RECOMPUTE_CRIT_ITER; 00177 } 00178 if(Options.Count[OT_INNER_LOOP_RECOMPUTE_DIVIDER] > 0) 00179 { 00180 Yes = OT_INNER_LOOP_RECOMPUTE_DIVIDER; 00181 } 00182 if(Options.Count[OT_TD_PLACE_EXP_FIRST] > 0) 00183 { 00184 Yes = OT_TD_PLACE_EXP_FIRST; 00185 } 00186 if(Options.Count[OT_TD_PLACE_EXP_LAST] > 0) 00187 { 00188 Yes = OT_TD_PLACE_EXP_LAST; 00189 } 00190 /* Make sure if place is off none of those options were given */ 00191 if((FALSE == TimingPlacer) && (Yes < OT_BASE_UNKNOWN)) 00192 { 00193 Cur = OptionBaseTokenList; 00194 while(Cur->Str) 00195 { 00196 if(Yes == Cur->Enum) 00197 { 00198 printf(ERRTAG 00199 "Option '%s' is not allowed when timing placement is " 00200 "not used.\n", Cur->Str); 00201 exit(1); 00202 } 00203 ++Cur; 00204 } 00205 } 00206 00207 Yes = OT_BASE_UNKNOWN; 00208 if(Options.Count[OT_ROUTE_TYPE] > 0) 00209 { 00210 Yes = OT_ROUTE_TYPE; 00211 } 00212 if(Options.Count[OT_ROUTE_CHAN_WIDTH] > 0) 00213 { 00214 Yes = OT_ROUTE_CHAN_WIDTH; 00215 } 00216 if(Options.Count[OT_ROUTER_ALGORITHM] > 0) 00217 { 00218 Yes = OT_ROUTER_ALGORITHM; 00219 } 00220 if(Options.Count[OT_MAX_ROUTER_ITERATIONS] > 0) 00221 { 00222 Yes = OT_MAX_ROUTER_ITERATIONS; 00223 } 00224 if(Options.Count[OT_INITIAL_PRES_FAC] > 0) 00225 { 00226 Yes = OT_INITIAL_PRES_FAC; 00227 } 00228 if(Options.Count[OT_FIRST_ITER_PRES_FAC] > 0) 00229 { 00230 Yes = OT_FIRST_ITER_PRES_FAC; 00231 } 00232 if(Options.Count[OT_PRES_FAC_MULT] > 0) 00233 { 00234 Yes = OT_PRES_FAC_MULT; 00235 } 00236 if(Options.Count[OT_ACC_FAC] > 0) 00237 { 00238 Yes = OT_ACC_FAC; 00239 } 00240 if(Options.Count[OT_BB_FACTOR] > 0) 00241 { 00242 Yes = OT_BB_FACTOR; 00243 } 00244 if(Options.Count[OT_BASE_COST_TYPE] > 0) 00245 { 00246 Yes = OT_BASE_COST_TYPE; 00247 } 00248 if(Options.Count[OT_BEND_COST] > 0) 00249 { 00250 Yes = OT_BEND_COST; 00251 } 00252 if(Options.Count[OT_BASE_COST_TYPE] > 0) 00253 { 00254 Yes = OT_BASE_COST_TYPE; 00255 } 00256 if(Options.Count[OT_ASTAR_FAC] > 0) 00257 { 00258 Yes = OT_ASTAR_FAC; 00259 } 00260 /* Make sure if router is off none of those options were given */ 00261 if((FALSE == Router) && (Yes < OT_BASE_UNKNOWN)) 00262 { 00263 Cur = OptionBaseTokenList; 00264 while(Cur->Str) 00265 { 00266 if(Yes == Cur->Enum) 00267 { 00268 printf(ERRTAG 00269 "Option '%s' is not allowed when router is " 00270 "not used.\n", Cur->Str); 00271 exit(1); 00272 } 00273 ++Cur; 00274 } 00275 } 00276 00277 Yes = OT_BASE_UNKNOWN; 00278 if(Options.Count[OT_MAX_CRITICALITY] > 0) 00279 { 00280 Yes = OT_MAX_CRITICALITY; 00281 } 00282 if(Options.Count[OT_CRITICALITY_EXP] > 0) 00283 { 00284 Yes = OT_CRITICALITY_EXP; 00285 } 00286 /* Make sure if timing router is off none of those options were given */ 00287 if((FALSE == TimingRouter) && (Yes < OT_BASE_UNKNOWN)) 00288 { 00289 Cur = OptionBaseTokenList; 00290 while(Cur->Str) 00291 { 00292 if(Yes == Cur->Enum) 00293 { 00294 printf(ERRTAG 00295 "Option '%s' is not allowed when timing router is " 00296 "not used.\n", Cur->Str); 00297 exit(1); 00298 } 00299 ++Cur; 00300 } 00301 } 00302 }