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

Go to the source code of this file.

Functions

static char ** ReadBaseToken (INP char **Args, OUTP enum e_OptionBaseToken *Token)
 
static void Error (INP const char *Token)
 
static char ** ProcessOption (INP char **Args, INOUTP t_options *Options)
 
static void MergeOptions (INOUTP t_options *dest, INP t_options *src, int id)
 
static char ** ReadFloat (INP char **Args, OUTP float *Val)
 
static char ** ReadInt (INP char **Args, OUTP int *Val)
 
static char ** ReadOnOff (INP char **Args, OUTP boolean *Val)
 
static char ** ReadClusterSeed (INP char **Args, OUTP enum e_cluster_seed *Type)
 
static char ** ReadFixPins (INP char **Args, OUTP char **PinFile)
 
static char ** ReadPlaceAlgorithm (INP char **Args, OUTP enum e_place_algorithm *Algo)
 
static char ** ReadRouterAlgorithm (INP char **Args, OUTP enum e_router_algorithm *Algo)
 
static char ** ReadPackerAlgorithm (INP char **Args, OUTP enum e_packer_algorithm *Algo)
 
static char ** ReadBaseCostType (INP char **Args, OUTP enum e_base_cost_type *BaseCostType)
 
static char ** ReadRouteType (INP char **Args, OUTP enum e_route_type *Type)
 
static char ** ReadString (INP char **Args, OUTP char **Val)
 
boolean IsTimingEnabled (INP t_options *Options)
 
boolean IsEchoEnabled (INP t_options *Options)
 
boolean getEchoEnabled (void)
 
void setEchoEnabled (boolean echo_enabled)
 
boolean GetPostSynthesisOption (void)
 
void SetPostSynthesisOption (boolean post_synthesis_enabled)
 
boolean IsPostSynthesisEnabled (INP t_options *Options)
 
void setAllEchoFileEnabled (boolean value)
 
void setEchoFileEnabled (enum e_echo_files echo_option, boolean value)
 
void setEchoFileName (enum e_echo_files echo_option, const char *name)
 
boolean isEchoFileEnabled (enum e_echo_files echo_option)
 
char * getEchoFileName (enum e_echo_files echo_option)
 
void alloc_and_load_echo_file_info ()
 
void free_echo_file_info ()
 
void setOutputFileName (enum e_output_files ename, const char *name, const char *default_name)
 
char * getOutputFileName (enum e_output_files ename)
 
void alloc_and_load_output_file_names (const char *default_name)
 
void free_output_file_names ()
 
void ReadOptions (INP int argc, INP char **argv, OUTP t_options *Options)
 
static char ** ReadToken (INP char **Args, OUTP enum e_OptionArgToken *Token)
 

Variables

static boolean EchoEnabled
 
static boolean Generate_PostSynthesis_Netlist
 
static booleanechoFileEnabled = NULL
 
static char ** echoFileNames = NULL
 
static char ** outputFileNames = NULL
 

Function Documentation

void alloc_and_load_echo_file_info ( )

Definition at line 126 of file ReadOptions.c.

126  {
127  echoFileEnabled = (boolean*)my_calloc((int) E_ECHO_END_TOKEN, sizeof(boolean));
128  echoFileNames = (char**)my_calloc((int) E_ECHO_END_TOKEN, sizeof(char*));
129 
131 
132  setEchoFileName(E_ECHO_INITIAL_CLB_PLACEMENT, "initial_clb_placement.echo");
133  setEchoFileName(E_ECHO_INITIAL_PLACEMENT_TIMING_GRAPH, "initial_placement_timing_graph.echo");
134  setEchoFileName(E_ECHO_INITIAL_PLACEMENT_SLACK, "initial_placement_slack.echo");
135  setEchoFileName(E_ECHO_INITIAL_PLACEMENT_CRITICALITY, "initial_placement_criticality.echo");
136  setEchoFileName(E_ECHO_END_CLB_PLACEMENT, "end_clb_placement.echo");
137  setEchoFileName(E_ECHO_PLACEMENT_SINK_DELAYS, "placement_sink_delays.echo");
138  setEchoFileName(E_ECHO_FINAL_PLACEMENT_TIMING_GRAPH, "final_placement_timing_graph.echo");
139  setEchoFileName(E_ECHO_FINAL_PLACEMENT_SLACK, "final_placement_slack.echo");
140  setEchoFileName(E_ECHO_FINAL_PLACEMENT_CRITICALITY, "final_placement_criticality.echo");
141  setEchoFileName(E_ECHO_PLACEMENT_CRIT_PATH, "placement_crit_path.echo");
142  setEchoFileName(E_ECHO_PB_GRAPH, "pb_graph.echo");
143  setEchoFileName(E_ECHO_ARCH, "arch.echo");
144  setEchoFileName(E_ECHO_PLACEMENT_CRITICAL_PATH, "placement_critical_path.echo");
145  setEchoFileName(E_ECHO_PLACEMENT_LOWER_BOUND_SINK_DELAYS, "placement_lower_bound_sink_delays.echo");
146  setEchoFileName(E_ECHO_PLACEMENT_LOGIC_SINK_DELAYS, "placement_logic_sink_delays.echo");
147  setEchoFileName(E_ECHO_ROUTING_SINK_DELAYS, "routing_sink_delays.echo");
148  setEchoFileName(E_ECHO_POST_FLOW_TIMING_GRAPH, "post_flow_timing_graph.blif");
149  setEchoFileName(E_ECHO_POST_PACK_NETLIST, "post_pack_netlist.blif");
150  setEchoFileName(E_ECHO_BLIF_INPUT, "blif_input.echo");
151  setEchoFileName(E_ECHO_NET_DELAY, "net_delay.echo");
152  setEchoFileName(E_ECHO_TIMING_GRAPH, "timing_graph.echo");
153  setEchoFileName(E_ECHO_LUT_REMAPPING, "lut_remapping.echo");
154  setEchoFileName(E_ECHO_PRE_PACKING_TIMING_GRAPH, "pre_packing_timing_graph.echo");
155  setEchoFileName(E_ECHO_PRE_PACKING_TIMING_GRAPH_AS_BLIF, "pre_packing_timing_graph_as_blif.blif");
156  setEchoFileName(E_ECHO_CLUSTERING_TIMING_INFO, "clustering_timing_info.echo");
157  setEchoFileName(E_ECHO_PRE_PACKING_SLACK, "pre_packing_slack.echo");
158  setEchoFileName(E_ECHO_PRE_PACKING_CRITICALITY, "pre_packing_criticality.echo");
159  setEchoFileName(E_ECHO_CLUSTERING_BLOCK_CRITICALITIES, "clustering_block_criticalities.echo");
160  setEchoFileName(E_ECHO_PRE_PACKING_MOLECULES_AND_PATTERNS, "pre_packing_molecules_and_patterns.echo");
161  setEchoFileName(E_ECHO_MEM, "mem.echo");
162  setEchoFileName(E_ECHO_RR_GRAPH, "rr_graph.echo");
163  setEchoFileName(E_ECHO_TIMING_CONSTRAINTS, "timing_constraints.echo");
164  setEchoFileName(E_ECHO_CRITICAL_PATH, "critical_path.echo");
165  setEchoFileName(E_ECHO_SLACK, "slack.echo");
166  setEchoFileName(E_ECHO_CRITICALITY, "criticality.echo");
167  setEchoFileName(E_ECHO_COMPLETE_NET_TRACE, "complete_net_trace.echo");
168  setEchoFileName(E_ECHO_SEG_DETAILS, "seg_details.txt");
169 }
boolean
Definition: util.h:11
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
static boolean * echoFileEnabled
Definition: ReadOptions.c:16
void setAllEchoFileEnabled(boolean value)
Definition: ReadOptions.c:97
static char ** echoFileNames
Definition: ReadOptions.c:17
void setEchoFileName(enum e_echo_files echo_option, const char *name)
Definition: ReadOptions.c:108
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void alloc_and_load_output_file_names ( const char *  default_name)

