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

Go to the source code of this file.

Data Structures

struct  s_power_breakdown
 

Macros

#define POWER_LUT_SLOW
 

Typedefs

typedef struct s_power_breakdown t_power_components
 

Enumerations

enum  e_power_component_type {
  POWER_COMPONENT_IGNORE = 0, POWER_COMPONENT_TOTAL, POWER_COMPONENT_ROUTING, POWER_COMPONENT_ROUTE_SB,
  POWER_COMPONENT_ROUTE_CB, POWER_COMPONENT_ROUTE_GLB_WIRE, POWER_COMPONENT_CLOCK, POWER_COMPONENT_CLOCK_BUFFER,
  POWER_COMPONENT_CLOCK_WIRE, POWER_COMPONENT_PB, POWER_COMPONENT_PB_PRIMITIVES, POWER_COMPONENT_PB_INTERC_MUXES,
  POWER_COMPONENT_PB_BUFS_WIRE, POWER_COMPONENT_PB_OTHER, POWER_COMPONENT_MAX_NUM
}
 

Functions

void power_components_init (void)
 
void power_components_uninit (void)
 
void power_component_get_usage (t_power_usage *power_usage, e_power_component_type component_idx)
 
void power_component_add_usage (t_power_usage *power_usage, e_power_component_type component_idx)
 
float power_component_get_usage_sum (e_power_component_type component_idx)
 
void power_usage_ff (t_power_usage *power_usage, float size, float D_prob, float D_dens, float Q_prob, float Q_dens, float clk_prob, float clk_dens, float period)
 
void power_usage_lut (t_power_usage *power_usage, int LUT_size, float transistor_size, char *SRAM_values, float *input_densities, float *input_probabilities, float period)
 
void power_usage_local_interc_mux (t_power_usage *power_usage, t_pb *pb, t_interconnect_pins *interc_pins)
 
void power_usage_mux_multilevel (t_power_usage *power_usage, t_mux_arch *mux_arch, float *in_prob, float *in_dens, int selected_input, boolean output_level_restored, float period)
 
void power_usage_buffer (t_power_usage *power_usage, float size, float in_prob, float in_dens, boolean level_restored, float period)
 

Variables

t_power_components g_power_by_component
 

Macro Definition Documentation

#define POWER_LUT_SLOW

This file offers functions to estimate power of major components within the FPGA (flip-flops, LUTs, interconnect structures, etc).

Definition at line 37 of file power_components.h.

Typedef Documentation

Definition at line 67 of file power_components.h.

Enumeration Type Documentation

Enumerator
POWER_COMPONENT_IGNORE 
POWER_COMPONENT_TOTAL 
POWER_COMPONENT_ROUTING 
POWER_COMPONENT_ROUTE_SB 
POWER_COMPONENT_ROUTE_CB 
POWER_COMPONENT_ROUTE_GLB_WIRE 
POWER_COMPONENT_CLOCK 
POWER_COMPONENT_CLOCK_BUFFER 
POWER_COMPONENT_CLOCK_WIRE 
POWER_COMPONENT_PB 
POWER_COMPONENT_PB_PRIMITIVES 
POWER_COMPONENT_PB_INTERC_MUXES 
POWER_COMPONENT_PB_BUFS_WIRE 
POWER_COMPONENT_PB_OTHER 
POWER_COMPONENT_MAX_NUM 

Definition at line 43 of file power_components.h.

43  {
44  POWER_COMPONENT_IGNORE = 0, /* */
45  POWER_COMPONENT_TOTAL, /* Total power for entire FPGA */
46 
47  POWER_COMPONENT_ROUTING, /* Power for routing fabric (not local routing) */
48  POWER_COMPONENT_ROUTE_SB, /* Switch-box */
49  POWER_COMPONENT_ROUTE_CB, /* Connection box*/
51 
52  POWER_COMPONENT_CLOCK, /* Clock network */
53  POWER_COMPONENT_CLOCK_BUFFER, /* Buffers in clock network */
54  POWER_COMPONENT_CLOCK_WIRE, /* Wires in clock network */
55 
56  POWER_COMPONENT_PB, /* Logic Blocks, and other hard blocks */
57  POWER_COMPONENT_PB_PRIMITIVES, /* Primitives (LUTs, FF, etc) */
58  POWER_COMPONENT_PB_INTERC_MUXES, /* Local interconnect structures (muxes) */
59  POWER_COMPONENT_PB_BUFS_WIRE, /* Local buffers and wire capacitance */
60 
61  POWER_COMPONENT_PB_OTHER, /* Power from other estimation methods - not transistor-level */
62 
e_power_component_type

Function Documentation

void power_component_add_usage ( t_power_usage power_usage,
e_power_component_type  component_idx 
)

Adds power usage for a component to the global component tracker

  • power_usage: Power usage to add
  • component_idx: Type of component

Definition at line 74 of file power_components.c.

75  {
77  power_usage);
78 }
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
t_power_components g_power_by_component
t_power_usage * components

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_component_get_usage ( t_power_usage power_usage,
e_power_component_type  component_idx 
)

Gets power usage for a component

  • power_usage: (Return value) Power usage for the given component
  • component_idx: Type of component

Definition at line 85 of file power_components.c.

86  {
87  memcpy(power_usage, &g_power_by_component.components[component_idx],
88  sizeof(t_power_usage));
89 }
t_power_components g_power_by_component
t_power_usage * components
float power_component_get_usage_sum ( e_power_component_type  component_idx)

Returns total power for a given component

  • component_idx: Type of component

Definition at line 95 of file power_components.c.

95  {
96  return power_sum_usage(&g_power_by_component.components[component_idx]);
97 }
float power_sum_usage(t_power_usage *power_usage)
Definition: power_util.c:59
t_power_components g_power_by_component
t_power_usage * components

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_components_init ( void  )

Module initializer function, called by power_init

Definition at line 52 of file power_components.c.

52  {
53  int i;
54 
57  for (i = 0; i < POWER_COMPONENT_MAX_NUM; i++) {
59  }
60 }
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
t_power_components g_power_by_component
t_power_usage * components

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_components_uninit ( void  )

Module un-initializer function, called by power_uninit

Definition at line 65 of file power_components.c.

65  {
67 }
t_power_components g_power_by_component
t_power_usage * components
void power_usage_buffer ( t_power_usage power_usage,
float  size,
float  in_prob,
float  in_dens,
boolean  level_restorer,
float  period 
)

This function calculates the power of a multistage buffer

  • power_usage: (Return value) Power usage of buffer
  • size: The size of the final buffer stage, relative to min-sized inverter
  • in_prob: The signal probability of the input
  • in_dens: The transition density of the input
  • level_restored: Whether this buffer must level restore the input
  • input_mux_size: If fed by a mux, the size of this mutliplexer

Definition at line 633 of file power_components.c.

634  {
635  t_power_usage sub_power_usage;
636  int i, num_stages;
637  float stage_effort;
638  float stage_inv_size;
639  float stage_in_prob;
640  float input_dyn_power;
641  float scale_factor;
642  PowerSpicedComponent * callibration;
643 
644  power_zero_usage(power_usage);
645 
646  if (size == 0.) {
647  return;
648  }
649 
650  num_stages = power_calc_buffer_num_stages(size,
652  stage_effort = calc_buffer_stage_effort(num_stages, size);
653 
654  stage_in_prob = in_prob;
655  for (i = 0; i < num_stages; i++) {
656  stage_inv_size = pow(stage_effort, i);
657 
658  if (i == 0) {
659  if (level_restorer) {
660  /* Sense Buffer */
661  power_usage_level_restorer(&sub_power_usage, &input_dyn_power,
662  in_dens, stage_in_prob, period);
663  } else {
664  power_usage_inverter(&sub_power_usage, in_dens, stage_in_prob,
665  stage_inv_size, period);
666  }
667  } else {
668  power_usage_inverter(&sub_power_usage, in_dens, stage_in_prob,
669  stage_inv_size, period);
670  }
671  power_add_usage(power_usage, &sub_power_usage);
672 
673  stage_in_prob = 1 - stage_in_prob;
674  }
675 
676  /* Callibration */
677  if (level_restorer) {
678  callibration =
680  } else {
681  callibration =
683  }
684 
685  if (callibration->is_done_callibration()) {
686  scale_factor = callibration->scale_factor(1, size);
687  power_scale_usage(power_usage, scale_factor);
688  }
689 
690  /* Short-circuit: add a factor to dynamic power, but the factor is not in addition to the input power
691  * Need to subtract input before adding factor - this matters for small buffers
692  */
693  /*power_usage->dynamic += (power_usage->dynamic - input_dyn_power)
694  * power_calc_buffer_sc(num_stages, stage_effort, level_restorer,
695  input_mux_size); */
696 }
t_power_arch * g_power_arch
Definition: power.c:68
PowerSpicedComponent ** component_callibration
Definition: power.h:237
void power_usage_level_restorer(t_power_usage *power_usage, float *dyn_power_in, float in_dens, float in_prob, float period)
float logical_effort_factor
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
int power_calc_buffer_num_stages(float final_stage_size, float desired_stage_effort)
Definition: power_util.c:179
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
void power_scale_usage(t_power_usage *power_usage, float scale_factor)
Definition: power_util.c:54
float scale_factor(int num_inputs, float transistor_size)
float calc_buffer_stage_effort(int N, float final_stage_size)
Definition: power_util.c:204
void power_usage_inverter(t_power_usage *power_usage, float in_dens, float in_prob, float size, float period)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_usage_ff ( t_power_usage power_usage,
float  size,
float  D_prob,
float  D_dens,
float  Q_prob,
float  Q_dens,
float  clk_prob,
float  clk_dens,
float  period 
)

Calculates power of a D flip-flop

  • power_usage: (Return value) power usage of the flip-flop
  • D_prob: Signal probability of the input
  • D_dens: Transition density of the input
  • Q_prob: Signal probability of the output
  • Q_dens: Transition density of the output
  • clk_prob: Signal probability of the clock
  • clk_dens: Transition density of the clock

Definition at line 109 of file power_components.c.

111  {
112  t_power_usage sub_power_usage;
113  float mux_in_dens[2];
114  float mux_in_prob[2];
115  PowerSpicedComponent * callibration;
116  float scale_factor;
117 
118  power_zero_usage(power_usage);
119 
120  /* DFF is build using a master loop and slave loop.
121  * Each loop begins with a MUX and contains 2 inverters
122  * in a feedback loop to the mux.
123  * Each mux is built using two transmission gates.
124  */
125 
126  /* Master */
127  mux_in_dens[0] = D_dens;
128  mux_in_dens[1] = (1 - clk_prob) * D_dens;
129  mux_in_prob[0] = D_prob;
130  mux_in_prob[1] = D_prob;
131  power_usage_MUX2_transmission(&sub_power_usage, size, mux_in_dens,
132  mux_in_prob, clk_dens, (1 - clk_prob) * D_dens, period);
133  power_add_usage(power_usage, &sub_power_usage);
134 
135  power_usage_inverter(&sub_power_usage, (1 - clk_prob) * D_dens, D_prob,
136  size, period);
137  power_add_usage(power_usage, &sub_power_usage);
138 
139  power_usage_inverter(&sub_power_usage, (1 - clk_prob) * D_dens, 1 - D_prob,
140  size, period);
141  power_add_usage(power_usage, &sub_power_usage);
142 
143  /* Slave */
144  mux_in_dens[0] = Q_dens;
145  mux_in_dens[1] = (1 - clk_prob) * D_dens;
146  mux_in_prob[0] = (1 - Q_prob);
147  mux_in_prob[1] = (1 - D_prob);
148  power_usage_MUX2_transmission(&sub_power_usage, size, mux_in_dens,
149  mux_in_prob, clk_dens, Q_dens, period);
150  power_add_usage(power_usage, &sub_power_usage);
151 
152  power_usage_inverter(&sub_power_usage, Q_dens, 1 - Q_prob, size, period);
153  power_add_usage(power_usage, &sub_power_usage);
154 
155  power_usage_inverter(&sub_power_usage, Q_dens, Q_prob, size, period);
156  power_add_usage(power_usage, &sub_power_usage);
157 
158  /* Callibration */
159  callibration =
161  if (callibration->is_done_callibration()) {
162  scale_factor = callibration->scale_factor(1, size);
163  power_scale_usage(power_usage, scale_factor);
164  }
165 
166  return;
167 }
PowerSpicedComponent ** component_callibration
Definition: power.h:237
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
void power_usage_MUX2_transmission(t_power_usage *power_usage, float size, float *in_dens, float *in_prob, float sel_dens, float out_dens, float period)
void power_scale_usage(t_power_usage *power_usage, float scale_factor)
Definition: power_util.c:54
float scale_factor(int num_inputs, float transistor_size)
void power_usage_inverter(t_power_usage *power_usage, float in_dens, float in_prob, float size, float period)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_usage_local_interc_mux ( t_power_usage power_usage,
t_pb pb,
t_interconnect_pins interc_pins 
)

This function calculates power of a local interconnect structure

  • power_usage: (Return value) Power usage of the structure
  • pb: The physical block to which this interconnect belongs
  • interc_pins: The interconnect input/ouput pin information
  • interc_length: The physical length spanned by the interconnect (meters)

Definition at line 404 of file power_components.c.

405  {
406  int pin_idx;
407  int out_port_idx;
408  int in_port_idx;
409  float * in_dens;
410  float * in_prob;
411  t_power_usage MUX_power;
412  t_interconnect * interc = interc_pins->interconnect;
413  t_interconnect_power * interc_power = interc->interconnect_power;
414 
415  power_zero_usage(power_usage);
416 
417  /* Ensure port/pins are structured as expected */
418  switch (interc_pins->interconnect->type) {
419  case DIRECT_INTERC:
420  assert(interc_power->num_input_ports == 1);
421  assert(interc_power->num_output_ports == 1);
422  break;
423  case MUX_INTERC:
424  assert(interc_power->num_output_ports == 1);
425  break;
426  case COMPLETE_INTERC:
427  break;
428  }
429 
430  /* Power of transistors to build interconnect structure */
431  switch (interc_pins->interconnect->type) {
432  case DIRECT_INTERC:
433  /* Direct connections require no transistors */
434  break;
435  case MUX_INTERC:
436  case COMPLETE_INTERC:
437  /* Many-to-1, or Many-to-Many
438  * Implemented as a multiplexer for each output
439  * */
440  in_dens = (float*) my_calloc(
441  interc->interconnect_power->num_input_ports, sizeof(float));
442  in_prob = (float*) my_calloc(
443  interc->interconnect_power->num_input_ports, sizeof(float));
444 
445  for (out_port_idx = 0;
446  out_port_idx < interc->interconnect_power->num_output_ports;
447  out_port_idx++) {
448  for (pin_idx = 0;
449  pin_idx < interc->interconnect_power->num_pins_per_port;
450  pin_idx++) {
451 
452  int selected_input = OPEN;
453 
454  /* Clear input densities */
455  for (in_port_idx = 0;
456  in_port_idx
458  in_port_idx++) {
459  in_dens[in_port_idx] = 0.;
460  in_prob[in_port_idx] = 0.;
461  }
462 
463  /* Get probability/density of input signals */
464  if (pb) {
465  int output_pin_net =
466  pb->rr_graph[interc_pins->output_pins[out_port_idx][pin_idx]->pin_count_in_cluster].net_num;
467 
468  if (output_pin_net == OPEN) {
469  selected_input = 0;
470  } else {
471  for (in_port_idx = 0;
472  in_port_idx
474  in_port_idx++) {
475  t_pb_graph_pin * input_pin =
476  interc_pins->input_pins[in_port_idx][pin_idx];
477  int input_pin_net =
478  pb->rr_graph[input_pin->pin_count_in_cluster].net_num;
479 
480  /* Find input pin that connects through the mux to the output pin */
481  if (output_pin_net == input_pin_net) {
482  selected_input = in_port_idx;
483  }
484 
485  /* Initialize input densities */
486  if (input_pin_net != OPEN) {
487  in_dens[in_port_idx] = pin_dens(pb, input_pin);
488  in_prob[in_port_idx] = pin_prob(pb, input_pin);
489  }
490  }
491 
492  /* Check that the input pin was found with a matching net to the output pin */
493  assert(selected_input != OPEN);
494  }
495  } else {
496  selected_input = 0;
497  }
498 
499  /* Calculate power of the multiplexer */
500  power_usage_mux_multilevel(&MUX_power,
504  in_dens, selected_input, TRUE, g_solution_inf.T_crit);
505 
506  power_add_usage(power_usage, &MUX_power);
507  }
508  }
509 
510  free(in_dens);
511  free(in_prob);
512  break;
513  default:
514  assert(0);
515  }
516 
518  power_usage);
519 }
t_power_arch * g_power_arch
Definition: power.c:68
void power_usage_mux_multilevel(t_power_usage *power_usage, t_mux_arch *mux_arch, float *in_prob, float *in_dens, int selected_input, boolean output_level_restored, float period)
int net_num
Definition: vpr_types.h:917
struct s_rr_node * rr_graph
Definition: vpr_types.h:188
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
t_interconnect * interconnect
t_solution_inf g_solution_inf
Definition: power.c:64
struct s_pb_graph_pin *** output_pins
t_mux_arch * power_get_mux_arch(int num_mux_inputs, float transistor_size)
Definition: power_util.c:490
float pin_prob(t_pb *pb, t_pb_graph_pin *pin)
Definition: power_util.c:96
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
enum e_interconnect type
float T_crit
Definition: power.h:83
float pin_dens(t_pb *pb, t_pb_graph_pin *pin)
Definition: power_util.c:81
Definition: slre.c:50
struct s_pb_graph_pin *** input_pins
t_power_usage power_usage
float mux_transistor_size
t_interconnect_power * interconnect_power
Definition: util.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_usage_lut ( t_power_usage power_usage,
int  lut_size,
float  transistor_size,
char *  SRAM_values,
float *  input_prob,
float *  input_dens,
float  period 
)

Calculated power of a look-up table (LUT)

  • power_usage: (Return value) The power usage of the LUT
  • LUT_size: Number of LUT inputs
  • SRAM_values: The 2^(LUT_size) truth table values. String of '0' and '1' characters. First characters is for all inputs = 0 and last characters is for all inputs = 1.
  • input_prob: Array of input signal probabilities
  • input_dens: Array of input transition densities

NOTE: The following provides a diagram of a 3-LUT, the sram bit ordering, and the input array ordering.

X - NMOS gate controlled by complement of input Z - NMOS gate controlled by input

S R I I I A N N N M 2 1 0 | | | | v v | | v | 0 X | |_X_ v 1 Z| | |_X_ 2 X | | |_Z_| | 3 Z| | |---— out 4 X | |_X_ | 5 Z| | | |_Z_| 6 X | |_Z_| 7 Z|

Definition at line 208 of file power_components.c.

210  {
211  float **internal_prob;
212  float **internal_dens;
213  float **internal_v;
214  int i;
215  int level_idx;
216  PowerSpicedComponent * callibration;
217  float scale_factor;
218 
219  int num_SRAM_bits;
220 
221  boolean level_restorer_this_level = FALSE;
222 
223  power_zero_usage(power_usage);
224 
225  num_SRAM_bits = 1 << lut_size;
226 
227  /* Initialize internal node data */
228  internal_prob = (float**) my_calloc(lut_size + 1, sizeof(float*));
229  internal_dens = (float**) my_calloc(lut_size + 1, sizeof(float*));
230  internal_v = (float**) my_calloc(lut_size + 1, sizeof(float*));
231  for (i = 0; i <= lut_size; i++) {
232  internal_prob[i] = (float*) my_calloc(1 << (lut_size - i),
233  sizeof(float));
234  internal_dens[i] = (float*) my_calloc(1 << (lut_size - i),
235  sizeof(float));
236  internal_v[i] = (float*) my_calloc(1 << (lut_size - i), sizeof(float));
237  }
238 
239  /* Initialize internal probabilities/densities from SRAM bits */
240  for (i = 0; i < num_SRAM_bits; i++) {
241  if (SRAM_values[i] == '0') {
242  internal_prob[0][i] = 0.;
243  } else {
244  internal_prob[0][i] = 1.;
245  }
246  internal_dens[0][i] = 0.;
247  internal_v[0][i] = g_power_tech->Vdd;
248  }
249 
250  for (level_idx = 0; level_idx < lut_size; level_idx++) {
251  t_power_usage driver_power_usage;
252  int MUXs_this_level;
253  int MUX_idx;
254  int reverse_idx = lut_size - level_idx - 1;
255 
256  MUXs_this_level = 1 << (reverse_idx);
257 
258  /* Power of input drivers */
259  power_usage_inverter(&driver_power_usage, input_dens[reverse_idx],
260  input_prob[reverse_idx], 1.0, period);
261  power_add_usage(power_usage, &driver_power_usage);
262 
263  power_usage_inverter(&driver_power_usage, input_dens[reverse_idx],
264  input_prob[reverse_idx], 2.0, period);
265  power_add_usage(power_usage, &driver_power_usage);
266 
267  power_usage_inverter(&driver_power_usage, input_dens[reverse_idx],
268  1 - input_prob[reverse_idx], 2.0, period);
269  power_add_usage(power_usage, &driver_power_usage);
270 
271  /* Add level restorer after every 2 stages (level_idx %2 == 1)
272  * But if there is an odd # of stages, just put one at the last
273  * stage (level_idx == LUT_size - 1) and not at the stage just before
274  * the last stage (level_idx != LUT_size - 2)
275  */
276  if (((level_idx % 2 == 1) && (level_idx != lut_size - 2))
277  || (level_idx == lut_size - 1)) {
278  level_restorer_this_level = TRUE;
279  } else {
280  level_restorer_this_level = FALSE;
281  }
282 
283  /* Loop through the 2-muxs at each level */
284  for (MUX_idx = 0; MUX_idx < MUXs_this_level; MUX_idx++) {
285  t_power_usage sub_power;
286  float out_prob;
287  float out_dens;
288  float sum_prob = 0;
289  int sram_offset = MUX_idx * ipow(2, level_idx + 1);
290  int sram_per_branch = ipow(2, level_idx);
291  int branch_lvl_idx;
292  int sram_idx;
293  float v_out;
294 
295  /* Calculate output probability of multiplexer */
296  out_prob = internal_prob[level_idx][MUX_idx * 2]
297  * (1 - input_prob[reverse_idx])
298  + internal_prob[level_idx][MUX_idx * 2 + 1]
299  * input_prob[reverse_idx];
300 
301  /* Calculate output density of multiplexer */
302  out_dens = internal_dens[level_idx][MUX_idx * 2]
303  * (1 - input_prob[reverse_idx])
304  + internal_dens[level_idx][MUX_idx * 2 + 1]
305  * input_prob[reverse_idx];
306 
307 #ifdef POWER_LUT_FAST
308  out_dens += ((1 - internal_prob[level_idx][MUX_idx * 2]) * internal_prob[level_idx][MUX_idx * 2 + 1]
309  + internal_prob[level_idx][MUX_idx * 2] * (1 - internal_prob[level_idx][MUX_idx * 2 + 1]))
310  * input_dens[reverse_idx];
311 #elif defined(POWER_LUT_SLOW)
312  for (sram_idx = sram_offset;
313  sram_idx < sram_offset + sram_per_branch; sram_idx++) {
314  float branch_prob = 1.;
315  if (SRAM_values[sram_idx]
316  == SRAM_values[sram_idx + sram_per_branch]) {
317  continue;
318  }
319  for (branch_lvl_idx = 0; branch_lvl_idx < level_idx;
320  branch_lvl_idx++) {
321  int branch_lvl_reverse_idx = lut_size - branch_lvl_idx - 1;
322  int even_odd = sram_idx / ipow(2, branch_lvl_idx);
323  if (even_odd % 2 == 0) {
324  branch_prob *= (1 - input_prob[branch_lvl_reverse_idx]);
325  } else {
326  branch_prob *= input_prob[branch_lvl_reverse_idx];
327  }
328  }
329  sum_prob += branch_prob;
330  }
331  out_dens += sum_prob * input_dens[reverse_idx];
332 #endif
333 
334  /* Calculate output voltage of multiplexer */
335  if (level_restorer_this_level) {
336  v_out = g_power_tech->Vdd;
337  } else {
338  v_out = (1 - input_prob[reverse_idx])
339  * power_calc_mux_v_out(2, 1.0,
340  internal_v[level_idx][MUX_idx * 2],
341  internal_prob[level_idx][MUX_idx * 2 + 1])
342  + input_prob[reverse_idx]
343  * power_calc_mux_v_out(2, 1.0,
344  internal_v[level_idx][MUX_idx * 2 + 1],
345  internal_prob[level_idx][MUX_idx * 2]);
346  }
347 
348  /* Save internal node info */
349  internal_dens[level_idx + 1][MUX_idx] = out_dens;
350  internal_prob[level_idx + 1][MUX_idx] = out_prob;
351  internal_v[level_idx + 1][MUX_idx] = v_out;
352 
353  /* Calculate power of the 2-mux */
355  internal_dens[level_idx + 1][MUX_idx],
356  internal_v[level_idx + 1][MUX_idx],
357  &internal_prob[level_idx][MUX_idx * 2],
358  &internal_dens[level_idx][MUX_idx * 2],
359  &internal_v[level_idx][MUX_idx * 2],
360  input_dens[reverse_idx], input_prob[reverse_idx],
361  transistor_size, period);
362  power_add_usage(power_usage, &sub_power);
363 
364  /* Add the level-restoring buffer if necessary */
365  if (level_restorer_this_level) {
366  /* Level restorer */
367  power_usage_buffer(&sub_power, 1,
368  internal_prob[level_idx + 1][MUX_idx],
369  internal_dens[level_idx + 1][MUX_idx], TRUE, period);
370  power_add_usage(power_usage, &sub_power);
371  }
372  }
373 
374  }
375 
376  /* Free allocated memory */
377  for (i = 0; i <= lut_size; i++) {
378  free(internal_prob[i]);
379  free(internal_dens[i]);
380  free(internal_v[i]);
381  }
382  free(internal_prob);
383  free(internal_dens);
384  free(internal_v);
385 
386  /* Callibration */
387  callibration =
389  if (callibration->is_done_callibration()) {
390  scale_factor = callibration->scale_factor(lut_size, transistor_size);
391  power_scale_usage(power_usage, scale_factor);
392  }
393 
394  return;
395 }
t_power_tech * g_power_tech
Definition: power.c:67
int ipow(int base, int exp)
Definition: util.c:775
PowerSpicedComponent ** component_callibration
Definition: power.h:237
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
Definition: util.h:12
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
Definition: power_util.c:49
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
void power_usage_mux_singlelevel_dynamic(t_power_usage *power_usage, int num_inputs, float out_density, float v_out, float *in_prob, float *in_dens, float *v_in, float sel_dens, float sel_prob, float transistor_size, float period)
float Vdd
Definition: power.h:132
void power_scale_usage(t_power_usage *power_usage, float scale_factor)
Definition: power_util.c:54
void power_usage_buffer(t_power_usage *power_usage, float size, float in_prob, float in_dens, boolean level_restorer, float period)
float power_calc_mux_v_out(int num_inputs, float transistor_size, float v_in, float in_prob_avg)
float scale_factor(int num_inputs, float transistor_size)
Definition: util.h:12
void power_usage_inverter(t_power_usage *power_usage, float in_dens, float in_prob, float size, float period)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void power_usage_mux_multilevel ( t_power_usage power_usage,
t_mux_arch mux_arch,
float *  in_prob,
float *  in_dens,
int  selected_input,
boolean  output_level_restored,
float  period 
)

This calculates the power of a multilevel multiplexer, with static inputs

  • power_usage: (Return value) The power usage of the multiplexer
  • mux_arch: The information on the multiplexer architecture
  • in_prob: Array of input signal probabilities
  • in_dens: Array of input transition densitites
  • selected_input: The index of the input that has been statically selected
  • output_level_restored: Whether the output is level restored to Vdd.

Definition at line 530 of file power_components.c.

532  {
533  float output_density;
534  float output_prob;
535  float V_out;
536  boolean found;
537  PowerSpicedComponent * callibration;
538  float scale_factor;
539  int * selector_values = (int*) my_calloc(mux_arch->levels, sizeof(int));
540 
541  assert(selected_input != OPEN);
542 
543  power_zero_usage(power_usage);
544 
545  /* Find selection index at each level */
546  found = mux_find_selector_values(selector_values, mux_arch->mux_graph_head,
547  selected_input);
548 
549  assert(found);
550 
551  /* Calculate power of the multiplexor stages, from final stage, to first stages */
552  power_usage_mux_rec(power_usage, &output_density, &output_prob, &V_out,
553  mux_arch->mux_graph_head, mux_arch, selector_values, in_prob,
554  in_dens, output_level_restored, period);
555 
556  free(selector_values);
557 
558  callibration =
560  if (callibration->is_done_callibration()) {
561  scale_factor = callibration->scale_factor(mux_arch->num_inputs,
562  mux_arch->transistor_size);
563  power_scale_usage(power_usage, scale_factor);
564  }
565 
566 }
int num_inputs
Definition: power.h:281
PowerSpicedComponent ** component_callibration
Definition: power.h:237
t_power_commonly_used * g_power_commonly_used
Definition: power.c:66
void * my_calloc(size_t nelem, size_t size)
Definition: util.c:132
void power_zero_usage(t_power_usage *power_usage)
Definition: power_util.c:44
float transistor_size
Definition: power.h:282
static void power_usage_mux_rec(t_power_usage *power_usage, float *out_prob, float *out_dens, float *v_out, t_mux_node *mux_node, t_mux_arch *mux_arch, int *selector_values, float *primary_input_prob, float *primary_input_dens, boolean v_out_restored, float period)
int levels
Definition: power.h:280
Definition: slre.c:50
void power_scale_usage(t_power_usage *power_usage, float scale_factor)
Definition: power_util.c:54
boolean mux_find_selector_values(int *selector_values, t_mux_node *mux_node, int selected_input_pin)
Definition: power_util.c:119
t_mux_node * mux_graph_head
Definition: power.h:284
float scale_factor(int num_inputs, float transistor_size)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

t_power_components g_power_by_component

Definition at line 38 of file power_components.c.