1 /************************************************************
3 ** COPYRIGHT (C) 1993 UNIVERSITY OF PITTSBURGH
4 ** COPYRIGHT (C) 1996 GANNON UNIVERSITY
7 ** This software is distributed on an as-is basis
8 ** with no warranty implied or intended. No author
9 ** or distributor takes responsibility to anyone
10 ** regarding its use of or suitability.
12 ** The software may be distributed and modified
13 ** freely for academic and other non-commercial
14 ** use but may NOT be utilized or included in whole
15 ** or part within any commercial product.
17 ** This copyright notice must remain on all copies
18 ** and modified versions of this software.
20 ************************************************************/
24 /* ------------------------------------------------------------------------
25 * debugging routines for place and route spl 7/89
27 * ------------------------------------------------------------------------
35 /*---------------------------------------------------------------
37 *---------------------------------------------------------------
42 /*---------------------------------------------------------------
43 * print the full list of all modules
44 *---------------------------------------------------------------
51 for (m
= modules
; m
!= NULL
; m
= m
->next
)
53 fprintf(f
, "\nModule index: %d name: %s,\ttype: %s, \tflag: %d\n",
54 m
->this->index
, m
->this->name
, m
->this->type
, m
->this->flag
);
55 fprintf(f
, "\tpostition: %d %d,\tsize: %d %d,\trotation: %d\n",
56 m
->this->x_pos
, m
->this->y_pos
,
57 m
->this->x_size
, m
->this->y_size
, m
->this->rot
);
58 fprintf(f
, " Terminal List:\n");
59 print_tlist(f
,m
->this->terms
);
64 *---------------------------------------------------------------
65 * print the full list of all nets
66 *---------------------------------------------------------------
73 for (n
= nets
; n
!= NULL
; n
= n
->next
)
75 fprintf(f
, "\nNet name: %s Type: %d \n", n
->this->name
, n
->this->type
);
76 fprintf(f
, " Terminal List:\n");
77 print_tlist(f
,n
->this->terms
);
82 *---------------------------------------------------------------
83 * print a terminal list
84 *---------------------------------------------------------------
91 for(; t
!= NULL
; t
= t
->next
)
93 fprintf(f
, "\t%s:%s: %d,%d type:%d", t
->this->mod
->name
, t
->this->name
,
94 t
->this->x_pos
, t
->this->y_pos
, t
->this->type
);
103 *---------------------------------------------------------------
104 * print the list of "external/system" terminals
105 *---------------------------------------------------------------
114 fprintf(f
, "\nExternal Ports:\n");
116 for(t
= ext_terms
; t
!= NULL
; t
= t
->next
)
118 fprintf(f
, "\t%s:", t
->this->name
);
119 switch (t
->this->type
)
121 case IN
: fprintf(f
, "global_input"); break;
123 case OUT
: fprintf(f
, "global_output"); break;
125 case INOUT
: fprintf(f
, "global_inout"); break;
127 default: fprintf(f
, "bad type"); break;
139 *---------------------------------------------------------------
140 * print_connections (stf 9-89)
141 *---------------------------------------------------------------
143 void print_connections(f
)
148 fprintf(f
, "\nConnections:\n");
150 for (i
= 0; i
< module_count
; i
++)
152 for (j
= 0; j
< module_count
; j
++)
154 fprintf(f
, "i,j:%d,%d:%d\t", i
, j
, connected
[i
][j
]);
155 if ((j
+1)%5 == 0) fprintf(f
, "\n");
162 *---------------------------------------------------------------
164 *---------------------------------------------------------------
166 void p_cons(f
,q
, limbs
)
173 fprintf(f
, "\nConnections:(%d)\n", q
);
175 for (i
= 0; i
< q
; i
++)
177 fprintf(f
,"%2d | ", i
);
179 for (j
= 0; j
< q
; j
++)
181 fprintf(f
, "%2d ", connected
[i
][j
]);
182 if ((j
+1)%50 == 0) fprintf(f
, "\n");
186 if (find_indexed_element(i
, limbs
) != NULL
)
187 print_ctree(f
, ( find_indexed_element(i
, limbs
) )->this);
196 *--------------------------------------------------------------
197 * det_in_out_relationship(m1, m2)
198 *--------------------------------------------------------------
200 void det_in_out_relationship(m1
, m2
, in_x
, out_x
)
206 /* Check out the connection between <m1> and <m2> */
207 for (tl
= m1
->terms
; tl
!= NULL
; tl
= tl
->next
)
209 if (tl
->this->nt
== NULL
) /* Don't Care */
216 for (tll
= tl
->this->nt
->terms
; tll
!= NULL
; tll
= tll
->next
)
218 if (tll
->this->mod
== m2
)
220 if (((tl
->this->type
== IN
) && (tll
->this->type
!= IN
)) ||
221 ((tl
->this->type
== INOUT
) && (tll
->this->type
== OUT
)))
223 /* <m2> drives <m1> */
224 *in_x
= m1
->x_pos
+ tl
->this->x_pos
;
225 *out_x
= m2
->x_pos
+ tll
->this->x_pos
;
227 else if (((tll
->this->type
== IN
) && (tl
->this->type
!= IN
)) ||
228 ((tll
->this->type
== INOUT
) && (tl
->this->type
== OUT
)))
230 /* <m1> drives <m2> */
231 *out_x
= m1
->x_pos
+ tl
->this->x_pos
;
232 *in_x
= m2
->x_pos
+ tll
->this->x_pos
;
234 else /* Don't care: */
244 *--------------------------------------------------------------
245 * float manhattan_PWS (stf 5-91)
246 *--------------------------------------------------------------
248 float manhattan_PWS()
250 /* this function returns the manhattan (x + y) distances among the modules of
251 the design. This number can be used to measure the quality of the
252 placement, and is accomplished by doing a pairwise multiplication of the
253 inverse distance with the connectivity for all of the modules in the
256 /* Modified to only include those connections that are not xfouled */
258 int rIndex
, cIndex
, match_module_index();
259 int in_x
, out_x
, xNoise
, yNoise
;
260 float connectivity
, manhat_dist
[MAX_MOD
][MAX_MOD
];
261 float x
, y
, inv_manhat_dist
[MAX_MOD
][MAX_MOD
], manhat_sum
= 0.0;
264 /* Rebuild the connected[][] matrix for reference: */
265 build_connections(matrix_type
);
266 overlay_connections(module_count
, matrix_type
);
268 /* Build the two distance matricies */
269 for (ml
= modules
; ml
!= NULL
; ml
= ml
->next
)
271 rIndex
= ml
->this->index
;
272 for (mll
= ml
->next
; mll
!= NULL
; mll
= mll
->next
)
274 cIndex
= mll
->this->index
;
275 mll
->this->placed
= UNPLACED
; /* Avoids screwups in the cc code */
277 if (connected
[rIndex
][cIndex
] != 0)
279 /* Skip cross-coupled gates: */
280 if (cross_coupled_p(ml
->this, mll
->this, cc_search_level
) != FALSE
)
286 /* Noise Reduction */
287 xNoise
= ml
->this->x_pos
+ ml
->this->x_size
/2 -
288 mll
->this->x_pos
- mll
->this->x_size
/2;
290 yNoise
= ml
->this->y_pos
+ ml
->this->y_size
/2 -
291 mll
->this->y_pos
- mll
->this->y_size
/2;
292 x
= (float)abs(xNoise
); y
= (float)abs(yNoise
);
295 manhat_dist
[rIndex
][cIndex
] = x
+ y
;
298 inv_manhat_dist
[rIndex
][cIndex
] =1.0/manhat_dist
[rIndex
][cIndex
];
300 /* Calculate the pairwise sums: Penalize for bad, non-cc
301 (xfoul) connections: */
302 det_in_out_relationship(ml
->this, mll
->this, &in_x
, &out_x
);
305 connectivity
= (float)connected
[rIndex
][cIndex
];
306 manhat_sum
-= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
310 connectivity
= (float)connected
[rIndex
][cIndex
];
311 manhat_sum
+= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
322 *--------------------------------------------------------------
323 * print_distance_stats (stf 5-91)
324 *--------------------------------------------------------------
326 void print_distance_stats(mfile
)
327 FILE *mfile
; /* Where to write the info */
329 /* this function prints the manhattan (x + y) and euclidian (sqrt(x^2 + y^2))
330 distances among the modules of the design to a file "dist_stats"
331 along with a measure of how this correlates with the connectivity
332 of the design. This number can be used to measure the quality of the
333 placement, and is accomplished by doing a pairwise multiplication of the
334 inverse distance with the connectivity for all of the modules in the
337 /* Modified to only include those connections that are not xfouled */
339 int rIndex
, cIndex
, match_module_index();
340 int in_x
, out_x
, xNoise
, yNoise
;
341 float connectivity
, manhat_dist
[MAX_MOD
][MAX_MOD
], euclid_dist
[MAX_MOD
][MAX_MOD
];
342 float x
, inv_manhat_dist
[MAX_MOD
][MAX_MOD
], manhat_sum
= 0.0;
343 float y
, inv_euclid_dist
[MAX_MOD
][MAX_MOD
], euclid_sum
= 0.0;
346 /* Rebuild the connected[][] matrix for reference: */
347 build_connections(matrix_type
);
348 overlay_connections(module_count
, matrix_type
);
350 /* Build the two distance matricies */
351 for (ml
= modules
; ml
!= NULL
; ml
= ml
->next
)
353 rIndex
= ml
->this->index
;
354 for (mll
= ml
->next
; mll
!= NULL
; mll
= mll
->next
)
356 cIndex
= mll
->this->index
;
357 mll
->this->placed
= UNPLACED
; /* Avoids screwups in the cc code */
359 if (connected
[rIndex
][cIndex
] != 0)
361 /* Skip cross-coupled gates: */
362 if (cross_coupled_p(ml
->this, mll
->this, cc_search_level
) != FALSE
)
368 /* Noise Reduction */
369 xNoise
= ml
->this->x_pos
+ ml
->this->x_size
/2 -
370 mll
->this->x_pos
- mll
->this->x_size
/2;
372 yNoise
= ml
->this->y_pos
+ ml
->this->y_size
/2 -
373 mll
->this->y_pos
- mll
->this->y_size
/2;
374 x
= (float)abs(xNoise
); y
= (float)abs(yNoise
);
377 manhat_dist
[rIndex
][cIndex
] = x
+ y
;
378 euclid_dist
[rIndex
][cIndex
] = (float)sqrt((double)((x
* x
)+(y
* y
)));
381 inv_manhat_dist
[rIndex
][cIndex
] =1.0/manhat_dist
[rIndex
][cIndex
];
382 inv_euclid_dist
[rIndex
][cIndex
] =1.0/euclid_dist
[rIndex
][cIndex
];
384 /* Calculate the pairwise sums: Penalize for bad, non-cc
385 (xfoul) connections: */
386 det_in_out_relationship(ml
->this, mll
->this, &in_x
, &out_x
);
389 connectivity
= (float)connected
[rIndex
][cIndex
];
390 manhat_sum
-= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
391 euclid_sum
-= inv_euclid_dist
[rIndex
][cIndex
] * connectivity
;
395 connectivity
= (float)connected
[rIndex
][cIndex
];
396 manhat_sum
+= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
397 euclid_sum
+= inv_euclid_dist
[rIndex
][cIndex
] * connectivity
;
405 /* Now dump the two sums to the stats file: */
406 fprintf(mfile
,"\t%-8.7f \t%-8.7f ",
407 manhat_sum
, euclid_sum
);
410 *--------------------------------------------------------------
411 * print_distance_matricies (stf 5-91)
412 *--------------------------------------------------------------
414 void print_distance_matricies()
416 /* this function prints the manhattan (x + y) and euclidian (sqrt(x^2 + y^2))
417 distances among the modules of the design to a file "dist_stats"
418 along with a measure of how this correlates with the connectivity
419 of the design. This number can be used to measure the quality of the
420 placement, and is accomplished by doing a pairwise multiplication of the
421 inverse distance with the connectivity for all of the modules in the
424 FILE *mfile
= fopen("dist_stats","a");
425 int rIndex
, cIndex
, match_module_index();
426 int in_x
, out_x
, xNoise
, yNoise
;
427 float connectivity
, manhat_dist
[MAX_MOD
][MAX_MOD
], euclid_dist
[MAX_MOD
][MAX_MOD
];
428 float x
, inv_manhat_dist
[MAX_MOD
][MAX_MOD
], manhat_sum
= 0.0;
429 float y
, inv_euclid_dist
[MAX_MOD
][MAX_MOD
], euclid_sum
= 0.0;
432 /* Rebuild the connected[][] matrix for reference: */
433 build_connections(matrix_type
);
434 overlay_connections(module_count
, matrix_type
);
436 /* Build the two distance matricies */
437 for (ml
= modules
; ml
!= NULL
; ml
= ml
->next
)
439 rIndex
= ml
->this->index
;
440 for (mll
= ml
->next
; mll
!= NULL
; mll
= mll
->next
)
442 cIndex
= mll
->this->index
;
443 mll
->this->placed
= UNPLACED
; /* Avoids screwups in the cc code */
445 if (connected
[rIndex
][cIndex
] != 0)
447 /* Skip cross-coupled gates: */
448 if (cross_coupled_p(ml
->this, mll
->this, cc_search_level
) != FALSE
)
454 /* Noise Reduction */
455 xNoise
= ml
->this->x_pos
+ ml
->this->x_size
/2 -
456 mll
->this->x_pos
- mll
->this->x_size
/2;
458 yNoise
= ml
->this->y_pos
+ ml
->this->y_size
/2 -
459 mll
->this->y_pos
- mll
->this->y_size
/2;
460 x
= (float)abs(xNoise
); y
= (float)abs(yNoise
);
463 manhat_dist
[rIndex
][cIndex
] = x
+ y
;
464 euclid_dist
[rIndex
][cIndex
] = (float)sqrt((double)((x
* x
)+(y
* y
)));
467 inv_manhat_dist
[rIndex
][cIndex
] =1.0/manhat_dist
[rIndex
][cIndex
];
468 inv_euclid_dist
[rIndex
][cIndex
] =1.0/euclid_dist
[rIndex
][cIndex
];
470 /* Calculate the pairwise sums: Penalize for bad, non-cc
471 (xfoul) connections: */
472 det_in_out_relationship(ml
->this, mll
->this, &in_x
, &out_x
);
475 connectivity
= (float)connected
[rIndex
][cIndex
];
476 manhat_sum
-= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
477 euclid_sum
-= inv_euclid_dist
[rIndex
][cIndex
] * connectivity
;
481 connectivity
= (float)connected
[rIndex
][cIndex
];
482 manhat_sum
+= inv_manhat_dist
[rIndex
][cIndex
] * connectivity
;
483 euclid_sum
+= inv_euclid_dist
[rIndex
][cIndex
] * connectivity
;
490 /* Now dump all of this to the stats file: */
491 fprintf(mfile
,"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
492 fprintf(mfile
,"| -p%d -s%d -c%d -r%-4.2f -m%d %s %s %s\t ||",
493 partition_rule
, max_partition_size
, max_partition_conn
,
494 partition_ratio
, matrix_type
, (stopAtFirstCut
== TRUE
) ? "-f" : "--",
495 (useSlivering
== FALSE
) ? "-v" : "--", (useAveraging
== TRUE
) ? "-w" : "--");
497 fprintf(mfile
, "The Connection Matrix looks like: \n");
498 for(rIndex
= 0; rIndex
< module_count
; rIndex
++)
500 for(cIndex
= 0; cIndex
< module_count
; cIndex
++)
502 fprintf(mfile
, "%6d ", connected
[rIndex
][cIndex
]);
504 ml
= (mlist
*)member(rIndex
, modules
, match_module_index
);
505 fprintf(mfile
," | %s\n", ml
->this->name
);
508 fprintf(mfile
, "\n\nThe Manhattan Distance Matrix looks like: \n");
509 for(rIndex
= 0; rIndex
< module_count
; rIndex
++)
511 for(cIndex
= 0; cIndex
< module_count
; cIndex
++)
513 fprintf(mfile
, "%-6.1f ", manhat_dist
[rIndex
][cIndex
]);
515 ml
= (mlist
*)member(rIndex
, modules
, match_module_index
);
516 fprintf(mfile
," | %s\n", ml
->this->name
);
519 /* fprintf(mfile, "\n\nThe Euclidian Distance Matrix looks like: \n");
520 for(rIndex = 0; rIndex < module_count; rIndex++)
522 for(cIndex = 0; cIndex < module_count; cIndex++)
524 fprintf(mfile, "%-6.3f ", euclid_dist[rIndex][cIndex]);
526 ml = (mlist*)member(rIndex, modules, match_module_index);
527 fprintf(mfile," | %s\n", ml->this->name);
530 fprintf(mfile
,"\n\nThe pairwise sum for inv. Manhattan vs. Connectivity is %-8.7f\n",
532 fprintf(mfile
,"\n\nThe pairwise sum for inv. Euclidian vs. Connectivity is %-8.7f\n",
537 int match_module_index(i
, m
)
541 /* Return TRUE if the module->index field matches the index <i> given: */
542 if (m
->index
== i
) return (TRUE
);
547 *--------------------------------------------------------------
548 * print_ctree (stf 9-89)
549 *--------------------------------------------------------------
557 int this, next
, breadth
= 0;
559 if (t
== NULL
) return 0;
561 /* Load the queue and begin: */
562 indexed_list_insert(t
,0,&queue
);
563 this = 1; next
= 0; breadth
= 1;
567 /* Yank the first person off of the list, and add any children to the back */
570 temp
= (ctree
*)remove_indexed_element(0, &queue
); /* dequeue the next item */
573 if (temp
->right
!=NULL
) /* enque the right child */
575 indexed_list_insert(temp
->right
,ilist_length(queue
),&queue
);
578 if (temp
->left
!=NULL
) /* enque the left child */
580 indexed_list_insert(temp
->left
,ilist_length(queue
),&queue
);
583 /* Now do something with the element: */
585 if (temp
->this->contents
!= NULL
)
586 fprintf(f
,"[c=%d] %s, ", temp
->this->connects
, temp
->this->contents
->name
);
589 fprintf(f
,"[s=%d c=%d r=%-5.3f]", temp
->this->size
, temp
->this->connects
,
590 (float)temp
->this->connects
/(float)temp
->this->size
);
592 if (--this == 0) /* end of a layer */
594 breadth
= MAX(breadth
, next
);
595 this = next
; next
= 0;
600 /* go on to the next thing in the queue */
601 } while (ilist_length(queue
)!= 0);
610 *---------------------------------------------------------------
612 *---------------------------------------------------------------
618 fprintf(f
, "\nInfo:\n");
620 for(i
= 0; i
< module_count
; i
++)
622 fprintf(f
, "module:%d\t used:%d\t in:%d\t out:%d\n",
623 i
, module_info
[i
].used
, module_info
[i
].in
, module_info
[i
].out
);
627 *---------------------------------------------------------------
629 *---------------------------------------------------------------
637 fprintf(f
, "\nBoxes:\n");
639 for(i
= 0; i
<= partition_count
; i
++)
641 fprintf(f
, "Boxes for partition %d:\n", i
);
643 for (ml
= boxes
[i
]; ml
!= NULL
; ml
= ml
->next
)
645 fprintf(f
, "\t\tModule: %s\n", ml
->this->name
);
651 *---------------------------------------------------------------
653 *---------------------------------------------------------------
655 void print_strings(f
)
661 fprintf(f
, "\nStrings:\n");
663 for(i
= 0; i
<= partition_count
; i
++)
665 fprintf(f
, "string for partition %d: total size: %d %d\n",
666 i
, x_sizes
[i
], y_sizes
[i
]);
668 for (ml
= strings
[i
]; ml
!= NULL
; ml
= ml
->next
)
670 fprintf(f
, "\t\tModule: %s, pos: %d %d, in: %s, out: %s\n",
674 (ml
->this->primary_in
) ?
675 ml
->this->primary_in
->nt
->name
: "",
676 (ml
->this->primary_out
) ?
677 ml
->this->primary_out
->nt
->name
: "");
684 /*---------------------------------------------------------------
686 *---------------------------------------------------------------
692 fprintf(stderr
, "Range list: %s\n", s
);
694 for (; rl
!= NULL
; rl
= rl
->next
)
696 fprintf(stderr
, "\t x-low:%d\t y-high:%d\t crosses:%d\n",
697 rl
->this->x
, rl
->this->y
, rl
->this->c
);
702 *---------------------------------------------------------------
704 *---------------------------------------------------------------
706 #define SIDE_CONVERT(n) ((n==0)?0:(n==1)?90:(n==2)?180:(n==3)?270:0)
707 #define SIDE_X(n) ((n==0)?-4:(n==1)?0:(n==2)?0:(n==3)?0:0)
708 #define SIDE_Y(n) ((n==0)?0:(n==1)?2:(n==2)?0:(n==3)?-2:0)
720 /* for date and time */
722 extern long int time();
724 /* copy the Post Script header file to the output file */
725 ps_print_standard_header(f
);
727 /* Define the bounding box for the post-script code: */
728 fprintf(f
,"%%%%BoundingBox: %d %d %d %d\n",
729 xfloor
- CHANNEL_LENGTH
- 1,
730 yfloor
- CHANNEL_HEIGHT
- 1,
731 x_sizes
[0] + CHANNEL_LENGTH
+ 1,
732 y_sizes
[0] + CHANNEL_HEIGHT
+ 1);
735 /* now dump the result */
738 if (latex
!= TRUE
) /* Not in latex mode */
741 "\n(N2A %s %s input:? s:%d c:%d r:%-5.3f rule #%d part:%d dir:%d) %d %d %d %d init\n",
742 getenv("USER"), ctime(&time_loc
),
743 max_partition_size
, max_partition_conn
, partition_ratio
, partition_rule
,
744 partition_count
, matrix_type
,
745 xfloor
, yfloor
, x_sizes
[0], y_sizes
[0]);
747 else /* This stuff replaces the init for latex mode */
749 fprintf(f
, "swidth setlinewidth\n/Courier findfont fwidth scalefont setfont\n");
753 for (ml
= partitions
[0]; ml
!= NULL
; ml
= ml
->next
)
755 ps_print_mod(f
, ml
->this);
758 if (do_routing
== FALSE
)
759 for (i
=1; i
<=partition_count
; i
++)
761 if (partitions
[i
] != NULL
)
763 index
= partitions
[i
]->this->index
;
765 ps_print_border(f
,x_positions
[i
], y_positions
[i
], x_sizes
[i
], y_sizes
[i
]);
766 fprintf(f
,"%d %d ([part: #%d, placed:%d]) label\n",
767 x_positions
[i
] + 1, y_sizes
[i
] - 2,
768 module_info
[index
].used
, module_info
[index
].order
);
772 fprintf(f
, "done\n");
776 *---------------------------------------------------------------
777 * ps_box(x_len, y_len, x_org, y_org, rot)
778 * --------------------------------------------------------------
780 int ps_box(x_len
, y_len
, x_org
, y_org
, rot
)
781 int x_len
, y_len
, x_org
, y_org
, rot
;
782 /* this function produces the relative code for a box of size (x_len, y_len)
783 * starting at position (x_org, yorg)
788 /* --------------------------------------------------------------
790 * This function provides statistics on how well the draft was
791 * done: Statistics are # modules, # nets, # terminals, #cc @ level <l>...
792 * # cc @ level 1, # foul-ups.
793 * A signal flow foulup is defined as any non-cc module who's child is not
794 * in an x-position greater-than its parent.
795 * Other useful info is the filename, date, and all of the (specified?)
796 * command-line args. All information is printed to a file "draft_stats"
797 *---------------------------------------------------------------
799 void draft_statistics()
802 int xfouls
= 0, yfouls
= 0, term_count
= 0, lev
;
803 int out_x
, in_x
, out_y
, in_y
, possibly_screwed
, also_unscrewed
;
806 module
*m
, *last_m
, *cc_m
, *top_cc_mod
, *bot_cc_mod
;
809 FILE *f
= fopen("draft_stats", "a");
811 for (lev
=0; lev
< cc_search_level
; lev
++) cc_count
[lev
] = 0;
813 last_m
= modules
->this;
814 last_m
->placed
= UNPLACED
; /* for cross_coupled_p to work properly */
816 term_count
= list_length(last_m
->terms
);
819 for(ml
= modules
->next
; ml
!= NULL
; ml
= ml
->next
)
822 term_count
+= list_length(m
->terms
);
824 /* Set up all the strangeness for cross-coupled modules: */
825 for (lev
= 1; (lev
<= cc_search_level
) && (cc_m
!= NULL
); lev
++)
827 cc_m
->placed
= UNPLACED
;
829 if (cross_coupled_p(last_m
, cc_m
, lev
) != FALSE
)
833 cc_count
[lev
-1] += 1;
836 cc_m
= (ml
->next
!= NULL
) ? ml
->next
->this : NULL
;
839 for (t
= last_m
->terms
; t
!= NULL
; t
= t
->next
)
841 if ((t
->this->type
== OUT
) || (t
->this->type
== INOUT
))
843 possibly_screwed
= FALSE
;
844 also_unscrewed
= FALSE
;
846 for (tt
= t
->this->nt
->terms
; tt
!= NULL
; tt
= tt
->next
)
848 if ((tt
->this->type
== IN
) || (tt
->this->type
== INOUT
))
850 out_x
= t
->this->mod
->x_pos
+ t
->this->x_pos
;
851 in_x
= tt
->this->mod
->x_pos
+ tt
->this->x_pos
;
852 out_y
= t
->this->mod
->y_pos
+ t
->this->y_pos
;
853 in_y
= tt
->this->mod
->y_pos
+ tt
->this->y_pos
;
855 if (((t
->this->mod
== top_cc_mod
)&&(tt
->this->mod
== bot_cc_mod
)) ||
856 ((t
->this->mod
== bot_cc_mod
)&&(tt
->this->mod
== top_cc_mod
)))
857 { /* Skip cc modules */
858 also_unscrewed
= TRUE
;
861 else if (out_x
> in_x
)
864 else if (out_y
< in_y
)
865 { possibly_screwed
= TRUE
; }
868 { also_unscrewed
= TRUE
; }
872 if ((possibly_screwed
== TRUE
) && (also_unscrewed
== FALSE
)) yfouls
+= 1;
875 /* for next iteration: */
877 last_m
->placed
= UNPLACED
;
881 /* Done gathering statistics! */
882 terminal_count
= term_count
; /* Set the global so others can use it */
884 fprintf(f
,"------------------------------------------------------------------------------\n");
886 fprintf(f
,"? -p%d -s%d -c%d -r%-4.2f | %d\t ||",
887 partition_rule
, max_partition_size
, max_partition_conn
,
888 partition_ratio
, term_count
);
890 fprintf(f
, "\t %d \t %d \t %d \t %dx%d = %d",
891 xfouls
, yfouls
, xfouls
+yfouls
, x_sizes
[0], y_sizes
[0], x_sizes
[0] * y_sizes
[0]);
892 print_distance_stats(f
);
898 /*--------------------------------------------------------------
899 * stats_table_header (incomplete)
900 *---------------------------------------------------------------
902 void stats_table_header(f
)
905 int lev
, cc_count
[10], term_count
;
907 fprintf(f
, "Modules: %d, Nets: %d, Terminals: %d, Partitions: %d\n",
908 module_count
, node_count
, term_count
, partition_count
);
910 fprintf(f
, "CC Stats: ");
912 for(lev
= 1; lev
<= cc_search_level
; lev
++)
914 fprintf(f
, "lev%d: %d ", lev
, cc_count
[lev
-1]);
920 *---------------------------------------------------------------
922 *---------------------------------------------------------------