@@ -250,16 +250,17 @@ t_model_ports* free_arch_model_port(t_model_ports* model_port) {
250
250
}
251
251
252
252
void free_type_descriptors (std::vector<t_physical_tile_type>& type_descriptors) {
253
- for (auto & type : type_descriptors) {
254
- vtr::free (type.name );
253
+ for (t_physical_tile_type& type : type_descriptors) {
254
+ vtr::release_memory (type.name );
255
+
255
256
if (type.index == EMPTY_TYPE_INDEX) {
256
257
continue ;
257
258
}
258
259
259
- for (auto & sub_tile : type.sub_tiles ) {
260
- vtr::free (sub_tile.name );
260
+ for (t_sub_tile & sub_tile : type.sub_tiles ) {
261
+ vtr::release_memory (sub_tile.name );
261
262
262
- for (auto port : sub_tile.ports ) {
263
+ for (t_physical_tile_port& port : sub_tile.ports ) {
263
264
vtr::free (port.name );
264
265
}
265
266
}
@@ -270,8 +271,8 @@ void free_type_descriptors(std::vector<t_physical_tile_type>& type_descriptors)
270
271
void free_type_descriptors (std::vector<t_logical_block_type>& type_descriptors) {
271
272
free_all_pb_graph_nodes (type_descriptors);
272
273
273
- for (auto & type : type_descriptors) {
274
- vtr::free (type.name );
274
+ for (t_logical_block_type & type : type_descriptors) {
275
+ vtr::release_memory (type.name );
275
276
if (type.index == EMPTY_TYPE_INDEX) {
276
277
continue ;
277
278
}
@@ -1098,7 +1099,6 @@ void SyncModelsPbTypes(t_arch* arch,
1098
1099
1099
1100
void SyncModelsPbTypes_rec (t_arch* arch,
1100
1101
t_pb_type* pb_type) {
1101
- int i, j, p;
1102
1102
t_model *model_match_prim, *cur_model;
1103
1103
t_model_ports* model_port;
1104
1104
vtr::t_linked_vptr* old;
@@ -1137,7 +1137,7 @@ void SyncModelsPbTypes_rec(t_arch* arch,
1137
1137
}
1138
1138
cur_model = cur_model->next ;
1139
1139
}
1140
- if (found != true ) {
1140
+ if (!found ) {
1141
1141
archfpga_throw (get_arch_file_name (), 0 ,
1142
1142
" No matching model for pb_type %s\n " , pb_type->blif_model );
1143
1143
}
@@ -1148,7 +1148,7 @@ void SyncModelsPbTypes_rec(t_arch* arch,
1148
1148
model_match_prim->pb_types ->next = old;
1149
1149
model_match_prim->pb_types ->data_vptr = pb_type;
1150
1150
1151
- for (p = 0 ; p < pb_type->num_ports ; p++) {
1151
+ for (int p = 0 ; p < pb_type->num_ports ; p++) {
1152
1152
found = false ;
1153
1153
/* TODO: Parse error checking - check if INPUT matches INPUT and OUTPUT matches OUTPUT (not yet done) */
1154
1154
model_port = model_match_prim->inputs ;
@@ -1197,17 +1197,16 @@ void SyncModelsPbTypes_rec(t_arch* arch,
1197
1197
}
1198
1198
model_port = model_port->next ;
1199
1199
}
1200
- if (found != true ) {
1200
+ if (!found ) {
1201
1201
archfpga_throw (get_arch_file_name (), 0 ,
1202
1202
" No matching model port for port %s in pb_type %s\n " ,
1203
1203
pb_type->ports [p].name , pb_type->name );
1204
1204
}
1205
1205
}
1206
1206
} else {
1207
- for (i = 0 ; i < pb_type->num_modes ; i++) {
1208
- for (j = 0 ; j < pb_type->modes [i].num_pb_type_children ; j++) {
1209
- SyncModelsPbTypes_rec (arch,
1210
- &(pb_type->modes [i].pb_type_children [j]));
1207
+ for (int i = 0 ; i < pb_type->num_modes ; i++) {
1208
+ for (int j = 0 ; j < pb_type->modes [i].num_pb_type_children ; j++) {
1209
+ SyncModelsPbTypes_rec (arch, &(pb_type->modes [i].pb_type_children [j]));
1211
1210
}
1212
1211
}
1213
1212
}
@@ -1223,11 +1222,11 @@ void SyncModelsPbTypes_rec(t_arch* arch,
1223
1222
void primitives_annotation_clock_match (t_pin_to_pin_annotation* annotation,
1224
1223
t_pb_type* parent_pb_type) {
1225
1224
int i_port;
1226
- bool clock_valid = false ; // Determine if annotation's clock is same as primtive 's clock
1225
+ bool clock_valid = false ; // Determine if annotation's clock is same as primitive 's clock
1227
1226
1228
1227
if (!parent_pb_type || !annotation) {
1229
1228
archfpga_throw (__FILE__, __LINE__,
1230
- " Annotation_clock check encouters invalid annotation or primitive.\n " );
1229
+ " Annotation_clock check encounters invalid annotation or primitive.\n " );
1231
1230
}
1232
1231
1233
1232
for (i_port = 0 ; i_port < parent_pb_type->num_ports ; i_port++) {
@@ -1247,18 +1246,17 @@ void primitives_annotation_clock_match(t_pin_to_pin_annotation* annotation,
1247
1246
}
1248
1247
}
1249
1248
1250
- const t_segment_inf* find_segment (const t_arch* arch, std::string name) {
1251
- for (size_t i = 0 ; i < (arch->Segments ).size (); ++i) {
1252
- const t_segment_inf* seg = &arch->Segments [i];
1253
- if (seg->name == name) {
1254
- return seg;
1249
+ const t_segment_inf* find_segment (const t_arch* arch, std::string_view name) {
1250
+ for (const auto & segment : arch->Segments ) {
1251
+ if (segment.name == name) {
1252
+ return &segment;
1255
1253
}
1256
1254
}
1257
1255
1258
1256
return nullptr ;
1259
1257
}
1260
1258
1261
- bool segment_exists (const t_arch* arch, std::string name) {
1259
+ bool segment_exists (const t_arch* arch, std::string_view name) {
1262
1260
return find_segment (arch, name) != nullptr ;
1263
1261
}
1264
1262
@@ -1336,7 +1334,7 @@ const t_pin_to_pin_annotation* find_sequential_annotation(const t_pb_type* pb_ty
1336
1334
return nullptr ;
1337
1335
}
1338
1336
1339
- const t_pin_to_pin_annotation* find_combinational_annotation (const t_pb_type* pb_type, std::string in_port, std::string out_port) {
1337
+ const t_pin_to_pin_annotation* find_combinational_annotation (const t_pb_type* pb_type, std::string_view in_port, std::string_view out_port) {
1340
1338
for (int iannot = 0 ; iannot < pb_type->num_annotations ; ++iannot) {
1341
1339
const t_pin_to_pin_annotation* annot = &pb_type->annotations [iannot];
1342
1340
for (const auto & annot_in_str : vtr::split (annot->input_pins )) {
@@ -1380,24 +1378,24 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
1380
1378
1381
1379
std::sort (equivalent_sites.begin (), equivalent_sites.end (), criteria);
1382
1380
1383
- for (auto & logical_block : LogicalBlockTypes) {
1381
+ for (t_logical_block_type & logical_block : LogicalBlockTypes) {
1384
1382
for (auto site : equivalent_sites) {
1385
- if (0 == strcmp ( logical_block.name , site->pb_type ->name ) ) {
1383
+ if (logical_block.name == site->pb_type ->name ) {
1386
1384
logical_block.equivalent_tiles .push_back (&physical_tile);
1387
1385
break ;
1388
1386
}
1389
1387
}
1390
1388
}
1391
1389
}
1392
1390
1393
- for (auto & logical_block : LogicalBlockTypes) {
1391
+ for (t_logical_block_type & logical_block : LogicalBlockTypes) {
1394
1392
if (logical_block.index == EMPTY_TYPE_INDEX) continue ;
1395
1393
1396
1394
auto & equivalent_tiles = logical_block.equivalent_tiles ;
1397
1395
1398
1396
if ((int )equivalent_tiles.size () <= 0 ) {
1399
1397
archfpga_throw (__FILE__, __LINE__,
1400
- " Logical Block %s does not have any equivalent tiles.\n " , logical_block.name );
1398
+ " Logical Block %s does not have any equivalent tiles.\n " , logical_block.name . c_str () );
1401
1399
}
1402
1400
1403
1401
std::unordered_map<int , bool > ignored_pins_check_map;
@@ -1433,7 +1431,7 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
1433
1431
if (result == direct_map.end ()) {
1434
1432
archfpga_throw (__FILE__, __LINE__,
1435
1433
" Logical pin %d not present in pin mapping between Tile %s and Block %s.\n " ,
1436
- pin, tile->name , logical_block.name );
1434
+ pin, tile->name . c_str () , logical_block.name . c_str () );
1437
1435
}
1438
1436
1439
1437
int sub_tile_pin_index = result->second .pin ;
@@ -1447,15 +1445,15 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
1447
1445
archfpga_throw (__FILE__, __LINE__,
1448
1446
" Physical Tile %s has a different value for the ignored pin (physical pin: %d, logical pin: %d) "
1449
1447
" different from the corresponding pins of the other equivalent site %s\n ." ,
1450
- tile->name , phy_index, pin, logical_block.name );
1448
+ tile->name . c_str () , phy_index, pin, logical_block.name . c_str () );
1451
1449
}
1452
1450
1453
1451
auto global_result = global_pins_check_map.insert (std::pair<int , bool >(pin, is_global));
1454
1452
if (!global_result.second && global_result.first ->second != is_global) {
1455
1453
archfpga_throw (__FILE__, __LINE__,
1456
1454
" Physical Tile %s has a different value for the global pin (physical pin: %d, logical pin: %d) "
1457
1455
" different from the corresponding pins of the other equivalent sites\n ." ,
1458
- tile->name , phy_index, pin);
1456
+ tile->name . c_str () , phy_index, pin);
1459
1457
}
1460
1458
}
1461
1459
}
@@ -1465,27 +1463,25 @@ void link_physical_logical_types(std::vector<t_physical_tile_type>& PhysicalTile
1465
1463
1466
1464
/* Sets up the pin classes for the type. */
1467
1465
void setup_pin_classes (t_physical_tile_type* type) {
1468
- int i, k;
1469
- int pin_count;
1470
1466
int num_class;
1471
1467
1472
- for (i = 0 ; i < type->num_pins ; i++) {
1468
+ for (int i = 0 ; i < type->num_pins ; i++) {
1473
1469
type->pin_class .push_back (OPEN);
1474
1470
type->is_ignored_pin .push_back (true );
1475
1471
type->is_pin_global .push_back (true );
1476
1472
}
1477
1473
1478
- pin_count = 0 ;
1474
+ int pin_count = 0 ;
1479
1475
1480
1476
t_class_range class_range;
1481
1477
1482
1478
/* Equivalent pins share the same class, non-equivalent pins belong to different pin classes */
1483
- for (auto & sub_tile : type->sub_tiles ) {
1479
+ for (const t_sub_tile & sub_tile : type->sub_tiles ) {
1484
1480
int capacity = sub_tile.capacity .total ();
1485
1481
class_range.low = type->class_inf .size ();
1486
1482
class_range.high = class_range.low - 1 ;
1487
- for (i = 0 ; i < capacity; ++i) {
1488
- for (const auto & port : sub_tile.ports ) {
1483
+ for (int i = 0 ; i < capacity; ++i) {
1484
+ for (const t_physical_tile_port & port : sub_tile.ports ) {
1489
1485
if (port.equivalent != PortEquivalence::NONE) {
1490
1486
t_class class_inf;
1491
1487
num_class = (int )type->class_inf .size ();
@@ -1499,7 +1495,7 @@ void setup_pin_classes(t_physical_tile_type* type) {
1499
1495
class_inf.type = DRIVER;
1500
1496
}
1501
1497
1502
- for (k = 0 ; k < port.num_pins ; ++k) {
1498
+ for (int k = 0 ; k < port.num_pins ; ++k) {
1503
1499
class_inf.pinlist .push_back (pin_count);
1504
1500
type->pin_class [pin_count] = num_class;
1505
1501
// clock pins and other specified global ports are initially specified
@@ -1519,7 +1515,7 @@ void setup_pin_classes(t_physical_tile_type* type) {
1519
1515
type->class_inf .push_back (class_inf);
1520
1516
class_range.high ++;
1521
1517
} else if (port.equivalent == PortEquivalence::NONE) {
1522
- for (k = 0 ; k < port.num_pins ; ++k) {
1518
+ for (int k = 0 ; k < port.num_pins ; ++k) {
1523
1519
t_class class_inf;
1524
1520
num_class = (int )type->class_inf .size ();
1525
1521
class_inf.num_pins = 1 ;
@@ -1538,7 +1534,7 @@ void setup_pin_classes(t_physical_tile_type* type) {
1538
1534
// as ignored pins (i.e. connections are not created in the rr_graph and
1539
1535
// nets connected to the port are ignored as well).
1540
1536
type->is_ignored_pin [pin_count] = port.is_clock || port.is_non_clock_global ;
1541
- // clock pins and other specified global ports are flaged as global
1537
+ // clock pins and other specified global ports are flagged as global
1542
1538
type->is_pin_global [pin_count] = port.is_clock || port.is_non_clock_global ;
1543
1539
1544
1540
if (port.is_clock ) {
0 commit comments