1 /*------------------------------------------------------------\
2 | |
3 | This file is part of the Alliance CAD System Copyright |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 | |
6 | Home page : http://www-asim.lip6.fr/alliance/ |
7 | E-mail : mailto:alliance-users@asim.lip6.fr |
8 | |
9 | This progam is free software; you can redistribute it |
10 | and/or modify it under the terms of the GNU Library General|
11 | Public License as published by the Free Software Foundation |
12 | either version 2 of the License, or (at your option) any |
13 | later version. |
14 | |
15 | Alliance VLSI CAD System is distributed in the hope that |
16 | it will be useful, but WITHOUT ANY WARRANTY; |
17 | without even the implied warranty of MERCHANTABILITY or |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
19 | Public License for more details. |
20 | |
21 | You should have received a copy of the GNU General Public |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc., |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | |
26 \------------------------------------------------------------*/
27 /*------------------------------------------------------------\
28 | |
29 | Tool : Sch |
30 | |
31 | File : schadd.c |
32 | |
33 | Date : 04.03.98 |
34 | |
35 \------------------------------------------------------------*/
36 /*------------------------------------------------------------\
37 | |
38 | Include Files |
39 | |
40 \------------------------------------------------------------*/
41
42 # include "mut.h"
43 # include "aut.h"
44 # include "mlo.h"
45 # include "scl.h"
46
47 # include <stdio.h>
48 # include "schadd.h"
49 # include "scherror.h"
50
51 /*------------------------------------------------------------\
52 | |
53 | Constants |
54 | |
55 \------------------------------------------------------------*/
56 /*------------------------------------------------------------\
57 | |
58 | Types |
59 | |
60 \------------------------------------------------------------*/
61 /*------------------------------------------------------------\
62 | |
63 | Variables |
64 | |
65 \------------------------------------------------------------*/
66 /*------------------------------------------------------------\
67 | |
68 | Functions |
69 | |
70 \------------------------------------------------------------*/
71 /*------------------------------------------------------------\
72 | |
73 | Sch Add Functions |
74 | |
75 \------------------------------------------------------------*/
76
addschnetcon(Net,Con)77 schnet_list *addschnetcon( Net, Con)
78
79 schnet_list *Net;
80 schcon_list *Con;
81
82 {
83 Con->NET = Net;
84 Net->CON_NET = addchain( Net->CON_NET, (void *)Con );
85
86 if ( IsSchConExternal( Con ) )
87 {
88 if ( IsSchConIn( Con ) ) Net->NUMBER_IN++;
89 else Net->NUMBER_OUT++;
90 }
91 else
92 {
93 if ( IsSchConIn( Con ) ) Net->NUMBER_OUT++;
94 else Net->NUMBER_IN++;
95 }
96
97 return ( Net );
98 }
99
100 /*------------------------------------------------------------\
101 | |
102 | Sch Add Figure |
103 | |
104 \------------------------------------------------------------*/
105
addschfig(Name)106 schfig_list *addschfig( Name )
107
108 char *Name;
109
110 {
111 schfig_list *Figure;
112
113 Figure = allocschfig();
114
115 Figure->NAME = namealloc( Name );
116
117 Figure->NEXT = HEAD_SCHFIG;
118 HEAD_SCHFIG = Figure;
119
120 return( Figure );
121 }
122
123 /*------------------------------------------------------------\
124 | |
125 | Sch Add Box |
126 | |
127 \------------------------------------------------------------*/
128
addschbox(Figure,Name)129 schbox_list *addschbox( Figure, Name )
130
131 schfig_list *Figure;
132 char *Name;
133 {
134 schbox_list *Box;
135
136 Box = allocschbox();
137
138 Box->NAME = namealloc( Name );
139
140 Box->NEXT = Figure->BOX;
141 Figure->BOX = Box;
142
143 return( Box );
144 }
145
146 /*------------------------------------------------------------\
147 | |
148 | Sch Add Box Connector |
149 | |
150 \------------------------------------------------------------*/
151
addschboxcon(Figure,Box,Name,Type)152 schcon_list *addschboxcon( Figure, Box, Name, Type )
153
154 schfig_list *Figure;
155 schbox_list *Box;
156 char *Name;
157 unsigned char Type;
158 {
159 schcon_list *Connector;
160
161 Connector = allocschcon();
162
163 Connector->NAME = namealloc( Name );
164
165 if ( Type == SCH_CON_IN )
166 {
167 Connector->NEXT = Box->CON_IN;
168 Box->CON_IN = Connector;
169
170 Box->NUMBER_IN++;
171 }
172 else
173 {
174 Connector->NEXT = Box->CON_OUT;
175 Box->CON_OUT = Connector;
176
177 Box->NUMBER_OUT++;
178 }
179
180 if ( Type == SCH_CON_IN ) SetSchConIn( Connector );
181 else SetSchConOut( Connector );
182
183 SetSchConInternal( Connector );
184
185 Connector->ROOT_TYPE = SCH_ROOT_CON_BOX;
186 Connector->ROOT = (void *)Box;
187
188 return( Connector );
189 }
190
191 /*------------------------------------------------------------\
192 | |
193 | Sch Add Figure Connector |
194 | |
195 \------------------------------------------------------------*/
196
addschfigcon(Figure,Name,Type)197 schcon_list *addschfigcon( Figure, Name, Type )
198
199 schfig_list *Figure;
200 char *Name;
201 unsigned char Type;
202 {
203 schcon_list *Connector;
204
205 Connector = allocschcon();
206
207 Connector->NAME = namealloc( Name );
208
209 if ( Type == SCH_CON_IN )
210 {
211 Connector->NEXT = Figure->CON_IN;
212 Figure->CON_IN = Connector;
213
214 Figure->NUMBER_IN++;
215 }
216 else
217 {
218 Connector->NEXT = Figure->CON_OUT;
219 Figure->CON_OUT = Connector;
220
221 Figure->NUMBER_OUT++;
222 }
223
224 if ( Type == SCH_CON_IN ) SetSchConIn( Connector );
225 else SetSchConOut( Connector );
226
227 SetSchConExternal( Connector );
228
229 Connector->ROOT_TYPE = SCH_ROOT_CON_FIG;
230 Connector->ROOT = (void *)Figure;
231
232 return( Connector );
233 }
234
235 /*------------------------------------------------------------\
236 | |
237 | Sch Add Net |
238 | |
239 \------------------------------------------------------------*/
240
addschnet(Figure)241 schnet_list *addschnet( Figure )
242
243 schfig_list *Figure;
244 {
245 schnet_list *Net;
246
247 Net = allocschnet();
248
249 Net->NEXT = Figure->NET;
250 Figure->NET = Net;
251
252 return( Net );
253 }
254
255 /*------------------------------------------------------------\
256 | |
257 | Sch Add Wire |
258 | |
259 \------------------------------------------------------------*/
260
addschwir(Figure,Net)261 schwir_list *addschwir( Figure, Net )
262
263 schfig_list *Figure;
264 schnet_list *Net;
265 {
266 schwir_list *Wire;
267
268 Wire = allocschwir();
269
270 Wire->NEXT = Net->WIRE;
271 Net->WIRE = Wire;
272
273 return( Wire );
274 }
275
276