Definition at line 200 of file ReadOptions.c.

200  {
201  char *name;
202 
203  if(outputFileNames == NULL) {
204 
205  outputFileNames = (char**)my_calloc((int)E_FILE_END_TOKEN, sizeof(char*));
206 
207  name = (char*)my_malloc((strlen(default_name) + 40) * sizeof(char));
208  sprintf(name, "%s.critical_path.out", default_name);
209  setOutputFileName(E_CRIT_PATH_FILE, name, default_name);
210 
211  sprintf(name, "%s.slack.out", default_name);
212  setOutputFileName(E_SLACK_FILE, name, default_name);
213 
214  sprintf(name, "%s.criticality.out", default_name);
215  setOutputFileName(E_CRITICALITY_FILE, name, default_name);
216 
217  free(name);
218  }
219 }
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
static void * my_malloc(int ibytes)
Definition: graphics.c:499
void setOutputFileName(enum e_output_files ename, const char *name, const char *default_name)
Definition: ReadOptions.c:186
static char ** outputFileNames
Definition: ReadOptions.c:19

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void Error ( INP const char *  Token)
static

Definition at line 749 of file ReadOptions.c.

749  {
750  if (Token) {
751  vpr_printf(TIO_MESSAGE_ERROR, "Unexpected token '%s' on command line.\n", Token);
752  } else {
753  vpr_printf(TIO_MESSAGE_ERROR, "Missing token at end of command line.\n");
754  }
755  exit(1);
756 }
messagelogger vpr_printf
Definition: util.c:17

+ Here is the caller graph for this function:

void free_echo_file_info ( )

Definition at line 171 of file ReadOptions.c.

171  {
172  int i;
173  if(echoFileEnabled != NULL) {
174  for(i = 0; i < (int) E_ECHO_END_TOKEN; i++) {
175  if(echoFileNames[i] != NULL) {
176  free(echoFileNames[i]);
177  }
178  }
179  free(echoFileNames);
180  free(echoFileEnabled);
181  echoFileNames = NULL;
182  echoFileEnabled = NULL;
183  }
184 }
static boolean * echoFileEnabled
Definition: ReadOptions.c:16
static char ** echoFileNames
Definition: ReadOptions.c:17

+ Here is the caller graph for this function:

void free_output_file_names ( )

Definition at line 221 of file ReadOptions.c.

221  {
222  int i;
223  if(outputFileNames != NULL) {
224  for(i = 0; i < (int)E_FILE_END_TOKEN; i++) {
225  if(outputFileNames[i] != NULL) {
226  free(outputFileNames[i]);
227  outputFileNames[i] = NULL;
228  }
229  }
230  free(outputFileNames);
231  outputFileNames = NULL;
232  }
233 }
static char ** outputFileNames
Definition: ReadOptions.c:19

+ Here is the caller graph for this function:

boolean getEchoEnabled ( void  )

Definition at line 67 of file ReadOptions.c.

67  {
68  return EchoEnabled;
69 }
static boolean EchoEnabled
Definition: ReadOptions.c:12

+ Here is the caller graph for this function:

char* getEchoFileName ( enum e_echo_files  echo_option)

Definition at line 122 of file ReadOptions.c.

122  {
123  return echoFileNames[(int)echo_option];
124 }
static char ** echoFileNames
Definition: ReadOptions.c:17

