summaryrefslogtreecommitdiff
path: root/base/test.c
blob: f515be819d74efccde1bf3d2f5f42eb9c9b53b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/* "NETGEN", a netlist-specification tool for VLSI
   Copyright (C) 1989, 1990   Massimo A. Sivilotti
   Author's address: mass@csvax.cs.caltech.edu;
                     Caltech 256-80, Pasadena CA 91125.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation (any version).

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; see the file copying.  If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */

/* test.c  -- top-level (main) routine wrapping a test suite */

#define TESTSHORTS 0
#define TESTNTK 0
#define TESTACTEL 0
#define TESTSCOPING 0
#define TESTEMBEDDED 0
#define TESTPRINT 0

#include <stdio.h>
#ifdef ANSI_LIBRARY
#include <stdlib.h>  /* for getenv */
#endif
#include "netgen.h"
#ifdef TESTPRINT
#include "print.h"
#endif

void test_entry(void) 
{ 

#if TESTPRINT
  Printf("this is a test");
  Ftab(stdout,50);
  Printf("of the tab");
  Printf(" facility\n");
  printf("just testing\n");
#endif /* TESTPRINT */


#if TESTSCOPING
  CellDef("leaf", -1);
  Global("global");
  UniqueGlobal("uniqueglobal"); 
  Port("port");
  Port("W.in");
  Port("E.out");
  N("leaf", "W.in","E.out","global");
  Cell("p","W.in","port","uniqueglobal");

	
  CellDef("twoleaves", -1);
  Node("global");
  Composition = HORIZONTAL;
  Array("leaf",2);
  Connect("leaf*/port","leaf1/port");
  EndCell();

  CellDef("fourleaves", -1);
  Composition = HORIZONTAL;
  Array("twoleaves",2);
  EndCell();
#endif /* TESTSCOPING */


#if TESTNTK
  CellDef ("test", -1);
  Port("in");
  Port("out");
  Node("internal1");
  Node("internal2");
  join("in","internal1");
  join("out","internal2");
  Connect("in","out");
		
  PrintCell("test");
	
  CellDef("test2", -1);
  Port("IN");
  Port("OUT");
  Instance("test","test1");
  Instance("test","test2");
  Instance("n","M1");
  join("IN","test1.in");
  join("test1.out","test2.in");
  join("IN","M1.gate");
  join("OUT","M1.drain");
  join("test1.out","M1.source");
  join("test2.out","OUT");
		
  PrintCell("test2");

  Ntk("test2","test2.ntk");
  Fanout("test2","M1.gate", ALLOBJECTS);
	      
  ReadNtk("exphorn.ntk");
#endif  /* TESTNTK */

#ifdef TESTEMBEDDED
  CellDef("tcamp", -1);
  Port("N.vdd");
  Port("S.gnd");
  Port("W.in");
  Port("W.bias");
  Port("E.out");
  Port("E.bias");
		
  Node("plusin");
  Node("minusin");
		
  Instance("n","bias");
  Instance("n","plus");
  Instance("n","minus");
  Instance("p","mir");
  Instance("p","load");
		
  Connect("mir/gate","mir/drain");
  Connect("mir/gate","load/gate");
  Connect("mir/gate","plus/drain");
  Connect("load/drain","minus/drain");
  Connect("{p,min}*/s*","bias/drain");

  Connect("N.vdd","{mir,load}/source");
  Connect("bias/source","*.gnd");
  Connect("bias/gate","*.bias");
  Connect("minus/gate","minusin");
  Connect("plus/gate","plusin");

  Connect("plusin","*.in");
  Connect("load/drain","*.out");
  Connect("minusin","E.out");
  EndCell();
		

  CellDef("tcdelayline", -1);
  Port("vdd.top");
  Port("gnd.bot");
  Port("left.in");
  Port("left.bias");
  Port("right.out");
  Port("right.bias");
  Instance("tcamp", "tc1");
  Connect("tc1/W.in", "left.in");
  Connect("tc1/W.bias", "left.bias");

  Instance("tcamp", "tc2");
  Connect("tc1/E*", "tc2/W*");
  Instance("tcamp", "tc3");
  Connect("tc2/E*", "tc3/W*");
#if 1
  Instance("tcamp", "tc4");
  Connect("tc3/E*", "tc4/W*");
  Instance("tcamp", "tc5");
  Connect("tc4/E*", "tc5/W*");
  Instance("tcamp", "tc6");
  Connect("tc5/E*", "tc6/W*");
  Instance("tcamp", "tc7");
  Connect("tc6/E*", "tc7/W*");
  Instance("tcamp", "tc8");
  Connect("tc7/E*", "tc8/W*");
#else
  Instance("tcamp", "tc8");
  Connect("tc3/E*", "tc8/W*");
#endif

  Connect("tc8/E.out", "right.out");
  Connect("tc8/E.bias", "right.bias");
  Connect("tc*vdd", "vdd.top");
  Connect("tc*gnd", "gnd.bot");
  EndCell();

  CellDef("wramp", -1);
  Global("vdd");
  Global("gnd");
  Port("W.in");
  Port("W.bias");
  Port("E.out");
  Port("E.bias");

  Node("minusin");
  Node("pmir");
  Node("nmir");
  Node("bias");
  Node("minus");
		
  N("wramp", "W.in", "pmir", "bias");	/* + input */
  N("wramp", "minusin", "nmir", "bias"); /* - input */
  N("wramp", "E.bias", "bias", "gnd");	/* bias */
  P("wramp", "pmir", "pmir", "vdd");
  P("wramp", "nmir", "nmir", "vdd");
  P("wramp", "pmir", "E.out", "vdd");
  P("wramp", "nmir", "minus", "vdd");
  N("wramp", "minus", "minus", "gnd");
#if 0
  N("wramp", "minus", "E.out", "gnd"); 
#else
  /* test named parameter list */
  N("wramp", "gate=minus", "drain=E.out", "source=gnd");
#endif
  Connect("E.bias", "W.bias");
  Connect("minusin", "E.out");
  EndCell();

  CellDef("wrdelayline", -1);
  Composition = HORIZONTAL;
  Place("wramp");
  Place("wramp");
  Place("wramp");
  Place("wramp");
  Place("wramp");
  Place("wramp");
  Place("wramp");
  Place("wramp");
  EndCell();
#endif /* TESTEMBEDDED */

#if TESTSHORTS
  CellDef("short", -1);
  Port("in");
  Port("out");
  Connect("in","out");
  CellDef("top", -1);
  Port("foo");
  Port("bar");
  Instance("short","short");
  Connect("short/in", "foo");
  Connect("short/out","bar");
#endif

#if TESTACTEL
  ActelLib();
#endif /* TESTACTEL */
}




int main(int argc, char **argv)
{
  Finsert(stderr);
  InitializeCommandLine(argc, argv);

#ifdef TEST
  test_entry();
#endif

#ifdef HAVE_X11
  X_main_loop(argc, argv);  /* does not return, if really running X */
#else
  Query();
#endif

  return(0);
}