~ubuntu-branches/ubuntu/jaunty/electric/jaunty

« back to all changes in this revision

Viewing changes to src/pla/placdecode.c

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2009-01-08 02:05:08 UTC
  • mfrom: (1.3.1 upstream) (3.1.3 sid)
  • mto: (3.1.4 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20090108020508-3e7e6241i7bkit2l
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Electric(tm) VLSI Design System
3
 
 *
4
 
 * File: placdecode.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
 
/* prototypes for local routines */
39
 
static NODEINST *plac_decode_bufs(NODEPROTO*, NODEINST*, NODEPROTO*, NODEINST*, NODEPROTO*, INTBIG,
40
 
                                        NODEINST**, INTBIG);
41
 
static void plac_dec_exp(NODEPROTO*, NODEINST*, NODEPROTO*);
42
 
static BOOLEAN plac_decode_route(NODEPROTO*, NODEINST*, NODEPROTO*, NODEINST*, NODEPROTO*, NODEINST*,
43
 
                                        NODEINST*, INTBIG);
44
 
 
45
 
NODEPROTO *plac_decode_gen(LIBRARY *library, NODEPROTO *pmos_np, NODEPROTO *nmos_np,
46
 
        char *facet_name, INTBIG INPUTS)
47
 
{
48
 
        NODEPROTO *decode_np;
49
 
        NODEINST *p_ni, *n_ni, *first_buf, *last_buf;
50
 
        INTBIG X;
51
 
 
52
 
        decode_np = newnodeproto(facet_name, library);
53
 
        p_ni = plac_make_instance(decode_np, pmos_np, 0, 0, FALSE);
54
 
        if (p_ni == NONODEINST) return(NONODEPROTO);
55
 
        modifynodeinst(p_ni, 0, 0, 0, 0, 2700, 0);  /* rotate by 90 degrees */
56
 
 
57
 
        X = p_ni->geom->highx - p_ni->geom->lowx;  /* CHG */
58
 
        if (X < 0) X = -X;
59
 
        X = X + 0 +  12*pla_lam; /* SEPARATION */
60
 
 
61
 
        n_ni = plac_make_instance(decode_np, nmos_np, X, 0, FALSE);
62
 
        if (n_ni == NONODEINST) return(NONODEPROTO);
63
 
        modifynodeinst(n_ni, 0, 0, 0, 0, 2700, 0); /* rotate by 90 degrees */
64
 
 
65
 
        first_buf = plac_decode_bufs(pmos_np, p_ni, nmos_np, n_ni, decode_np, X, &last_buf, INPUTS);
66
 
        if (first_buf == NONODEINST) return(NONODEPROTO);
67
 
        if (plac_decode_route(pmos_np, p_ni, nmos_np, n_ni, decode_np, first_buf,
68
 
                last_buf, INPUTS)) return(NONODEPROTO);
69
 
        plac_dec_exp(nmos_np, n_ni, decode_np);
70
 
 
71
 
        /* ensure that the facet is the proper size */
72
 
        (*el_curconstraint->solve)(decode_np);
73
 
 
74
 
        return(decode_np);
75
 
}
76
 
 
77
 
NODEINST *plac_decode_bufs(NODEPROTO *pmos_np, NODEINST *p_ni, NODEPROTO *nmos_np,
78
 
        NODEINST *n_ni, NODEPROTO *decode_np, INTBIG X, NODEINST **last_buf, INTBIG INPUTS)
79
 
{
80
 
        NODEINST *first_p_ni, *last_p_ni, *last_n_ni, *newno, *newno_2;
81
 
        PORTPROTO *pwr_e_pp, *pwr_w_pp, *gnd_e_pp, *gnd_w_pp, *p_pp, *n_pp;
82
 
        NODEPROTO *buf_np;
83
 
        VARIABLE *var;
84
 
        char a_name[60], i_name[60], side;
85
 
        INTBIG rows, diff, limit, x, i, cnt, Y, X_offset, amt_1, amt_2;
86
 
        INTBIG lowx, lowy, highy;
87
 
 
88
 
        newno = NONODEINST;
89
 
        first_p_ni = last_p_ni = last_n_ni = NONODEINST;
90
 
        var = getval((INTBIG)pmos_np, VNODEPROTO, VINTEGER, "PLA_access_rows");
91
 
        if (var != NOVARIABLE) rows = (INTBIG)((INTBIG *)var->addr); else
92
 
        {
93
 
                ttyputerr(_("ACCESS_rows defaulting to 2"));
94
 
                rows = 2;
95
 
        }
96
 
 
97
 
        if (INPUTS == TRUE) side = 'e'; else side = 'w';
98
 
        lowx = p_ni->geom->lowx;   /* highx = p_ni->geom->highx; */
99
 
        lowy = p_ni->geom->lowy;   highy = p_ni->geom->highy;
100
 
        buf_np = getnodeproto("decoder_inv1");
101
 
        if (buf_np != NONODEPROTO)
102
 
        {
103
 
                diff = (INTBIG)(buf_np->highy - buf_np->lowy);
104
 
                if (diff < 0) diff = -diff;
105
 
                limit = rows / 4;
106
 
                if ((limit == 0) || ((rows % 4) != 0))  limit = limit + 1;
107
 
                cnt = 0;
108
 
                if (INPUTS == TRUE) Y = lowy - diff; else Y = highy;
109
 
                Y -= 13*pla_lam;
110
 
                if ((rows %4) == 0) X_offset = lowx - 18*pla_lam; else
111
 
                        X_offset = lowx - 38*pla_lam;
112
 
                (void)sprintf(a_name, "PWR.m-2.w");
113
 
                (void)sprintf(i_name, "PWR.m-2.e");
114
 
                pwr_w_pp = getportproto(buf_np, a_name);
115
 
                pwr_e_pp = getportproto(buf_np, i_name);
116
 
                (void)sprintf(a_name, "GND.m-2.w");
117
 
                (void)sprintf(i_name, "GND.m-2.e");
118
 
                gnd_w_pp = getportproto(buf_np, a_name);
119
 
                gnd_e_pp = getportproto(buf_np, i_name);
120
 
                for (i= limit; i > 0; i--)
121
 
                {
122
 
                        newno = plac_make_instance(decode_np, buf_np,
123
 
                                i*50*pla_lam + X_offset, Y, FALSE);
124
 
                        if (newno == NONODEINST) return(NONODEINST);
125
 
                        newno_2 = plac_make_instance(decode_np, buf_np,
126
 
                                X + i*50*pla_lam + X_offset, Y, FALSE);
127
 
                        if (newno_2 == NONODEINST) return(NONODEINST);
128
 
                        if (INPUTS != TRUE)
129
 
                        {
130
 
                                if (newno_2->transpose == 0) amt_2 = 900; else amt_2 = 2700;
131
 
                                if (newno->transpose == 0) amt_1 = 900; else amt_1 = 2700;
132
 
 
133
 
                                /* rotate by 90 degrees */
134
 
                                modifynodeinst(newno_2, 0, 0, 0, 0, 1800, 0);
135
 
                                modifynodeinst(newno, 0, 0, 0, 0, 1800, 0);
136
 
 
137
 
                                /* mirror */
138
 
                                modifynodeinst(newno_2, 0, 0, 0, 0, amt_2, 1-newno_2->transpose*2);
139
 
                                modifynodeinst(newno, 0, 0, 0, 0, amt_1, 1-newno->transpose*2);
140
 
                        }
141
 
                        if ((last_p_ni == NONODEINST) && (last_n_ni == NONODEINST))
142
 
                        {
143
 
                                (void)newportproto(decode_np, newno_2, pwr_e_pp, "PWR.m-2.e");
144
 
                                (void)newportproto(decode_np, newno_2, gnd_e_pp, "GND.m-2.e");
145
 
                                first_p_ni = last_p_ni =  newno;
146
 
                                last_n_ni = *last_buf = newno_2;
147
 
                        } else
148
 
                        {
149
 
                                /* get wired */
150
 
                                if ((pwr_w_pp != NOPORTPROTO) && (pwr_e_pp != NOPORTPROTO))
151
 
                                {
152
 
                                        plac_wire("Metal-2", 14*pla_lam, last_p_ni,
153
 
                                                pwr_w_pp, newno, pwr_e_pp, decode_np);
154
 
                                        plac_wire("Metal-2", 14*pla_lam, last_n_ni,
155
 
                                                pwr_w_pp, newno_2, pwr_e_pp, decode_np);
156
 
                                }
157
 
                                if ((gnd_w_pp != NOPORTPROTO) && (gnd_e_pp != NOPORTPROTO))
158
 
                                {
159
 
                                        plac_wire("Metal-2", 14*pla_lam, last_n_ni,
160
 
                                                gnd_w_pp, newno, gnd_e_pp, decode_np);
161
 
                                        plac_wire("Metal-2", 14*pla_lam, last_n_ni,
162
 
                                                gnd_w_pp, newno_2, gnd_e_pp, decode_np);
163
 
                                }
164
 
                                last_p_ni = newno;
165
 
                                last_n_ni = newno_2;
166
 
                        }
167
 
                        for (x = cnt; x < cnt+4; x++)
168
 
                        {
169
 
                                (void)sprintf(a_name, "ACCESS%ld.m-1.%c", x, side);
170
 
                                (void)sprintf(i_name, "LINE%ld.p.n", x % 4);
171
 
                                p_pp = getportproto(pmos_np, a_name);
172
 
                                n_pp = getportproto(buf_np, i_name);
173
 
                                if ((p_pp != NOPORTPROTO) && (n_pp != NOPORTPROTO))
174
 
                                        plac_wire("Polysilicon", 2*pla_lam, p_ni, p_pp,
175
 
                                                newno, n_pp, decode_np);
176
 
                                p_pp = getportproto(nmos_np, a_name);
177
 
                                if ((n_pp != NOPORTPROTO) && (p_pp != NOPORTPROTO))
178
 
                                        plac_wire("Polysilicon", 2*pla_lam, n_ni, p_pp,
179
 
                                                newno_2, n_pp, decode_np);
180
 
                        }
181
 
                        cnt += 4;
182
 
                }
183
 
        }
184
 
        if ((pwr_w_pp != NOPORTPROTO) && (pwr_e_pp != NOPORTPROTO))
185
 
        {
186
 
                plac_wire("Metal-2", 14*pla_lam, last_n_ni, pwr_w_pp,
187
 
                        first_p_ni, pwr_e_pp, decode_np);
188
 
                (void)newportproto(decode_np, last_p_ni, pwr_w_pp, "PWR.m-2.w");
189
 
        }
190
 
        if ((gnd_w_pp != NOPORTPROTO) && (gnd_e_pp != NOPORTPROTO))
191
 
        {
192
 
                plac_wire("Metal-2", 14*pla_lam, last_n_ni, gnd_w_pp,
193
 
                        first_p_ni, gnd_e_pp, decode_np);
194
 
                (void)newportproto(decode_np, last_p_ni, gnd_w_pp, "GND.m-2.w");
195
 
        }
196
 
        return(last_p_ni);
197
 
}
198
 
 
199
 
void plac_dec_exp(NODEPROTO *nmos_np, NODEINST *n_ni, NODEPROTO *decode_np)
200
 
{
201
 
        PORTPROTO *pp;
202
 
        char name[100], side;
203
 
        INTBIG x = 0;
204
 
 
205
 
        side = 'n';
206
 
        (void)sprintf(name, "DATA%ld.m-1.%c", x, side);
207
 
        pp = getportproto(nmos_np, name);
208
 
        while (pp != NOPORTPROTO)
209
 
        {
210
 
                (void)newportproto(decode_np, n_ni, pp, name);
211
 
                x = x + 1;
212
 
                (void)sprintf(name, "DATA%ld.m-1.%c", x, side);
213
 
                pp = getportproto(nmos_np, name);
214
 
        }
215
 
}
216
 
 
217
 
BOOLEAN plac_decode_route(NODEPROTO *pmos_np, NODEINST *p_ni, NODEPROTO *nmos_np,
218
 
        NODEINST *n_ni, NODEPROTO *decode_np, NODEINST *first_buf, NODEINST *last_buf, INTBIG INPUTS)
219
 
{
220
 
        INTBIG cnt, pwr_cnt, in_cnt, sep;
221
 
        char name[100];
222
 
        PORTPROTO *p_pp, *n_pp, *pwr_pp;
223
 
        NODEINST *pm_ni_1, *pm_ni_2;
224
 
        INTBIG p_X, p_Y, n_X, n_Y, Y;
225
 
        INTBIG init_offset;
226
 
        VARIABLE *var;
227
 
        INTBIG columns;
228
 
        char side, ac_side;
229
 
        INTBIG O_Y;
230
 
 
231
 
        /*** Make connection between N and P planes ***/
232
 
        (void)sprintf(name, "DATA%d.m-1.n", 0);
233
 
        p_pp = getportproto(pmos_np, name);
234
 
        (void)sprintf(name, "DATA%d.m-1.s", 0);
235
 
        n_pp = getportproto(nmos_np, name);
236
 
        cnt = 0;
237
 
        while ((p_pp != NOPORTPROTO) && (n_pp != NOPORTPROTO))
238
 
        {
239
 
                /* Connect them up here */
240
 
                plac_wire("Metal-1", 4*pla_lam, p_ni, p_pp, n_ni, n_pp, decode_np);
241
 
 
242
 
                /* now find the next ports */
243
 
                cnt += 1;
244
 
                (void)sprintf(name, "DATA%ld.m-1.n", cnt);
245
 
                p_pp = getportproto(pmos_np, name);
246
 
                (void)sprintf(name, "DATA%ld.m-1.s", cnt);
247
 
                n_pp = getportproto(nmos_np, name);
248
 
        }
249
 
 
250
 
        /*** Make connection between PWR and P-plane ***/
251
 
        (void)sprintf(name, "DATA%d.m-1.s", 0);
252
 
        p_pp = getportproto(pmos_np, name);
253
 
        (void)sprintf(name, "PWR%d.m-1.s", 0);
254
 
        n_pp = getportproto(pmos_np, name);
255
 
        if ((p_pp != NOPORTPROTO) && (n_pp != NOPORTPROTO))
256
 
                plac_wire("Metal-1", 4*pla_lam, p_ni, p_pp, p_ni, n_pp, decode_np);
257
 
        portposition(p_ni, n_pp, &p_X, &p_Y);
258
 
        pm_ni_1 = plac_make_Pin(decode_np, p_X-13*pla_lam, p_Y,
259
 
                6*pla_lam, "Metal-1-Metal-2-Con");
260
 
        if (pm_ni_1 == NONODEINST) return(TRUE);
261
 
        plac_wire("Metal-1", 4*pla_lam, p_ni, n_pp, pm_ni_1,
262
 
                pm_ni_1->proto->firstportproto, decode_np);
263
 
        if (INPUTS != TRUE) /* Buffers are at the top of the facet */
264
 
        {
265
 
                pwr_pp = getportproto(first_buf->proto, "PWR.m-2.w");
266
 
                pm_ni_2 = plac_make_Pin(decode_np, p_X-13*pla_lam,
267
 
                        p_Y+24*pla_lam, 14*pla_lam, "Metal-2-Pin");
268
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
269
 
                plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
270
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
271
 
                plac_wire("Metal-2", 14*pla_lam, first_buf, pwr_pp,
272
 
                        pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
273
 
        }
274
 
        n_pp = p_pp;
275
 
        (void)sprintf(name, "DATA%d.m-1.s", 1);
276
 
        p_pp = getportproto(pmos_np, name);
277
 
        cnt = 1;
278
 
        pwr_cnt = 0;
279
 
        while ((p_pp != NOPORTPROTO) && (n_pp != NOPORTPROTO))
280
 
        {
281
 
                /* Connect them up here */
282
 
                plac_wire("Metal-1", 4*pla_lam, p_ni, p_pp, p_ni, n_pp, decode_np);
283
 
 
284
 
                /* now find the next ports */
285
 
                cnt += 1;
286
 
                n_pp = p_pp;
287
 
                if ((cnt % 4) == 0)
288
 
                {
289
 
                        pwr_cnt += 1;
290
 
                        (void)sprintf(name, "PWR%ld.m-1.s", pwr_cnt);
291
 
                        p_pp = getportproto(pmos_np, name);
292
 
                        if (p_pp != NOPORTPROTO)
293
 
                                plac_wire("Metal-1", 4*pla_lam, p_ni, p_pp, p_ni, n_pp, decode_np);
294
 
                        portposition(p_ni, p_pp, &p_X, &p_Y);
295
 
                        pm_ni_2 = plac_make_Pin(decode_np, p_X-13*pla_lam, p_Y,
296
 
                                6*pla_lam, "Metal-1-Metal-2-Con");
297
 
                        if (pm_ni_2 == NONODEINST) return(TRUE);
298
 
                        plac_wire("Metal-1", 4*pla_lam, p_ni, p_pp, pm_ni_2,
299
 
                                pm_ni_2->proto->firstportproto, decode_np);
300
 
                        plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
301
 
                                pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
302
 
                        pm_ni_1 = pm_ni_2;
303
 
                        n_pp = p_pp;
304
 
                }
305
 
                (void)sprintf(name, "DATA%ld.m-1.s", cnt);
306
 
                p_pp = getportproto(pmos_np, name);
307
 
        }
308
 
        if (INPUTS == TRUE) /* Buffers are at the top of the facet */
309
 
        {
310
 
                pwr_pp = getportproto(first_buf->proto, "PWR.m-2.w");
311
 
                pm_ni_2 = plac_make_Pin(decode_np, p_X-13*pla_lam,
312
 
                        p_Y-24*pla_lam, 14*pla_lam, "Metal-2-Pin");
313
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
314
 
                plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
315
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
316
 
                plac_wire("Metal-2", 14*pla_lam, first_buf, pwr_pp,
317
 
                        pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
318
 
        }
319
 
 
320
 
        /*** Make connection between GND and N-plane ***/
321
 
        (void)sprintf(name, "GND%d.m-1.n", 0);
322
 
        n_pp = getportproto(nmos_np, name);
323
 
        portposition(n_ni, n_pp, &p_X, &p_Y);
324
 
        pm_ni_1 = plac_make_Pin(decode_np, p_X+13*pla_lam, p_Y,
325
 
                6*pla_lam, "Metal-1-Metal-2-Con");
326
 
        if (pm_ni_1 == NONODEINST) return(TRUE);
327
 
        plac_wire("Metal-1", 4*pla_lam, n_ni, n_pp, pm_ni_1,
328
 
                pm_ni_1->proto->firstportproto, decode_np);
329
 
        if (INPUTS != TRUE) /* Buffers are at the top of the facet */
330
 
        {
331
 
                pwr_pp = getportproto(last_buf->proto, "GND.m-2.e");
332
 
                pm_ni_2 = plac_make_Pin(decode_np, p_X+13*pla_lam,
333
 
                        p_Y+90*pla_lam, 14*pla_lam, "Metal-2-Pin");
334
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
335
 
                plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
336
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
337
 
                plac_wire("Metal-2", 14*pla_lam, last_buf, pwr_pp,
338
 
                        pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
339
 
        }
340
 
        cnt = 1;
341
 
        (void)sprintf(name, "GND%ld.m-1.n", cnt);
342
 
        n_pp = getportproto(nmos_np, name);
343
 
        while (n_pp != NOPORTPROTO)
344
 
        {
345
 
                /* Connect them up here */
346
 
                portposition(n_ni, n_pp, &p_X, &p_Y);
347
 
                pm_ni_2 = plac_make_Pin(decode_np, p_X+13*pla_lam, p_Y,
348
 
                        6*pla_lam, "Metal-1-Metal-2-Con");
349
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
350
 
                plac_wire("Metal-1", 4*pla_lam, n_ni, n_pp, pm_ni_2,
351
 
                        pm_ni_2->proto->firstportproto, decode_np);
352
 
                plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
353
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
354
 
                pm_ni_1 = pm_ni_2;
355
 
                cnt++;
356
 
                (void)sprintf(name, "GND%ld.m-1.n", cnt);
357
 
                n_pp = getportproto(nmos_np, name);
358
 
        }
359
 
        if (INPUTS == TRUE) /* Buffers are at the bottom of the facet */
360
 
        {
361
 
                pwr_pp = getportproto(last_buf->proto, "GND.m-2.e");
362
 
                pm_ni_2 = plac_make_Pin(decode_np, p_X+13*pla_lam,
363
 
                        p_Y-90*pla_lam, 14*pla_lam, "Metal-2-Pin");
364
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
365
 
                plac_wire("Metal-2", 14*pla_lam, pm_ni_1,
366
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
367
 
                plac_wire("Metal-2", 14*pla_lam, last_buf, pwr_pp,
368
 
                        pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
369
 
        }
370
 
 
371
 
        if (INPUTS == TRUE)
372
 
        {
373
 
                side = 'n';
374
 
                ac_side = 'w';
375
 
        } else
376
 
        {
377
 
                side = 's';
378
 
                ac_side = 'e';
379
 
        }
380
 
        var = getval((INTBIG)pmos_np, VNODEPROTO, VINTEGER, "PLA_access_rows");
381
 
        if (var != NOVARIABLE)
382
 
        {
383
 
                columns = (INTBIG)((INTBIG *)var->addr);
384
 
                columns = columns/2;
385
 
        } else
386
 
        {
387
 
                ttyputerr(_("DATA_cols defaulting to 2"));
388
 
                columns = 2;
389
 
        }
390
 
 
391
 
        init_offset = 8*pla_lam;
392
 
        sep = 7*pla_lam;
393
 
        cnt = 0;
394
 
        (void)sprintf(name, "ACCESS%ld.m-1.%c", cnt, ac_side);
395
 
        p_pp = getportproto(pmos_np, name);
396
 
        n_pp = getportproto(nmos_np, name);
397
 
        while ((p_pp != NOPORTPROTO) && (n_pp != NOPORTPROTO))
398
 
        {
399
 
                /* wire it */
400
 
                in_cnt = cnt/2;
401
 
                portposition(p_ni, p_pp, &p_X, &p_Y);
402
 
                portposition(n_ni, n_pp, &n_X, &n_Y);
403
 
                if (INPUTS == TRUE)
404
 
                {
405
 
                        Y = n_Y + init_offset + in_cnt*sep;
406
 
                        O_Y = Y + (columns - in_cnt - 1)*sep;
407
 
                } else
408
 
                {
409
 
                        Y = n_Y - init_offset - in_cnt*sep;
410
 
                        O_Y = Y - (columns - in_cnt - 1)*sep;
411
 
                }
412
 
                pm_ni_1 = plac_make_Pin(decode_np, p_X, Y, 6*pla_lam,
413
 
                        "Metal-1-Polysilicon-Con");
414
 
                if (pm_ni_1 == NONODEINST) return(TRUE);
415
 
                pm_ni_2 = plac_make_Pin(decode_np, n_X, Y, 6*pla_lam,
416
 
                        "Metal-1-Polysilicon-Con");
417
 
                if (pm_ni_2 == NONODEINST) return(TRUE);
418
 
                plac_wire("Metal-1", 4*pla_lam, pm_ni_1,
419
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
420
 
                plac_wire("Polysilicon", 2*pla_lam, p_ni, p_pp, pm_ni_1,
421
 
                        pm_ni_1->proto->firstportproto, decode_np);
422
 
                plac_wire("Polysilicon", 2*pla_lam, n_ni, n_pp, pm_ni_2,
423
 
                        pm_ni_2->proto->firstportproto, decode_np);
424
 
 
425
 
                pm_ni_1 = plac_make_Pin(decode_np, n_X, O_Y, 4*pla_lam, "Metal-1-Pin");
426
 
                if (pm_ni_1 == NONODEINST) return(TRUE);
427
 
                plac_wire("Metal-1", 4*pla_lam, pm_ni_1,
428
 
                        pm_ni_1->proto->firstportproto, pm_ni_2, pm_ni_2->proto->firstportproto, decode_np);
429
 
                (void)sprintf(name, "INPUT%ld.m-1.%c", in_cnt, side);
430
 
                (void)newportproto(decode_np, pm_ni_1, pm_ni_1->proto->firstportproto, name);
431
 
                cnt += 2;  /* Only route every second one */
432
 
                (void)sprintf(name, "ACCESS%ld.m-1.%c", cnt, ac_side);
433
 
                p_pp = getportproto(pmos_np, name);
434
 
                n_pp = getportproto(nmos_np, name);
435
 
        }
436
 
        return(FALSE);
437
 
}
438
 
 
439
 
#endif  /* PLATOOL - at top */