+ Here is the caller graph for this function:

char* getOutputFileName ( enum e_output_files  ename)

Definition at line 196 of file ReadOptions.c.

196  {
197  return outputFileNames[(int)ename];
198 }
static char ** outputFileNames
Definition: ReadOptions.c:19

+ Here is the caller graph for this function:

boolean GetPostSynthesisOption ( void  )

Definition at line 80 of file ReadOptions.c.

80  {
82 }
static boolean Generate_PostSynthesis_Netlist
Definition: ReadOptions.c:14

+ Here is the caller graph for this function:

boolean IsEchoEnabled ( INP t_options Options)

Definition at line 58 of file ReadOptions.c.

58  {
59  /* First priority to the '--echo_file' flag */
60  if (Options->Count[OT_CREATE_ECHO_FILE]) {
61  return Options->CreateEchoFile;
62  }
63  return FALSE;
64 }
Definition: util.h:12

+ Here is the caller graph for this function:

boolean isEchoFileEnabled ( enum e_echo_files  echo_option)

Definition at line 115 of file ReadOptions.c.

115  {
116  if(echoFileEnabled == NULL) {
117  return FALSE;
118  } else {
119  return echoFileEnabled[(int)echo_option];
120  }
121 }
static boolean * echoFileEnabled
Definition: ReadOptions.c:16
Definition: util.h:12

+ Here is the caller graph for this function:

boolean IsPostSynthesisEnabled ( INP t_options Options)

Definition at line 88 of file ReadOptions.c.

88  {
89  /* First priority to the '--generate_postsynthesis_netlist' flag */
90  if (Options->Count[OT_GENERATE_POST_SYNTHESIS_NETLIST]) {
91  return Options->Generate_Post_Synthesis_Netlist;
92  }
93  return FALSE;
94 }
Definition: util.h:12

+ Here is the caller graph for this function:

boolean IsTimingEnabled ( INP t_options Options)

Definition at line 47 of file ReadOptions.c.

47  {
48  /* First priority to the '--timing_analysis' flag */
49  if (Options->Count[OT_TIMING_ANALYSIS]) {
50  return Options->TimingAnalysis;
51  }
52  return TRUE;
53 }
Definition: util.h:12

+ Here is the caller graph for this function:

static void MergeOptions ( INOUTP t_options dest,
INP t_options src,
int  id 
)
static

Definition at line 488 of file ReadOptions.c.

