VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
power.h File Reference
#include <list>
#include "vpr_types.h"
#include "PowerSpicedComponent.h"
+ Include dependency graph for power.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_solution_inf
 
struct  s_transistor_size_inf
 
struct  s_transistor_inf
 
struct  s_power_nmos_mux_inf
 
struct  s_power_nmos_leakage_inf
 
struct  s_power_tech
 
struct  s_power_buffer_size_inf
 
struct  s_power_mux_volt_inf
 
struct  s_power_mux_volt_pair
 
struct  s_power_buffer_strength_inf
 
struct  s_power_buffer_sc_levr_inf
 
struct  s_power_nmos_leakage_pair
 
struct  s_power_output
 
struct  s_log
 
struct  s_power_mux_info
 
struct  s_power_commonly_used
 
struct  s_rr_node_power
 
struct  s_mux_arch
 
struct  s_mux_node
 

Macros

#define MAX_LOGS   10000
 
#define CLOCK_PROB   0.5
 
#define CLOCK_DENS   2
 

Typedefs

typedef struct s_power_output t_power_output
 
typedef struct s_log t_log
 
typedef struct
s_power_commonly_used 
t_power_commonly_used
 
typedef struct s_power_mux_volt_inf t_power_mux_volt_inf
 
typedef struct
s_power_mux_volt_pair 
t_power_mux_volt_pair
 
typedef struct
s_power_nmos_leakages 
t_power_nmos_leakages
 
typedef struct
s_power_nmos_leakage_pair 
t_power_nmos_leakage_pair
 
typedef struct
s_power_buffer_sc_levr_inf 
t_power_buffer_sc_levr_inf
 
typedef struct s_power_tech t_power_tech
 
typedef struct s_transistor_inf t_transistor_inf
 
typedef struct
s_transistor_size_inf 
t_transistor_size_inf
 
typedef struct s_rr_node_power t_rr_node_power
 
typedef struct
s_power_buffer_size_inf 
t_power_buffer_size_inf
 
typedef struct
s_power_buffer_strength_inf 
t_power_buffer_strength_inf
 
typedef struct s_mux_node t_mux_node
 
typedef struct s_mux_arch t_mux_arch
 
typedef struct s_solution_inf t_solution_inf
 
typedef struct s_power_nmos_mux_inf t_power_nmos_mux_inf
 
typedef struct
s_power_nmos_leakage_inf 
t_power_nmos_leakage_inf
 
typedef struct s_power_mux_info t_power_mux_info
 

Enumerations

enum  e_power_ret_code { POWER_RET_CODE_SUCCESS = 0, POWER_RET_CODE_ERRORS, POWER_RET_CODE_WARNINGS }
 
enum  e_power_log_type { POWER_LOG_ERROR, POWER_LOG_WARNING, POWER_LOG_NUM_TYPES }
 
enum  e_tx_type { NMOS, PMOS }
 

Functions

boolean power_init (char *power_out_filepath, char *cmos_tech_behavior_filepath, t_arch *arch, t_det_routing_arch *routing_arch)
 
boolean power_uninit (void)
 
e_power_ret_code power_total (float *run_time_s, t_vpr_setup vpr_setup, t_arch *arch, t_det_routing_arch *routing_arch)
 

Variables

t_solution_inf g_solution_inf
 
t_power_outputg_power_output
 
t_power_commonly_usedg_power_commonly_used
 
t_power_techg_power_tech
 
t_power_archg_power_arch
 

Macro Definition Documentation

#define CLOCK_DENS   2

Definition at line 37 of file power.h.

#define CLOCK_PROB   0.5

Definition at line 36 of file power.h.

#define MAX_LOGS   10000

This is the top-level file for power estimation in VTR

Definition at line 33 of file power.h.

Typedef Documentation

typedef struct s_log t_log

Definition at line 61 of file power.h.

typedef struct s_mux_arch t_mux_arch

Definition at line 75 of file power.h.

typedef struct s_mux_node t_mux_node

Definition at line 74 of file power.h.

Definition at line 67 of file power.h.

Definition at line 72 of file power.h.

Definition at line 73 of file power.h.

Definition at line 62 of file power.h.

Definition at line 79 of file power.h.

Definition at line 63 of file power.h.

Definition at line 64 of file power.h.

Definition at line 78 of file power.h.

Definition at line 66 of file power.h.

typedef struct s_power_nmos_leakages t_power_nmos_leakages

Definition at line 65 of file power.h.

Definition at line 77 of file power.h.

Definition at line 60 of file power.h.

typedef struct s_power_tech t_power_tech

Definition at line 68 of file power.h.

Definition at line 71 of file power.h.

Definition at line 76 of file power.h.

Definition at line 69 of file power.h.

Definition at line 70 of file power.h.

Enumeration Type Documentation

Enumerator
POWER_LOG_ERROR 
POWER_LOG_WARNING 
POWER_LOG_NUM_TYPES 

Definition at line 47 of file power.h.

