33 float period,
float voltage);
35 float *C_g,
e_tx_type transistor_type,
float size);
99 float period,
float voltage) {
100 return 0.5 * voltage *
g_power_tech->
Vdd * capacitance * density / period;
111 float in_prob,
float size,
float period) {
112 float C_drain, C_gate, C_source;
116 float NMOS_size = size;
125 C_inv += C_gate + C_drain;
129 C_inv += C_gate + C_drain;
150 float * dyn_power_input,
float in_density,
float in_probability,
151 float PMOS_size,
float NMOS_size,
float period) {
152 float C_drain, C_gate, C_source;
164 C_inv += C_gate + C_drain;
169 C_inv += C_gate + C_drain;
175 power_usage->
leakage = in_probability
189 void power_calc_inverter_with_input(
t_power_usage * power_usage,
190 float * input_dynamic_power,
float in_density,
float in_prob,
192 float C_drain, C_gate, C_source;
197 float NMOS_size = size;
207 C_inv += C_gate + C_drain;
212 C_inv += C_gate + C_drain;
235 float *C_g,
e_tx_type transistor_type,
float size) {
246 transistor_type, size);
251 if (tx_info_lower == NULL) {
253 *C_d = tx_info_upper->
C_d;
254 *C_s = tx_info_upper->
C_s;
255 *C_g = tx_info_upper->
C_g;
256 }
else if (tx_info_upper == NULL) {
258 *C_d = tx_info_lower->
C_d;
259 *C_s = tx_info_lower->
C_s;
260 *C_g = tx_info_lower->
C_g;
263 float percent_upper = (size - tx_info_lower->
size)
264 / (tx_info_upper->
size - tx_info_lower->
size);
265 *C_d = (1 - percent_upper) * tx_info_lower->
C_d
266 + percent_upper * tx_info_upper->
C_d;
267 *C_s = (1 - percent_upper) * tx_info_lower->
C_s
268 + percent_upper * tx_info_upper->
C_s;
269 *C_g = (1 - percent_upper) * tx_info_lower->
C_g
270 + percent_upper * tx_info_upper->
C_g;
289 transistor_type, size);
294 if (tx_info_lower == NULL) {
298 }
else if (tx_info_upper == NULL) {
303 float percent_upper = (size - tx_info_lower->
size)
304 / (tx_info_upper->
size - tx_info_lower->
size);
324 transistor_type, size);
329 if (tx_info_lower == NULL) {
333 }
else if (tx_info_upper == NULL) {
338 float percent_upper = (size - tx_info_lower->
size)
339 / (tx_info_upper->
size - tx_info_lower->
size);
340 current = (1 - percent_upper) * tx_info_lower->
leakage_gate
362 bool over_range =
false;
376 if (size < g_power_tech->nmos_leakage_info[i].nmos_size) {
388 "The architectures uses multiplexers with \
389 transistors sizes larger than what is defined in the <nmos_leakages> \
390 section of the technology file.");
394 if (lower->
v_ds == v_ds || !upper) {
397 float perc_upper = (v_ds - lower->
v_ds) / (upper->
v_ds - lower->
v_ds);
398 i_ds = (1 - perc_upper) * lower->
i_ds + perc_upper * upper->
i_ds;
404 if (lower->
v_ds == v_ds || !upper) {
407 float perc_upper = (v_ds - lower->
v_ds)
409 i_ds = (1 - perc_upper) * lower->
i_ds + perc_upper * upper->
i_ds;
417 float perc_upper = (size - nmos_low->
nmos_size)
419 return power_high * perc_upper + power_low * (1 - perc_upper);
430 float density,
float period) {
446 float * in_dens,
float * in_prob,
float sel_dens,
float out_dens,
451 float leakage_n, leakage_p;
455 float C_g_n, C_d_n, C_s_n;
458 float C_g_p, C_d_p, C_s_p;
463 power_usage->
leakage += (in_prob[0] * (1 - in_prob[1])
464 + (1 - in_prob[0]) * in_prob[1]) * (leakage_n + leakage_p);
495 float * out_prob,
float * out_dens,
float * v_out,
int num_inputs,
496 int selected_idx,
float * in_prob,
float * in_dens,
float * v_in,
497 float transistor_size,
boolean v_out_restored,
float period) {
504 assert(transistor_size >= 1.0);
506 if (selected_idx < num_inputs) {
507 *out_prob = in_prob[selected_idx];
508 *out_dens = in_dens[selected_idx];
509 v_in_selected = v_in[selected_idx];
523 for (input_idx = 0; input_idx < num_inputs; input_idx++) {
524 v_in_selected += v_in[input_idx];
526 v_in_selected /= num_inputs;
534 for (input_idx = 0; input_idx < num_inputs; input_idx++) {
537 in_dens[input_idx], period, v_in[input_idx]);
539 if (input_idx != selected_idx) {
540 in_prob_avg += in_prob[input_idx];
543 in_prob_avg /= (num_inputs - 1);
545 if (v_out_restored) {
549 v_in_selected, in_prob_avg);
552 for (input_idx = 0; input_idx < num_inputs; input_idx++) {
555 if (input_idx == selected_idx) {
560 power_usage->
leakage += (*out_prob) * (1 - in_prob[input_idx])
565 power_usage->
leakage += (1 - *out_prob) * in_prob[input_idx]
572 *out_dens, period, *v_out);
589 float v_out_min, v_out_max;
592 bool over_range =
false;
594 assert(transistor_size >= 1.0);
607 if (transistor_size < g_power_tech->nmos_mux_info[i].nmos_size) {
618 "The architectures uses multiplexers with \
619 transistors sizes larger than what is defined in the <multiplexers> \
620 section of the technology file.");
624 || (!over_range && num_inputs > mux_nmos_inf_upper->
max_mux_sl_size)) {
626 "The circuit contains a single-level mux larger than \
627 what is defined in the <multiplexers> section of the \
634 if (lower->
v_in == v_in || !upper) {
638 float perc_upper = (v_in - lower->
v_in) / (upper->
v_in - lower->
v_in);
639 v_out_min = (1 - perc_upper) * lower->
v_out_min
641 v_out_max = (1 - perc_upper) * lower->
v_out_max
644 v_out_low = in_prob_avg * v_out_max + (1 - in_prob_avg) * v_out_min;
649 if (lower->
v_in == v_in || !upper) {
653 float perc_upper = (v_in - lower->
v_in)
655 v_out_min = (1 - perc_upper) * lower->
v_out_min
657 v_out_max = (1 - perc_upper) * lower->
v_out_max
660 v_out_high = in_prob_avg * v_out_max + (1 - in_prob_avg) * v_out_min;
667 (transistor_size - mux_nmos_inf_lower->
nmos_size)
670 return v_out_high * perc_upper + (1 - perc_upper) * v_out_low;
689 int num_inputs,
float out_density,
float v_out,
float * in_prob,
690 float * in_dens,
float * v_in,
float sel_dens,
float sel_prob,
691 float transistor_size,
float period) {
693 assert(num_inputs == 2);
702 power_usage->
leakage += (1 - sel_prob) * (1 - in_prob[0]) * in_prob[1]
707 power_usage->
leakage += ((1 - sel_prob) * in_prob[0] * (1 - in_prob[1])
708 + sel_prob * (1 - in_prob[0]) * in_prob[1])
712 power_usage->
leakage += sel_prob * in_prob[0] * (1 - in_prob[1])
741 float * dyn_power_in,
float in_dens,
float in_prob,
float period) {
745 float input_dyn_power = 0.;
751 in_prob, 1.0, 2.0, period);
757 "No long transistor information exists. Cannot determine transistor properties.");
766 power_usage->
leakage += (1 - in_prob)
769 *dyn_power_in = input_dyn_power;
782 float power_calc_buffer_sc(
int stages,
float gain,
boolean level_restorer,
783 int input_mux_size) {
797 if (!level_restorer) {
798 if (strength_upper == NULL) {
801 float percent_upper = (gain - strength_lower->
stage_gain)
803 sc = (1 - percent_upper) * strength_lower->
sc_no_levr
809 if (strength_upper == NULL) {
810 sc = power_calc_buffer_sc_levr(strength_lower, input_mux_size);
815 sc_buf_low = power_calc_buffer_sc_levr(strength_lower,
817 sc_buf_high = power_calc_buffer_sc_levr(strength_upper,
820 float percent_upper = (gain - strength_lower->
stage_gain)
822 sc = (1 - percent_upper) * sc_buf_low + percent_upper * sc_buf_high;
834 static float power_calc_buffer_sc_levr(
841 if (mux_upper == NULL) {
844 float percent_upper = (input_mux_size - mux_lower->
mux_size)
846 return (1 - percent_upper) * mux_lower->
sc_levr
847 + percent_upper * mux_upper->
sc_levr;
865 if (C_out == C_found) {
870 if (C_found > C_out) {
873 "Attempted to search for a transistor with a capacitance smaller than the smallest in the technology file.\n");
878 float percent_upper = (C_out - C_prev) / (C_found - C_prev);
880 + (1 - percent_upper) * nmos_info->
size_inf[i - 1].
size;
887 "Attempted to search for a transistor with a capacitance greater than the largest in the technology file.\n");
void power_usage_wire(t_power_usage *power_usage, float capacitance, float density, float period)
t_power_tech * g_power_tech
static float power_calc_leakage_gate(e_tx_type transistor_type, float size)
t_transistor_size_inf * size_inf
void power_usage_mux_singlelevel_static(t_power_usage *power_usage, float *out_prob, float *out_dens, float *v_out, int num_inputs, int selected_idx, float *in_prob, float *in_dens, float *v_in, float transistor_size, boolean v_out_restored, float period)
t_transistor_inf PMOS_inf
void power_usage_level_restorer(t_power_usage *power_usage, float *dyn_power_in, float in_dens, float in_prob, float period)
t_power_mux_volt_inf * mux_voltage_inf
t_power_commonly_used * g_power_commonly_used
float power_calc_node_switching(float capacitance, float density, float period)
t_power_nmos_mux_inf * nmos_mux_info
void power_lowlevel_init()
void power_find_buffer_sc_levr(t_power_buffer_sc_levr_inf **lower, t_power_buffer_sc_levr_inf **upper, t_power_buffer_strength_inf *buffer_strength, int input_mux_size)
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
void power_usage_inverter_irregular(t_power_usage *power_usage, float *dyn_power_input, float in_density, float in_probability, float PMOS_size, float NMOS_size, float period)
static float power_calc_leakage_st(e_tx_type transistor_type, float size)
void power_find_nmos_leakage(t_power_nmos_leakage_inf *nmos_leakage_info, t_power_nmos_leakage_pair **lower, t_power_nmos_leakage_pair **upper, float v_ds)
void power_zero_usage(t_power_usage *power_usage)
static void power_calc_transistor_capacitance(float *C_d, float *C_s, float *C_g, e_tx_type transistor_type, float size)
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)
int num_nmos_leakage_info
static float power_calc_leakage_st_pass_transistor(float size, float v_ds)
static float power_calc_node_switching_v(float capacitance, float density, float period, float voltage)
void power_find_mux_volt_inf(t_power_mux_volt_pair **lower, t_power_mux_volt_pair **upper, t_power_mux_volt_inf *volt_inf, float v_in)
t_power_nmos_leakage_inf * nmos_leakage_info
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 power_calc_buffer_size_from_Cout(float C_out)
float leakage_subthreshold
t_transistor_inf NMOS_inf
t_power_buffer_size_inf * buffer_size_inf
float power_calc_mux_v_out(int num_inputs, float transistor_size, float v_in, float in_prob_avg)
void power_find_buffer_strength_inf(t_power_buffer_strength_inf **lower, t_power_buffer_strength_inf **upper, t_power_buffer_size_inf *size_inf, float stage_gain)
t_transistor_size_inf * long_trans_inf
boolean power_find_transistor_info(t_transistor_size_inf **lower, t_transistor_size_inf **upper, e_tx_type type, float size)
void power_log_msg(e_power_log_type log_type, char *msg)
void power_usage_inverter(t_power_usage *power_usage, float in_dens, float in_prob, float size, float period)