489 {
490  int Token;
491 
492  for (Token = 0; Token < OT_BASE_UNKNOWN; Token++)
493  {
494  /* Don't override values already set in the
495  * target destination. Also do not process
496  * Tokens that are not present in the source.
497  */
498  if ((dest->Count[Token] || (!src->Count[Token])))
499  continue;
500 
501  dest->Count[Token] = src->Count[Token];
502  dest->Provenance[Token] = id;
503 
504  switch (Token) {
505  /* File naming options */
506  case OT_BLIF_FILE:
507  dest->BlifFile = src->BlifFile;
508  break;
509  case OT_NET_FILE:
510  dest->NetFile = src->NetFile;
511  break;
512  case OT_PLACE_FILE:
513  dest->PlaceFile = src->PlaceFile;
514  break;
515  case OT_ROUTE_FILE:
516  dest->RouteFile = src->RouteFile;
517  break;
518  case OT_SETTINGS_FILE:
519  dest->SettingsFile = src->SettingsFile;
520  break;
521  case OT_SDC_FILE:
522  dest->SDCFile = src->SDCFile;
523  break;
524  /* General Options */
525  case OT_NODISP:
526  break;
527  case OT_AUTO:
528  dest->GraphPause = src->GraphPause;
529  break;
530  case OT_PACK:
531  case OT_ROUTE:
532  case OT_PLACE:
533  break;
535  dest->constant_net_delay = src->constant_net_delay;
536  break;
537  case OT_FAST:
538  case OT_FULL_STATS:
539  break;
540  case OT_TIMING_ANALYSIS:
541  dest->TimingAnalysis = src->TimingAnalysis;
542  break;
543  case OT_OUTFILE_PREFIX:
544  dest->out_file_prefix = src->out_file_prefix;
545  break;
546  case OT_CREATE_ECHO_FILE:
547  dest->CreateEchoFile = src->CreateEchoFile;
548  break;
549 
550  /* Clustering Options */
551  case OT_GLOBAL_CLOCKS:
552  dest->global_clocks = src->global_clocks;
553  break;
555  dest->hill_climbing_flag = src->hill_climbing_flag;
556  break;
558  dest->sweep_hanging_nets_and_inputs = src->sweep_hanging_nets_and_inputs;
559  break;
561  dest->timing_driven = src->timing_driven;
562  break;
563  case OT_CLUSTER_SEED:
564  dest->cluster_seed_type = src->cluster_seed_type;
565  break;
566  case OT_ALPHA_CLUSTERING:
567  dest->alpha = src->alpha;
568  break;
569  case OT_BETA_CLUSTERING:
570  dest->beta = src->beta;
571  break;
573  dest->recompute_timing_after = src->recompute_timing_after;
574  break;
576  dest->block_delay = src->block_delay;
577  break;
579  dest->allow_unrelated_clustering = src->allow_unrelated_clustering;
580  break;
581  case OT_ALLOW_EARLY_EXIT:
582  dest->allow_early_exit = src->allow_early_exit;
583  break;
585  dest->intra_cluster_net_delay = src->intra_cluster_net_delay;
586  break;
588  dest->inter_cluster_net_delay = src->inter_cluster_net_delay;
589  break;
591  dest->connection_driven = src->connection_driven;
592  break;
593  case OT_SKIP_CLUSTERING:
594  break;
595  case OT_PACKER_ALGORITHM:
596  dest->packer_algorithm = src->packer_algorithm;
597  break;
598 
599  /* Placer Options */
600  case OT_PLACE_ALGORITHM:
601  dest->PlaceAlgorithm = src->PlaceAlgorithm;
602  break;
603  case OT_INIT_T:
604  dest->PlaceInitT = src->PlaceInitT;
605  break;
606  case OT_EXIT_T:
607  dest->PlaceExitT = src->PlaceExitT;
608  break;
609  case OT_ALPHA_T:
610  dest->PlaceAlphaT = src->PlaceAlphaT;
611  break;
612  case OT_INNER_NUM:
613  dest->PlaceInnerNum = src->PlaceInnerNum;
614  break;
615  case OT_SEED:
616  dest->Seed = src->Seed;
617  break;
618  case OT_PLACE_COST_EXP:
619  dest->place_cost_exp = src->place_cost_exp;
620  break;
621  case OT_PLACE_CHAN_WIDTH:
622  dest->PlaceChanWidth = src->PlaceChanWidth;
623  break;
624  case OT_FIX_PINS:
625  dest->PinFile = src->PinFile;
626  break;
628  dest->ShowPlaceTiming = src->ShowPlaceTiming;
629  break;
630  case OT_BLOCK_DIST:
631  dest->block_dist = src->block_dist;
632  break;
633 
634  /* Placement Options Valid Only for Timing-Driven Placement */
635  case OT_TIMING_TRADEOFF:
636  dest->PlaceTimingTradeoff = src->PlaceTimingTradeoff;
637  break;
639  dest->RecomputeCritIter = src->RecomputeCritIter;
640  break;
642  dest->inner_loop_recompute_divider = src->inner_loop_recompute_divider;
643  break;
645  dest->place_exp_first = src->place_exp_first;
646  break;
648  dest->place_exp_last = src->place_exp_last;
649  break;
650 
651  /* Router Options */
653  dest->max_router_iterations = src->max_router_iterations;
654  break;
655  case OT_BB_FACTOR:
656  dest->bb_factor = src->bb_factor;
657  break;
658  case OT_INITIAL_PRES_FAC:
659  dest->initial_pres_fac = src->initial_pres_fac;
660  break;
661  case OT_PRES_FAC_MULT:
662  dest->pres_fac_mult = src->pres_fac_mult;
663  break;
664  case OT_ACC_FAC:
665  dest->acc_fac = src->acc_fac;
666  break;
668  dest->first_iter_pres_fac = src->first_iter_pres_fac;
669  break;
670  case OT_BEND_COST:
671  dest->bend_cost = src->bend_cost;
672  break;
673  case OT_ROUTE_TYPE:
674  dest->RouteType = src->RouteType;
675  break;
677  break;
678  case OT_ROUTE_CHAN_WIDTH:
679  dest->RouteChanWidth = src->RouteChanWidth;
680  break;
681  case OT_ROUTER_ALGORITHM:
682  dest->RouterAlgorithm = src->RouterAlgorithm;
683  break;
684  case OT_BASE_COST_TYPE:
685  dest->base_cost_type = src->base_cost_type;
686  break;
687 
688  /* Routing options valid only for timing-driven routing */
689  case OT_ASTAR_FAC:
690  dest->astar_fac = src->astar_fac;
691  break;
692  case OT_MAX_CRITICALITY:
693  dest->max_criticality = src->max_criticality;
694  break;
695  case OT_CRITICALITY_EXP:
696  dest->criticality_exp = src->criticality_exp;
697  break;
698  default:
699  break;
700  }
701  }
702 }

+ Here is the caller graph for this function:

static char ** ProcessOption ( INP char **  Args,
INOUTP t_options Options 
)
static

Definition at line 306 of file ReadOptions.c.

306  {
307  enum e_OptionBaseToken Token;
308  char **PrevArgs;
309 
310  PrevArgs = Args;
311  Args = ReadBaseToken(Args, &Token);
312 
313  if (Token < OT_BASE_UNKNOWN) {
314  /* If this was previously set by a lower priority source
315  * (ie. a settings file), reset the provenance and the
316  * count */
317  if (Options->Provenance[Token])
318  {
319  Options->Provenance[Token] = 0;
320  Options->Count[Token] = 1;
321  }
322  else
323  ++Options->Count[Token];
324  }
325 
326  switch (Token) {
327  /* File naming options */
328  case OT_BLIF_FILE:
329  return ReadString(Args, &Options->BlifFile);
330  case OT_NET_FILE:
331  return ReadString(Args, &Options->NetFile);
332  case OT_PLACE_FILE:
333  return ReadString(Args, &Options->PlaceFile);
334  case OT_ROUTE_FILE:
335  return ReadString(Args, &Options->RouteFile);
336  case OT_SDC_FILE:
337  return ReadString(Args, &Options->SDCFile);
338  case OT_SETTINGS_FILE:
339  return ReadString(Args, &Options->SettingsFile);
340  /* General Options */
341  case OT_NODISP:
342  return Args;
343  case OT_AUTO:
344  return ReadInt(Args, &Options->GraphPause);
345  case OT_PACK:
346  case OT_ROUTE:
347  case OT_PLACE:
348  return Args;
350  return ReadFloat(Args, &Options->constant_net_delay);
351  case OT_FAST:
352  case OT_FULL_STATS:
353  return Args;
354  case OT_TIMING_ANALYSIS:
355  return ReadOnOff(Args, &Options->TimingAnalysis);
356  case OT_OUTFILE_PREFIX:
357  return ReadString(Args, &Options->out_file_prefix);
358  case OT_CREATE_ECHO_FILE:
359  return ReadOnOff(Args, &Options->CreateEchoFile);
361 
362  return ReadOnOff(Args, &Options->Generate_Post_Synthesis_Netlist);
363  /* Clustering Options */
364  case OT_GLOBAL_CLOCKS:
365  return ReadOnOff(Args, &Options->global_clocks);
367  return ReadOnOff(Args, &Options->hill_climbing_flag);
369  return ReadOnOff(Args, &Options->sweep_hanging_nets_and_inputs);
371  return ReadOnOff(Args, &Options->timing_driven);
372  case OT_CLUSTER_SEED:
373  return ReadClusterSeed(Args, &Options->cluster_seed_type);
374  case OT_ALPHA_CLUSTERING:
375  return ReadFloat(Args, &Options->alpha);
376  case OT_BETA_CLUSTERING:
377  return ReadFloat(Args, &Options->beta);
379  return ReadInt(Args, &Options->recompute_timing_after);
381  return ReadFloat(Args, &Options->block_delay);
383  return ReadOnOff(Args, &Options->allow_unrelated_clustering);
384  case OT_ALLOW_EARLY_EXIT:
385  return ReadOnOff(Args, &Options->allow_early_exit);
387  return ReadFloat(Args, &Options->intra_cluster_net_delay);
389  return ReadFloat(Args, &Options->inter_cluster_net_delay);
391  return ReadOnOff(Args, &Options->connection_driven);
392  case OT_SKIP_CLUSTERING:
393  return Args;
394  case OT_PACKER_ALGORITHM:
395  return ReadPackerAlgorithm(Args, &Options->packer_algorithm);
396 
397  /* Placer Options */
398  case OT_PLACE_ALGORITHM:
399  return ReadPlaceAlgorithm(Args, &Options->PlaceAlgorithm);
400  case OT_INIT_T:
401  return ReadFloat(Args, &Options->PlaceInitT);
402  case OT_EXIT_T:
403  return ReadFloat(Args, &Options->PlaceExitT);
404  case OT_ALPHA_T:
405  return ReadFloat(Args, &Options->PlaceAlphaT);
406  case OT_INNER_NUM:
407  return ReadFloat(Args, &Options->PlaceInnerNum);
408  case OT_SEED:
409  return ReadInt(Args, &Options->Seed);
410  case OT_PLACE_COST_EXP:
411  return ReadFloat(Args, &Options->place_cost_exp);
412  case OT_PLACE_CHAN_WIDTH:
413  return ReadInt(Args, &Options->PlaceChanWidth);
414  case OT_FIX_PINS:
415  return ReadFixPins(Args, &Options->PinFile);
417  return ReadOnOff(Args, &Options->ShowPlaceTiming);
418  case OT_BLOCK_DIST:
419  return ReadInt(Args, &Options->block_dist);
420 
421  /* Placement Options Valid Only for Timing-Driven Placement */
422  case OT_TIMING_TRADEOFF:
423  return ReadFloat(Args, &Options->PlaceTimingTradeoff);
425  return ReadInt(Args, &Options->RecomputeCritIter);
427  return ReadInt(Args, &Options->inner_loop_recompute_divider);
429  return ReadFloat(Args, &Options->place_exp_first);
431  return ReadFloat(Args, &Options->place_exp_last);
432 
433  /* Router Options */
435  return ReadInt(Args, &Options->max_router_iterations);
436  case OT_BB_FACTOR:
437  return ReadInt(Args, &Options->bb_factor);
438  case OT_INITIAL_PRES_FAC:
439  return ReadFloat(Args, &Options->initial_pres_fac);
440  case OT_PRES_FAC_MULT:
441  return ReadFloat(Args, &Options->pres_fac_mult);
442  case OT_ACC_FAC:
443  return ReadFloat(Args, &Options->acc_fac);
445  return ReadFloat(Args, &Options->first_iter_pres_fac);
446  case OT_BEND_COST:
447  return ReadFloat(Args, &Options->bend_cost);
448  case OT_ROUTE_TYPE:
449  return ReadRouteType(Args, &Options->RouteType);
451  return Args;
452  case OT_ROUTE_CHAN_WIDTH:
453  return ReadInt(Args, &Options->RouteChanWidth);
454  case OT_ROUTER_ALGORITHM:
455  return ReadRouterAlgorithm(Args, &Options->RouterAlgorithm);
456  case OT_BASE_COST_TYPE:
457  return ReadBaseCostType(Args, &Options->base_cost_type);
458 
459  /* Routing options valid only for timing-driven routing */
460  case OT_ASTAR_FAC:
461  return ReadFloat(Args, &Options->astar_fac);
462  case OT_MAX_CRITICALITY:
463  return ReadFloat(Args, &Options->max_criticality);
464  case OT_CRITICALITY_EXP:
465  return ReadFloat(Args, &Options->criticality_exp);
466 
467  /* Power options */
468  case OT_POWER:
469  return Args;
470  case OT_ACTIVITY_FILE:
471  return ReadString(Args, &Options->ActFile);
472  case OT_POWER_OUT_FILE:
473  return ReadString(Args, &Options->PowerFile);
475  return ReadString(Args, &Options->CmosTechFile);
476 
477  default:
478  vpr_printf(TIO_MESSAGE_ERROR, "Unexpected option '%s' on command line.\n", *PrevArgs);
479  exit(1);
480  }
481 }
static char ** ReadString(INP char **Args, OUTP char **Val)
Definition: ReadOptions.c:957
static char ** ReadBaseCostType(INP char **Args, OUTP enum e_base_cost_type *BaseCostType)
Definition: ReadOptions.c:825
static char ** ReadClusterSeed(INP char **Args, OUTP enum e_cluster_seed *Type)
Definition: ReadOptions.c:759
static char ** ReadPackerAlgorithm(INP char **Args, OUTP enum e_packer_algorithm *Algo)
Definition: ReadOptions.c:780
static char ** ReadInt(INP char **Args, OUTP int *Val)
Definition: ReadOptions.c:929
static char ** ReadBaseToken(INP char **Args, OUTP enum e_OptionBaseToken *Token)
Definition: ReadOptions.c:705
static char ** ReadFixPins(INP char **Args, OUTP char **PinFile)
Definition: ReadOptions.c:894
static char ** ReadPlaceAlgorithm(INP char **Args, OUTP enum e_place_algorithm *Algo)
Definition: ReadOptions.c:870
static char ** ReadOnOff(INP char **Args, OUTP boolean *Val)
Definition: ReadOptions.c:909
static char ** ReadRouteType(INP char **Args, OUTP enum e_route_type *Type)
Definition: ReadOptions.c:849
e_OptionBaseToken
Definition: OptionTokens.h:6
static char ** ReadFloat(INP char **Args, OUTP float *Val)
Definition: ReadOptions.c:941
messagelogger vpr_printf
Definition: util.c:17
static char ** ReadRouterAlgorithm(INP char **Args, OUTP enum e_router_algorithm *Algo)
Definition: ReadOptions.c:801

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadBaseCostType ( INP char **  Args,
OUTP enum e_base_cost_type BaseCostType 
)
static