Enumerator
POWER_RET_CODE_SUCCESS 
POWER_RET_CODE_ERRORS 
POWER_RET_CODE_WARNINGS 

Definition at line 42 of file power.h.

enum e_tx_type
Enumerator
NMOS 
PMOS 

Definition at line 88 of file power.h.

88  {
89  NMOS, PMOS
90 } e_tx_type;
Definition: power.h:89
Definition: power.h:89
e_tx_type
Definition: power.h:88

Function Documentation

boolean power_init ( char *  power_out_filepath,
char *  cmos_tech_behavior_filepath,
t_arch arch,
t_det_routing_arch routing_arch 
)

Initialization for all power-related functions

Definition at line 1270 of file power.c.

1272  {
1273  boolean error = FALSE;
1274 
1275  /* Set global power architecture & options */
1276  g_power_arch = arch->power;
1280 
1281  /* Set up Logs */
1284  sizeof(t_log));
1287 
1288  /* Initialize output file */
1289  if (!error) {
1290  g_power_output->out = NULL;
1291  g_power_output->out = my_fopen(power_out_filepath, "w", 0);
1292  if (!g_power_output->out) {
1293  error = TRUE;
1294  }
1295  }
1296 
1297  /* Load technology properties */
1298  power_tech_init(cmos_tech_behavior_filepath);
1299 
1300  /* Low-Level Initialization */
1302 
1303  /* Initialize sub-modules */
1305 
1306  /* Perform callibration */
1307  power_callibrate();
1308 
1309  /* Initialize routing information */
1310  power_routing_init(routing_arch);
1311 
1312 // Allocates power structures for each pb pin
1314 
1315  /* Size all components */
1316  power_sizing_init(arch);
1317 
1318  //power_print_spice_comparison();
1319 
1320  return error;
1321 }
t_power_tech * g_power_tech
Definition: power.c:67
t_power_arch * g_power_arch
Definition: power.c:68
FILE * out
Definition: power.h:200
FILE * my_fopen(const char *fname, const char *flag, int prompt)
Definition: util.c:54
t_power_arch * power
void power_callibrate(void)
struct s_power_commonly_used t_power_commonly_used
Definition: power.h:62
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
void power_routing_init(t_det_routing_arch *routing_arch)
Definition: power.c:1140
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
char * name
Definition: power.h:206
void power_sizing_init(t_arch *arch)
Definition: power_sizing.c:237
void power_lowlevel_init()
t_log * logs
Definition: power.h:201
Definition: util.h:12
t_power_output * g_power_output
Definition: power.c:65
void power_components_init(void)
static void * my_malloc(int ibytes)
Definition: graphics.c:499
int num_logs
Definition: power.h:202
void power_tech_init(char *cmos_tech_behavior_filepath)
void power_pb_pins_init()
Definition: power.c:1130
char * my_strdup(const char *str)
Definition: util.c:101
Definition: power.h:205
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 at line 1695 of file power.c.

1696  {
1697  t_power_usage total_power;
1698  t_power_usage sub_power_usage;
1699  clock_t t_start;
1700  clock_t t_end;
1701  t_power_usage clb_power_usage;
1702 
1703  t_start = clock();
1704 
1705  power_zero_usage(&total_power);
1706 
1707  if (routing_arch->directionality == BI_DIRECTIONAL) {
1709  "Cannot calculate routing power for bi-directional architectures");
1710  return POWER_RET_CODE_ERRORS;
1711  }
1712 
1713  /* Calculate Power */
1714  /* Routing */
1715  power_usage_routing(&sub_power_usage, routing_arch, arch->Segments);
1716  power_add_usage(&total_power, &sub_power_usage);
1718 
1719  /* Clock */
1720  power_usage_clock(&sub_power_usage, arch->clocks);
1721  power_add_usage(&total_power, &sub_power_usage);
1723 
1724  /* CLBs */
1725  power_usage_blocks(&clb_power_usage);
1726  power_add_usage(&total_power, &clb_power_usage);
1727  power_component_add_usage(&clb_power_usage, POWER_COMPONENT_PB);
1728 
1730 
1731  power_print_title(g_power_output->out, "Summary");
1732  power_print_summary(g_power_output->out, vpr_setup);
1733 
1734  /* Print Error & Warning Logs */
1737 
1738  //power_print_title(g_power_output->out, "Statistics");
1739  //power_print_stats(g_power_output->out);
1740 
1741  power_print_title(g_power_output->out, "Power Breakdown");
1743 
1744  power_print_title(g_power_output->out, "Power Breakdown by PB");
1746 
1747  //power_print_title(g_power_output->out, "Spice Comparison");
1748  //power_print_spice_comparison();
1749 
1750  t_end = clock();
1751 
1752  *run_time_s = (float) (t_end - t_start) / CLOCKS_PER_SEC;
1753 
1754  /* Return code */
1756  return POWER_RET_CODE_ERRORS;
1758  return POWER_RET_CODE_WARNINGS;
1759  } else {
1760  return POWER_RET_CODE_SUCCESS;
1761  }
1762 }
static void power_usage_blocks(t_power_usage *power_usage)
Definition: power.c:592
FILE * out
Definition: power.h:200
void power_print_title(FILE *fp, char *title)
Definition: power_util.c:475
static void power_usage_routing(t_power_usage *power_usage, t_det_routing_arch *routing_arch, t_segment_inf *segment_inf)
Definition: power.c:762
static void power_print_breakdown_pb(FILE *fp)
Definition: power.c:1775
static void power_print_summary(FILE *fp, t_vpr_setup vpr_setup)
Definition: power.c:1661
t_log * logs
Definition: power.h:201
t_power_output * g_power_output
Definition: power.c:65
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
t_clock_arch * clocks
int num_logs
Definition: power.h:202
enum e_directionality directionality
Definition: vpr_types.h:758
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
static void power_print_breakdown_summary(FILE *fp)
Definition: power.c:1768
t_segment_inf * Segments
int num_messages
Definition: power.h:208
void power_component_add_usage(t_power_usage *power_usage, e_power_component_type component_idx)
static void power_usage_clock(t_power_usage *power_usage, t_clock_arch *clock_arch)
Definition: power.c:627
void power_log_msg(e_power_log_type log_type, char *msg)
Definition: power_util.c:67
void output_logs(FILE *fp, t_log *logs, int num_logs)
Definition: power_util.c:457

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boolean power_uninit ( void  )

