~ubuntu-branches/ubuntu/intrepid/electric/intrepid

« back to all changes in this revision

Viewing changes to src/pla/placio.c

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2008-07-23 02:09:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080723020953-1gmnv7q2wpsdbnop
Tags: 8.07-0ubuntu1
* New Upstream version. Please check changelog for details. (LP: #242720)
* debian/control
  - Add build dependencies *-jdk, cdbs and bsh.
  - Remove build dependency dpatch. We will be using CDBS simple patchsys.
  - Refreshed runtime dependencies to default-jre | java2-runtime and bsh.
  - Added home page field.
  - Standard version 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
  - Changed email address for original maintainer to indicate who has
    refreshed the packaging.
* debian/rules
  - Revamped to use cdbs.
  - Added get-orig-source target.
* debian/patches
  - 00list, 02_sensible-browser.dpatch, 01_errors-numbers.dpatch,
    03_manpage.dpatch - Deleted, not relevant anymore.
  - 01_fix_build_xml.patch - Patch to fix the build.xml.
* debian/ant.properties
  - File to set various compilation properties.
* debian/electric.1
  - Remove the entry that causes lintian warning.
* debian/electric.desktop
  - Change as suggested by desktop-file-validate.
* debian/electric.docs
  - Updated as per changes in file names.
* debian/electric.svg
  - Name changed from electric_icon.svg.
* debian/install
  - Added appropriate locations for jar file, desktop file and wrapper shell
    script.
* debian/README.source
  - Added to comply with standards version 3.8.0.
* debian/TODO.Debian
  - Name changed form TODO.
* debain/wrapper/electric
  - Wrapper shell script to launch the application.
* debian/manpages
  - Added for installation of manpage.
* debian/watch
  - Updated to match jar files instead of older tar.gz files.
* debian/dirs
  - Removed, not needed anymore.
* debian/{electric.doc-base, electric.examples, substvars}
  - Removed, not relevant anymore.
* debian/*.debhelper
  - Removed auto generated files. Not relevant anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Electric(tm) VLSI Design System
3
 
 *
4
 
 * File: placio.c
5
 
 * PLA generator for CMOS
6
 
 * Written by: Wallace Kroeker at the University of Calgary
7
 
 *
8
 
 * Copyright (c) 2000 Static Free Software.
9
 
 *
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.
14
 
 *
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.
19
 
 *
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.
24
 
 *
25
 
 * Static Free Software
26
 
 * 4119 Alpine Road
27
 
 * Portola Valley, California 94028
28
 
 * info@staticfreesoft.com
29
 
 */
30
 
 
31
 
#include "config.h"
32
 
#if PLATOOL
33
 
 
34
 
#include "global.h"
35
 
#include "pla.h"
36
 
#include "placmos.h"
37
 
 
38
 
extern COMCOMP us_yesnop, us_colorreadp;                /* from usrcom.c */
39
 
 
40
 
/*
41
 
 * routine called for the command "telltool pla cmos generate-pla"
42
 
 */
43
 
void plac_generate(void)
44
 
{
45
 
        LIBRARY  *plac_lib;
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;
50
 
 
51
 
        /* FUDGE library/lambda for now */
52
 
        plac_lib = el_curlib;
53
 
        pla_lam = plac_lib->lambda[el_curtech->techindex];
54
 
 
55
 
        /* prompt the user for some information */
56
 
        (void)initinfstr();
57
 
        (void)addstringtoinfstr("platab/");
58
 
        (void)addstringtoinfstr(_("AND Plane Input File"));
59
 
        count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
60
 
        if (count == 0)
61
 
        {
62
 
                ttyputerr(_("Aborted: no array input file name given"));
63
 
                return;
64
 
        }
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)
68
 
        {
69
 
                ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
70
 
                return;
71
 
        }
72
 
 
73
 
        (void)initinfstr();
74
 
        (void)addstringtoinfstr("platab/");
75
 
        (void)addstringtoinfstr(_("OR Plane Input File"));
76
 
        count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
77
 
        if (count == 0)
78
 
        {
79
 
                ttyputerr(_("Aborted: no array input file name given"));
80
 
                return;
81
 
        }
82
 
        or_array_file = xopen(params[0], pla_filetypeplatab, "", &filename);
83
 
        if (or_array_file == NULL)
84
 
        {
85
 
                ttyputerr(_("Aborted: unable to open file %s"), params[0]);
86
 
                return;
87
 
        }
88
 
 
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
91
 
                INPUTS = TRUE;
92
 
 
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
95
 
                OUTPUTS = TRUE;
96
 
 
97
 
        /* last prompt of user, for facet name */
98
 
        pt1 = ttygetline(_("Facet name: "));
99
 
        if (pt1 == 0 || *pt1 == 0)
100
 
        {
101
 
                ttyputerr(_("Aborted: no array facet name given"));
102
 
                return;
103
 
        }
104
 
        (void)strcpy(facet_name, pt1);
105
 
 
106
 
        /* generate the AND plane (Decode unit of a ROM) using facets from library */
107
 
        (void)initinfstr();
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;
113
 
 
114
 
        (void)initinfstr();
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)
119
 
        {
120
 
                ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
121
 
                return;
122
 
        }
