• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/core/techModels/libHotSpot/temperature.h

00001 #ifndef __TEMPERATURE_H_
00002 #define __TEMPERATURE_H_
00003 
00004 #include "flp.h"
00005 #include "util.h"
00006 
00007 /* temperature sanity check threshold for natural convection and thermal runaway*/
00008 #define TEMP_HIGH       500.0
00009 
00010 /* model type   */
00011 #define BLOCK_MODEL             0
00012 #define GRID_MODEL              1
00013 #define BLOCK_MODEL_STR "block"
00014 #define GRID_MODEL_STR  "grid"
00015 
00016 /* grid to block mapping mode   */
00017 #define GRID_AVG        0
00018 #define GRID_MIN        1
00019 #define GRID_MAX        2
00020 #define GRID_CENTER     3
00021 #define GRID_AVG_STR    "avg"
00022 #define GRID_MIN_STR    "min"
00023 #define GRID_MAX_STR    "max"
00024 #define GRID_CENTER_STR "center"
00025 
00026 /* temperature-leakage loop constants */
00027 #define LEAKAGE_MAX_ITER 100 /* max thermal-leakage iteration number, if exceeded, report thermal runaway*/
00028 #define LEAK_TOL        0.01 /* thermal-leakage temperature convergence criterion */
00029 
00030 /* number of extra nodes due to the model:
00031  * 4 spreader nodes, 4 heat sink nodes under
00032  * the spreader (center), 4 peripheral heat 
00033  * sink nodes (north, south, east and west)
00034  * and a separate node for the ambient 
00035  */
00036 #define EXTRA           12
00037 /* spreader nodes       */
00038 #define SP_W            0
00039 #define SP_E            1
00040 #define SP_N            2
00041 #define SP_S            3
00042 /* central sink nodes (directly under the spreader) */
00043 #define SINK_C_W        4
00044 #define SINK_C_E        5
00045 #define SINK_C_N        6
00046 #define SINK_C_S        7
00047 /* peripheral sink nodes        */
00048 #define SINK_W          8
00049 #define SINK_E          9
00050 #define SINK_N          10
00051 #define SINK_S          11
00052 
00053 /* secondary extra nodes */
00054 #define EXTRA_SEC               16
00055 /* package substrate nodes      */
00056 #define SUB_W           12
00057 #define SUB_E           13
00058 #define SUB_N           14
00059 #define SUB_S           15
00060 /* solder ball nodes    */
00061 #define SOLDER_W                16
00062 #define SOLDER_E                17
00063 #define SOLDER_N                18
00064 #define SOLDER_S                19
00065 /* central PCB nodes (directly under the solder balls) */
00066 #define PCB_C_W 20
00067 #define PCB_C_E 21
00068 #define PCB_C_N 22
00069 #define PCB_C_S 23
00070 /* peripheral PCB nodes */
00071 #define PCB_W           24
00072 #define PCB_E           25
00073 #define PCB_N           26
00074 #define PCB_S           27
00075 
00076 /* physical constants, now become configurable in the config file       */
00077 //#define RHO_SI        0.01    /* thermal resistivity of silicon between 300K-400K in (mK)/W   */
00078 //#define       RHO_CU  0.0025  /* thermal resistivity of copper between 300K-400K in (mK)/W    */
00079 //#define RHO_INT       0.25    /* thermal resistivity of the interface material in (mK)/W      */
00080 //#define K_SI  (1.0/RHO_SI)    /* thermal conductivity of silicon      */
00081 //#define K_CU  (1.0/RHO_CU)    /* thermal conductivity of copper       */
00082 //#define K_INT (1.0/RHO_INT)   /* thermal conductivity of the interface material       */
00083 //#define SPEC_HEAT_SI  1.75e6  /* specfic heat of silicon in J/(m^3K)  */
00084 //#define SPEC_HEAT_CU  3.55e6  /* specific heat of copper in J/(m^3K)  */
00085 //#define SPEC_HEAT_INT 4e6             /* specific heat of the interface material in J/(m^3K)  */
00086 
00087 /* typical thermal properties for secondary path layers */
00088 /* */
00089 #define RHO_METAL       0.0025  
00090 #define RHO_DIELECTRIC  1.0
00091 #define RHO_C4  0.8
00092 #define RHO_UNDERFILL 0.03
00093 #define RHO_SUB 0.5
00094 #define RHO_SOLDER      0.06
00095 #define RHO_PCB 0.333
00096 #define K_METAL (1.0/RHO_METAL) 
00097 #define K_DIELECTRIC (1.0/RHO_DIELECTRIC)
00098 #define K_C4    (1.0/RHO_C4)
00099 #define K_UNDERFILL (1.0/RHO_UNDERFILL)
00100 #define K_SUB   (1.0/RHO_SUB)   
00101 #define K_SOLDER        (1.0/RHO_SOLDER)        
00102 #define K_PCB   (1.0/RHO_PCB)
00103 //FIXME! the following values need to be found
00104 #define SPEC_HEAT_METAL 3.55e6  /* specfic heat of silicon in J/(m^3K)  */
00105 #define SPEC_HEAT_DIELECTRIC    2.2e6  
00106 #define SPEC_HEAT_C4    1.65e6  
00107 #define SPEC_HEAT_UNDERFILL     2.65e6  
00108 #define SPEC_HEAT_SUB   1.6e6   /* specific heat of copper in J/(m^3K)  */
00109 #define SPEC_HEAT_SOLDER        2.1e6           /* specific heat of the interface material in J/(m^3K)  */
00110 #define SPEC_HEAT_PCB   1.32e6  
00111 
00112 /* model specific constants     */
00113 /* changed from 1/2 to 1/3 due to the difference from traditional Elmore Delay scenario */
00114 #define C_FACTOR        0.333           /* fitting factor to match floworks (due to lumping)    */
00115 
00116 /* constants related to transient temperature calculation       */
00117 #define MIN_STEP        1e-7    /* 0.1 us       */
00118 
00119 /* BLAS/LAPACK definitions      */
00120 #define MA_NONE         0 
00121 #define MA_INTEL        1 
00122 #define MA_AMD          2 
00123 #define MA_APPLE        3 
00124 #define MA_SUN          4 
00125 
00126 #if (MATHACCEL == MA_INTEL)
00127         #include <mkl_cblas.h>
00128         #include <mkl_lapack.h>
00129 #elif (MATHACCEL == MA_AMD)
00130         #include <acml.h>
00131 #elif (MATHACCEL == MA_APPLE)
00132         #include <vecLib/cblas.h>
00133         #include <vecLib/clapack.h>
00134 #elif (MATHACCEL == MA_SUN)
00135         #include <sunperf.h>
00136 #endif
00137 
00138 /* thermal model configuration  */
00139 typedef struct thermal_config_t_st
00140 {
00141         /* chip specs   */
00142         double t_chip;  /* chip thickness in meters     */
00143         double k_chip;  /* chip thermal conductivity */
00144         double p_chip;  /* chip specific heat */
00145         double thermal_threshold;       /* temperature threshold for DTM (Kelvin)*/
00146 
00147         /* heat sink specs      */
00148         double c_convec;        /* convection capacitance in J/K */
00149         double r_convec;        /* convection resistance in K/W */
00150         double s_sink;  /* heatsink side in meters      */
00151         double t_sink;  /* heatsink thickness in meters */
00152         double k_sink;  /* heatsink thermal conductivity */
00153         double p_sink;  /* heatsink specific heat */
00154 
00155         /* heat spreader specs  */
00156         double s_spreader;      /* spreader side in meters      */
00157         double t_spreader;      /* spreader thickness in meters */
00158         double k_spreader;      /* spreader thermal conductivity */
00159         double p_spreader;      /* spreader specific heat */
00160 
00161         /* interface material specs     */
00162         double t_interface;     /* interface material thickness in meters       */
00163         double k_interface;     /* interface material thermal conductivity */
00164         double p_interface; /* interface material specific heat */
00165         
00166         /* secondary path specs */
00167         int model_secondary;
00168         double r_convec_sec;
00169         double c_convec_sec;
00170         int n_metal;
00171         double t_metal;
00172         double t_c4;
00173         double s_c4;
00174         int n_c4;
00175         double s_sub;
00176         double t_sub;
00177         double s_solder;
00178         double t_solder;
00179         double s_pcb;
00180         double t_pcb;
00181 
00182         /* others       */
00183         double ambient;                 /* ambient temperature in kelvin        */
00184         /* initial temperatures from file       */
00185         char init_file[STR_SIZE];
00186         double init_temp;               /* if init_file is NULL */
00187         /* steady state temperatures to file    */
00188         char steady_file[STR_SIZE];
00189         double sampling_intvl;  /* interval per call to compute_temp    */
00190         double base_proc_freq;  /* in Hz        */
00191         int dtm_used;                   /* flag to guide the scaling of init Ts */
00192         /* model type - block or grid */
00193         char model_type[STR_SIZE];
00194         
00195         /* temperature-leakage loop */
00196         int leakage_used;
00197         int leakage_mode;
00198         
00199         /* package model */
00200         int package_model_used; /* flag to indicate whether package model is used */
00201         char package_config_file[STR_SIZE]; /* package/fan configurations */ 
00202 
00203         /* parameters specific to block model   */
00204         int block_omit_lateral; /* omit lateral resistance?     */
00205 
00206         /* parameters specific to grid model    */
00207         int grid_rows;                  /* grid resolution - no. of rows        */
00208         int grid_cols;                  /* grid resolution - no. of cols        */
00209         /* layer configuration from     file */
00210         char grid_layer_file[STR_SIZE];
00211         /* output grid temperatures instead of block temperatures */
00212         char grid_steady_file[STR_SIZE];
00213         /* mapping mode between grid and block models   */
00214         char grid_map_mode[STR_SIZE];
00215 }thermal_config_t;
00216 
00217 /* defaults     */
00218 thermal_config_t default_thermal_config(void);
00219 /* 
00220  * parse a table of name-value string pairs and add the configuration
00221  * parameters to 'config'
00222  */
00223 void thermal_config_add_from_strs(thermal_config_t *config, str_pair *table, int size);
00224 /* 
00225  * convert config into a table of name-value pairs. returns the no.
00226  * of parameters converted
00227  */
00228 int thermal_config_to_strs(thermal_config_t *config, str_pair *table, int max_entries);
00229 
00230 /* package parameters   */
00231 typedef struct package_RC_t_st
00232 {
00233         /* lateral resistances  */
00234         /* peripheral spreader nodes */
00235         double r_sp1_x;
00236         double r_sp1_y;
00237         /* sink's inner periphery */
00238         double r_hs1_x;
00239         double r_hs1_y;
00240         double r_hs2_x;
00241         double r_hs2_y;
00242         /* sink's outer periphery */
00243         double r_hs;
00244         
00245         /* vertical resistances */
00246         /* peripheral spreader nodes */
00247         double r_sp_per_x;
00248         double r_sp_per_y;
00249         /* sink's inner periphery       */
00250         double r_hs_c_per_x;
00251         double r_hs_c_per_y;
00252         /* sink's outer periphery       */
00253         double r_hs_per;
00254 
00255         /* vertical capacitances        */
00256         /* peripheral spreader nodes */
00257         double c_sp_per_x;
00258         double c_sp_per_y;
00259         /* sink's inner periphery       */
00260         double c_hs_c_per_x;
00261         double c_hs_c_per_y;
00262         /* sink's outer periphery       */
00263         double c_hs_per;
00264 
00265         /* vertical R's and C's to ambient      */
00266         /* sink's inner periphery       */
00267         double r_amb_c_per_x;
00268         double c_amb_c_per_x;
00269         double r_amb_c_per_y;
00270         double c_amb_c_per_y;
00271         /* sink's outer periphery       */
00272         double r_amb_per;
00273         double c_amb_per;
00274         
00275         /* secondary path R's and C's */
00276         
00277         /* lateral resistances  */
00278         /* peripheral package substrate nodes */
00279         double r_sub1_x;
00280         double r_sub1_y;
00281         /* peripheral solder ball nodes */
00282         double r_solder1_x;
00283         double r_solder1_y;
00284         /* PCB's inner periphery */
00285         double r_pcb1_x;
00286         double r_pcb1_y;
00287         double r_pcb2_x;
00288         double r_pcb2_y;
00289         /* PCB's outer periphery */
00290         double r_pcb;
00291         
00292         /* vertical resistances */
00293         /* peripheral package substrate nodes */
00294         double r_sub_per_x;
00295         double r_sub_per_y;
00296         /* peripheral solder ball nodes */
00297         double r_solder_per_x;
00298         double r_solder_per_y;
00299         /* PCB's inner periphery        */
00300         double r_pcb_c_per_x;
00301         double r_pcb_c_per_y;
00302         /* PCB's outer periphery        */
00303         double r_pcb_per;
00304 
00305         /* vertical capacitances        */
00306         /* peripheral package substrate nodes */
00307         double c_sub_per_x;
00308         double c_sub_per_y;
00309         /* peripheral solder ballnodes */
00310         double c_solder_per_x;
00311         double c_solder_per_y;
00312         /* PCB's inner periphery        */
00313         double c_pcb_c_per_x;
00314         double c_pcb_c_per_y;
00315         /* PCB's outer periphery        */
00316         double c_pcb_per;
00317 
00318         /* vertical R's and C's to ambient at PCB       */
00319         /* PCB's inner periphery        */
00320         double r_amb_sec_c_per_x;
00321         double c_amb_sec_c_per_x;
00322         double r_amb_sec_c_per_y;
00323         double c_amb_sec_c_per_y;
00324         /* PCB's outer periphery        */
00325         double r_amb_sec_per;
00326         double c_amb_sec_per;
00327         
00328 }package_RC_t;
00329 /* package parameter routines   */
00330 void populate_package_R(package_RC_t *p, thermal_config_t *config, double width, double height);
00331 void populate_package_C(package_RC_t *p, thermal_config_t *config, double width, double height);
00332 /* debug print  */
00333 void debug_print_package_RC(package_RC_t *p);
00334 
00335 /* slope function pointer - used as a call back by the transient solver */
00336 typedef void (*slope_fn_ptr)(void *model, void *y, void *p, void *dy);
00337 
00338 /* hotspot thermal model - can be a block or grid model */
00339 struct block_model_t_st;
00340 struct grid_model_t_st;
00341 typedef struct RC_model_t_st
00342 {
00343         union
00344         {
00345                 struct block_model_t_st *block;
00346                 struct grid_model_t_st *grid;
00347         };
00348         /* block model or grid model    */
00349         int type;
00350         thermal_config_t *config;
00351 }RC_model_t;
00352 
00353 /* constructor/destructor       */
00354 /* placeholder is an empty floorplan frame with only the names of the functional units  */
00355 RC_model_t *alloc_RC_model(thermal_config_t *config, flp_t *placeholder);
00356 void delete_RC_model(RC_model_t *model);
00357 
00358 /* initialization       */
00359 void populate_R_model(RC_model_t *model, flp_t *flp);
00360 void populate_C_model(RC_model_t *model, flp_t *flp);
00361 
00362 /* hotspot main interfaces - temperature.c      */
00363 void steady_state_temp(RC_model_t *model, double *power, double *temp);
00364 void compute_temp(RC_model_t *model, double *power, double *temp, double time_elapsed);
00365 /* differs from 'dvector()' in that memory for internal nodes is also allocated */
00366 double *hotspot_vector(RC_model_t *model);
00367 /* copy 'src' to 'dst' except for a window of 'size'
00368  * elements starting at 'at'. useful in floorplan
00369  * compaction
00370  */
00371 void trim_hotspot_vector(RC_model_t *model, double *dst, double *src, 
00372                                                  int at, int size);
00373 /* update the model's node count        */                                               
00374 void resize_thermal_model(RC_model_t *model, int n_units);                                               
00375 void set_temp (RC_model_t *model, double *temp, double val);
00376 void dump_temp (RC_model_t *model, double *temp, char *file);
00377 void copy_temp (RC_model_t *model, double *dst, double *src);
00378 void read_temp (RC_model_t *model, double *temp, char *file, int clip);
00379 void dump_power(RC_model_t *model, double *power, char *file);
00380 void read_power (RC_model_t *model, double *power, char *file);
00381 double find_max_temp(RC_model_t *model, double *temp);
00382 double find_avg_temp(RC_model_t *model, double *temp);
00383 /* debug print  */
00384 void debug_print_model(RC_model_t *model);
00385 
00386 /* other functions used by the above interfaces */
00387 
00388 /* LUP decomposition    */
00389 void lupdcmp(double**a, int n, int *p, int spd);
00390 
00391 /* get the thermal resistance and capacitance values    */
00392 double getr(double conductivity, double thickness, double area);
00393 double getcap(double sp_heat, double thickness, double area);
00394 
00395 /* LU forward and backward substitution */
00396 void lusolve(double **a, int n, int *p, double *b, double *x, int spd);
00397 
00398 /* 4th order Runge Kutta solver with adaptive step sizing */
00399 double rk4(void *model, double *y, void *p, int n, double h, double *yout, slope_fn_ptr f);
00400 
00401 /* matrix and vector routines   */
00402 void matmult(double **c, double **a, double **b, int n);
00403 /* same as above but 'a' is a diagonal matrix stored as a 1-d array     */
00404 void diagmatmult(double **c, double *a, double **b, int n); 
00405 void matvectmult(double *vout, double **m, double *vin, int n);
00406 /* same as above but 'm' is a diagonal matrix stored as a 1-d array     */
00407 void diagmatvectmult(double *vout, double *m, double *vin, int n);
00408 /* 
00409  * inv = m^-1, inv, m are n by n matrices.
00410  * the spd flag indicates that m is symmetric 
00411  * and positive definite 
00412  */
00413 void matinv(double **inv, double **m, int n, int spd);
00414 
00415 /* dst = src1 + scale * src2    */
00416 void scaleadd_dvector (double *dst, double *src1, double *src2, int n, double scale);
00417 
00418 /* temperature-aware leakage calculation */
00419 double calc_leakage(int mode, double h, double w, double temp);
00420 
00421 /* calculate average heatsink temperature for natural convection package model */
00422 double calc_sink_temp(RC_model_t *model, double *temp);
00423 
00424 #endif

Generated on Fri Oct 22 2010 11:02:14 for SST by  doxygen 1.7.1