@@ -257,18 +257,25 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
257257 }
258258
259259 i_input = i_output = i_clockport = 0 ;
260+ t_port* pb_type_ports;
260261 for (i = 0 ; i < pb_type->num_ports ; i++) {
261- if (pb_type->ports [i].model_port ) {
262+ if (pb_graph_node->has_secondary ) {
263+ pb_type_ports = pb_type->ports_sec ;
264+ } else {
265+ pb_type_ports = pb_type->ports ;
266+ }
267+
268+ if (pb_type_ports[i].model_port ) {
262269 VTR_ASSERT (pb_type->num_modes == 0 );
263270 } else {
264- VTR_ASSERT (pb_type->num_modes != 0 || pb_type-> ports [i].is_clock );
271+ VTR_ASSERT (pb_type->num_modes != 0 || pb_type_ports [i].is_clock );
265272 }
266- if (pb_type-> ports [i].type == IN_PORT && !pb_type-> ports [i].is_clock ) {
267- pb_graph_node->input_pins [i_input] = new t_pb_graph_pin[pb_type-> ports [i].num_pins ];
268- pb_graph_node->num_input_pins [i_input] = pb_type-> ports [i].num_pins ;
269- for (j = 0 ; j < pb_type-> ports [i].num_pins ; j++) {
273+ if (pb_type_ports [i].type == IN_PORT && !pb_type_ports [i].is_clock ) {
274+ pb_graph_node->input_pins [i_input] = new t_pb_graph_pin[pb_type_ports [i].num_pins ];
275+ pb_graph_node->num_input_pins [i_input] = pb_type_ports [i].num_pins ;
276+ for (j = 0 ; j < pb_type_ports [i].num_pins ; j++) {
270277 pb_graph_node->input_pins [i_input][j].pin_number = j;
271- pb_graph_node->input_pins [i_input][j].port = &pb_type-> ports [i];
278+ pb_graph_node->input_pins [i_input][j].port = &pb_type_ports [i];
272279 pb_graph_node->input_pins [i_input][j].parent_node = pb_graph_node;
273280 pb_graph_node->input_pins [i_input][j].pin_count_in_cluster = pin_count_in_cluster;
274281 if (pb_graph_node->pb_type ->blif_model != nullptr ) {
@@ -283,12 +290,12 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
283290 pin_count_in_cluster++;
284291 }
285292 i_input++;
286- } else if (pb_type-> ports [i].type == OUT_PORT) {
287- pb_graph_node->output_pins [i_output] = new t_pb_graph_pin[pb_type-> ports [i].num_pins ];
288- pb_graph_node->num_output_pins [i_output] = pb_type-> ports [i].num_pins ;
289- for (j = 0 ; j < pb_type-> ports [i].num_pins ; j++) {
293+ } else if (pb_type_ports [i].type == OUT_PORT) {
294+ pb_graph_node->output_pins [i_output] = new t_pb_graph_pin[pb_type_ports [i].num_pins ];
295+ pb_graph_node->num_output_pins [i_output] = pb_type_ports [i].num_pins ;
296+ for (j = 0 ; j < pb_type_ports [i].num_pins ; j++) {
290297 pb_graph_node->output_pins [i_output][j].pin_number = j;
291- pb_graph_node->output_pins [i_output][j].port = &pb_type-> ports [i];
298+ pb_graph_node->output_pins [i_output][j].port = &pb_type_ports [i];
292299 pb_graph_node->output_pins [i_output][j].parent_node = pb_graph_node;
293300 pb_graph_node->output_pins [i_output][j].pin_count_in_cluster = pin_count_in_cluster;
294301 if (pb_graph_node->pb_type ->blif_model != nullptr ) {
@@ -304,12 +311,12 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
304311 }
305312 i_output++;
306313 } else {
307- VTR_ASSERT (pb_type-> ports [i].is_clock && pb_type-> ports [i].type == IN_PORT);
308- pb_graph_node->clock_pins [i_clockport] = new t_pb_graph_pin[pb_type-> ports [i].num_pins ];
309- pb_graph_node->num_clock_pins [i_clockport] = pb_type-> ports [i].num_pins ;
310- for (j = 0 ; j < pb_type-> ports [i].num_pins ; j++) {
314+ VTR_ASSERT (pb_type_ports [i].is_clock && pb_type_ports [i].type == IN_PORT);
315+ pb_graph_node->clock_pins [i_clockport] = new t_pb_graph_pin[pb_type_ports [i].num_pins ];
316+ pb_graph_node->num_clock_pins [i_clockport] = pb_type_ports [i].num_pins ;
317+ for (j = 0 ; j < pb_type_ports [i].num_pins ; j++) {
311318 pb_graph_node->clock_pins [i_clockport][j].pin_number = j;
312- pb_graph_node->clock_pins [i_clockport][j].port = &pb_type-> ports [i];
319+ pb_graph_node->clock_pins [i_clockport][j].port = &pb_type_ports [i];
313320 pb_graph_node->clock_pins [i_clockport][j].parent_node = pb_graph_node;
314321 pb_graph_node->clock_pins [i_clockport][j].pin_count_in_cluster = pin_count_in_cluster;
315322 if (pb_graph_node->pb_type ->blif_model != nullptr ) {
0 commit comments