2
* Electric(tm) VLSI Design System
5
* PLA generator for CMOS
6
* Written by: Wallace Kroeker at the University of Calgary
8
* Copyright (c) 2000 Static Free Software.
10
* Electric(tm) is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* Electric(tm) is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with Electric(tm); see the file COPYING. If not, write to
22
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23
* Boston, Mass 02111-1307, USA.
25
* Static Free Software
27
* Portola Valley, California 94028
28
* info@staticfreesoft.com
38
extern COMCOMP us_yesnop, us_colorreadp; /* from usrcom.c */
41
* routine called for the command "telltool pla cmos generate-pla"
43
void plac_generate(void)
46
FILE *and_array_file, *or_array_file;
47
NODEPROTO *pmos_np, *nmos_np, *or_np, *or_plane_np, *decode_np;
48
char facet_name[100], and_file_name[100], *pt1, *params[MAXPARS], *filename;
49
INTBIG INPUTS = FALSE, OUTPUTS = FALSE, count;
51
/* FUDGE library/lambda for now */
53
pla_lam = plac_lib->lambda[el_curtech->techindex];
55
/* prompt the user for some information */
57
(void)addstringtoinfstr("platab/");
58
(void)addstringtoinfstr(_("AND Plane Input File"));
59
count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
62
ttyputerr(_("Aborted: no array input file name given"));
65
(void)strcpy(and_file_name, params[0]);
66
and_array_file = xopen(and_file_name, pla_filetypeplatab, "", &filename);
67
if (and_array_file == NULL)
69
ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
74
(void)addstringtoinfstr("platab/");
75
(void)addstringtoinfstr(_("OR Plane Input File"));
76
count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
79
ttyputerr(_("Aborted: no array input file name given"));
82
or_array_file = xopen(params[0], pla_filetypeplatab, "", &filename);
83
if (or_array_file == NULL)
85
ttyputerr(_("Aborted: unable to open file %s"), params[0]);
89
count = ttygetparam(_("INPUTS to the TOP of the AND plane? [y] "), &us_yesnop, MAXPARS, params);
90
if (count >= 1 && params[0][0] == 'n') INPUTS = FALSE; else
93
count = ttygetparam(_("OUTPUTS from the BOTTOM of the OR plane? [y] "), &us_yesnop, MAXPARS, params);
94
if (count >= 1 && params[0][0] == 'n') OUTPUTS = FALSE; else
97
/* last prompt of user, for facet name */
98
pt1 = ttygetline(_("Facet name: "));
99
if (pt1 == 0 || *pt1 == 0)
101
ttyputerr(_("Aborted: no array facet name given"));
104
(void)strcpy(facet_name, pt1);
106
/* generate the AND plane (Decode unit of a ROM) using facets from library */
108
(void)addstringtoinfstr(facet_name);
109
(void)addstringtoinfstr("_p_cell");
110
pmos_np = plac_pmos_grid(plac_lib, and_array_file, returninfstr());
111
xclose(and_array_file);
112
if (pmos_np == NONODEPROTO) return;
115
(void)addstringtoinfstr(facet_name);
116
(void)addstringtoinfstr("_n_cell");
117
and_array_file = xopen(and_file_name, pla_filetypeplatab, "", &filename);
118
if (and_array_file == NULL)
120
ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
123
nmos_np = plac_nmos_grid(plac_lib, and_array_file, returninfstr());
124
xclose(and_array_file);
125
if (nmos_np == NONODEPROTO) return;
128
(void)addstringtoinfstr(facet_name);
129
(void)addstringtoinfstr("_decode");
130
decode_np = plac_decode_gen(plac_lib, pmos_np, nmos_np, returninfstr(), INPUTS);
131
if (decode_np == NONODEPROTO) return;
133
/** Generate the OR plane **/
135
(void)addstringtoinfstr(facet_name);
136
(void)addstringtoinfstr("_or_cell");
137
or_np = plac_nmos_grid(plac_lib, or_array_file, returninfstr());
138
xclose(or_array_file);
139
if (or_np == NONODEPROTO) return;
142
(void)addstringtoinfstr(facet_name);
143
(void)addstringtoinfstr("_or_plane");
144
or_plane_np = plac_or_plane(plac_lib,or_np,returninfstr(),OUTPUTS);
145
if (or_plane_np == NONODEPROTO) return;
146
(void)plac_make_pla(plac_lib, decode_np, or_plane_np, facet_name);
150
* routine called for the command "telltool pla cmos decoder"
155
FILE *and_array_file;
156
NODEPROTO *pmos_np, *nmos_np;
157
char facet_name[40], temp_name[40], and_file_name[100], *params[MAXPARS];
158
INTBIG INPUTS = FALSE, count;
159
char *pt1, *filename;
161
/* FUDGE library/lambda for now */
162
plac_lib = el_curlib;
163
pla_lam = plac_lib->lambda[el_curtech->techindex];
165
/* prompt the user for some information */
167
(void)addstringtoinfstr("platab/");
168
(void)addstringtoinfstr(_("Decoder Plane Input File"));
169
count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
172
ttyputerr(_("Aborted: no array input file name given"));
175
(void)strcpy(and_file_name, params[0]);
177
count = ttygetparam(_("INPUTS to the TOP of the AND plane? [y] "), &us_yesnop, MAXPARS, params);
178
if (count >= 1 && params[0][0] == 'n') INPUTS = FALSE; else
181
/* last prompt of user, for facet name */
182
pt1 = ttygetline(_("Facet name: "));
183
if (pt1 == 0 || *pt1 == 0)
185
ttyputerr(_("Aborted: no array facet name given"));
188
(void)strcpy(facet_name, pt1);
190
/* generate the AND plane (Decode unit of a ROM) using facets from library */
191
(void)strcpy(temp_name, facet_name);
192
(void)strcat(temp_name, "_p_cell");
193
and_array_file = xopen(and_file_name, pla_filetypeplatab, "", &filename);
194
if (and_array_file == NULL)
196
ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
199
pmos_np = plac_pmos_grid(plac_lib, and_array_file, temp_name);
200
xclose(and_array_file);
201
if (pmos_np == NONODEPROTO) return;
202
(void)strcpy(temp_name, facet_name);
203
(void)strcat(temp_name, "_n_cell");
204
and_array_file = xopen(and_file_name, pla_filetypeplatab, "", &filename);
205
if (and_array_file == NULL)
207
ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
210
nmos_np = plac_nmos_grid(plac_lib, and_array_file, temp_name);
211
xclose(and_array_file);
212
if (nmos_np == NONODEPROTO) return;
213
(void)strcpy(temp_name, facet_name);
214
(void)strcat(temp_name, "_decode");
215
(void)plac_decode_gen(plac_lib, pmos_np, nmos_np, temp_name, INPUTS);
219
* routine called for the command "telltool pla cmos p-plane"
221
void plac_p_generate(void)
225
char *pt1, *filename;
226
char facet_name[40], array_file_name[100], *params[MAXPARS];
229
/* FUDGE library/lambda for now */
230
plac_lib = el_curlib;
231
pla_lam = plac_lib->lambda[el_curtech->techindex];
233
/* prompt the user for some information */
235
(void)addstringtoinfstr("platab/");
236
(void)addstringtoinfstr(_("Input File"));
237
count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
240
ttyputerr(_("Aborted: no array input file name given"));
243
(void)strcpy(array_file_name, params[0]);
245
/* last prompt of user, for facet name */
246
pt1 = ttygetline(_("Facet name: "));
247
if (pt1 == 0 || *pt1 == 0)
249
ttyputerr(_("Aborted: no array facet name given"));
252
(void)strcpy(facet_name, pt1);
254
/* generate pla_array_facet using facets from library */
255
array_file = xopen(array_file_name, pla_filetypeplatab, "", &filename);
256
(void)plac_pmos_grid(plac_lib, array_file, facet_name);
261
* routine called for the command "telltool pla cmos n-plane"
263
void plac_n_generate(void)
267
char *pt1, *filename;
268
char facet_name[40], array_file_name[100], *params[MAXPARS];
271
/* FUDGE library/lambda for now */
272
plac_lib = el_curlib;
273
pla_lam = plac_lib->lambda[el_curtech->techindex];
275
/* prompt the user for some information */
277
(void)addstringtoinfstr("platab/");
278
(void)addstringtoinfstr(_("Input File"));
279
count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
282
ttyputerr(_("Aborted: no array input file name given"));
285
(void)strcpy(array_file_name, params[0]);
287
/* last prompt of user, for facet name */
288
pt1 = ttygetline(_("Facet name: "));
289
if (pt1 == 0 || *pt1 == 0)
291
ttyputerr(_("Aborted: no array facet name given"));
294
(void)strcpy(facet_name, pt1);
296
/* generate pla_array_facet using facets from library */
297
array_file = xopen(array_file_name, pla_filetypeplatab, "", &filename);
298
(void)plac_nmos_grid(plac_lib, array_file, facet_name);
302
INTBIG plac_read_rows(INTBIG row[], INTBIG width, INTBIG width_in, FILE *file)
304
INTBIG i, eof, read, value;
308
for (i = 0; ((i < width) && (eof != EOF)); i++)
310
/* Ground Strapping slot */
311
if ((i % 5) == 0) row[i] = -2; else
314
eof = fscanf(file, "%ld", &value);
320
/* hit end of file too soon ! */
321
if ((i < width) && (eof == EOF))
326
/* read in array size and place perimeter metal pins and metal-poly contacts */
327
INTBIG plac_read_hw(FILE *file, INTBIG *height, INTBIG *width, INTBIG *height_in,
330
INTBIG eof, localhei, localwid;
332
eof = fscanf(file, "%ld %ld", &localhei, &localwid);
333
*height = localhei; *width = localwid;
335
ttyputmsg(_("height = %ld, width = %ld"), *height, *width);
338
*height_in = *height;
339
*height = (((((*height - 1)/4)+1)*5)+1);
340
if (*height > PLAC_MAX_COL_SIZE)
342
ttyputerr(_("PLA height exceeded"));
345
*width = (((((*width - 1)/4)+1)*5)+1);
346
if (*width > PLAC_MAX_COL_SIZE)
348
ttyputerr(_("PLA width exceeded"));
354
#endif /* PLATOOL - at top */