Uninitialize power module

Definition at line 1326 of file power.c.

1326  {
1327  int mux_size;
1328  int log_idx;
1329  int rr_node_idx;
1330  int msg_idx;
1331  boolean error = FALSE;
1332 
1333  for (rr_node_idx = 0; rr_node_idx < num_rr_nodes; rr_node_idx++) {
1334  t_rr_node * node = &rr_node[rr_node_idx];
1335  t_rr_node_power * node_power = &rr_node_power[rr_node_idx];
1336 
1337  switch (node->type) {
1338  case CHANX:
1339  case CHANY:
1340  case IPIN:
1341  if (node->fan_in) {
1342  free(node_power->in_dens);
1343  free(node_power->in_prob);
1344  }
1345  break;
1346  default:
1347  /* Do nothing */
1348  break;
1349  }
1350  }
1351  free(rr_node_power);
1352 
1353  /* Free mux architectures */
1354  for (std::map<float, t_power_mux_info*>::iterator it =
1356  it != g_power_commonly_used->mux_info.end(); it++) {
1357  t_power_mux_info * mux_info = it->second;
1358  for (mux_size = 1; mux_size <= mux_info->mux_arch_max_size;
1359  mux_size++) {
1360  dealloc_mux_graph(mux_info->mux_arch[mux_size].mux_graph_head);
1361  }
1362  delete mux_info;
1363  }
1364  free(g_power_commonly_used);
1365 
1366  if (g_power_output->out) {
1367  fclose(g_power_output->out);
1368  }
1369 
1370  /* Free logs */
1371  for (log_idx = 0; log_idx < g_power_output->num_logs; log_idx++) {
1372  for (msg_idx = 0; msg_idx < g_power_output->logs[log_idx].num_messages;
1373  msg_idx++) {
1374  free(g_power_output->logs[log_idx].messages[msg_idx]);
1375  }
1376  free(g_power_output->logs[log_idx].messages);
1377  free(g_power_output->logs[log_idx].name);
1378  }
1379  free(g_power_output->logs);
1380  free(g_power_output);
1381 
1382  return error;
1383 }
FILE * out
Definition: power.h:200
t_mux_arch * mux_arch
Definition: power.h:214
t_rr_node * rr_node
Definition: globals.c:70
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
char * name
Definition: power.h:206
std::map< float, t_power_mux_info * > mux_info
Definition: power.h:245
t_log * logs
Definition: power.h:201
Definition: util.h:12
t_power_output * g_power_output
Definition: power.c:65
float * in_prob
Definition: power.h:270
static t_rr_node_power * rr_node_power
Definition: power.c:69
int num_logs
Definition: power.h:202
int mux_arch_max_size
Definition: power.h:213
int num_rr_nodes
Definition: globals.c:69
float * in_dens
Definition: power.h:269
int num_messages
Definition: power.h:208
short fan_in
Definition: vpr_types.h:900
t_mux_node * mux_graph_head
Definition: power.h:284
static void dealloc_mux_graph(t_mux_node *node)
Definition: power.c:742
t_rr_type type
Definition: vpr_types.h:902
char ** messages
Definition: power.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

t_power_arch* g_power_arch

Definition at line 68 of file power.c.

t_power_commonly_used* g_power_commonly_used

Definition at line 66 of file power.c.

t_power_output* g_power_output

Definition at line 65 of file power.c.

t_power_tech* g_power_tech

Definition at line 67 of file power.c.

t_solution_inf g_solution_inf

Definition at line 64 of file power.c.