VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
power.h
Go to the documentation of this file.
1 /*********************************************************************
2  * The following code is part of the power modelling feature of VTR.
3  *
4  * For support:
5  * http://code.google.com/p/vtr-verilog-to-routing/wiki/Power
6  *
7  * or email:
8  * vtr.power.estimation@gmail.com
9  *
10  * If you are using power estimation for your researach please cite:
11  *
12  * Jeffrey Goeders and Steven Wilton. VersaPower: Power Estimation
13  * for Diverse FPGA Architectures. In International Conference on
14  * Field Programmable Technology, 2012.
15  *
16  ********************************************************************/
17 
18 /**
19  * This is the top-level file for power estimation in VTR
20  */
21 
22 #ifndef __POWER_H__
23 #define __POWER_H__
24 
25 /************************* INCLUDES *********************************/
26 #include <list>
27 
28 #include "vpr_types.h"
29 #include "PowerSpicedComponent.h"
30 
31 /************************* DEFINES ***********************************/
32 /* Maximum size of logs */
33 #define MAX_LOGS 10000
34 
35 /* Default clock behaviour */
36 #define CLOCK_PROB 0.5
37 #define CLOCK_DENS 2
38 
39 /************************* ENUMS ************************************/
40 
41 /* Return code used by power functions */
42 typedef enum {
45 
46 /* Power log types */
47 typedef enum {
50 
51 /* Multiplexer select encoding types */
52 #if 0
53 typedef enum {
54  ENCODING_ONE_HOT, /* One SRAM bit per mux input */
55  ENCODING_DECODER /* Log2(mux_inputs) SRAM bits */
56 }e_encoding_type;
57 #endif
58 
59 /************************* STRUCTS **********************************/
61 typedef struct s_log t_log;
65 typedef struct s_power_nmos_leakages t_power_nmos_leakages;
68 typedef struct s_power_tech t_power_tech;
74 typedef struct s_mux_node t_mux_node;
75 typedef struct s_mux_arch t_mux_arch;
80 
81 /* Information on the solution obtained by VPR */
83  float T_crit;
85 };
86 
87 /* two types of transisters */
88 typedef enum {
90 } e_tx_type;
91 
92 /* Information for a given transistor size */
94  float size;
95 
96  /* Subthreshold leakage, for Vds = Vdd */
98 
99  /* Gate leakage for Vgd/Vgs = Vdd */
101 
102  /* Gate, Source, Drain capacitance */
103  float C_g;
104  float C_s;
105  float C_d;
106 };
107 
108 /**
109  * Transistor information
110  */
113  t_transistor_size_inf * size_inf; /* Array of transistor sizes */
114  t_transistor_size_inf * long_trans_inf; /* Long transistor (W=1,L=2) */
115 };
116 
118  float nmos_size;
121 };
122 
124  float nmos_size;
127 };
128 
129 /* CMOS technology properties, populated from data in xml file */
130 struct s_power_tech {
131  float PN_ratio; /* Ratio of PMOS to NMOS in inverter */
132  float Vdd;
133 
134  float tech_size; /* Tech size in nm, for example 90e-9 for 90nm */
135  float temperature; /* Temp in C */
136 
139 
140  /* Pass Multiplexor Voltage Information */
143 
144  /* NMOS Leakage by Vds */
147 
148  /* Buffer Info */
151 };
152 
153 /* Buffer information for a given size (# of stages) */
157 };
158 
159 /* Set of I/O Voltages for a single-level multiplexer */
163 };
164 
165 /* Single I/O voltage for a single-level multiplexer */
167  float v_in;
168  float v_out_min;
169  float v_out_max;
170 };
171 
172 /* Buffer information for a given buffer stength */
174  float stage_gain;
175 
176  /* Short circuit factor - no level restorer */
177  float sc_no_levr;
178 
179  /* Short circuit factors - level restorers */
182 };
183 
184 /* Buffer short-circuit information for a given input mux size */
186  int mux_size;
187 
188  /* Short circuit factor */
189  float sc_levr;
190 };
191 
192 /* Vds/Ids subthreshold leakage pair */
194  float v_ds;
195  float i_ds;
196 };
197 
198 /* Output details of the power estimation */
200  FILE * out;
202  int num_logs;
203 };
204 
205 struct s_log {
206  char * name;
207  char ** messages;
209 };
210 
212  /* Mux architecture information for 0..mux_arch_max_size */
215 };
216 
217 /**
218  * Commonly used values that are cached here instead of recalculting each time,
219  * also includes statistics.
220  */
222 
223  /* Capacitances */
224  float NMOS_1X_C_g;
225  float NMOS_1X_C_d;
226  float NMOS_1X_C_s;
227 
228  float PMOS_1X_C_g;
229  float PMOS_1X_C_d;
230  float PMOS_1X_C_s;
231 
232  float INV_1X_C_in;
233  float INV_1X_C;
234  float INV_2X_C;
235 
236  /* Component Callibrations Array [0..POWER_CALLIB_COMPONENT_MAX-1] */
238 
239  /* Subthreshold leakages */
244 
245  std::map<float, t_power_mux_info*> mux_info;
246 
247  /* Routing stats */
253 
254  /* Physical length of a tile (meters) */
255  float tile_length;
256 
257  /* Size of switch and connection box buffers */
260 
263 };
264 
265 /* 1-to-1 data structure with t_rr_node
266  */
268  boolean visited; /* When traversing netlist, need to track whether the node has been processed */
269  float * in_dens; /* Switching density of inputs */
270  float * in_prob; /* Static probability of inputs */
271  short num_inputs; /* Number of inputs */
272  short selected_input; /* Input index that is selected */
273  short driver_switch_type; /* Switch type that drives this resource */
274 };
275 
276 /* Architecture information for a multiplexer.
277  * This is used to specify transistor sizes, encoding, etc.
278  */
279 struct s_mux_arch {
280  int levels;
283  //enum e_encoding_type * encoding_types;
285 };
286 
287 /* A single-level multiplexer data structure.
288  * These are combined in a hierarchy to represent
289  * multi-level multiplexers
290  */
291 struct s_mux_node {
292  int num_inputs; /* Number of inputs */
293  t_mux_node * children; /* Multiplexers that drive the inputs [0..num_inputs-1] */
294  int starting_pin_idx; /* Applicable to level 0 only, the overall mux primary input index */
295  int level; /* Level in the full multilevel mux - 0 = primary inputs to mux */
296  boolean level_restorer; /* Whether the output of this mux is level restored */
297 };
298 
299 /************************* GLOBALS **********************************/
303 extern t_power_tech * g_power_tech;
304 extern t_power_arch * g_power_arch;
305 
306 /************************* FUNCTION DECLARATIONS ********************/
307 
308 /* Call before using power module */
309 boolean power_init(char * power_out_filepath,
310  char * cmos_tech_behavior_filepath, t_arch * arch,
311  t_det_routing_arch * routing_arch);
312 
313 boolean power_uninit(void);
314 
315 /* Top-Level Function */
316 e_power_ret_code power_total(float * run_time_s, t_vpr_setup vpr_setup,
317  t_arch * arch, t_det_routing_arch * routing_arch);
318 
319 #endif /* __POWER_H__ */
float PMOS_1X_st_leakage
Definition: power.h:242
int num_inputs
Definition: power.h:281
float PMOS_2X_st_leakage
Definition: power.h:243
FILE * out
Definition: power.h:200
t_mux_arch * mux_arch
Definition: power.h:214
float total_cb_buffer_size
Definition: power.h:262
Definition: power.h:89
struct s_power_nmos_leakages t_power_nmos_leakages
Definition: power.h:65
t_transistor_size_inf * size_inf
Definition: power.h:113
short num_inputs
Definition: power.h:271
PowerSpicedComponent ** component_callibration
Definition: power.h:237
t_transistor_inf PMOS_inf
Definition: power.h:138
t_power_mux_volt_inf * mux_voltage_inf
Definition: power.h:120
float tech_size
Definition: power.h:134
t_power_buffer_sc_levr_inf * sc_levr_inf
Definition: power.h:181
t_power_nmos_leakage_pair * leakage_pairs
Definition: power.h:126
float NMOS_1X_st_leakage
Definition: power.h:240
float temperature
Definition: power.h:135
t_power_nmos_mux_inf * nmos_mux_info
Definition: power.h:142
float PN_ratio
Definition: power.h:131
t_power_arch * g_power_arch
Definition: power.c:68
char * name
Definition: power.h:206
e_power_log_type
Definition: power.h:47
std::map< float, t_power_mux_info * > mux_info
Definition: power.h:245
t_log * logs
Definition: power.h:201
short driver_switch_type
Definition: power.h:273
t_power_buffer_strength_inf * strength_inf
Definition: power.h:156
int channel_width
Definition: power.h:84
boolean visited
Definition: power.h:268
float * in_prob
Definition: power.h:270
int max_routing_mux_size
Definition: power.h:248
int max_seg_to_IPIN_fanout
Definition: power.h:251
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
int max_seg_to_seg_fanout
Definition: power.h:252
t_power_tech * g_power_tech
Definition: power.c:67
int level
Definition: power.h:295
int num_logs
Definition: power.h:202
int mux_arch_max_size
Definition: power.h:213
float * in_dens
Definition: power.h:269
int starting_pin_idx
Definition: power.h:294
int num_nmos_leakage_info
Definition: power.h:145
float transistor_size
Definition: power.h:282
float total_sb_buffer_size
Definition: power.h:259
int num_messages
Definition: power.h:208
float T_crit
Definition: power.h:83
Definition: power.h:89
int num_nmos_mux_info
Definition: power.h:141
int levels
Definition: power.h:280
t_power_nmos_leakage_inf * nmos_leakage_info
Definition: power.h:146
e_power_ret_code power_total(float *run_time_s, t_vpr_setup vpr_setup, t_arch *arch, t_det_routing_arch *routing_arch)
Definition: power.c:1695
float Vdd
Definition: power.h:132
boolean power_uninit(void)
Definition: power.c:1326
e_power_ret_code
Definition: power.h:42
float leakage_subthreshold
Definition: power.h:97
int num_inputs
Definition: power.h:292
float NMOS_2X_st_leakage
Definition: power.h:241
int num_size_entries
Definition: power.h:112
int max_buffer_size
Definition: power.h:149
short selected_input
Definition: power.h:272
t_transistor_inf NMOS_inf
Definition: power.h:137
t_power_buffer_size_inf * buffer_size_inf
Definition: power.h:150
boolean level_restorer
Definition: power.h:296
t_mux_node * mux_graph_head
Definition: power.h:284
Definition: power.h:205
t_transistor_size_inf * long_trans_inf
Definition: power.h:114
boolean power_init(char *power_out_filepath, char *cmos_tech_behavior_filepath, t_arch *arch, t_det_routing_arch *routing_arch)
Definition: power.c:1270
t_mux_node * children
Definition: power.h:293
t_power_output * g_power_output
Definition: power.c:65
t_solution_inf g_solution_inf
Definition: power.c:64
char ** messages
Definition: power.h:207
e_tx_type
Definition: power.h:88
t_power_mux_volt_pair * mux_voltage_pairs
Definition: power.h:162