Skip to content

Commit c012f19

Browse files
authored
Merge pull request #2028 from verilog-to-routing/malloc_to_new
Changing Some Mallocs to News for Test PR
2 parents c49f25f + 83790bb commit c012f19

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

vpr/src/power/power_callibrate.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ float power_usage_mux_for_callibration(int num_inputs, float transistor_size) {
329329
float* dens;
330330
float* prob;
331331

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];
334334
for (int i = 0; i < num_inputs; i++) {
335335
dens[i] = 2;
336336
prob[i] = 0.5;
@@ -340,8 +340,8 @@ float power_usage_mux_for_callibration(int num_inputs, float transistor_size) {
340340
power_get_mux_arch(num_inputs, transistor_size), prob, dens, 0,
341341
false, power_callib_period);
342342

343-
free(dens);
344-
free(prob);
343+
delete[] dens;
344+
delete[] prob;
345345

346346
return power_sum_usage(&power_usage);
347347
}
@@ -356,7 +356,7 @@ float power_usage_lut_for_callibration(int num_inputs, float transistor_size) {
356356
/* Initialize an SRAM pattern that guarantees the outputs toggle with
357357
* every input toggle.
358358
*/
359-
SRAM_bits = (char*)vtr::malloc(((1 << lut_size) + 1) * sizeof(char));
359+
SRAM_bits = new char[((1 << lut_size) + 1)];
360360
for (int i = 1; i <= lut_size; i++) {
361361
if (i == 1) {
362362
SRAM_bits[0] = '1';
@@ -369,18 +369,18 @@ float power_usage_lut_for_callibration(int num_inputs, float transistor_size) {
369369
SRAM_bits[1 << i] = '\0';
370370
}
371371

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];
374374
for (int i = 0; i < lut_size; i++) {
375375
dens[i] = 1;
376376
prob[i] = 0.5;
377377
}
378378
power_usage_lut(&power_usage, lut_size, transistor_size, SRAM_bits, prob,
379379
dens, power_callib_period);
380380

381-
free(SRAM_bits);
382-
free(dens);
383-
free(prob);
381+
delete[] SRAM_bits;
382+
delete[] dens;
383+
delete[] prob;
384384

385385
return power_sum_usage(&power_usage);
386386
}

0 commit comments

Comments
 (0)