Ejemplo n.º 1
0
Archivo: main.c Proyecto: jkim664/junik
// Function: main
// The main function of the floorplan.
int main(int argc, char *argv[]) {

  assert(argc == 3);

  floorplan(argv[1], argv[2]);
   
  test(argv[1]);

  return 0;
}
Ejemplo n.º 2
0
/* main function for the floorplanner	*/
int main(int argc, char **argv)
{
	flp_desc_t *flp_desc;
	flp_t *flp;
	RC_model_t *model;
	double *power;
	thermal_config_t thermal_config;
	flp_config_t flp_config;
	global_config_t global_config;
	str_pair table[MAX_ENTRIES];
	int size, compacted;

	if (!(argc >= 7 && argc % 2)) {
		usage(argc, argv);
		return 1;
	}
	
	size = parse_cmdline(table, MAX_ENTRIES, argc, argv);
	global_config_from_strs(&global_config, table, size);

	/* read configuration file	*/
	if (strcmp(global_config.config, NULLFILE))
		size += read_str_pairs(&table[size], MAX_ENTRIES, global_config.config);

	/* 
	 * in the str_pair 'table', earlier entries override later ones.
	 * so, command line options have priority over config file 
	 */
	size = str_pairs_remove_duplicates(table, size);

	/* get defaults */
	thermal_config = default_thermal_config();
	flp_config = default_flp_config();
	/* modify according to command line / config file	*/
	thermal_config_add_from_strs(&thermal_config, table, size);
	flp_config_add_from_strs(&flp_config, table, size);

	/* dump configuration if specified	*/
	if (strcmp(global_config.dump_config, NULLFILE)) {
		size = global_config_to_strs(&global_config, table, MAX_ENTRIES);
		size += thermal_config_to_strs(&thermal_config, &table[size], MAX_ENTRIES-size);
		size += flp_config_to_strs(&flp_config, &table[size], MAX_ENTRIES-size);
		/* prefix the name of the variable with a '-'	*/
		dump_str_pairs(table, size, global_config.dump_config, "-");
	}
	/* HotFloorplan currently uses the block model and does not 
	 * support the grid model.
	 */
	if (!strcasecmp(thermal_config.model_type, GRID_MODEL_STR))
		fatal("HotFloorplan doesn't support the grid model\n");

	/* description of the functional blocks to be floorplanned	*/
	flp_desc = read_flp_desc(global_config.flp_desc, &flp_config);
	/* 
	 * just an empty frame with blocks' names.
	 * block positions not known yet.
	 */
	flp = flp_placeholder(flp_desc);
	/* temperature model	*/
	model = alloc_RC_model(&thermal_config, flp);
	/* input power vector	*/
	power = hotspot_vector(model);
	read_power(model, power, global_config.power_in);

	/* main floorplanning routine	*/
	compacted = floorplan(flp, flp_desc, model, power);
	/* 
	 * print the finally selected floorplan in a format that can 
	 * be understood by tofig.pl (which converts it to a FIG file)
	 */
	print_flp_fig(flp);
	/* print the floorplan statistics	*/
	if (flp_config.wrap_l2 &&
		!strcasecmp(flp_desc->units[flp_desc->n_units-1].name, flp_config.l2_label))
		print_flp_stats(flp, model, flp_config.l2_label, 
						global_config.power_in, global_config.flp_desc);
	
	/* print the wire delays between blocks	*/
	print_wire_delays(flp, thermal_config.base_proc_freq);

	/* also output the floorplan to a file readable by hotspot	*/
	dump_flp(flp, global_config.flp_out, FALSE);

	free_flp_desc(flp_desc);
	delete_RC_model(model);
	free_dvector(power);

	/* while deallocating, free the compacted blocks too	*/
	free_flp(flp, compacted);

	return 0;
}