Definition at line 825 of file ReadOptions.c.

825  {
826  enum e_OptionArgToken Token;
827  char **PrevArgs;
828 
829  PrevArgs = Args;
830  Args = ReadToken(Args, &Token);
831  switch (Token) {
832  case OT_INTRINSIC_DELAY:
833  *BaseCostType = INTRINSIC_DELAY;
834  break;
835  case OT_DELAY_NORMALIZED:
836  *BaseCostType = DELAY_NORMALIZED;
837  break;
838  case OT_DEMAND_ONLY:
839  *BaseCostType = DEMAND_ONLY;
840  break;
841  default:
842  Error(*PrevArgs);
843  }
844 
845  return Args;
846 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadBaseToken ( INP char **  Args,
OUTP enum e_OptionBaseToken Token 
)
static

Definition at line 705 of file ReadOptions.c.

705  {
706  struct s_TokenPair *Cur;
707 
708  /* Empty string is end of tokens marker */
709  if (NULL == *Args)
710  Error(*Args);
711 
712  /* Linear search for the pair */
713  Cur = OptionBaseTokenList;
714  while (Cur->Str) {
715  if (strcmp(*Args, Cur->Str) == 0) {
716  *Token = (enum e_OptionBaseToken) Cur->Enum;
717  return ++Args;
718  }
719  ++Cur;
720  }
721 
722  *Token = OT_BASE_UNKNOWN;
723  return ++Args;
724 }
const char * Str
Definition: vpr_types.h:1027
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
struct s_TokenPair OptionBaseTokenList[]
Definition: OptionTokens.c:7
e_OptionBaseToken
Definition: OptionTokens.h:6

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadClusterSeed ( INP char **  Args,
OUTP enum e_cluster_seed Type 
)
static

Definition at line 759 of file ReadOptions.c.

759  {
760  enum e_OptionArgToken Token;
761  char **PrevArgs;
762 
763  PrevArgs = Args;
764  Args = ReadToken(Args, &Token);
765  switch (Token) {
766  case OT_TIMING:
767  *Type = VPACK_TIMING;
768  break;
769  case OT_MAX_INPUTS:
770  *Type = VPACK_MAX_INPUTS;
771  break;
772  default:
773  Error(*PrevArgs);
774  }
775 
776  return Args;
777 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadFixPins ( INP char **  Args,
OUTP char **  PinFile 
)
static

Definition at line 894 of file ReadOptions.c.

894  {
895  enum e_OptionArgToken Token;
896  int Len;
897  char **PrevArgs = Args;
898 
899  Args = ReadToken(Args, &Token);
900  if (OT_RANDOM != Token) {
901  Len = 1 + strlen(*PrevArgs);
902  *PinFile = (char *) my_malloc(Len * sizeof(char));
903  memcpy(*PinFile, *PrevArgs, Len);
904  }
905  return Args;
906 }
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
static void * my_malloc(int ibytes)
Definition: graphics.c:499
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadFloat ( INP char **  Args,
OUTP float *  Val 
)
static

Definition at line 941 of file ReadOptions.c.

941  {
942  if (NULL == *Args) {
943  Error(*Args);
944  }
945 
946  if ((**Args != '-') && (**Args != '.')
947  && ((**Args > '9') || (**Args < '0'))) {
948  Error(*Args);
949  }
950 
951  *Val = atof(*Args);
952 
953  return ++Args;
954 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadInt ( INP char **  Args,
OUTP int *  Val 
)
static

Definition at line 929 of file ReadOptions.c.

929  {
930  if (NULL == *Args)
931  Error(*Args);
932  if ((**Args > '9') || (**Args < '0'))
933  Error(*Args);
934 
935  *Val = atoi(*Args);
936 
937  return ++Args;
938 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadOnOff ( INP char **  Args,
OUTP boolean Val 
)
static

Definition at line 909 of file ReadOptions.c.

909  {
910  enum e_OptionArgToken Token;
911  char **PrevArgs;
912 
913  PrevArgs = Args;
914  Args = ReadToken(Args, &Token);
915  switch (Token) {
916  case OT_ON:
917  *Val = TRUE;
918  break;
919  case OT_OFF:
920  *Val = FALSE;
921  break;
922  default:
923  Error(*PrevArgs);
924  }
925  return Args;
926 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
Definition: util.h:12
e_OptionArgToken
Definition: OptionTokens.h:80
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ReadOptions ( INP int  argc,
INP char **  argv,
OUTP t_options Options 
)

Definition at line 239 of file ReadOptions.c.

239  {
240  char **Args, **head;
241  int offset;
242 
243  /* Clear values and pointers to zero */
244  memset(Options, 0, sizeof(t_options));
245 
246  /* Alloc a new pointer list for args with a NULL at end.
247  * This makes parsing the same as for archfile for consistency.
248  * Skips the first arg as it is the program image path */
249  --argc;
250  ++argv;
251  head = Args = (char **) my_malloc(sizeof(char *) * (argc + 1));
252  memcpy(Args, argv, (sizeof(char *) * argc));
253  Args[argc] = NULL;
254 
255  /* Go through the command line args. If they have hyphens they are
256  * options. Otherwise assume they are part of the four mandatory
257  * arguments */
258  while (*Args) {
259  if (strncmp("--", *Args, 2) == 0) {
260  *Args += 2; /* Skip the prefix */
261  Args = ProcessOption(Args, Options);
262  } else if (strncmp("-", *Args, 1) == 0) {
263  *Args += 1; /* Skip the prefix */
264  Args = ProcessOption(Args, Options);
265  } else if (NULL == Options->ArchFile) {
266  Options->ArchFile = my_strdup(*Args);
267  vpr_printf(TIO_MESSAGE_INFO, "Architecture file: %s\n", Options->ArchFile);
268  ++Args;
269  } else if (NULL == Options->CircuitName) {
270  Options->CircuitName = my_strdup(*Args);
271  /*if the user entered the circuit name with the .blif extension, remove it now*/
272  offset = strlen(Options->CircuitName) - 5;
273  if (offset > 0 && !strcmp(Options->CircuitName + offset, ".blif")) {
274  Options->CircuitName[offset] = '\0';
275  }
276  vpr_printf(TIO_MESSAGE_INFO, "Circuit name: %s.blif\n", Options->CircuitName);
277  vpr_printf(TIO_MESSAGE_INFO, "\n");
278  ++Args;
279  } else {
280  /* Not an option and arch and net already specified so fail */
281  Error(*Args);
282  }
283 
284  if (Options->Count[OT_SETTINGS_FILE] != Options->read_settings)
285  {
286  int tmp_argc = 0;
287  char **tmp_argv = NULL;
288  t_options SettingsFileOptions;
289 
290  tmp_argc = read_settings_file(Options->SettingsFile, &tmp_argv);
291 
292  ReadOptions(tmp_argc, tmp_argv, &SettingsFileOptions);
293 
294  MergeOptions(Options, &SettingsFileOptions, Options->Count[OT_SETTINGS_FILE]);
295 
296  Options->read_settings = Options->Count[OT_SETTINGS_FILE];
297 
298  /* clean up local data structures */
299  free(tmp_argv);
300  }
301  }
302  free(head);
303 }
int Count[OT_BASE_UNKNOWN]
Definition: ReadOptions.h:88
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static void MergeOptions(INOUTP t_options *dest, INP t_options *src, int id)
Definition: ReadOptions.c:488
void ReadOptions(INP int argc, INP char **argv, OUTP t_options *Options)
Definition: ReadOptions.c:239
static void * my_malloc(int ibytes)
Definition: graphics.c:499
static char ** ProcessOption(INP char **Args, INOUTP t_options *Options)
Definition: ReadOptions.c:306
int read_settings_file(char *file_name, char ***outv)
Definition: read_settings.c:53
char * my_strdup(const char *str)
Definition: util.c:101
messagelogger vpr_printf
Definition: util.c:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadPackerAlgorithm ( INP char **  Args,
OUTP enum e_packer_algorithm Algo 
)
static

Definition at line 780 of file ReadOptions.c.

780  {
781  enum e_OptionArgToken Token;
782  char **PrevArgs;
783 
784  PrevArgs = Args;
785  Args = ReadToken(Args, &Token);
786  switch (Token) {
787  case OT_GREEDY:
788  *Algo = PACK_GREEDY;
789  break;
790  case OT_BRUTE_FORCE:
791  *Algo = PACK_BRUTE_FORCE;
792  break;
793  default:
794  Error(*PrevArgs);
795  }
796 
797  return Args;
798 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadPlaceAlgorithm ( INP char **  Args,
OUTP enum e_place_algorithm Algo 
)
static

Definition at line 870 of file ReadOptions.c.

870  {
871  enum e_OptionArgToken Token;
872  char **PrevArgs;
873 
874  PrevArgs = Args;
875  Args = ReadToken(Args, &Token);
876  switch (Token) {
877  case OT_BOUNDING_BOX:
878  *Algo = BOUNDING_BOX_PLACE;
879  break;
881  *Algo = NET_TIMING_DRIVEN_PLACE;
882  break;
884  *Algo = PATH_TIMING_DRIVEN_PLACE;
885  break;
886  default:
887  Error(*PrevArgs);
888  }
889 
890  return Args;
891 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadRouterAlgorithm ( INP char **  Args,
OUTP enum e_router_algorithm Algo 
)
static

Definition at line 801 of file ReadOptions.c.

801  {
802  enum e_OptionArgToken Token;
803  char **PrevArgs;
804 
805  PrevArgs = Args;
806  Args = ReadToken(Args, &Token);
807  switch (Token) {
808  case OT_BREADTH_FIRST:
809  *Algo = BREADTH_FIRST;
810  break;
811  case OT_NO_TIMING:
812  *Algo = NO_TIMING;
813  break;
814  case OT_TIMING_DRIVEN:
815  *Algo = TIMING_DRIVEN;
816  break;
817  default:
818  Error(*PrevArgs);
819  }
820 
821  return Args;
822 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadRouteType ( INP char **  Args,
OUTP enum e_route_type Type 
)
static

Definition at line 849 of file ReadOptions.c.

849  {
850  enum e_OptionArgToken Token;
851  char **PrevArgs;
852 
853  PrevArgs = Args;
854  Args = ReadToken(Args, &Token);
855  switch (Token) {
856  case OT_GLOBAL:
857  *Type = GLOBAL;
858  break;
859  case OT_DETAILED:
860  *Type = DETAILED;
861  break;
862  default:
863  Error(*PrevArgs);
864  }
865 
866  return Args;
867 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
static char ** ReadToken(INP char **Args, OUTP enum e_OptionArgToken *Token)
Definition: ReadOptions.c:727
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char ** ReadString ( INP char **  Args,
OUTP char **  Val 
)
static

Definition at line 957 of file ReadOptions.c.

957  {
958  if (NULL == *Args) {
959  Error(*Args);
960  }
961 
962  *Val = my_strdup(*Args);
963 
964  return ++Args;
965 }
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
char * my_strdup(const char *str)
Definition: util.c:101

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char** ReadToken ( INP char **  Args,
OUTP enum e_OptionArgToken Token 
)
static

Definition at line 727 of file ReadOptions.c.

727  {
728  struct s_TokenPair *Cur;
729 
730  /* Empty string is end of tokens marker */
731  if (NULL == *Args)
732  Error(*Args);
733 
734  /* Linear search for the pair */
735  Cur = OptionArgTokenList;
736  while (Cur->Str) {
737  if (strcmp(*Args, Cur->Str) == 0) {
738  *Token = (enum e_OptionArgToken)Cur->Enum;
739  return ++Args;
740  }
741  ++Cur;
742  }
743 
744  *Token = OT_ARG_UNKNOWN;
745  return ++Args;
746 }
const char * Str
Definition: vpr_types.h:1027
static void Error(INP const char *Token)
Definition: ReadOptions.c:749
struct s_TokenPair OptionArgTokenList[]
Definition: OptionTokens.c:63
e_OptionArgToken
Definition: OptionTokens.h:80

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setAllEchoFileEnabled ( boolean  value)

Definition at line 97 of file ReadOptions.c.

97  {
98  int i;
99  for(i = 0; i < (int) E_ECHO_END_TOKEN; i++) {
100  echoFileEnabled[i] = value;
101  }
102 }
static boolean * echoFileEnabled
Definition: ReadOptions.c:16

+ Here is the caller graph for this function:

void setEchoEnabled ( boolean  echo_enabled)

Definition at line 71 of file ReadOptions.c.

71  {
72  /* enable echo outputs */
73  EchoEnabled = echo_enabled;
74  if(echoFileEnabled == NULL) {
75  /* initialize default echo options */
77  }
78 }
static boolean * echoFileEnabled
Definition: ReadOptions.c:16
static boolean EchoEnabled
Definition: ReadOptions.c:12
void alloc_and_load_echo_file_info()
Definition: ReadOptions.c:126

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setEchoFileEnabled ( enum e_echo_files  echo_option,
boolean  value 
)

Definition at line 104 of file ReadOptions.c.

104  {
105  echoFileEnabled[(int)echo_option] = value;
106 }
static boolean * echoFileEnabled
Definition: ReadOptions.c:16
void setEchoFileName ( enum e_echo_files  echo_option,
const char *  name 
)

Definition at line 108 of file ReadOptions.c.

108  {
109  if(echoFileNames[(int)echo_option] != NULL) {
110  free(echoFileNames[(int)echo_option]);
111  }
112  echoFileNames[(int)echo_option] = my_strdup(name);
113 }
static char ** echoFileNames
Definition: ReadOptions.c:17
char * my_strdup(const char *str)
Definition: util.c:101

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setOutputFileName ( enum e_output_files  ename,
const char *  name,
const char *  default_name 
)

Definition at line 186 of file ReadOptions.c.

186  {
187  if(outputFileNames == NULL) {
188  alloc_and_load_output_file_names(default_name);
189  }
190  if(outputFileNames[(int)ename] != NULL) {
191  free(outputFileNames[(int)ename]);
192  }
193  outputFileNames[(int)ename] = my_strdup(name);
194 }
static char ** outputFileNames
Definition: ReadOptions.c:19
char * my_strdup(const char *str)
Definition: util.c:101
void alloc_and_load_output_file_names(const char *default_name)
Definition: ReadOptions.c:200

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SetPostSynthesisOption ( boolean  post_synthesis_enabled)

Definition at line 84 of file ReadOptions.c.

84  {
85  Generate_PostSynthesis_Netlist = post_synthesis_enabled;
86 }
static boolean Generate_PostSynthesis_Netlist
Definition: ReadOptions.c:14

+ Here is the caller graph for this function:

Variable Documentation

boolean EchoEnabled
static

Definition at line 12 of file ReadOptions.c.

boolean* echoFileEnabled = NULL
static

Definition at line 16 of file ReadOptions.c.

char** echoFileNames = NULL
static

Definition at line 17 of file ReadOptions.c.

boolean Generate_PostSynthesis_Netlist
static

Definition at line 14 of file ReadOptions.c.

char** outputFileNames = NULL
static

Definition at line 19 of file ReadOptions.c.