VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
CheckOptions.c File Reference
#include <assert.h>
#include "util.h"
#include "vpr_types.h"
#include "globals.h"
#include "OptionTokens.h"
#include "ReadOptions.h"
#include "read_xml_arch_file.h"
#include "SetupVPR.h"
+ Include dependency graph for CheckOptions.c:

Go to the source code of this file.

Functions

void CheckOptions (INP t_options Options, INP boolean TimingEnabled)
 

Function Documentation

void CheckOptions ( INP t_options  Options,
INP boolean  TimingEnabled 
)

Definition at line 12 of file CheckOptions.c.

12  {
13  boolean TimingPlacer;
14  boolean TimingRouter;
15  boolean default_flow;
16 
17  const struct s_TokenPair *Cur;
18  enum e_OptionBaseToken Yes;
19 
20  default_flow = (boolean) (Options.Count[OT_ROUTE] == 0
21  && Options.Count[OT_PLACE] == 0 && Options.Count[OT_PACK] == 0
22  && Options.Count[OT_TIMING_ANALYZE_ONLY_WITH_NET_DELAY] == 0);
23 
24  /* Check that all filenames were given */
25  if ((NULL == Options.CircuitName) || (NULL == Options.ArchFile)) {
26  vpr_printf(TIO_MESSAGE_ERROR, "Not enough args. Need at least 'vpr <archfile> <circuit_name>'.\n");
27  exit(1);
28  }
29 
30  /* Check that options aren't over specified */
31  Cur = OptionBaseTokenList;
32  while (Cur->Str) {
33  if (Options.Count[Cur->Enum] > 1) {
34  vpr_printf(TIO_MESSAGE_ERROR, "Parameter '%s' was specified more than once on command line.\n", Cur->Str);
35  exit(1);
36  }
37  ++Cur;
38  }
39 
40  /* Todo: Add in checks for packer */
41 
42  /* Check for conflicting parameters and determine if placer and
43  * router are on. */
44 
45  if (Options.Count[OT_TIMING_ANALYZE_ONLY_WITH_NET_DELAY]
46  && (Options.Count[OT_PACK] || Options.Count[OT_PLACE]
47  || Options.Count[OT_ROUTE])) {
48  vpr_printf(TIO_MESSAGE_ERROR, "'cluster'/'route'/'place', and 'timing_analysis_only_with_net_delay' are mutually exclusive flags..\n");
49  exit(1);
50  }
51 
52  /* If placing and timing is enabled, default to a timing placer */
53  TimingPlacer = (boolean)((Options.Count[OT_PLACE] || default_flow) && TimingEnabled);
54  if (Options.Count[OT_PLACE_ALGORITHM] > 0) {
55  if ((PATH_TIMING_DRIVEN_PLACE != Options.PlaceAlgorithm)
56  && (NET_TIMING_DRIVEN_PLACE != Options.PlaceAlgorithm)) {
57  /* Turn off the timing placer if they request a different placer */
58  TimingPlacer = FALSE;
59  }
60  }
61 
62  /* If routing and timing is enabled, default to a timing router */
63  TimingRouter = (boolean)((Options.Count[OT_ROUTE] || default_flow) && TimingEnabled);
64  if (Options.Count[OT_ROUTER_ALGORITHM] > 0) {
65  if (TIMING_DRIVEN != Options.RouterAlgorithm) {
66  /* Turn off the timing router if they request a different router */
67  TimingRouter = FALSE;
68  }
69  }
70 
71  Yes = OT_BASE_UNKNOWN;
72  if (Options.Count[OT_SEED] > 0) {
73  Yes = OT_SEED;
74  }
75  if (Options.Count[OT_INNER_NUM] > 0) {
76  Yes = OT_INNER_NUM;
77  }
78  if (Options.Count[OT_INIT_T] > 0) {
79  Yes = OT_INIT_T;
80  }
81  if (Options.Count[OT_ALPHA_T] > 0) {
82  Yes = OT_ALPHA_T;
83  }
84  if (Options.Count[OT_EXIT_T] > 0) {
85  Yes = OT_EXIT_T;
86  }
87  if (Options.Count[OT_FIX_PINS] > 0) {
88  Yes = OT_FIX_PINS;
89  }
90  if (Options.Count[OT_PLACE_ALGORITHM] > 0) {
91  Yes = OT_PLACE_ALGORITHM;
92  }
93  if (Options.Count[OT_PLACE_COST_EXP] > 0) {
94  Yes = OT_PLACE_COST_EXP;
95  }
96  if (Options.Count[OT_PLACE_CHAN_WIDTH] > 0) {
97  Yes = OT_PLACE_CHAN_WIDTH;
98  }
99  if (Options.Count[OT_ENABLE_TIMING_COMPUTATIONS] > 0) {
101  }
102  if (Options.Count[OT_BLOCK_DIST] > 0) {
103  Yes = OT_BLOCK_DIST;
104  }
105  /* Make sure if place is off none of those options were given */
106  if ((Options.Count[OT_PLACE] == 0) && !default_flow
107  && (Yes < OT_BASE_UNKNOWN)) {
108  Cur = OptionBaseTokenList;
109  while (Cur->Str) {
110  if (Yes == Cur->Enum) {
111  vpr_printf(TIO_MESSAGE_ERROR, "Option '%s' is not allowed when placement is not run.\n", Cur->Str);
112  exit(1);
113  }
114  ++Cur;
115  }
116  }
117 
118  Yes = OT_BASE_UNKNOWN;
119  if (Options.Count[OT_TIMING_TRADEOFF] > 0) {
120  Yes = OT_TIMING_TRADEOFF;
121  }
122  if (Options.Count[OT_RECOMPUTE_CRIT_ITER] > 0) {
124  }
125  if (Options.Count[OT_INNER_LOOP_RECOMPUTE_DIVIDER] > 0) {
127  }
128  if (Options.Count[OT_TD_PLACE_EXP_FIRST] > 0) {
129  Yes = OT_TD_PLACE_EXP_FIRST;
130  }
131  if (Options.Count[OT_TD_PLACE_EXP_LAST] > 0) {
132  Yes = OT_TD_PLACE_EXP_LAST;
133  }
134  /* Make sure if place is off none of those options were given */
135  if ((FALSE == TimingPlacer) && (Yes < OT_BASE_UNKNOWN)) {
136  Cur = OptionBaseTokenList;
137  while (Cur->Str) {
138  if (Yes == Cur->Enum) {
139  vpr_printf(TIO_MESSAGE_ERROR, "Option '%s' is not allowed when timing placement is not used.\n", Cur->Str);
140  exit(1);
141  }
142  ++Cur;
143  }
144  }
145 
146  Yes = OT_BASE_UNKNOWN;
147  if (Options.Count[OT_ROUTE_TYPE] > 0) {
148  Yes = OT_ROUTE_TYPE;
149  }
150  if (Options.Count[OT_ROUTE_CHAN_WIDTH] > 0) {
151  Yes = OT_ROUTE_CHAN_WIDTH;
152  }
153  if (Options.Count[OT_ROUTER_ALGORITHM] > 0) {
154  Yes = OT_ROUTER_ALGORITHM;
155  }
156  if (Options.Count[OT_MAX_ROUTER_ITERATIONS] > 0) {
158  }
159  if (Options.Count[OT_INITIAL_PRES_FAC] > 0) {
160  Yes = OT_INITIAL_PRES_FAC;
161  }
162  if (Options.Count[OT_FIRST_ITER_PRES_FAC] > 0) {
164  }
165  if (Options.Count[OT_PRES_FAC_MULT] > 0) {
166  Yes = OT_PRES_FAC_MULT;
167  }
168  if (Options.Count[OT_ACC_FAC] > 0) {
169  Yes = OT_ACC_FAC;
170  }
171  if (Options.Count[OT_BB_FACTOR] > 0) {
172  Yes = OT_BB_FACTOR;
173  }
174  if (Options.Count[OT_BASE_COST_TYPE] > 0) {
175  Yes = OT_BASE_COST_TYPE;
176  }
177  if (Options.Count[OT_BEND_COST] > 0) {
178  Yes = OT_BEND_COST;
179  }
180  if (Options.Count[OT_BASE_COST_TYPE] > 0) {
181  Yes = OT_BASE_COST_TYPE;
182  }
183  if (Options.Count[OT_ASTAR_FAC] > 0) {
184  Yes = OT_ASTAR_FAC;
185  }
186  Yes = OT_BASE_UNKNOWN;
187  if (Options.Count[OT_MAX_CRITICALITY] > 0) {
188  Yes = OT_MAX_CRITICALITY;
189  }
190  if (Options.Count[OT_CRITICALITY_EXP] > 0) {
191  Yes = OT_CRITICALITY_EXP;
192  }
193  /* Make sure if timing router is off none of those options were given */
194  if ((FALSE == TimingRouter) && (Yes < OT_BASE_UNKNOWN)) {
195  Cur = OptionBaseTokenList;
196  while (Cur->Str) {
197  if (Yes == Cur->Enum) {
198  vpr_printf(TIO_MESSAGE_ERROR, "Option '%s' is not allowed when timing router is not used.\n", Cur->Str);
199  exit(1);
200  }
201  ++Cur;
202  }
203  }
204 }
const char * Str
Definition: vpr_types.h:1027
boolean
Definition: util.h:11
struct s_TokenPair OptionBaseTokenList[]
Definition: OptionTokens.c:7
Definition: util.h:12
e_OptionBaseToken
Definition: OptionTokens.h:6
messagelogger vpr_printf
Definition: util.c:17

+ Here is the caller graph for this function: