Modified the UGetCursor() routine to return a valid response if the
[xcircuit.git] / spiceparser / netlist_dev.h
blobd3b2ebd36c20a9ab62dcdea3f681290cf93dcb56
1 /********************
2 This file is part of the software library CADLIB written by Conrad Ziesler
3 Copyright 2003, Conrad Ziesler, all rights reserved.
5 *************************
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ******************/
21 /* netlist_dev.h, definitions for a netlist of circuital devices
22 Conrad Ziesler
24 #ifndef __NETLIST_DEV_H__
25 #define __NETLIST_DEV_H__
26 #ifndef __NETLIST_H__
27 #include "netlist.h"
28 #endif
30 #define DEVNODE_HEAD 0
31 #define DEVNODE_TAIL 1
33 #define DEVFET_S 0
34 #define DEVFET_D 1
35 #define DEVFET_G 2
36 #define DEVFET_B 3
37 #define DEVFET_w 0
38 #define DEVFET_l 1
39 #define DEVFET_as 2
40 #define DEVFET_ad 3
41 #define DEVFET_ps 4
42 #define DEVFET_pd 5
43 #define DEVFET_V 6
45 #define DEV2TERM_P 1
46 #define DEV2TERM_N 0
48 #define DEVCAP_c 0
49 #define DEVCAP_V 1
51 #define DEVRES_r 0
52 #define DEVRES_V 1
54 /* #define DEVT_NODE 0 defined in netlist.h */
55 #define DEVT_FET 1
56 #define DEVT_CAP 2
57 #define DEVT_RES 3
58 #define DEVT_IND 4
59 #define DEVT_DIODE 5
60 #define DEVT_VSRC 6
61 #define DEVT_ISRC 7
62 #define DEVT_BJT 8
63 #define DEVT_MAX 9
64 /* 0 1 2 3 4 5 6 7 8 */
65 #define DEVT_TERMS { 2, 4, 2, 2, 2, 2, 2, 2, 4 }
66 #define DEVT_SYMS { "NODE", "FET", "CAP", "RES", "IND", "DIODE", "VSRC", "ISRC", "BJT" }
67 #define DEVT_VALS { 0, DEVFET_V, DEVCAP_V, DEVRES_V, 0 , 0, 0, 0 , 0 }
68 #define DEVT_OTHERS { 0, sizeof(unsigned), 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 }
71 #define DEVP_NODE(nl,t) list_data(&((nl)->e[DEVT_NODE].l),(t).devi)
72 #define DEVP_NODEt(nl,t) ((devnode_t *)DEVP_NODE((nl),(t)))
74 #define DEVP_FET(nl,t) list_data(&((nl)->e[DEVT_FET].l),(t).devi)
75 #define DEVP_FETt(nl,t) ((devfet_t *)DEVP_NODE((nl),(t)))
77 #define DEVP_CAP(nl,t) list_data(&((nl)->e[DEVT_CAP].l),(t).devi)
78 #define DEVP_CAPt(nl,t) ((devcap_t *)DEVP_NODE((nl),(t)))
80 #define DEVGEN_V 8
82 typedef struct devgen_st
84 dev_input_t parent;
85 termptr_t n[TERMPTR_MAX_TERMI];
86 eqn_t v[DEVGEN_V];
87 }devgen_t;
89 #define DEVFET_nmos 1
90 #define DEVFET_pmos 2
92 typedef struct devfet_st
94 dev_input_t parent;
95 termptr_t n[4];
96 eqn_t v[DEVFET_V];
97 unsigned type; /* n/p */
98 }devfet_t;
101 typedef struct devcap_st
103 dev_input_t parent;
104 termptr_t n[2];
105 eqn_t v[1];
106 }devcap_t;
109 typedef struct devres_st
111 dev_input_t parent;
112 termptr_t n[2];
113 eqn_t v[1];
114 }devres_t;
117 typedef struct devind_st
119 dev_input_t parent;
120 termptr_t n[2];
121 eqn_t v[1];
122 }devind_t;
125 typedef struct devvsrc_st
127 dev_input_t parent;
128 termptr_t n[2];
129 eqn_t v[1];
130 }devvsrc_t;
133 typedef struct devisrc_st
135 dev_input_t parent;
136 termptr_t n[2];
137 eqn_t v[1];
138 }devisrc_t;
141 typedef struct devdiode_st
143 dev_input_t parent;
144 termptr_t n[2];
145 eqn_t v[4];
146 }devdiode_t;
149 typedef struct devbjt_st
151 dev_input_t parent;
152 termptr_t n[4];
153 eqn_t v[4];
154 }devbjt_t;
156 typedef struct dev2term_st
158 dev_input_t parent;
159 termptr_t n[2];
160 eqn_t v[1];
161 }dev2term_t;
163 typedef struct dev4term_st
165 dev_input_t parent;
166 termptr_t n[4];
167 eqn_t v[1];
168 }dev4term_t;
170 typedef union devall_un
172 void *p;
173 devgen_t *genp;
174 devnode_t *nodep;
175 devfet_t *fetp;
176 devcap_t *capp;
177 devind_t *indp;
178 devbjt_t *bjtp;
179 devvsrc_t *vsrcp;
180 devisrc_t *isrcp;
181 }devall_p;
184 #define NETLIST_DEFSIZES \
186 sizeof(devnode_t) , sizeof(devfet_t), sizeof(devcap_t), sizeof(devres_t), \
187 sizeof(devind_t), sizeof(devdiode_t), sizeof(devvsrc_t), \
188 sizeof(devisrc_t) , sizeof(devbjt_t) \
194 netlist_t *netlist_copyish(netlist_t *in, int size, int sizes[]);
195 void netlist_o_spice(void *of_fp, netlist_t *nl, int n_start);
196 netlist_t *netlist_devnew_inplace(netlist_input_t ni, int extrasize, int extrasizes[DEVT_MAX]);
197 netlist_t *netlist_devnew(netlist_input_t ni);
198 /********* netlist_funcs.c *********/
199 netlistfunc_t * netlist_devfet_funcs(netlist_t *nl, netlistfunc_t *fp);
201 #endif