Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
uvahotspot
GitHub Repository: uvahotspot/HotSpot
Path: blob/master/temperature_block.h
612 views
1
#ifndef __TEMPERATURE_BLOCK_H_
2
#define __TEMPERATURE_BLOCK_H_
3
4
#include "temperature.h"
5
6
/* functional block layers */
7
/* total */
8
#define NL 4
9
/* silicon is always layer 0 */
10
/* interface layer */
11
#define IFACE 1
12
/* heat spreader */
13
#define HSP 2
14
/* heat sink */
15
#define HSINK 3
16
17
/* block thermal model */
18
typedef struct block_model_t_st
19
{
20
/* floorplan */
21
flp_t *flp;
22
23
/* configuration */
24
thermal_config_t config;
25
26
/* main matrices */
27
/* conductance matrix */
28
double **b;
29
/* LUP decomposition of b */
30
double **lu;
31
int *p;
32
/* diagonal capacitance matrix stored as a 1-d vector */
33
double *a;
34
/* inverse of the above */
35
double *inva;
36
/* c = inva * b */
37
double **c;
38
39
/* package parameters */
40
package_RC_t pack;
41
42
/* intermediate vectors and matrices */
43
double *gx, *gy;
44
double *gx_int, *gy_int;
45
double *gx_sp, *gy_sp;
46
double *gx_hs, *gy_hs;
47
double *g_amb;
48
double *t_vector;
49
double **len, **g;
50
int **border;
51
52
/* total no. of nodes */
53
int n_nodes;
54
/* total no. of blocks */
55
int n_units;
56
/* to allow for resizing */
57
int base_n_units;
58
59
/* flags */
60
int r_ready; /* are the R's initialized? */
61
int c_ready; /* are the C's initialized? */
62
}block_model_t;
63
64
/* constructor/destructor */
65
/* placeholder is an empty floorplan frame with only the names of the functional units */
66
block_model_t *alloc_block_model(thermal_config_t *config, flp_t *placeholder);
67
void delete_block_model(block_model_t *model);
68
69
/* initialization */
70
void populate_R_model_block(block_model_t *model, flp_t *flp);
71
void populate_C_model_block(block_model_t *model, flp_t *flp);
72
73
/* hotspot main interfaces - temperature.c */
74
void steady_state_temp_block(block_model_t *model, double *power, double *temp);
75
void compute_temp_block(block_model_t *model, double *power, double *temp, double time_elapsed);
76
/* differs from 'dvector()' in that memory for internal nodes is also allocated */
77
double *hotspot_vector_block(block_model_t *model);
78
/* copy 'src' to 'dst' except for a window of 'size'
79
* elements starting at 'at'. useful in floorplan
80
* compaction
81
*/
82
void trim_hotspot_vector_block(block_model_t *model, double *dst, double *src,
83
int at, int size);
84
/* update the model's node count */
85
void resize_thermal_model_block(block_model_t *model, int n_units);
86
void set_temp_block (block_model_t *model, double *temp, double val);
87
void dump_temp_block (block_model_t *model, double *temp, char *file);
88
void copy_temp_block (block_model_t *model, double *dst, double *src);
89
void read_temp_block (block_model_t *model, double *temp, char *file, int clip);
90
void dump_power_block(block_model_t *model, double *power, char *file);
91
void read_power_block (block_model_t *model, double *power, char *file);
92
double find_max_temp_block(block_model_t *model, double *temp);
93
double find_avg_temp_block(block_model_t *model, double *temp);
94
double calc_sink_temp_block(block_model_t *model, double *temp, thermal_config_t *config); //for natural convection package model
95
/* debug print */
96
void debug_print_block(block_model_t *model);
97
98
#endif
99
100