48 unsigned int LUT_sizes[3] = { 6 };
58 char * SRAM_bits = NULL;
147 for (i = 0; i < (
sizeof(LUT_sizes) /
sizeof(
int)); i++) {
148 for (j = 1; j <= LUT_sizes[i]; j++) {
150 ((1 << j) + 1) *
sizeof(
char));
155 for (sram_idx = 0; sram_idx < (1 << (j - 1)); sram_idx++) {
156 SRAM_bits[sram_idx + (1 << (j - 1))] =
binary_not(
157 SRAM_bits[sram_idx]);
160 SRAM_bits[1 << j] =
'\0';
163 dens = (
float*)
my_realloc(dens, LUT_sizes[i] *
sizeof(
float));
164 prob = (
float*)
my_realloc(prob, LUT_sizes[i] *
sizeof(
float));
165 for (j = 0; j < LUT_sizes[i]; j++) {
166 dens[j] = 1.0 / (float) LUT_sizes[i];
174 float p[6] = { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };
175 float d[6] = { 1, 1, 1, 1, 1, 1 };
301 assert(num_inputs == 1);
310 float transistor_size) {
313 assert(num_inputs == 1);
326 dens = (
float*)
my_malloc(num_inputs *
sizeof(
float));
327 prob = (
float*)
my_malloc(num_inputs *
sizeof(
float));
328 for (
int i = 0; i < num_inputs; i++) {
348 int lut_size = num_inputs;
353 SRAM_bits = (
char*)
my_malloc(((1 << lut_size) + 1) *
sizeof(char));
354 for (
int i = 1; i <= lut_size; i++) {
359 for (
int sram_idx = 0; sram_idx < (1 << (i - 1)); sram_idx++) {
360 SRAM_bits[sram_idx + (1 << (i - 1))] =
binary_not(
361 SRAM_bits[sram_idx]);
364 SRAM_bits[1 << i] =
'\0';
367 dens = (
float*)
my_malloc(lut_size *
sizeof(
float));
368 prob = (
float*)
my_malloc(lut_size *
sizeof(
float));
369 for (
int i = 0; i < lut_size; i++) {
373 power_usage_lut(&power_usage, lut_size, transistor_size, SRAM_bits, prob,
386 assert(num_inputs == 1);
388 power_usage_ff(&power_usage, transistor_size, 0.5, 3, 0.5, 1, 0.5, 2,
float power_usage_mux_for_callibration(int num_inputs, float transistor_size)
void power_callibrate(void)
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)
PowerSpicedComponent ** component_callibration
t_power_commonly_used * g_power_commonly_used
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)
float power_usage_ff_for_callibration(int num_inputs, float transistor_size)
t_power_output * g_power_output
t_solution_inf g_solution_inf
float power_usage_buf_for_callibration(int num_inputs, float transistor_size)
t_mux_arch * power_get_mux_arch(int num_mux_inputs, float transistor_size)
void power_add_usage(t_power_usage *dest, const t_power_usage *src)
static void * my_malloc(int ibytes)
static char binary_not(char c)
float power_usage_lut_for_callibration(int num_inputs, float transistor_size)
const float power_callib_period
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)
float power_sum_usage(t_power_usage *power_usage)
static void * my_realloc(void *memblk, int ibytes)
void power_print_spice_comparison(void)
void power_usage_buffer(t_power_usage *power_usage, float size, float in_prob, float in_dens, boolean level_restorer, float period)
float power_usage_buf_levr_for_callibration(int num_inputs, float transistor_size)