40 INP int depth,
OUTP int *input_count,
OUTP int *output_count);
53 OUTP int *input_count,
OUTP int *output_count);
63 int i, depth, input_count, output_count;
70 for (i = 0; i < depth; i++) {
71 input_count = output_count = 0;
90 if (pb_graph_node->pb_type->num_modes == 0) {
92 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
93 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
94 pb_graph_node->input_pins[i][j].parent_pin_class =
95 (
int *)
my_calloc(pb_graph_node->pb_type->depth,
97 for (k = 0; k < pb_graph_node->pb_type->depth; k++) {
98 pb_graph_node->input_pins[i][j].parent_pin_class[k] =
OPEN;
102 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
103 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
104 pb_graph_node->output_pins[i][j].parent_pin_class =
105 (
int *)
my_calloc(pb_graph_node->pb_type->depth,
107 pb_graph_node->output_pins[i][j].list_of_connectable_input_pin_ptrs =
109 pb_graph_node->pb_type->depth,
111 pb_graph_node->output_pins[i][j].num_connectable_primtive_input_pins =
112 (
int*)
my_calloc(pb_graph_node->pb_type->depth,
114 for (k = 0; k < pb_graph_node->pb_type->depth; k++) {
115 pb_graph_node->output_pins[i][j].parent_pin_class[k] =
OPEN;
119 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
120 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
121 pb_graph_node->clock_pins[i][j].parent_pin_class =
122 (
int *)
my_calloc(pb_graph_node->pb_type->depth,
124 for (k = 0; k < pb_graph_node->pb_type->depth; k++) {
125 pb_graph_node->clock_pins[i][j].parent_pin_class[k] =
OPEN;
130 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
132 j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
136 < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
139 &pb_graph_node->child_pb_graph_nodes[i][j][k]);
149 int max_depth, depth;
154 if (pb_graph_node->pb_type->num_modes == 0) {
155 return pb_graph_node->pb_type->depth;
157 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
159 j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
163 < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
166 &pb_graph_node->child_pb_graph_nodes[i][j][k]);
167 if (depth > max_depth) {
182 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
183 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
184 pb_graph_node->input_pins[i][j].scratch_pad =
OPEN;
187 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
188 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
189 pb_graph_node->output_pins[i][j].scratch_pad =
OPEN;
192 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
193 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
194 pb_graph_node->clock_pins[i][j].scratch_pad =
OPEN;
198 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
199 for (j = 0; j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
203 < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
206 &pb_graph_node->child_pb_graph_nodes[i][j][k]);
214 INP int depth,
OUTP int *input_count,
OUTP int *output_count) {
217 if (pb_graph_node->pb_type->num_modes == 0) {
218 if (pb_graph_node->pb_type->depth > depth) {
220 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
221 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
222 if (pb_graph_node->input_pins[i][j].parent_pin_class[depth]
225 &pb_graph_node->input_pins[i][j],
226 &pb_graph_node->input_pins[i][j], depth,
227 input_count, output_count);
232 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
233 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
234 if (pb_graph_node->output_pins[i][j].parent_pin_class[depth]
237 &pb_graph_node->output_pins[i][j],
238 &pb_graph_node->output_pins[i][j], depth,
239 input_count, output_count);
244 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
245 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
246 if (pb_graph_node->clock_pins[i][j].parent_pin_class[depth]
249 &pb_graph_node->clock_pins[i][j],
250 &pb_graph_node->clock_pins[i][j], depth,
251 input_count, output_count);
259 if (pb_graph_node->pb_type->depth == depth) {
263 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
264 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
265 pb_graph_node->input_pins[i][j].pin_class =
OPEN;
268 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
269 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
270 pb_graph_node->output_pins[i][j].pin_class =
OPEN;
273 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
274 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
275 pb_graph_node->clock_pins[i][j].pin_class =
OPEN;
281 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
282 for (j = 0; j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
286 < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
289 &pb_graph_node->child_pb_graph_nodes[i][j][k], depth,
290 input_count, output_count);
295 if (pb_graph_node->pb_type->depth == depth
296 && pb_graph_node->pb_type->num_modes != 0) {
298 pb_graph_node->num_input_pin_class = *input_count + 1;
299 pb_graph_node->input_pin_class_size = (
int*)
my_calloc(*input_count + 1,
301 pb_graph_node->num_output_pin_class = *output_count + 1;
302 pb_graph_node->output_pin_class_size = (
int*)
my_calloc(*output_count + 1,
316 if (pb_graph_node->pb_type->num_modes == 0) {
318 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
319 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
320 for (k = 0; k < pb_graph_node->pb_type->depth; k++) {
322 &pb_graph_node->output_pins[i][j],
323 &pb_graph_node->output_pins[i][j], k);
325 &pb_graph_node->output_pins[i][j]);
331 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
332 for (j = 0; j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
334 for (k = 0;k < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
337 &pb_graph_node->child_pb_graph_nodes[i][j][k]);
351 if (current_pb_graph_pin->scratch_pad ==
OPEN
352 && current_pb_graph_pin->parent_node->pb_type->depth > depth) {
353 current_pb_graph_pin->scratch_pad = 1;
354 for (i = 0; i < current_pb_graph_pin->num_output_edges; i++) {
355 assert(current_pb_graph_pin->output_edges[i]->num_output_pins == 1);
357 current_pb_graph_pin->output_edges[i]->output_pins[0],
358 reference_pin, depth);
360 if (current_pb_graph_pin->parent_node->pb_type->num_modes == 0
361 && current_pb_graph_pin->port->type ==
IN_PORT) {
362 reference_pin->num_connectable_primtive_input_pins[depth]++;
363 reference_pin->list_of_connectable_input_pin_ptrs[depth] =
365 reference_pin->list_of_connectable_input_pin_ptrs[depth],
366 reference_pin->num_connectable_primtive_input_pins[depth]
368 reference_pin->list_of_connectable_input_pin_ptrs[depth][reference_pin->num_connectable_primtive_input_pins[depth]
369 - 1] = current_pb_graph_pin;
380 if (current_pb_graph_pin->scratch_pad !=
OPEN) {
381 current_pb_graph_pin->scratch_pad =
OPEN;
382 for (i = 0; i < current_pb_graph_pin->num_output_edges; i++) {
383 assert(current_pb_graph_pin->output_edges[i]->num_output_pins == 1);
385 current_pb_graph_pin->output_edges[i]->output_pins[0]);
396 OUTP int *input_count,
OUTP int *output_count) {
399 int active_pin_class;
401 if (reference_pb_graph_pin->port->type ==
IN_PORT) {
402 marker = *input_count + 10;
403 active_pin_class = *input_count;
405 marker = -10 - *output_count;
406 active_pin_class = *output_count;
408 assert(reference_pb_graph_pin->parent_node->pb_type->num_modes == 0);
409 assert(current_pb_graph_pin->parent_node->pb_type->depth >= depth);
410 assert(current_pb_graph_pin->port->type !=
INOUT_PORT);
411 if (current_pb_graph_pin->scratch_pad != marker) {
412 if (current_pb_graph_pin->parent_node->pb_type->num_modes == 0) {
413 current_pb_graph_pin->scratch_pad = marker;
415 if (current_pb_graph_pin->parent_pin_class[depth] ==
OPEN
416 && reference_pb_graph_pin->port->is_clock
417 == current_pb_graph_pin->port->is_clock
418 && reference_pb_graph_pin->port->type
419 == current_pb_graph_pin->port->type) {
420 current_pb_graph_pin->parent_pin_class[depth] =
423 for (i = 0; i < current_pb_graph_pin->num_input_edges; i++) {
425 current_pb_graph_pin->input_edges[i]->num_input_pins == 1);
427 current_pb_graph_pin->input_edges[i]->input_pins[0],
428 reference_pb_graph_pin, depth, input_count,
431 for (i = 0; i < current_pb_graph_pin->num_output_edges; i++) {
433 current_pb_graph_pin->output_edges[i]->num_output_pins == 1);
435 current_pb_graph_pin->output_edges[i]->output_pins[0],
436 reference_pb_graph_pin, depth, input_count,
439 }
else if (current_pb_graph_pin->parent_node->pb_type->depth == depth) {
440 current_pb_graph_pin->scratch_pad = marker;
441 if (current_pb_graph_pin->port->type ==
OUT_PORT) {
442 if (reference_pb_graph_pin->port->type ==
OUT_PORT) {
444 current_pb_graph_pin->pin_class = active_pin_class;
446 for (i = 0; i < current_pb_graph_pin->num_input_edges; i++) {
448 current_pb_graph_pin->input_edges[i]->num_input_pins == 1);
450 current_pb_graph_pin->input_edges[i]->input_pins[0],
451 reference_pb_graph_pin, depth, input_count,
455 if (current_pb_graph_pin->port->type ==
IN_PORT) {
456 if (reference_pb_graph_pin->port->type ==
IN_PORT) {
458 current_pb_graph_pin->pin_class = active_pin_class;
460 for (i = 0; i < current_pb_graph_pin->num_output_edges; i++) {
462 current_pb_graph_pin->output_edges[i]->num_output_pins == 1);
464 current_pb_graph_pin->output_edges[i]->output_pins[0],
465 reference_pb_graph_pin, depth, input_count,
469 }
else if (current_pb_graph_pin->parent_node->pb_type->depth > depth) {
471 current_pb_graph_pin->scratch_pad = marker;
472 for (i = 0; i < current_pb_graph_pin->num_input_edges; i++) {
474 current_pb_graph_pin->input_edges[i]->num_input_pins == 1);
476 current_pb_graph_pin->input_edges[i]->input_pins[0],
477 reference_pb_graph_pin, depth, input_count,
480 for (i = 0; i < current_pb_graph_pin->num_output_edges; i++) {
482 current_pb_graph_pin->output_edges[i]->num_output_pins == 1);
484 current_pb_graph_pin->output_edges[i]->output_pins[0],
485 reference_pb_graph_pin, depth, input_count,
497 for (i = 0; i < pb_graph_node->num_input_ports; i++) {
498 for (j = 0; j < pb_graph_node->num_input_pins[i]; j++) {
500 pb_graph_node->input_pins[i][j].pin_class < pb_graph_node->num_input_pin_class);
501 if (pb_graph_node->input_pins[i][j].pin_class ==
OPEN) {
502 vpr_printf(TIO_MESSAGE_WARNING,
"%s[%d].%s[%d] unconnected pin in architecture.\n",
503 pb_graph_node->pb_type->name,
504 pb_graph_node->placement_index,
505 pb_graph_node->input_pins[i][j].port->name,
506 pb_graph_node->input_pins[i][j].pin_number);
509 pb_graph_node->input_pin_class_size[pb_graph_node->input_pins[i][j].pin_class]++;
512 for (i = 0; i < pb_graph_node->num_output_ports; i++) {
513 for (j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
515 pb_graph_node->output_pins[i][j].pin_class < pb_graph_node->num_output_pin_class);
516 if (pb_graph_node->output_pins[i][j].pin_class ==
OPEN) {
517 vpr_printf(TIO_MESSAGE_WARNING,
"%s[%d].%s[%d] unconnected pin in architecture.\n",
518 pb_graph_node->pb_type->name,
519 pb_graph_node->placement_index,
520 pb_graph_node->output_pins[i][j].port->name,
521 pb_graph_node->output_pins[i][j].pin_number);
524 pb_graph_node->output_pin_class_size[pb_graph_node->output_pins[i][j].pin_class]++;
527 for (i = 0; i < pb_graph_node->num_clock_ports; i++) {
528 for (j = 0; j < pb_graph_node->num_clock_pins[i]; j++) {
530 pb_graph_node->clock_pins[i][j].pin_class < pb_graph_node->num_input_pin_class);
531 if (pb_graph_node->clock_pins[i][j].pin_class ==
OPEN) {
532 vpr_printf(TIO_MESSAGE_WARNING,
"%s[%d].%s[%d] unconnected pin in architecture.\n",
533 pb_graph_node->pb_type->name,
534 pb_graph_node->placement_index,
535 pb_graph_node->clock_pins[i][j].port->name,
536 pb_graph_node->clock_pins[i][j].pin_number);
539 pb_graph_node->input_pin_class_size[pb_graph_node->clock_pins[i][j].pin_class]++;
549 if (pb_graph_node->pb_type->num_modes == 0) {
550 for(i = 0; i < pb_graph_node->num_output_ports; i++) {
551 for(j = 0; j < pb_graph_node->num_output_pins[i]; j++) {
552 pb_graph_node->output_pins[i][j].is_forced_connection =
is_forced_connection(&pb_graph_node->output_pins[i][j]);
556 for (i = 0; i < pb_graph_node->pb_type->num_modes; i++) {
558 j < pb_graph_node->pb_type->modes[i].num_pb_type_children;
561 k < pb_graph_node->pb_type->modes[i].pb_type_children[j].num_pb;
574 if(pb_graph_pin->num_output_edges > 1) {
577 if(pb_graph_pin->num_output_edges == 0) {
578 if(pb_graph_pin->parent_node->pb_type->num_modes == 0) {
static void discover_all_forced_connections(INOUTP t_pb_graph_node *pb_graph_node)
static void sum_pin_class(INOUTP t_pb_graph_node *pb_graph_node)
void * my_calloc(size_t nelem, size_t size)
static int get_max_depth_of_pb_graph_node(INP t_pb_graph_node *pb_graph_node)
static void load_list_of_connectable_input_pin_ptrs(INOUTP t_pb_graph_node *pb_graph_node)
static void load_pin_class_by_depth(INOUTP t_pb_graph_node *pb_graph_node, INP int depth, OUTP int *input_count, OUTP int *output_count)
static void expand_pb_graph_node_and_load_pin_class_by_depth(INOUTP t_pb_graph_pin *current_pb_graph_pin, INP t_pb_graph_pin *reference_pb_graph_pin, INP int depth, OUTP int *input_count, OUTP int *output_count)
static boolean is_forced_connection(INP t_pb_graph_pin *pb_graph_pin)
static void reset_pin_class_scratch_pad_rec(INOUTP t_pb_graph_node *pb_graph_node)
static void alloc_pin_classes_in_pb_graph_node(INOUTP t_pb_graph_node *pb_graph_node)
void load_pin_classes_in_pb_graph_head(INOUTP t_pb_graph_node *pb_graph_node)
static void * my_realloc(void *memblk, int ibytes)
static void expand_pb_graph_node_and_load_output_to_input_connections(INOUTP t_pb_graph_pin *current_pb_graph_pin, INOUTP t_pb_graph_pin *reference_pin, INP int depth)
static void unmark_fanout_intermediate_nodes(INOUTP t_pb_graph_pin *current_pb_graph_pin)