1 
2 #ifndef lint
3 static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/resis/ResDebug.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
4 #endif  /* not lint */
5 
6 #include <stdio.h>
7 #include <string.h>
8 #include <ctype.h>
9 #include <math.h>
10 
11 #include "utils/magic.h"
12 #include "utils/geometry.h"
13 #include "utils/geofast.h"
14 #include "tiles/tile.h"
15 #include "utils/hash.h"
16 #include "database/database.h"
17 #include "utils/malloc.h"
18 #include "textio/textio.h"
19 #include "extract/extract.h"
20 #include "extract/extractInt.h"
21 #include "windows/windows.h"
22 #include "dbwind/dbwind.h"
23 #include "utils/utils.h"
24 #include "utils/tech.h"
25 #include "textio/txcommands.h"
26 #include "utils/stack.h"
27 #include "resis/resis.h"
28 
29 #define MAXNAME			1000
30 #define KV_TO_mV		1000000
31 
32 
33 /*
34  *-------------------------------------------------------------------------
35  *
36  * ResPrintNodeList--  Prints out all the nodes in nodelist.
37  *
38  *
39  *  Results:
40  *	None.
41  *
42  *  Side effects:
43  *	prints out the 'nodes' in list to fp.
44  *
45  *-------------------------------------------------------------------------
46  */
47 
48 void
ResPrintNodeList(fp,list)49 ResPrintNodeList(fp, list)
50     FILE *fp;
51     resNode *list;
52 {
53 
54     for (; list != NULL; list = list->rn_more)
55     {
56 	fprintf(fp, "node %p: (%d %d) r= %d\n",
57 	  	list, list->rn_loc.p_x, list->rn_loc.p_y, list->rn_noderes);
58     }
59 }
60 
61 /*
62  *-------------------------------------------------------------------------
63  *
64  * ResPrintResistorList--
65  *
66  *
67  * results: none
68  *
69  *
70  * side effects: prints out Resistors in list to file fp.
71  *
72  *-------------------------------------------------------------------------
73  */
74 void
ResPrintResistorList(fp,list)75 ResPrintResistorList(fp, list)
76     FILE *fp;
77     resResistor *list;
78 
79 {
80     for (; list != NULL; list = list->rr_nextResistor)
81     {
82 	if (fp == stdout)
83 	    TxPrintf("r (%d,%d) (%d,%d) r=%d\n",
84 	          list->rr_connection1->rn_loc.p_x,
85 	          list->rr_connection1->rn_loc.p_y,
86 	          list->rr_connection2->rn_loc.p_x,
87 	          list->rr_connection2->rn_loc.p_y,
88 		  list->rr_value);
89 	else
90 	    fprintf(fp, "r (%d,%d) (%d,%d) r=%d\n",
91 	          list->rr_connection1->rn_loc.p_x,
92 	          list->rr_connection1->rn_loc.p_y,
93 	          list->rr_connection2->rn_loc.p_x,
94 	          list->rr_connection2->rn_loc.p_y,
95 		  list->rr_value);
96     }
97 }
98 
99 
100 /*
101  *-------------------------------------------------------------------------
102  *
103  * ResPrintDeviceList--
104  *
105  *
106  *  Results: none
107  *
108  *  Side effects: prints out devices in list to file fp.
109  *
110  *-------------------------------------------------------------------------
111  */
112 
113 void
ResPrintDeviceList(fp,list)114 ResPrintDeviceList(fp, list)
115     FILE *fp;
116     resDevice *list;
117 
118 {
119     static char termtype[] = {'g','s','d','c'};
120     int i;
121     for (; list != NULL; list = list->rd_nextDev)
122     {
123      	if (list->rd_status & RES_DEV_PLUG) continue;
124 	if (fp == stdout)
125 	    TxPrintf("t w %d l %d ", list->rd_width, list->rd_length);
126 	else
127 	    fprintf(fp, "t w %d l %d ", list->rd_width, list->rd_length);
128 	for (i = 0; i != list->rd_nterms; i++)
129 	{
130 	    if (list->rd_terminals[i] == NULL) continue;
131 	    if (fp == stdout)
132 		TxPrintf("%c (%d,%d) ",termtype[i],
133 	       		list->rd_terminals[i]->rn_loc.p_x,
134 			list->rd_terminals[i]->rn_loc.p_y);
135 	    else
136 		fprintf(fp, "%c (%d,%d) ",termtype[i],
137 	       		list->rd_terminals[i]->rn_loc.p_x,
138 			list->rd_terminals[i]->rn_loc.p_y);
139 
140 	}
141 	if (fp == stdout)
142 	    TxPrintf("\n");
143 	else
144 	    fprintf(fp,"\n");
145     }
146 }
147