123
 
        nmos_np = plac_nmos_grid(plac_lib, and_array_file, returninfstr());
124
 
        xclose(and_array_file);
125
 
        if (nmos_np == NONODEPROTO) return;
126
 
 
127
 
        (void)initinfstr();
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;
132
 
 
133
 
        /** Generate the OR plane **/
134
 
        (void)initinfstr();
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;
140
 
 
141
 
        (void)initinfstr();
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);
147
 
}
148
 
 
149
 
/*
150
 
 * routine called for the command "telltool pla cmos decoder"
151
 
 */
152
 
void plac_dec(void)
153
 
{
154
 
        LIBRARY *plac_lib;
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;
160
 
 
161
 
        /* FUDGE library/lambda for now */
162
 
        plac_lib = el_curlib;
163
 
        pla_lam = plac_lib->lambda[el_curtech->techindex];
164
 
 
165
 
        /* prompt the user for some information */
166
 
        (void)initinfstr();
167
 
        (void)addstringtoinfstr("platab/");
168
 
        (void)addstringtoinfstr(_("Decoder Plane Input File"));
169
 
        count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
170
 
        if (count == 0)
171
 
        {
172
 
                ttyputerr(_("Aborted: no array input file name given"));
173
 
                return;
174
 
        }
175
 
        (void)strcpy(and_file_name, params[0]);
176
 
 
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
179
 
                INPUTS = TRUE;
180
 
 
181
 
        /* last prompt of user, for facet name */
182
 
        pt1 = ttygetline(_("Facet name: "));
183
 
        if (pt1 == 0 || *pt1 == 0)
184
 
        {
185
 
                ttyputerr(_("Aborted: no array facet name given"));
186
 
                return;
187
 
        }
188
 
        (void)strcpy(facet_name, pt1);
189
 
 
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)
195
 
        {
196
 
                ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
197
 
                return;
198
 
        }
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)
206
 
        {
207
 
                ttyputerr(_("Aborted: unable to open file %s"), and_file_name);
208
 
                return;
209
 
        }
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);
216
 
}
217
 
 
218
 
/*
219
 
 * routine called for the command "telltool pla cmos p-plane"
220
 
 */
221
 
void plac_p_generate(void)
222
 
{
223
 
        LIBRARY *plac_lib;
224
 
        FILE *array_file;
225
 
        char *pt1, *filename;
226
 
        char facet_name[40], array_file_name[100], *params[MAXPARS];
227
 
        INTBIG count;
228
 
 
229
 
        /* FUDGE library/lambda for now */
230
 
        plac_lib = el_curlib;
231
 
        pla_lam = plac_lib->lambda[el_curtech->techindex];
232
 
 
233
 
        /* prompt the user for some information */
234
 
        (void)initinfstr();
235
 
        (void)addstringtoinfstr("platab/");
236
 
        (void)addstringtoinfstr(_("Input File"));
237
 
        count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
238
 
        if (count == 0)
239
 
        {
240
 
                ttyputerr(_("Aborted: no array input file name given"));
241
 
                return;
242
 
        }
243
 
        (void)strcpy(array_file_name, params[0]);
244
 
 
245
 
        /* last prompt of user, for facet name */
246
 
        pt1 = ttygetline(_("Facet name: "));
247
 
        if (pt1 == 0 || *pt1 == 0)
248
 
        {
249
 
                ttyputerr(_("Aborted: no array facet name given"));
250
 
                return;
251
 
        }
252
 
        (void)strcpy(facet_name, pt1);
253
 
 
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);
257
 
        xclose(array_file);
