#ifndef __HOTSPOT_IFACE_H_1#define __HOTSPOT_IFACE_H_23#define STR_SIZE 5124#define MAX_UNITS 81925#define NULLFILE "(null)"6#define BLOCK_MODEL 07#define GRID_MODEL 189/* floorplan structure */10typedef struct unit_t_st11{12char name[STR_SIZE];13double width;14double height;15double leftx;16double bottomy;17}unit_t;18typedef struct flp_t_st19{20unit_t *units;21int n_units;22double **wire_density;23} flp_t;2425/* floorplan routines */2627/* reads the floorplan from a file and allocates memory.28* 'read_connects' is a boolean flag indicating if29* connectivity information should also be read (usually30* set to FALSE). 'initialize_connects' is a boolean flag indicating31* if the connectivity information should be populated at all, as this32* can slow down larger simulations.33*/34flp_t *read_flp(char *file, int read_connects, int initialize_connects);3536/* deletes floorplan from memory. 'compacted' is a37* boolean flag indicating if this is a floorplan38* compacted by HotFloorplan (usually set to FALSE).39*/40void free_flp(flp_t *flp, int compacted, int free_connects);4142/* thermal model configuration structure */43typedef struct thermal_config_t_st44{45/* chip specs */46double t_chip; /* chip thickness in meters */47double k_chip; /* chip thermal conductivity */48double p_chip; /* chip specific heat */49double thermal_threshold; /* temperature threshold for DTM (Kelvin)*/5051/* heat sink specs */52double c_convec; /* convection capacitance in J/K */53double r_convec; /* convection resistance in K/W */54double s_sink; /* heatsink side in meters */55double t_sink; /* heatsink thickness in meters */56double k_sink; /* heatsink thermal conductivity */57double p_sink; /* heatsink specific heat */5859/* heat spreader specs */60double s_spreader; /* spreader side in meters */61double t_spreader; /* spreader thickness in meters */62double k_spreader; /* spreader thermal conductivity */63double p_spreader; /* spreader specific heat */6465/* interface material specs */66double t_interface; /* interface material thickness in meters */67double k_interface; /* interface material thermal conductivity */68double p_interface; /* interface material specific heat */6970/* secondary path specs */71int model_secondary;72double r_convec_sec;73double c_convec_sec;74int n_metal;75double t_metal;76double t_c4;77double s_c4;78int n_c4;79double s_sub;80double t_sub;81double s_solder;82double t_solder;83double s_pcb;84double t_pcb;8586/* others */87double ambient; /* ambient temperature in kelvin */88/* initial temperatures from file */89char init_file[STR_SIZE];90double init_temp; /* if init_file is NULL */91/* steady state temperatures to file */92char steady_file[STR_SIZE];93/* transient grid temperatures to file */94char grid_transient_file[STR_SIZE];95double sampling_intvl; /* interval per call to compute_temp */96double base_proc_freq; /* in Hz */97int dtm_used; /* flag to guide the scaling of init Ts */98/* model type - block or grid */99char model_type[STR_SIZE];100101/* temperature-leakage loop */102int leakage_used;103int leakage_mode;104105/* package model */106int package_model_used; /* flag to indicate whether package model is used */107char package_config_file[STR_SIZE]; /* package/fan configurations */108109/* parameters specific to block model */110int block_omit_lateral; /* omit lateral resistance? */111112/* parameters specific to grid model */113int grid_rows; /* grid resolution - no. of rows */114int grid_cols; /* grid resolution - no. of cols */115/* layer configuration from file */116char grid_layer_file[STR_SIZE];117/* output grid temperatures instead of block temperatures */118char grid_steady_file[STR_SIZE];119/* mapping mode between grid and block models */120char grid_map_mode[STR_SIZE];121122int detailed_3D_used; //BU_3D: Added parameter to check for heterogenous R-C model123}thermal_config_t;124125// Microchannel configuration structure126typedef struct microchannel_config_t_st127{128// width of an individual cell in m129double cell_width;130131// height of an individual cell in m132double cell_height;133134// thickness of an individual cell in m135double cell_thickness;136137// pumping pressure between inlet(s) and outlet(s) in Pa138double pumping_pressure;139140// pump internal resistance in K/W141double pump_internal_res;142143// temperature of coolant at inlet in K144double inlet_temperature;145146// volumetric heat capacity of coolant in J/m^3-K147double coolant_capac;148149// resistivity of coolant in m-K/W150double coolant_res;151152// dynamic viscosity of coolant in Pa-s/m^3153double coolant_visc;154155// volumetric heat capacity of channel walls in J/m^3-K156double wall_capac;157158// resistivity of channel walls in m-K/W159double wall_res;160161// Heat Transfer Coefficient from coolant to channel walls in W/m^2-K162double htc;163164// csv file containing description of microchannel network165char network_file[STR_SIZE];166167// floorplan file created from network_file168char floorplan_file[STR_SIZE+3];169170// rows and columns in microchannel network171int num_rows;172int num_columns;173174// number of fluid cells in microchannel network175int n_fluid_cells;176177// array of cell types178int **cell_types;179180// mapping from cell indices to pressure circuit node indices181int **mapping;182183// For SuperLU184double **A;185double *b;186int nnz;187} microchannel_config_t;188189// Individual material properties190typedef struct material_t_st191{192int material_type; // solid or fluid193double thermal_conductivity;194double volumetric_heat_capacity;195double dynamic_viscosity;196} material_t;197198// Materials list structure199typedef struct materials_list_t_st200{201// number of materials entries202int size;203204// names of all materials205char **names;206207// properties of each material208material_t *material_properties;209} materials_list_t;210211/* thermal configuration routines */212213/* returns a thermal configuration structure with214* the default set of parameters215*/216thermal_config_t default_thermal_config(void);217218/* thermal model structure */219struct block_model_t_st;220struct grid_model_t_st;221typedef struct RC_model_t_st222{223union224{225struct block_model_t_st *block;226struct grid_model_t_st *grid;227};228int type;229thermal_config_t *config;230}RC_model_t;231232/* thermal model routines */233234/* creates a new thermal model. 'config' can be obtained235* from the 'default_thermal_config' function and236* 'placeholder' can be obtained from the 'read_flp'237* function238*/239RC_model_t *alloc_RC_model(thermal_config_t *config, flp_t *placeholder, microchannel_config_t *microchannel_config, materials_list_t *materials_list,240int do_detailed_3D, int use_microchannels);241242/* deletes the thermal model and frees up memory */243void delete_RC_model(RC_model_t *model);244245/* populates the thermal resistances of the model. This is246* a prerequisite for computing transient or steady state247* temperatures.248*/249void populate_R_model(RC_model_t *model, flp_t *flp);250251/* populates the thermal capacitances of the model. This is252* a prerequisite for computing transient temperatures.253*/254void populate_C_model(RC_model_t *model, flp_t *flp);255256/* memory allocator for the power and temperature vectors */257double *hotspot_vector(RC_model_t *model);258259/* destructor for a vector allocated using 'hotspot_vector' */260void free_dvector(double *v);261262/* outputs the 'temp' vector onto 'file'. 'temp' must263* be allocated using ' hotspot_vector'.264*/265void dump_temp (RC_model_t *model, double *temp, char *file);266267/* sets all the temperatures of the 'temp' vector to the268* value 'val'. 'temp' must be allocated using '269* hotspot_vector'.270*/271void set_temp (RC_model_t *model, double *temp, double val);272273/* read the 'temp' vector from 'file'. The format of the274* file should be the same as the one output by the275* 'dump_temp' function. 'temp' must be allocated using276* 'hotspot_vector'. 'clip' is a boolean flag indicating277* whether to clip the peak temperature of the vector to278* the thermal threshold 'model->config->thermal_threshold'279* (usually set to FALSE).280*/281void read_temp (RC_model_t *model, double *temp, char *file, int clip);282283/* computation of the steady state temperatures. 'power'284* and 'temp' must be allocated using 'hotspot_vector'.285* 'populate_R_model' must be called before this.286* 'power' should contain the input power numbers. 'temp'287* will contain the output temperature numbers after the288* call.289*/290void steady_state_temp(RC_model_t *model, double *power, double *temp);291292/* computation of the transient temperatures. 'power'293* and 'temp' must be allocated using 'hotspot_vector'.294* 'populate_R_model' and 'populate_C_model' must be295* called before this. 'power' should contain the296* input power numbers and 'temp' should contain the297* current temperatures. 'time_elapsed' is the duration298* of the transient simulation. 'temp' will contain the299* output temperature numbers after the call.300*/301void compute_temp(RC_model_t *model, double *power, double *temp, double time_elapsed);302303#endif304305306