@@ -163,7 +163,7 @@ void free_arch(t_arch* arch) {
163
163
vtr::free (arch->architecture_id );
164
164
165
165
if (arch->clocks ) {
166
- vtr::free ( arch->clocks ->clock_inf ) ;
166
+ delete[] arch->clocks ->clock_inf ;
167
167
}
168
168
169
169
delete (arch->noc );
@@ -336,16 +336,16 @@ static void free_pb_type(t_pb_type* pb_type) {
336
336
vtr::free (pb_type->modes [i].interconnect [j].annotations [k].value [m]);
337
337
}
338
338
delete[] pb_type->modes [i].interconnect [j].annotations [k].prop ;
339
- vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].value ) ;
339
+ delete[] pb_type->modes [i].interconnect [j].annotations [k].value ;
340
340
}
341
- vtr::free ( pb_type->modes [i].interconnect [j].annotations ) ;
341
+ delete[] pb_type->modes [i].interconnect [j].annotations ;
342
342
if (pb_type->modes [i].interconnect [j].interconnect_power )
343
- vtr::free ( pb_type->modes [i].interconnect [j].interconnect_power ) ;
343
+ delete pb_type->modes [i].interconnect [j].interconnect_power ;
344
344
}
345
345
if (pb_type->modes [i].interconnect )
346
346
delete[] pb_type->modes [i].interconnect ;
347
347
if (pb_type->modes [i].mode_power )
348
- vtr::free (pb_type->modes [i].mode_power );
348
+ delete (pb_type->modes [i].mode_power );
349
349
}
350
350
if (pb_type->modes )
351
351
delete[] pb_type->modes ;
@@ -354,7 +354,7 @@ static void free_pb_type(t_pb_type* pb_type) {
354
354
for (int j = 0 ; j < pb_type->annotations [i].num_value_prop_pairs ; ++j) {
355
355
vtr::free (pb_type->annotations [i].value [j]);
356
356
}
357
- vtr::free ( pb_type->annotations [i].value ) ;
357
+ delete[] pb_type->annotations [i].value ;
358
358
delete[] pb_type->annotations [i].prop ;
359
359
if (pb_type->annotations [i].input_pins ) {
360
360
vtr::free (pb_type->annotations [i].input_pins );
@@ -371,7 +371,7 @@ static void free_pb_type(t_pb_type* pb_type) {
371
371
}
372
372
373
373
if (pb_type->pb_type_power ) {
374
- vtr::free ( pb_type->pb_type_power ) ;
374
+ delete pb_type->pb_type_power ;
375
375
}
376
376
377
377
for (int i = 0 ; i < pb_type->num_ports ; ++i) {
@@ -380,10 +380,10 @@ static void free_pb_type(t_pb_type* pb_type) {
380
380
vtr::free (pb_type->ports [i].port_class );
381
381
}
382
382
if (pb_type->ports [i].port_power ) {
383
- vtr::free ( pb_type->ports [i].port_power ) ;
383
+ delete pb_type->ports [i].port_power ;
384
384
}
385
385
}
386
- vtr::free ( pb_type->ports ) ;
386
+ delete[] pb_type->ports ;
387
387
}
388
388
389
389
t_port* findPortByName (const char * name, t_pb_type* pb_type, int * high_index, int * low_index) {
@@ -495,13 +495,12 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
495
495
copy->num_pb = 1 ;
496
496
497
497
/* Power */
498
- copy->pb_type_power = (t_pb_type_power*)vtr::calloc (1 ,
499
- sizeof (t_pb_type_power));
498
+ copy->pb_type_power = new t_pb_type_power ();
500
499
copy->pb_type_power ->estimation_method = power_method_inherited (pb_type->pb_type_power ->estimation_method );
501
500
502
501
/* Ports */
503
502
copy->num_ports = pb_type->num_ports ;
504
- copy->ports = ( t_port*) vtr::calloc ( pb_type->num_ports , sizeof (t_port) );
503
+ copy->ports = new t_port[ pb_type->num_ports ]( );
505
504
for (i = 0 ; i < pb_type->num_ports ; i++) {
506
505
copy->ports [i].is_clock = pb_type->ports [i].is_clock ;
507
506
copy->ports [i].model_port = pb_type->ports [i].model_port ;
@@ -514,8 +513,7 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
514
513
copy->ports [i].index = pb_type->ports [i].index ;
515
514
copy->ports [i].absolute_first_pin_index = pb_type->ports [i].absolute_first_pin_index ;
516
515
517
- copy->ports [i].port_power = (t_port_power*)vtr::calloc (1 ,
518
- sizeof (t_port_power));
516
+ copy->ports [i].port_power = new t_port_power ();
519
517
// Defaults
520
518
if (copy->pb_type_power ->estimation_method == POWER_METHOD_AUTO_SIZES) {
521
519
copy->ports [i].port_power ->wire_type = POWER_WIRE_TYPE_AUTO;
@@ -550,7 +548,7 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
550
548
copy->annotations [i].type = pb_type->annotations [i].type ;
551
549
copy->annotations [i].num_value_prop_pairs = pb_type->annotations [i].num_value_prop_pairs ;
552
550
copy->annotations [i].prop = new int [pb_type->annotations [i].num_value_prop_pairs ];
553
- copy->annotations [i].value = ( char **) vtr::malloc ( sizeof ( char *) * pb_type->annotations [i].num_value_prop_pairs ) ;
551
+ copy->annotations [i].value = new char *[ pb_type->annotations [i].num_value_prop_pairs ] ;
554
552
for (j = 0 ; j < pb_type->annotations [i].num_value_prop_pairs ; j++) {
555
553
copy->annotations [i].prop [j] = pb_type->annotations [i].prop [j];
556
554
copy->annotations [i].value [j] = vtr::strdup (pb_type->annotations [i].value [j]);
@@ -580,8 +578,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
580
578
lut_pb_type->modes [0 ].parent_pb_type = lut_pb_type;
581
579
lut_pb_type->modes [0 ].index = 0 ;
582
580
lut_pb_type->modes [0 ].num_pb_type_children = 0 ;
583
- lut_pb_type->modes [0 ].mode_power = (t_mode_power*)vtr::calloc (1 ,
584
- sizeof (t_mode_power));
581
+ lut_pb_type->modes [0 ].mode_power = new t_mode_power ();
585
582
586
583
/* Process interconnect */
587
584
/* TODO: add timing annotations to route-through */
@@ -613,10 +610,9 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
613
610
614
611
lut_pb_type->modes [0 ].interconnect [0 ].parent_mode_index = 0 ;
615
612
lut_pb_type->modes [0 ].interconnect [0 ].parent_mode = &lut_pb_type->modes [0 ];
616
- lut_pb_type->modes [0 ].interconnect [0 ].interconnect_power = (t_interconnect_power*) vtr::calloc ( 1 , sizeof ( t_interconnect_power) );
613
+ lut_pb_type->modes [0 ].interconnect [0 ].interconnect_power = new t_interconnect_power ( );
617
614
618
- lut_pb_type->modes [0 ].interconnect [0 ].annotations = (t_pin_to_pin_annotation*)vtr::calloc (lut_pb_type->num_annotations ,
619
- sizeof (t_pin_to_pin_annotation));
615
+ lut_pb_type->modes [0 ].interconnect [0 ].annotations = new t_pin_to_pin_annotation[lut_pb_type->num_annotations ]();
620
616
lut_pb_type->modes [0 ].interconnect [0 ].num_annotations = lut_pb_type->num_annotations ;
621
617
for (i = 0 ; i < lut_pb_type->modes [0 ].interconnect [0 ].num_annotations ;
622
618
i++) {
@@ -628,8 +624,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
628
624
lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].type = lut_pb_type->annotations [i].type ;
629
625
lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].num_value_prop_pairs = lut_pb_type->annotations [i].num_value_prop_pairs ;
630
626
lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].prop = new int [lut_pb_type->annotations [i].num_value_prop_pairs ];
631
- lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].value = (char **)vtr::malloc (sizeof (char *)
632
- * lut_pb_type->annotations [i].num_value_prop_pairs );
627
+ lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].value = new char *[lut_pb_type->annotations [i].num_value_prop_pairs ];
633
628
for (j = 0 ; j < lut_pb_type->annotations [i].num_value_prop_pairs ; j++) {
634
629
lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].prop [j] = lut_pb_type->annotations [i].prop [j];
635
630
lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].value [j] = vtr::strdup (lut_pb_type->annotations [i].value [j]);
@@ -642,26 +637,25 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
642
637
lut_pb_type->modes [1 ].parent_pb_type = lut_pb_type;
643
638
lut_pb_type->modes [1 ].index = 1 ;
644
639
lut_pb_type->modes [1 ].num_pb_type_children = 1 ;
645
- lut_pb_type->modes [1 ].mode_power = (t_mode_power*)vtr::calloc (1 ,
646
- sizeof (t_mode_power));
640
+ lut_pb_type->modes [1 ].mode_power = new t_mode_power ();
647
641
lut_pb_type->modes [1 ].pb_type_children = new t_pb_type[1 ];
648
642
alloc_and_load_default_child_for_pb_type (lut_pb_type, default_name,
649
643
lut_pb_type->modes [1 ].pb_type_children );
650
644
/* moved annotations to child so delete old annotations */
651
645
for (i = 0 ; i < lut_pb_type->num_annotations ; i++) {
652
646
for (j = 0 ; j < lut_pb_type->annotations [i].num_value_prop_pairs ; j++) {
653
- free (lut_pb_type->annotations [i].value [j]);
647
+ vtr:: free (lut_pb_type->annotations [i].value [j]);
654
648
}
655
- free ( lut_pb_type->annotations [i].value ) ;
649
+ delete[] lut_pb_type->annotations [i].value ;
656
650
delete[] lut_pb_type->annotations [i].prop ;
657
651
if (lut_pb_type->annotations [i].input_pins ) {
658
- free (lut_pb_type->annotations [i].input_pins );
652
+ vtr:: free (lut_pb_type->annotations [i].input_pins );
659
653
}
660
654
if (lut_pb_type->annotations [i].output_pins ) {
661
- free (lut_pb_type->annotations [i].output_pins );
655
+ vtr:: free (lut_pb_type->annotations [i].output_pins );
662
656
}
663
657
if (lut_pb_type->annotations [i].clock ) {
664
- free (lut_pb_type->annotations [i].clock );
658
+ vtr:: free (lut_pb_type->annotations [i].clock );
665
659
}
666
660
}
667
661
lut_pb_type->num_annotations = 0 ;
@@ -693,7 +687,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
693
687
694
688
lut_pb_type->modes [1 ].interconnect [0 ].parent_mode_index = 1 ;
695
689
lut_pb_type->modes [1 ].interconnect [0 ].parent_mode = &lut_pb_type->modes [1 ];
696
- lut_pb_type->modes [1 ].interconnect [0 ].interconnect_power = (t_interconnect_power*) vtr::calloc ( 1 , sizeof ( t_interconnect_power) );
690
+ lut_pb_type->modes [1 ].interconnect [0 ].interconnect_power = new t_interconnect_power ( );
697
691
698
692
lut_pb_type->modes [1 ].interconnect [1 ].name = (char *)vtr::calloc (strlen (lut_pb_type->name ) + 11 , sizeof (char ));
699
693
sprintf (lut_pb_type->modes [1 ].interconnect [1 ].name , " direct:%s" ,
@@ -712,7 +706,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
712
706
713
707
lut_pb_type->modes [1 ].interconnect [1 ].parent_mode_index = 1 ;
714
708
lut_pb_type->modes [1 ].interconnect [1 ].parent_mode = &lut_pb_type->modes [1 ];
715
- lut_pb_type->modes [1 ].interconnect [1 ].interconnect_power = (t_interconnect_power*) vtr::calloc ( 1 , sizeof ( t_interconnect_power) );
709
+ lut_pb_type->modes [1 ].interconnect [1 ].interconnect_power = new t_interconnect_power ( );
716
710
717
711
free (default_name);
718
712
@@ -737,8 +731,7 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
737
731
mem_pb_type->modes [0 ].name = vtr::strdup (default_name);
738
732
mem_pb_type->modes [0 ].parent_pb_type = mem_pb_type;
739
733
mem_pb_type->modes [0 ].index = 0 ;
740
- mem_pb_type->modes [0 ].mode_power = (t_mode_power*)vtr::calloc (1 ,
741
- sizeof (t_mode_power));
734
+ mem_pb_type->modes [0 ].mode_power = new t_mode_power ();
742
735
num_pb = OPEN;
743
736
for (i = 0 ; i < mem_pb_type->num_ports ; i++) {
744
737
if (mem_pb_type->ports [i].port_class != nullptr
@@ -834,8 +827,7 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
834
827
}
835
828
836
829
/* Allocate interconnect power structures */
837
- mem_pb_type->modes [0 ].interconnect [i_inter].interconnect_power = (t_interconnect_power*)vtr::calloc (1 ,
838
- sizeof (t_interconnect_power));
830
+ mem_pb_type->modes [0 ].interconnect [i_inter].interconnect_power = new t_interconnect_power ();
839
831
i_inter++;
840
832
} else {
841
833
for (j = 0 ; j < num_pb; j++) {
@@ -875,8 +867,7 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
875
867
}
876
868
877
869
/* Allocate interconnect power structures */
878
- mem_pb_type->modes [0 ].interconnect [i_inter].interconnect_power = (t_interconnect_power*)vtr::calloc (1 ,
879
- sizeof (t_interconnect_power));
870
+ mem_pb_type->modes [0 ].interconnect [i_inter].interconnect_power = new t_interconnect_power ();
880
871
i_inter++;
881
872
}
882
873
}
0 commit comments