258
 
}
259
 
 
260
 
/*
261
 
 * routine called for the command "telltool pla cmos n-plane"
262
 
 */
263
 
void plac_n_generate(void)
264
 
{
265
 
        LIBRARY *plac_lib;
266
 
        FILE *array_file;
267
 
        char *pt1, *filename;
268
 
        char facet_name[40], array_file_name[100], *params[MAXPARS];
269
 
        INTBIG count;
270
 
 
271
 
        /* FUDGE library/lambda for now */
272
 
        plac_lib = el_curlib;
273
 
        pla_lam = plac_lib->lambda[el_curtech->techindex];
274
 
 
275
 
        /* prompt the user for some information */
276
 
        (void)initinfstr();
277
 
        (void)addstringtoinfstr("platab/");
278
 
        (void)addstringtoinfstr(_("Input File"));
279
 
        count = ttygetparam(returninfstr(), &us_colorreadp, MAXPARS, params);
280
 
        if (count == 0)
281
 
        {
282
 
                ttyputerr(_("Aborted: no array input file name given"));
283
 
                return;
284
 
        }
285
 
        (void)strcpy(array_file_name, params[0]);
286
 
 
287
 
        /* last prompt of user, for facet name */
288
 
        pt1 = ttygetline(_("Facet name: "));
289
 
        if (pt1 == 0 || *pt1 == 0)
290
 
        {
291
 
                ttyputerr(_("Aborted: no array facet name given"));
292
 
                return;
293
 
        }
294
 
        (void)strcpy(facet_name, pt1);
295
 
 
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);
299
 
        xclose(array_file);
300
 
}
301
 
 
302
 
INTBIG plac_read_rows(INTBIG row[], INTBIG width, INTBIG width_in, FILE *file)
303
 
{
304
 
        INTBIG i, eof, read, value;
305
 
 
306
 
        read = 0;
307
 
        eof = ~EOF;
308
 
        for (i = 0; ((i < width) && (eof != EOF)); i++)
309
 
        {
310
 
                /* Ground Strapping slot */
311
 
                if ((i % 5) == 0) row[i] = -2; else
312
 
                        if (read < width_in)
313
 
                {
314
 
                        eof = fscanf(file, "%ld", &value);
315
 
                        row[i] = value;
316
 
                        read++;
317
 
                } else row[i] = -1;
318
 
        }
319
 
 
320
 
        /* hit end of file too soon ! */
321
 
        if ((i < width) && (eof == EOF))
322
 
                row[0] = -1;
323
 
        return(eof);
324
 
}
325
 
 
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,
328
 
        INTBIG *width_in)
329
 
{
330
 
        INTBIG eof, localhei, localwid;
331
 
 
332
 
        eof = fscanf(file, "%ld %ld", &localhei, &localwid);
333
 
        *height = localhei;   *width = localwid;
334
 
 
335
 
        ttyputmsg(_("height = %ld, width = %ld"), *height, *width);
336
 
 
337
 
        *width_in = *width;
338
 
        *height_in = *height;
339
 
        *height = (((((*height - 1)/4)+1)*5)+1);
340
 
        if (*height > PLAC_MAX_COL_SIZE)
341
 
        {
342
 
                ttyputerr(_("PLA height exceeded"));
343
 
                return(EOF);
344
 
        }
345
 
        *width = (((((*width - 1)/4)+1)*5)+1);
346
 
        if (*width > PLAC_MAX_COL_SIZE)
347
 
        {
348
 
                ttyputerr(_("PLA width exceeded"));
349
 
                return(EOF);
350
 
        }
351
 
        return(eof);
352
 
}
353
 
 
354
 
#endif  /* PLATOOL - at top */