📄 main.c
字号:
} if (strcmp (argv[i],"-allow_early_exit") == 0) { if (argc <= i+1) { printf ("Error: -allow_early_exit option requires a " "string parameter.\n"); exit (1); } if (strcmp(argv[i+1], "on") == 0) { *allow_early_exit = TRUE; } else if (strcmp(argv[i+1], "off") == 0) { *allow_early_exit = FALSE; } else { printf("Error: -allow_early_exit must be on or off.\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-timing_driven") == 0) { if (argc <= i+1) { printf ("Error: -timing_driven option requires a string parameter." "\n"); exit (1); } if (strcmp(argv[i+1], "on") == 0) { *timing_driven = TRUE; } else if (strcmp(argv[i+1], "off") == 0) { *timing_driven = FALSE; } else { printf("Error: -timing_driven must be on or off.\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-connection_driven") == 0) { if (argc <= i+1) { printf ("Error: -connection_driven option requires a string parameter." "\n"); exit (1); } if (strcmp(argv[i+1], "on") == 0) { *connection_driven = TRUE; } else if (strcmp(argv[i+1], "off") == 0) { *connection_driven = FALSE; } else { printf("Error: -connection_driven must be on or off.\n"); exit (1); } i += 2; continue; } if (strcmp(argv[i],"-cluster_seed") == 0) { if (argc <= i+1) { printf("Error: -cluster_seed option requires a " "string parameter.\n"); exit (1); } if (strcmp(argv[i+1], "timing") == 0) { *cluster_seed_type = TIMING; } else if (strcmp(argv[i+1], "max_inputs") == 0) { *cluster_seed_type = MAX_INPUTS; } else { printf("Error: -cluster_seed must be timing or " "max_inputs.\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-alpha") == 0) { *alpha = read_float_option (argc, argv, i); if (*alpha > 1.0 || *alpha < 0.0) { printf("Error: alpha must be between 0 and 1.\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-recompute_timing_after") == 0) { *recompute_timing_after = read_int_option (argc, argv, i); if (*recompute_timing_after < 1){ printf("Error: recompute_timing_after must be >= 1\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-block_delay") == 0) { *block_delay = read_float_option (argc, argv, i); i += 2; continue; } if (strcmp (argv[i],"-intra_cluster_net_delay") == 0) { *intra_cluster_net_delay = read_float_option (argc, argv, i); i += 2; continue; } if (strcmp (argv[i],"-inter_cluster_net_delay") == 0) { *inter_cluster_net_delay = read_float_option (argc, argv, i); i += 2; continue; } if (strcmp (argv[i],"-cluster_size") == 0) { *cluster_size = read_int_option (argc, argv, i); if (*cluster_size < 1) { printf("Error: cluster_size must be greater than 0.\n"); exit (1); } i += 2; continue; } if (strcmp (argv[i],"-inputs_per_cluster") == 0) { *inputs_per_cluster = read_int_option (argc, argv, i); inputs_per_cluster_set = TRUE; /* Do sanity check after cluster_size and lut_size known. */ i += 2; continue; } if (strcmp (argv[i],"-clocks_per_cluster") == 0) { *clocks_per_cluster = read_int_option (argc, argv, i); /* Do sanity check after cluster_size known. */ i += 2; continue; } if (strcmp (argv[i],"-muxes_to_cluster_output_pins") == 0) { if (argc <= i+1) { printf ("Error: -muxes_to_cluster_output_pins option requires a " "string parameter.\n"); exit (1); } if (strcmp(argv[i+1], "on") == 0) { *muxes_to_cluster_output_pins = TRUE; } else if (strcmp(argv[i+1], "off") == 0) { *muxes_to_cluster_output_pins = FALSE; } else { printf("Error: -muxes_to_cluster_output_pins must be on or off.\n"); exit (1); } i += 2; continue; } printf("Unrecognized option: %s. Aborting.\n",argv[i]); exit(1); } /* End of options while loop. *//* Assign new default values if required. */ if (!inputs_per_cluster_set) *inputs_per_cluster = *lut_size * *cluster_size; if (!*timing_driven) { *cluster_seed_type=MAX_INPUTS; *allow_unrelated_clustering = TRUE; } if (*recompute_timing_after == -1) { *recompute_timing_after = *cluster_size; } /*additional santiy checks*/ if (*inputs_per_cluster < *lut_size || *inputs_per_cluster > *cluster_size * *lut_size) { printf("Error: Number of input pins must be between lut_size and " "cluster_size * lut_size.\n"); exit (1); } if (*clocks_per_cluster < 1 || *clocks_per_cluster > *cluster_size) { printf("Error: Number of clock pins must be between 1 and " "cluster_size.\n"); exit(1); } if (*skip_clustering == TRUE) { if (*inputs_per_cluster != *lut_size || *cluster_size != 1 || *clocks_per_cluster != 1 || *muxes_to_cluster_output_pins != FALSE) { printf("Error: Cluster attributes cannot be specified with \n"); printf("-no_clustering enabled.\n"); exit (1); } }/* Echo back selected options. */ printf("Selected options:\n\n"); printf("\tLut Size: %d inputs\n", *lut_size); printf("\tCluster Size: %d (LUT+FF) logic block(s) / cluster\n", *cluster_size); printf("\tDistinct Input Pins Per Cluster: %d\n", *inputs_per_cluster); printf("\tClock Pins Per Cluster: %d\n", *clocks_per_cluster); printf("\tClocks Routed Via Dedicated Resource: %s\n", (*global_clocks) ? "Yes" : "No"); printf("\tEach BLE output connected directly to a cluster output: %s\n", (*muxes_to_cluster_output_pins) ? "No" : "Yes"); if (*skip_clustering) { printf("\tClustering Step Will NOT Be Performed.\n"); } else { printf("\tClustering Seed Found Via: %s\n", (*cluster_seed_type == TIMING) ? "Most Critical Block" : "Maximum Inputs Used"); printf("\tHill Climbing During Clustering: %s\n", (*hill_climbing_flag) ? "Enabled" : "Disabled"); printf("\tAllow Unrelated Blocks to be Clustered: %s\n", (*allow_unrelated_clustering) ? "Yes" : " No " "(Yes after critical path is fully minimized)"); printf("\tConnection Driven Clustering: %s\n", (*connection_driven) ? "yes" : " No "); if (*timing_driven){ printf("\tTiming Driven Clustering On\n"); printf("\tTiming Analysis Done Every %d blocks\n",*recompute_timing_after); printf("\tAllow Early Exit: %s\n", (*allow_early_exit) ? "Yes" : " No"); printf("\tTradeoff Parameter Alpha:%7.2f\n",*alpha); printf("\tDelay Through Blocks:%7.2f\n",*block_delay); printf("\tIntra Cluster Net Delay:%7.2f\n", *intra_cluster_net_delay); printf("\tInter Cluster Net Delay:%7.2f\n", *inter_cluster_net_delay); } else printf("\tTiming Driven Clustering: Off\n"); } printf("\n\n");}static int read_int_option (int argc, char *argv[], int iarg) {/* This routine returns the value in argv[iarg+1]. This value must exist * * and be an integer, or an error message is printed and the program * * exits. */ int value, num_read; num_read = 0; /* Does value exist for this option? */ if (argc > iarg+1) num_read = sscanf(argv[iarg+1],"%d",&value); /* Value exists and was a proper int? */ if (num_read != 1) { printf("Error: %s option requires an integer parameter.\n\n", argv[iarg]); exit(1); } return (value);}static float read_float_option (int argc, char *argv[], int iarg) {/* This routine returns the value in argv[iarg+1]. This value must exist * * and be an integer, or an error message is printed and the program * * exits. */ float value; int num_read; num_read = 0; /* Does value exist for this option? */ if (argc > iarg+1) num_read = sscanf(argv[iarg+1],"%f",&value); /* Value exists and was a proper int? */ if (num_read != 1) { printf("Error: %s option requires an integer parameter.\n\n", argv[iarg]); exit(1); } return (value);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -