VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
PowerSpicedComponent Class Reference

#include <PowerSpicedComponent.h>

Public Member Functions

PowerCallibInputsadd_entry (int num_inputs)
 
PowerCallibInputsget_entry (int num_inputs)
 
PowerCallibInputsget_entry_bound (bool lower, int num_inputs)
 
 PowerSpicedComponent (float(*usage_fn)(int num_inputs, float transistor_size))
 
void add_data_point (int num_inputs, float transistor_size, float power)
 
float scale_factor (int num_inputs, float transistor_size)
 
void sort_me ()
 
void callibrate (void)
 
bool is_done_callibration (void)
 

Data Fields

std::vector< PowerCallibInputs * > entries
 
float(* component_usage )(int num_inputs, float transistor_size)
 
bool sorted
 
bool done_callibration
 

Detailed Description

Definition at line 56 of file PowerSpicedComponent.h.

Constructor & Destructor Documentation

PowerSpicedComponent::PowerSpicedComponent ( float(*)(int num_inputs, float transistor_size)  usage_fn)

Definition at line 76 of file PowerSpicedComponent.c.

77  {
78  component_usage = usage_fn;
79 
80  /* Always pad with a high and low entry */
81  add_entry(0);
82 // add_entry(std::numeric_limits<int>::max());
83  add_entry(1000000000);
84 
85  done_callibration = false;
86  sorted = true;
87 }
float(* component_usage)(int num_inputs, float transistor_size)
PowerCallibInputs * add_entry(int num_inputs)

+ Here is the call graph for this function:

Member Function Documentation

void PowerSpicedComponent::add_data_point ( int  num_inputs,
float  transistor_size,
float  power 
)

Definition at line 136 of file PowerSpicedComponent.c.

137  {
138  assert(!done_callibration);
139  PowerCallibInputs * inputs_entry = get_entry(num_inputs);
140  inputs_entry->add_size(transistor_size, power);
141  sorted = false;
142 }
void add_size(float transistor_size, float power=0.)
PowerCallibInputs * get_entry(int num_inputs)

+ Here is the call graph for this function:

PowerCallibInputs * PowerSpicedComponent::add_entry ( int  num_inputs)

Definition at line 89 of file PowerSpicedComponent.c.

89  {
90  PowerCallibInputs * entry = new PowerCallibInputs(this, num_inputs);
91  entries.push_back(entry);
92  return entry;
93 }
std::vector< PowerCallibInputs * > entries

+ Here is the caller graph for this function:

void PowerSpicedComponent::callibrate ( void  )

Definition at line 218 of file PowerSpicedComponent.c.

218  {
219  sort_me();
220 
221  for (vector<PowerCallibInputs*>::iterator it = entries.begin();
222  it != entries.end(); it++) {
223  (*it)->callibrate();
224  }
225  done_callibration = true;
226 }
std::vector< PowerCallibInputs * > entries

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PowerCallibInputs * PowerSpicedComponent::get_entry ( int  num_inputs)

Definition at line 95 of file PowerSpicedComponent.c.

95  {
96  vector<PowerCallibInputs*>::iterator it;
97 
98  for (it = entries.begin(); it != entries.end(); it++) {
99  if ((*it)->num_inputs == num_inputs) {
100  break;
101  }
102  }
103 
104  if (it == entries.end()) {
105  return add_entry(num_inputs);
106  } else {
107  return *it;
108  }
109 }
std::vector< PowerCallibInputs * > entries
PowerCallibInputs * add_entry(int num_inputs)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PowerCallibInputs * PowerSpicedComponent::get_entry_bound ( bool  lower,
int  num_inputs 
)

Definition at line 111 of file PowerSpicedComponent.c.

112  {
113  PowerCallibInputs * prev = entries[0];
114 
115  assert(sorted);
116  for (vector<PowerCallibInputs*>::iterator it = entries.begin() + 1;
117  it != entries.end(); it++) {
118  if ((*it)->num_inputs > num_inputs) {
119  if (lower) {
120  if (prev == entries[0])
121  return NULL;
122  else
123  return prev;
124  } else {
125  if (*it == entries[entries.size() - 1])
126  return NULL;
127  else
128  return *it;
129  }
130  }
131  prev = *it;
132  }
133  return NULL;
134 }
std::vector< PowerCallibInputs * > entries

+ Here is the caller graph for this function:

bool PowerSpicedComponent::is_done_callibration ( void  )

Definition at line 228 of file PowerSpicedComponent.c.

228  {
229  return done_callibration;
230 }

+ Here is the caller graph for this function:

float PowerSpicedComponent::scale_factor ( int  num_inputs,
float  transistor_size 
)

Definition at line 144 of file PowerSpicedComponent.c.

145  {
146 
147  PowerCallibInputs * inputs_lower;
148  PowerCallibInputs * inputs_upper;
149 
150  PowerCallibSize * size_lower;
151  PowerCallibSize * size_upper;
152 
153  float factor_lower = 0.;
154  float factor_upper = 0.;
155  float factor;
156 
157  float perc_upper;
158 
159  assert(done_callibration);
160 
161  inputs_lower = get_entry_bound(true, num_inputs);
162  inputs_upper = get_entry_bound(false, num_inputs);
163 
164  if (inputs_lower) {
165  /* Interpolation of factor between sizes for lower # inputs */
166  assert(inputs_lower->done_callibration);
167  size_lower = inputs_lower->get_entry_bound(true, transistor_size);
168  size_upper = inputs_lower->get_entry_bound(false, transistor_size);
169 
170  perc_upper = (transistor_size - size_lower->transistor_size)
171  / (size_upper->transistor_size - size_lower->transistor_size);
172  factor_lower = perc_upper * size_upper->factor
173  + (1 - perc_upper) * size_lower->factor;
174  }
175 
176  if (inputs_upper) {
177  /* Interpolation of factor between sizes for upper # inputs */
178  assert(inputs_upper->done_callibration);
179  size_lower = inputs_upper->get_entry_bound(true, transistor_size);
180  size_upper = inputs_upper->get_entry_bound(false, transistor_size);
181 
182  perc_upper = (transistor_size - size_lower->transistor_size)
183  / (size_upper->transistor_size - size_lower->transistor_size);
184  factor_upper = perc_upper * size_upper->factor
185  + (1 - perc_upper) * size_lower->factor;
186  }
187 
188  if (!inputs_lower) {
189  factor = factor_upper;
190  } else if (!inputs_upper) {
191  factor = factor_lower;
192  } else {
193  /* Interpolation of factor between inputs */
194  perc_upper =
195  ((float) (num_inputs - inputs_lower->num_inputs))
196  / ((float) (inputs_upper->num_inputs
197  - inputs_lower->num_inputs));
198  factor = perc_upper * factor_upper + (1 - perc_upper) * factor_lower;
199  }
200  return factor;
201 
202 }
PowerCallibSize * get_entry_bound(bool lower, float transistor_size)
PowerCallibInputs * get_entry_bound(bool lower, int num_inputs)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PowerSpicedComponent::sort_me ( void  )

Definition at line 208 of file PowerSpicedComponent.c.

208  {
209  sort(entries.begin(), entries.end(), sorter_PowerCallibInputs);
210 
211  for (vector<PowerCallibInputs*>::iterator it = entries.begin();
212  it != entries.end(); it++) {
213  (*it)->sort_me();
214  }
215  sorted = true;
216 }
bool sorter_PowerCallibInputs(PowerCallibInputs *a, PowerCallibInputs *b)
std::vector< PowerCallibInputs * > entries

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

float(* PowerSpicedComponent::component_usage)(int num_inputs, float transistor_size)

Definition at line 61 of file PowerSpicedComponent.h.

bool PowerSpicedComponent::done_callibration

Definition at line 64 of file PowerSpicedComponent.h.

std::vector<PowerCallibInputs*> PowerSpicedComponent::entries

Definition at line 58 of file PowerSpicedComponent.h.

bool PowerSpicedComponent::sorted

Definition at line 63 of file PowerSpicedComponent.h.


The documentation for this class was generated from the following files: