35
35
36
36
static const char * netlist_file_name = nullptr ;
37
37
38
- static int processPorts (pugi::xml_node Parent, t_pb* pb, t_pb_routes& pb_route, const pugiutil::loc_data& loc_data);
38
+ static void processPorts (pugi::xml_node Parent, t_pb* pb, t_pb_routes& pb_route, const pugiutil::loc_data& loc_data);
39
39
40
40
static void processPb (pugi::xml_node Parent, const ClusterBlockId index, t_pb* pb, t_pb_routes& pb_route, int * num_primitives, const pugiutil::loc_data& loc_data, ClusteredNetlist* clb_nlist);
41
41
@@ -395,13 +395,41 @@ static void processPb(pugi::xml_node Parent, const ClusterBlockId index, t_pb* p
395
395
auto & atom_ctx = g_vpr_ctx.mutable_atom ();
396
396
397
397
auto inputs = pugiutil::get_single_child (Parent, " inputs" , loc_data);
398
- int num_in_ports = processPorts (inputs, pb, pb_route, loc_data);
398
+ processPorts (inputs, pb, pb_route, loc_data);
399
399
400
400
auto outputs = pugiutil::get_single_child (Parent, " outputs" , loc_data);
401
- int num_out_ports = processPorts (outputs, pb, pb_route, loc_data);
401
+ processPorts (outputs, pb, pb_route, loc_data);
402
402
403
403
auto clocks = pugiutil::get_single_child (Parent, " clocks" , loc_data);
404
- int num_clock_ports = processPorts (clocks, pb, pb_route, loc_data);
404
+ processPorts (clocks, pb, pb_route, loc_data);
405
+
406
+ int num_in_ports = 0 ;
407
+ int begin_out_port;
408
+ int end_out_port;
409
+ int begin_clock_port;
410
+ int end_clock_port;
411
+
412
+ {
413
+ int num_out_ports = 0 ;
414
+ int num_clock_ports = 0 ;
415
+ for (i = 0 ; i < pb->pb_graph_node ->pb_type ->num_ports ; i++) {
416
+ if (pb->pb_graph_node ->pb_type ->ports [i].is_clock
417
+ && pb->pb_graph_node ->pb_type ->ports [i].type == IN_PORT) {
418
+ num_clock_ports++;
419
+ } else if (!pb->pb_graph_node ->pb_type ->ports [i].is_clock
420
+ && pb->pb_graph_node ->pb_type ->ports [i].type == IN_PORT) {
421
+ num_in_ports++;
422
+ } else {
423
+ VTR_ASSERT (pb->pb_graph_node ->pb_type ->ports [i].type == OUT_PORT);
424
+ num_out_ports++;
425
+ }
426
+ }
427
+
428
+ begin_out_port = num_in_ports;
429
+ end_out_port = begin_out_port + num_out_ports;
430
+ begin_clock_port = end_out_port;
431
+ end_clock_port = begin_clock_port + num_clock_ports;
432
+ }
405
433
406
434
auto attrs = pugiutil::get_single_child (Parent, " attributes" , loc_data, pugiutil::OPTIONAL);
407
435
auto params = pugiutil::get_single_child (Parent, " parameters" , loc_data, pugiutil::OPTIONAL);
@@ -410,15 +438,13 @@ static void processPb(pugi::xml_node Parent, const ClusterBlockId index, t_pb* p
410
438
411
439
// Create the ports in the clb_nlist for the top-level pb
412
440
if (pb->is_root ()) {
413
- VTR_ASSERT (num_in_ports <= num_out_ports);
414
-
415
441
for (i = 0 ; i < num_in_ports; i++) {
416
442
clb_nlist->create_port (index, pb_type->ports [i].name , pb_type->ports [i].num_pins , PortType::INPUT);
417
443
}
418
- for (i = num_in_ports ; i < num_out_ports ; i++) {
444
+ for (i = begin_out_port ; i < end_out_port ; i++) {
419
445
clb_nlist->create_port (index, pb_type->ports [i].name , pb_type->ports [i].num_pins , PortType::OUTPUT);
420
446
}
421
- for (i = num_out_ports ; i < num_clock_ports ; i++) {
447
+ for (i = begin_clock_port ; i < end_clock_port ; i++) {
422
448
clb_nlist->create_port (index, pb_type->ports [i].name , pb_type->ports [i].num_pins , PortType::CLOCK);
423
449
}
424
450
@@ -576,7 +602,7 @@ static int add_net_to_hash(t_hash** nhash, const char* net_name, int* ncount) {
576
602
return hash_value->index ;
577
603
}
578
604
579
- static int processPorts (pugi::xml_node Parent, t_pb* pb, t_pb_routes& pb_route, const pugiutil::loc_data& loc_data) {
605
+ static void processPorts (pugi::xml_node Parent, t_pb* pb, t_pb_routes& pb_route, const pugiutil::loc_data& loc_data) {
580
606
int i, j, num_tokens;
581
607
int in_port = 0 , out_port = 0 , clock_port = 0 ;
582
608
std::vector<std::string> pins;
@@ -852,10 +878,6 @@ static int processPorts(pugi::xml_node Parent, t_pb* pb, t_pb_routes& pb_route,
852
878
pb->set_atom_pin_bit_index (pb_gpin, atom_pin_index);
853
879
}
854
880
}
855
-
856
- // Return the sum of the ports + 1, as we want to number of the ports
857
- // E.g. If there is 1 input port, the in_port index is 0, but num_in_ports = 1
858
- return in_port + out_port + clock_port + 1 ;
859
881
}
860
882
861
883
/* *
@@ -877,6 +899,8 @@ static void load_external_nets_and_cb(ClusteredNetlist& clb_nlist) {
877
899
878
900
/* Assumes that complex block pins are ordered inputs, outputs, globals */
879
901
902
+ clb_nlist.verify ();
903
+
880
904
/* Determine the external nets of complex block */
881
905
for (auto blk_id : clb_nlist.blocks ()) {
882
906
block_type = clb_nlist.block_type (blk_id);
@@ -956,6 +980,8 @@ static void load_external_nets_and_cb(ClusteredNetlist& clb_nlist) {
956
980
}
957
981
}
958
982
983
+ clb_nlist.verify ();
984
+
959
985
vtr::vector<ClusterNetId, int > count (ext_ncount);
960
986
961
987
/* complete load of external nets so that each net points back to the blocks,
0 commit comments