@@ -329,8 +329,8 @@ float power_usage_mux_for_callibration(int num_inputs, float transistor_size) {
329
329
float * dens;
330
330
float * prob;
331
331
332
- dens = ( float *) vtr::malloc (num_inputs * sizeof ( float )) ;
333
- prob = ( float *) vtr::malloc (num_inputs * sizeof ( float )) ;
332
+ dens = new float [num_inputs] ;
333
+ prob = new float [num_inputs] ;
334
334
for (int i = 0 ; i < num_inputs; i++) {
335
335
dens[i] = 2 ;
336
336
prob[i] = 0.5 ;
@@ -340,8 +340,8 @@ float power_usage_mux_for_callibration(int num_inputs, float transistor_size) {
340
340
power_get_mux_arch (num_inputs, transistor_size), prob, dens, 0 ,
341
341
false , power_callib_period);
342
342
343
- free ( dens) ;
344
- free ( prob) ;
343
+ delete[] dens;
344
+ delete[] prob;
345
345
346
346
return power_sum_usage (&power_usage);
347
347
}
@@ -356,7 +356,7 @@ float power_usage_lut_for_callibration(int num_inputs, float transistor_size) {
356
356
/* Initialize an SRAM pattern that guarantees the outputs toggle with
357
357
* every input toggle.
358
358
*/
359
- SRAM_bits = ( char *) vtr::malloc ((( 1 << lut_size) + 1 ) * sizeof ( char )) ;
359
+ SRAM_bits = new char [(( 1 << lut_size) + 1 )] ;
360
360
for (int i = 1 ; i <= lut_size; i++) {
361
361
if (i == 1 ) {
362
362
SRAM_bits[0 ] = ' 1' ;
@@ -369,18 +369,18 @@ float power_usage_lut_for_callibration(int num_inputs, float transistor_size) {
369
369
SRAM_bits[1 << i] = ' \0 ' ;
370
370
}
371
371
372
- dens = ( float *) vtr::malloc (lut_size * sizeof ( float )) ;
373
- prob = ( float *) vtr::malloc (lut_size * sizeof ( float )) ;
372
+ dens = new float [lut_size] ;
373
+ prob = new float [lut_size] ;
374
374
for (int i = 0 ; i < lut_size; i++) {
375
375
dens[i] = 1 ;
376
376
prob[i] = 0.5 ;
377
377
}
378
378
power_usage_lut (&power_usage, lut_size, transistor_size, SRAM_bits, prob,
379
379
dens, power_callib_period);
380
380
381
- free ( SRAM_bits) ;
382
- free ( dens) ;
383
- free ( prob) ;
381
+ delete[] SRAM_bits;
382
+ delete[] dens;
383
+ delete[] prob;
384
384
385
385
return power_sum_usage (&power_usage);
386
386
}
0 commit comments