Exemplo n.º 1
0
// copied from IO::writeHotSpotFiles; adapter for getter on FloorPlanner
//
void writeHotSpotFiles__passiveSi_bonding(FloorPlanner& fp) {
	std::ofstream file, file_bond;
	int cur_layer;
	unsigned x, y;
	unsigned map_x, map_y;
	float x_ll, y_ll;
	float bin_w, bin_h;

	/// generate floorplans for passive Si and bonding layer; considering TSVs (modelled via densities)
	for (cur_layer = 0; cur_layer < fp.getLayers(); cur_layer++) {

		// build up file names
		std::stringstream Si_fp_file;
		Si_fp_file << fp.getBenchmark() << "_HotSpot_Si_passive_" << cur_layer + 1 << ".flp";
		std::stringstream bond_fp_file;
		bond_fp_file << fp.getBenchmark() << "_HotSpot_bond_" << cur_layer + 1 << ".flp";

		// init file streams
		file.open(Si_fp_file.str().c_str());
		file_bond.open(bond_fp_file.str().c_str());

		// file headers
		file << "# Line Format: <unit-name>\\t<width>\\t<height>\\t<left-x>\\t<bottom-y>\\t<specific-heat>\\t<resistivity>" << std::endl;
		file << "# all dimensions are in meters" << std::endl;
		file << "# comment lines begin with a '#'" << std::endl;
		file << "# comments and empty lines are ignored" << std::endl;
		file_bond << "# Line Format: <unit-name>\\t<width>\\t<height>\\t<left-x>\\t<bottom-y>\\t<specific-heat>\\t<resistivity>" << std::endl;
		file_bond << "# all dimensions are in meters" << std::endl;
		file_bond << "# comment lines begin with a '#'" << std::endl;
		file_bond << "# comments and empty lines are ignored" << std::endl;

		// walk power-map grid to obtain specific TSV densities of bins
		for (x = ThermalAnalyzer::POWER_MAPS_PADDED_BINS; x < ThermalAnalyzer::THERMAL_MAP_DIM + ThermalAnalyzer::POWER_MAPS_PADDED_BINS; x++) {

			// adapt index for final thermal map according to padding
			map_x = x - ThermalAnalyzer::POWER_MAPS_PADDED_BINS;

			// pre-calculate bin's lower-left corner coordinates;
			// float precision required to avoid grid coordinate
			// mismatches
			x_ll = static_cast<float>(map_x * fp.getThermalAnalyzer().power_maps_dim_x * Math::SCALE_UM_M);

			// pre-calculate bin dimensions; float precision required
			// to avoid grid coordinate mismatches; re-calculation
			// only required for lower and upper bounds
			//
			// lower bound, regular bin dimension; value also used
			// until reaching upper bound
			if (x == ThermalAnalyzer::POWER_MAPS_PADDED_BINS) {
				bin_w = static_cast<float>(fp.getThermalAnalyzer().power_maps_dim_x * Math::SCALE_UM_M);
			}
			// upper bound, limit bin dimension according to overall
			// chip outline; scale down slightly is required to avoid
			// rounding errors during HotSpot's grid mapping
			else if (x == (ThermalAnalyzer::THERMAL_MAP_DIM + ThermalAnalyzer::POWER_MAPS_PADDED_BINS - 1)) {
				bin_w = 0.999 * static_cast<float>(fp.getOutline().x * Math::SCALE_UM_M - x_ll);
			}

			for (y = ThermalAnalyzer::POWER_MAPS_PADDED_BINS; y < ThermalAnalyzer::THERMAL_MAP_DIM + ThermalAnalyzer::POWER_MAPS_PADDED_BINS; y++) {
				// adapt index for final thermal map according to padding
				map_y = y - ThermalAnalyzer::POWER_MAPS_PADDED_BINS;

				// pre-calculate bin's lower-left corner
				// coordinates; float precision required to avoid
				// grid coordinate mismatches
				y_ll = static_cast<float>(map_y * fp.getThermalAnalyzer().power_maps_dim_y * Math::SCALE_UM_M);

				// pre-calculate bin dimensions; float precision required
				// to avoid grid coordinate mismatches; re-calculation
				// only required for lower and upper bounds
				//
				// lower bound, regular bin dimension; value also used
				// until reaching upper bound
				if (y == ThermalAnalyzer::POWER_MAPS_PADDED_BINS) {
					bin_h = static_cast<float>(fp.getThermalAnalyzer().power_maps_dim_y * Math::SCALE_UM_M);
				}
				// upper bound, limit bin dimension according to
				// overall chip outline; scale down slightly is
				// required to avoid rounding errors during
				// HotSpot's grid mapping
				else if (y == (ThermalAnalyzer::THERMAL_MAP_DIM + ThermalAnalyzer::POWER_MAPS_PADDED_BINS - 1)) {
					bin_h = 0.999 * static_cast<float>(fp.getOutline().y * Math::SCALE_UM_M - y_ll);
				}

				// put grid block as floorplan blocks; passive Si layer
				file << "Si_passive_" << cur_layer + 1 << "_" << map_x << ":" << map_y;
				/// bin dimensions
				file << "	" << bin_w;
				file << "	" << bin_h;
				/// bin's lower-left corner
				file << "	" << x_ll;
				file << "	" << y_ll;
				// thermal properties, depending on bin's TSV density
				file << "	" << ThermalAnalyzer::heatCapSi(fp.getTechParameters().TSV_group_Cu_area_ratio, fp.getThermalAnalyzer().getPowerMaps()[cur_layer][x][y].TSV_density);
				file << "	" << ThermalAnalyzer::thermResSi(fp.getTechParameters().TSV_group_Cu_area_ratio, fp.getThermalAnalyzer().getPowerMaps()[cur_layer][x][y].TSV_density);
				file << std::endl;

				// put grid block as floorplan blocks; bonding layer
				file_bond << "bond_" << cur_layer + 1 << "_" << map_x << ":" << map_y;
				/// bin dimensions
				file_bond << "	" << bin_w;
				file_bond << "	" << bin_h;
				/// bin's lower-left corner
				file_bond << "	" << x_ll;
				file_bond << "	" << y_ll;
				// thermal properties, depending on bin's TSV density
				file_bond << "	" << ThermalAnalyzer::heatCapBond(fp.getTechParameters().TSV_group_Cu_area_ratio, fp.getThermalAnalyzer().getPowerMaps()[cur_layer][x][y].TSV_density);
				file_bond << "	" << ThermalAnalyzer::thermResBond(fp.getTechParameters().TSV_group_Cu_area_ratio, fp.getThermalAnalyzer().getPowerMaps()[cur_layer][x][y].TSV_density);
				file_bond << std::endl;
			}
		}

		// close file streams
		file.close();
		file_bond.close();
	}
}