@@ -3327,12 +3327,16 @@ static void ProcessClockMetalLayers(
3327
3327
std::unordered_map<std::string, t_metal_layer>& metal_layers,
3328
3328
pugiutil::loc_data& loc_data)
3329
3329
{
3330
+ std::vector<std::string> expected_attributes = {" name" , " Rmetal" , " Cmetal" };
3331
+
3330
3332
pugi::xml_node metal_layers_parent = get_single_child (parent, " metal_layers" , loc_data);
3331
3333
int num_metal_layers = count_children (metal_layers_parent, " metal_layer" , loc_data);
3332
3334
3333
3335
pugi::xml_node curr_layer = get_first_child (metal_layers_parent, " metal_layer" , loc_data);
3334
3336
for (int i = 0 ; i < num_metal_layers; i++) {
3335
3337
3338
+ expect_only_attributes (curr_layer, expected_attributes, loc_data);
3339
+
3336
3340
// Get metal layer values: name, r_metal, and c_metal
3337
3341
std::string name (get_attribute (curr_layer, " name" , loc_data).value ());
3338
3342
t_metal_layer metal_layer;
@@ -3359,6 +3363,11 @@ static void ProcessClockNetworks(
3359
3363
const int num_switches,
3360
3364
pugiutil::loc_data& loc_data)
3361
3365
{
3366
+ std::vector<std::string> expected_spine_attributes =
3367
+ {" name" , " num_inst" , " metal_layer" , " starty" , " endy" , " x" , " repeatx" , " repeaty" };
3368
+ std::vector<std::string> expected_rib_attributes =
3369
+ {" name" , " num_inst" , " metal_layer" , " startx" , " endx" , " y" , " repeatx" , " repeaty" };
3370
+
3362
3371
int num_clock_networks = count_children (parent, " clock_network" , loc_data);
3363
3372
pugi::xml_node curr_network = get_first_child (parent, " clock_network" , loc_data);
3364
3373
for (int i = 0 ; i < num_clock_networks; i++) {
@@ -3373,6 +3382,9 @@ static void ProcessClockNetworks(
3373
3382
// Parse spine
3374
3383
curr_type = get_single_child (curr_network, " spine" , loc_data, OPTIONAL);
3375
3384
if (curr_type) {
3385
+
3386
+ expect_only_attributes (curr_network, expected_spine_attributes, loc_data);
3387
+
3376
3388
is_supported_clock_type = true ;
3377
3389
clock_network.type = e_clock_type::SPINE;
3378
3390
@@ -3396,6 +3408,9 @@ static void ProcessClockNetworks(
3396
3408
// Parse rib
3397
3409
curr_type = get_single_child (curr_network, " rib" , loc_data, OPTIONAL);
3398
3410
if (curr_type) {
3411
+
3412
+ expect_only_attributes (curr_network, expected_spine_attributes, loc_data);
3413
+
3399
3414
is_supported_clock_type = true ;
3400
3415
clock_network.type = e_clock_type::RIB;
3401
3416
@@ -3436,6 +3451,15 @@ static void ProcessClockSwitchPoints(
3436
3451
const int num_switches,
3437
3452
pugiutil::loc_data& loc_data)
3438
3453
{
3454
+ std::vector<std::string> expected_spine_drive_attributes =
3455
+ {" name" , " type" , " yoffset" , " switch_name" };
3456
+ std::vector<std::string> expected_rib_drive_attributes =
3457
+ {" name" , " type" , " xoffset" , " switch_name" };
3458
+ std::vector<std::string> expected_spine_tap_attributes =
3459
+ {" name" , " type" , " yoffset" , " yincr" };
3460
+ std::vector<std::string> expected_rib_tap_attributes =
3461
+ {" name" , " type" , " xoffset" , " xincr" };
3462
+
3439
3463
int num_clock_switches = count_children (parent, " switch_point" , loc_data);
3440
3464
pugi::xml_node curr_switch = get_first_child (parent, " switch_point" , loc_data);
3441
3465
@@ -3452,9 +3476,11 @@ static void ProcessClockSwitchPoints(
3452
3476
std::string name (get_attribute (curr_switch, " name" , loc_data).value ());
3453
3477
const char * offset;
3454
3478
if (clock_network.type == e_clock_type::SPINE) {
3479
+ expect_only_attributes (curr_switch, expected_spine_drive_attributes, loc_data);
3455
3480
offset = get_attribute (curr_switch, " yoffset" , loc_data).value ();
3456
3481
} else {
3457
3482
VTR_ASSERT (clock_network.type == e_clock_type::RIB);
3483
+ expect_only_attributes (curr_switch, expected_rib_drive_attributes, loc_data);
3458
3484
offset = get_attribute (curr_switch, " xoffset" , loc_data).value ();
3459
3485
}
3460
3486
@@ -3483,10 +3509,12 @@ static void ProcessClockSwitchPoints(
3483
3509
const char * offset;
3484
3510
const char * increment;
3485
3511
if (clock_network.type == e_clock_type::SPINE) {
3512
+ expect_only_attributes (curr_switch, expected_spine_tap_attributes, loc_data);
3486
3513
offset = get_attribute (curr_switch, " yoffset" , loc_data).value ();
3487
3514
increment = get_attribute (curr_switch, " yincr" , loc_data).value ();
3488
3515
} else {
3489
3516
VTR_ASSERT (clock_network.type == e_clock_type::RIB);
3517
+ expect_only_attributes (curr_switch, expected_rib_tap_attributes, loc_data);
3490
3518
offset = get_attribute (curr_switch, " xoffset" , loc_data).value ();
3491
3519
increment = get_attribute (curr_switch, " xincr" , loc_data).value ();
3492
3520
}
@@ -3514,12 +3542,18 @@ static void ProcessClockRouting(
3514
3542
const int num_switches,
3515
3543
pugiutil::loc_data& loc_data)
3516
3544
{
3545
+ std::vector<std::string> expected_attributes =
3546
+ {" from" , " to" , " switch" , " fc_val" , " locationx" , " locationy" };
3547
+
3517
3548
pugi::xml_node clock_routing_parent = get_single_child (parent, " clock_routing" , loc_data);
3518
3549
int num_routing_connections = count_children (clock_routing_parent, " tap" , loc_data);
3519
3550
3520
3551
pugi::xml_node curr_connection =
3521
3552
get_first_child (clock_routing_parent, " tap" , loc_data);
3522
3553
for (int i = 0 ; i < num_routing_connections; i++) {
3554
+
3555
+ expect_only_attributes (curr_connection, expected_attributes, loc_data);
3556
+
3523
3557
t_clock_connection_arch clock_connection;
3524
3558
3525
3559
const char * from = get_attribute (curr_connection, " from" , loc_data).value ();
0 commit comments