Codacfd
Codacfd
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
38
39
40
42
43
44
45
47
48
49
51
Trigonometric Functions.
acos() . . . . . . . . . . . . . . .
asin() . . . . . . . . . . . . . . .
atan() . . . . . . . . . . . . . . .
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
.
.
.
.
..
..
..
..
.
.
.
.
52
52
53
54
cos() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
sin() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
tan() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
File and I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
fclose()
fgetc() .
fgets() .
fopen()
fprint() .
fprintf()
fscan()
fscanf()
print() .
printf() .
scan() .
scanf()
sprint()
sprintf()
sscan()
sscanf()
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
60
61
63
64
66
68
69
71
73
74
77
78
80
82
83
85
String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
str() . . . . .
strext() . .
strind() . .
strlen() . .
strncat() .
strncmp()
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
.
.
.
.
.
.
87
88
90
92
93
94
strncpy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
strrext() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
strstr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Waveform Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
addpoint() . . . .
area() . . . . . . .
average() . . . .
diff() . . . . . . . .
digitize() . . . . .
fwdfft() . . . . . .
getanalysis() . .
getcrosses() . .
getdate() . . . . .
gethightime() . .
getlowtime() . .
getmodify() . . .
getmodifynum()
getpoints() . . .
getrerun() . . . .
getrerunnum() .
getrun() . . . . . .
getsigcent() . . .
getsiggp() . . . .
getsighigh() . . .
getsiglow() . . .
getsigname() . .
gettemp() . . . .
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
101
103
106
110
111
115
118
119
121
123
125
127
129
131
132
134
136
138
139
141
143
145
147
gettime() . . . . . . .
gettitle() . . . . . . .
gettransitions() . .
gettransitiontime()
getx() . . . . . . . . .
getxt() . . . . . . . . .
gety() . . . . . . . . .
interpolate() . . . .
intg() . . . . . . . . . .
isfall() . . . . . . . . .
isrise() . . . . . . . .
ivcurve() . . . . . . .
loaddb() . . . . . . .
nextsignal() . . . . .
range() . . . . . . . .
readspicepunch()
readwave() . . . . .
revfft() . . . . . . . . .
savedb() . . . . . . .
setlevels() . . . . . .
setreftime() . . . . .
setsigcent() . . . . .
setsiggp() . . . . . .
setsighigh() . . . . .
setsiglow() . . . . .
setsigname() . . . .
settolerance() . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
149
150
152
153
156
158
161
163
164
166
168
170
172
174
176
179
180
184
185
187
189
192
194
196
198
200
202
setxyunits() . . . . .
sigexists() . . . . . .
thresholdsignal() .
wabs() . . . . . . . . .
wacos() . . . . . . . .
wasin() . . . . . . . .
watan() . . . . . . . .
wcos() . . . . . . . . .
wexp() . . . . . . . . .
wlog() . . . . . . . . .
wlog10() . . . . . . .
wpow() . . . . . . . .
writepunch() . . . .
writesignal() . . . .
wsin() . . . . . . . . .
wsqrt() . . . . . . . .
wtan() . . . . . . . . .
xpoint() . . . . . . . .
ypoint() . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
203
206
208
210
212
214
216
217
219
221
223
225
227
230
232
234
236
238
240
Simulator Functions
addcards() . . . . . . .
caddcards() . . . . . . .
getsrvrstatus() . . . . .
getstatus() . . . . . . .
invokespice3() . . . .
invokespicesrvr() . .
setsockconfig() . . . .
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
243
243
245
247
249
253
256
260
sndsrvrmodify() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
stopspicesrvr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
setspice3path() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Task Broker/Manager Functions. . . . . . . . . . . . . . . . . . . . . 272
loadservice() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
setservice() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
uselsftb() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
ac Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
bandwidth() . .
gainatphase()
gainmargin() .
phaseatgain()
phasemargin()
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
279
282
284
287
289
Transient Functions
abspeak() . . . . . . . .
crosstime() . . . . . . .
crossvalue() . . . . . .
delay() . . . . . . . . . .
delaych() . . . . . . . . .
delaycl() . . . . . . . . .
delayhc() . . . . . . . . .
delayhh() . . . . . . . .
delayhl() . . . . . . . . .
delaylc() . . . . . . . . .
delaylh() . . . . . . . . .
delayll() . . . . . . . . . .
delayoff() . . . . . . . .
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
294
294
296
299
301
304
307
309
312
315
317
320
323
326
delayxx() . . . . . . . . .
dip() . . . . . . . . . . . .
dutycycle() . . . . . . .
falltime() . . . . . . . . .
peak() . . . . . . . . . . .
peak2peak() . . . . . .
pulsefrequency() . . .
pulseperiod() . . . . . .
pulsewidth() . . . . . .
risetime() . . . . . . . .
rms() . . . . . . . . . . . .
settle() . . . . . . . . . .
skew() . . . . . . . . . . .
slewrate() . . . . . . . .
slope() . . . . . . . . . .
threshold() . . . . . . .
thresholdhysteresis()
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
330
332
335
338
341
344
347
350
354
356
359
361
363
366
368
370
373
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
377
379
381
383
385
387
389
391
393
pltxmin() . . .
pltxmjrgrid()
pltxorigin() . .
pltxscale() . .
pltxunits() . .
pltygrid() . . .
pltymax() . . .
pltymin() . . .
pltymjrgrid()
pltyorigin() . .
pltyscale() . .
pltyunits() . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
395
397
398
400
402
403
405
407
409
411
413
415
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
418
419
420
421
423
425
427
428
431
432
434
435
437
438
system() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Optimizer Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
getmeasval() . . . .
optconstraint() . . .
optgangparam() .
optgetiterval() . . .
optgetobj() . . . . .
optgetparam() . . .
optimize() . . . . . .
optiterations() . . .
optparameter() . .
optspicedeck() . .
optsumparam() . .
punch() . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
442
444
446
449
451
453
455
457
459
463
466
468
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
470
471
471
472
473
473
474
474
475
475
476
freewave() . . . . .
getsrvrstatus() . . .
invokespicesrvr()
invokespice3() . .
readspicepunch()
readwave() . . . . .
rbinomial() . . . . .
rnormal() . . . . . . .
rpoisson() . . . . . .
runiform() . . . . . .
setlevels() . . . . . .
setpath() . . . . . . .
setseed() . . . . . .
setspice3path() . .
sigcase() . . . . . . .
stopspicesrvr() . .
sndsrvrmodify() . .
stopsrvrstatus() . .
thresholdsignal() .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
477
477
478
478
478
479
479
480
480
481
481
481
483
483
484
484
484
484
485
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
486
486
487
488
488
489
489
490
10
dip() . . . . . . . .
dutycycle() . . .
falltime() . . . . .
findsignal() . . .
firstsignal() . . .
fwdfft() . . . . . .
gainatphase() .
gainmargin() . .
getanalysis() . .
getcrosses() . .
gethightime() . .
getlowtime() . .
getmodify() . . .
getmodifynum()
getnewwave() .
getpoints() . . .
getrerun() . . . .
getrerunnum() .
getrun() . . . . . .
getsigcent() . . .
getsiggp() . . . .
getsighigh() . . .
getsiglow() . . .
getsigname() . .
gettemp() . . . .
gettime() . . . . .
gettitle() . . . . .
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
490
490
490
491
491
492
493
493
493
494
494
495
495
496
496
497
498
498
498
499
499
499
499
499
500
500
501
11
gettransitions() . .
gettransitiontime()
getx() . . . . . . . . .
getxt() . . . . . . . . .
gety() . . . . . . . . .
histogram() . . . . .
interpolate() . . . .
intg() . . . . . . . . . .
isfall() . . . . . . . . .
isrise() . . . . . . . .
ivcurve() . . . . . . .
loaddb() . . . . . . .
nextsignal() . . . . .
peak() . . . . . . . . .
peak2peak() . . . .
phaseatgain() . . .
phasemargin() . .
pulsefrequency() .
pulseperiod() . . . .
pulsewidth() . . . .
range() . . . . . . . .
revfft() . . . . . . . . .
risetime() . . . . . .
rms() . . . . . . . . . .
setreftime() . . . . .
setsigcent() . . . . .
setsighigh() . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
501
501
502
502
502
503
503
504
504
505
505
505
506
506
506
507
507
507
507
507
507
509
509
509
509
509
509
12
setsiglow() . . . . . . .
setsigname() . . . . . .
settle() . . . . . . . . . .
sigexists() . . . . . . . .
skew() . . . . . . . . . . .
slewrate() . . . . . . . .
slope() . . . . . . . . . .
threshold() . . . . . . .
thresholdhysterisis()
wabs() . . . . . . . . . . .
wacos() . . . . . . . . . .
wasin() . . . . . . . . . .
wexp() . . . . . . . . . . .
wlog() . . . . . . . . . . .
wlog10() . . . . . . . . .
wpow() . . . . . . . . . .
wsin() . . . . . . . . . . .
wsqrt() . . . . . . . . . .
wtan() . . . . . . . . . . .
writesignal() . . . . . .
xpoint() . . . . . . . . . .
ypoint() . . . . . . . . . .
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
510
510
510
510
510
510
511
511
511
511
513
513
513
513
513
513
514
514
514
514
514
515
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
516
516
516
517
517
13
pltcomment()
pltdate() . . .
pltgrid() . . . .
pltmjrgrid() .
pltportrait() .
pltprtres() . .
pltxgrid() . . .
pltxmax() . . .
pltxmin() . . .
pltxscale() . .
pltxunits() . .
pltygrid() . . .
pltymax() . . .
pltymin() . . .
pltymjrgrid()
pltyorigin() . .
pltyscale() . .
pltyunits() . .
savedb() . . .
setreftime() .
setsigcent() .
setsiglow() .
setsighigh() .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
518
518
518
518
518
519
519
519
520
520
520
520
521
521
521
521
521
522
522
522
522
522
523
14
strrext() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
C CODAC AC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
bandwidth() . .
gainatphase()
gainmargin() .
phaseatgain()
phasemargin()
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
527
528
529
529
530
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
531
532
533
533
534
535
535
536
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
537
537
538
538
539
540
541
541
542
542
543
15
delaylh() . . . . . . . . .
delayll() . . . . . . . . .
delayoff() . . . . . . . .
delayxx() . . . . . . . .
dip() . . . . . . . . . . . .
dutycycle() . . . . . . .
falltime() . . . . . . . . .
peak() . . . . . . . . . .
peak2peak() . . . . . .
pulsefrequency() . .
pulseperiod() . . . . .
pulsewidth() . . . . . .
risetime() . . . . . . . .
rms() . . . . . . . . . . .
settle() . . . . . . . . . .
skew() . . . . . . . . . .
slewrate() . . . . . . . .
slope() . . . . . . . . . .
threshold() . . . . . . .
thresholdhysterisis()
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
543
544
544
546
546
547
548
549
549
550
551
551
552
552
554
554
555
556
556
557
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
558
558
559
560
560
560
560
16
pltxgrid() . . .
pltxmax() . . .
pltxmin() . . .
pltxmjrgrid()
pltxorigin() . .
pltxscale() . .
pltxunits() . .
pltygrid() . . .
pltymax() . . .
pltymin() . . .
pltymjrgrid()
pltyorigin() . .
pltyscale() . .
pltyunits() . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
560
561
561
562
562
562
563
563
564
564
565
565
565
566
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
567
568
569
569
570
571
572
573
574
575
576
576
17
getmodifynum() . .
getpoints() . . . . .
getrerun() . . . . . .
getrerunnum() . . .
getrun() . . . . . . . .
getsigcent() . . . . .
getsiggp() . . . . . .
getsighigh() . . . . .
getsiglow() . . . . .
getsigname() . . . .
gettemp() . . . . . .
gettime() . . . . . . .
gettitle() . . . . . . .
gettransitions() . .
gettransitiontime()
getx() . . . . . . . . .
getxt() . . . . . . . . .
gety() . . . . . . . . .
interpolate() . . . .
intg() . . . . . . . . . .
isfall() . . . . . . . . .
isrise() . . . . . . . .
ivcurve() . . . . . . .
loaddb() . . . . . . .
nextsignal() . . . . .
range() . . . . . . . .
readspicepunch()
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
577
577
578
579
579
579
580
581
582
583
583
584
584
585
585
586
587
587
588
589
590
591
591
592
593
593
594
18
readwave() . . . . .
revfft() . . . . . . . . .
savedb() . . . . . . .
setlevels() . . . . . .
setreftime() . . . . .
setsigcent() . . . . .
setsiggp() . . . . . .
setsighigh() . . . . .
setsiglow() . . . . .
setsigname() . . . .
sigexists() . . . . . .
thresholdsignal() .
wabs() . . . . . . . . .
wacos() . . . . . . . .
wasin() . . . . . . . .
watan() . . . . . . . .
wcos() . . . . . . . . .
wexp() . . . . . . . . .
wlog() . . . . . . . . .
wlog10() . . . . . . .
wpow() . . . . . . . .
writepunch() . . . .
writesignal() . . . .
wsin() . . . . . . . . .
wsqrt() . . . . . . . .
wtan() . . . . . . . . .
xpoint() . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
595
596
596
596
597
598
599
599
600
601
601
602
602
604
604
605
605
606
606
607
607
608
608
609
609
610
610
19
ypoint() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
C CODAC Miscellaneous Functions . . . . . . . . . . . . . . . . . . . 613
copyfile() . . . .
deletefile() . . .
freepunchfile()
freewave() . .
histogram() . .
rnormal() . . . .
rbinomial() . .
rpoisson() . . .
runiform() . . .
setpath() . . . .
setseed() . . .
sigcase() . . . .
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
..
..
..
..
..
..
..
..
..
..
613
613
614
614
615
616
617
617
618
618
619
619
20
Function Summary
This subsection contains an alphabetized table of functions.
Table 1. Mathematical Function Summary
Function
Description
abs()
ceil()
exp()
fabs()
floor()
log()
log10()
max()
min()
pow()
sqrt()
21
Description
acos()
asin()
atan()
cos()
sin()
tan()
Description
fclose()
fgetc()
fgets()
fopen()
fprint()
fprintf()
fscan()
22
Description
fscanf()
print()
fprintf()
scan()
scanf()
sprint()
sprintf()
sscan()
sscanf()
23
Description
str()
Returns a string
strext()
strind()
Returns an integer
strlen()
Returns an integer
strncat()
Returns a string
strncmp()
Returns an integer
strncpy()
Returns a variable
strrext()
strstr()
Returns a string
Description
addpoint()
area()
24
Description
average()
diff()
digitize()
fwdfft()
getanalysis()
getcrosses()
getdate()
gethightime()
getlowtime()
getmodify()
getmodifynum()
getrerun()
getrerunnum()
getsigcent()
25
Description
getsiggp()
getsighigh()
getsiglow()
getsigname()
gettemp()
gettime()
gettitle()
gettransitions()
gettransitiontime()
getx()
getxt()
gety()
interpolate()
intg()
26
Description
isfall()
isrise()
ivcurve()
loaddb()
nextsignal()
range()
Returns a waveform
readspicepunch()
readwave()
revfft()
savedb()
setlevels()
setreftime()
setsigcent()
setsiggp()
setsighigh()
27
Description
setsiglow()
setsigname()
settolerance()
setxyunits()
Returns an integer
thresholdsignal()
wabs()
wacos()
wasin()
watan()
wcos()
wexp()
28
Description
wlog()
wlog10()
wpow()
writesignal()
wsin()
wsqrt()
wtan()
xpoint()
ypoint()
29
Description
addcards()
caddcards()
getsrvrstatus()
getstatus()
invokespice3()
Invokes TI Spice3
invokespicesrvr()
setsockconfig()
setspice3path()
sndsrvrmodify()
stopspicesrvr()
Description
loadservice()
setservice()
30
Description
bandwidth()
gainatphase()
gainmargin()
phaseatgain()
phasemargin()
Description
abspeak()
crosstime()
crossvalue()
delay()
delaych()
delaycl()
31
Function
Description
delayhc()
delayhh()
delayhl()
delaylc()
delaylh()
delayll()
delayoff()
delayxx()
dip()
dutycycle()
falltime()
peak()
setlevels()
32
Function
Description
pulsefrequency()
pulseperiod()
pulsewidth()
risetime()
rms()
settle()
skew()
slewrate()
slope()
threshold()
Description
plot()
pltcomment()
33
Description
pltdate()
pltgrid()
pltmjrgrid()
pltportrait()
pltxgrid()
pltxmax()
pltxmin()
pltxmjrgrid()
pltxorigin()
pltxscale()
pltxunits()
pltxgrid()
pltxmax()
pltymin()
pltymjrgrid()
pltyorigin()
34
Description
pltyscale()
pltyunits()
Description
copyfile()
Copies files
deletefile()
exit()
freepunchfile()
histogram()
rbinomial()
rnormal()
setpath()
setreltol()
35
Description
setseed()
sigcase()
system()
36
Function Descriptions
CODAC provides a set of library routines to help you with the
characterization process. These routines can be classified into these
categories:
Mathematical Functions
Trigonometric Functions
File and I/O Functions
String Functions
Waveform Functions
Simulator Functions
Task Broker/Manager Functions
ac Functions
Transient Functions
Plot Functions
37
Mathematical Functions
This subsection describes the available mathematical functions.
abs()
The abs function returns the absolute value of the specified integer
argument.
Function Usage
abs(int1)
Prerequisites
None.
Required Arguments
int1
Returns an integer
Description
The abs function returns the absolute value of the integer parameter,
int1.
CODAC Function Dictionary,
38
Example
This example assigns the absolute value of int1 to the variable int2. The
value of int2 is returned after execution.
main()
{
int int1, int2;
int1 = -3;
int2 = abs(int1);
print(int2);
}
ceil()
The cell function returns the smallest integer greater than or equal to
the specified real argument.
Function Usage
ceil(floatval)
Prerequisites
None.
Required Arguments
floatval
39
Returned Value
The cell function returns the smallest integer that is not less than the
value passed. This function resembles the C mathematical function
ceil().
Example
This example assigns the value of 10 to the variable ceilval. The value
of ceilval is returned after execution.
main()
{
float ceilval;
ceilval = ceil(9.9);
print(// ceil value of 9.9 =, ceilval);
}
exp()
The exp function returns the exponential function of the specified real
argument.
Function Usage
exp(floatval);
40
Prerequisites
None.
Required Arguments
floatval
The exp function returns the e raised to the power of the value passed.
This function resembles the C mathematical function exp().
Example
41
fabs()
The fabs function returns the absolute value of the specified argument.
Function Usage
fabs(float1)
Prerequisites
None.
Required Arguments
float1
Returns a float
Description
The fabs function returns the absolute value of the floating point number
float1
Example
This example assigns the absolute value of float1 to the variable float2.
It returns the value of float2 after execution.
42
main()
{
float float1, float2;
float1 = -3.66;
float2 = fabs(float1);
print(float2);
}
floor()
The floor function returns the greatest integer (as the double-precision
number) that is less than the value passed. This function resembles the
C mathematical function, floor().
Function Usage
floor(floatval)
Prerequisites
None.
Required Arguments
floatval
43
Description
This example assigns the value nine to the variable floorval. It returns
the value of floor after execution.
main()
{
float floorval;
floorval = floor(9.9);
print(// floor value of 9.9 =, floorval);
}
log()
The log function returns the natural logarithm.
Function Usage
log(floatval)
Prerequisites
None.
Required Arguments
floatval
44
The log function returns the natural logarithm of the value passed. This
function resembles the C mathematical function log().
Example
log10()
The log10 function returns the log10 of the value.
Function Usage
log10(floatval)
45
Prerequisites
None.
Required Arguments
floatval
The log10 function returns the logarithm base 10 of the value passed.
This function resembles the C mathematical function log 10().
Example
46
max()
The max function returns the maximum value of the specified
arguments.
Function Usage
max(flt1, flt2,.....fltn))
Required Arguments
flt1
Represents a float
flt2
Represents a float
Returned Value
A float.
Description
47
Example
Related Functions
min()
min()
The min function returns the minimum of the specified arguments.
Function Usage
min(filt1, filt2,.....fltn))
Required Arguments
flt1
Represents a float
flt2
Represents a float
48
Returned Value
A float
Description
The min function returns the minimum of the specified arguments, flt1,
flt2,.....fltn.
Example
Related Functions
max()
pow()
The pow function raises a number to a power.
Function Usage
pow(x, y)
49
Prerequisites
None.
Required Arguments
x, y
The pow function returns the value of x raised to the power of y. This
function resembles the C mathematical function pow().
Example
This example assigns the value of 100 to the variable powval. It returns
the value of powval after execution.
main()
{
float powval;
powval = pow(10.0, 2.0);
print(// pow value of 10.0 raised to 2.0 =, powval);
}
50
sqrt()
The sqrt function returns the square root of the value.
Function Usage
sqrt(x)
Prerequisites
None.
Required Arguments
x
The sqrt function returns the positive square root of x. The value of x
should be positive.
51
Example
This example assigns the value two to the variable sqrval. It returns the
value of sqrval after execution.
main()
{
float sqrval;
sqrval = sqrt(4);
print(// sqrt value of 4 =, sqrval);
}
Trigonometric Functions
This subsection describes the available trigonometric functions.
acos()
The acos function returns the arccosine of the specified argument.
Function Usage
acos(floatval)
Prerequisites
None.
Required Arguments
floatval
52
Returned Value
This example assigns the inverse cosine of 0.5 to the variable acosval.
It returns the value of acosval after execution.
main()
{
float
acosval;
acosval = acos(0.5);
print(// acos value of 0.5 =, acosval);
}
asin()
The asin function returns the arcsine of the specified argument.
Function Usage
asin(floatval)
Prerequisites
None.
53
Required Arguments
floatval
The asin function returns an arcsine (inverse sine) of the value passed.
This function resembles the C mathematical function asin().
Example
This example assigns the inverse sine of 0.5 to the variable asinval. It
returns the value of asinval after execution.
main()
{
float asinval;
asinval = asin(0.5);
print(// asin value of 0.5 =, asinval);
}
atan()
The atan function returns the arctangent of the specified argument.
Function Usage
atan(floatval)
CODAC Function Dictionary,
54
Prerequisites
None.
Required Arguments
floatval
This example assigns the inverse tangent of 1.0 to the variable atanval.
It returns the value of atanval after execution.
main()
{
float atanval;
atanval = atan(1.0);
print(atan value of 1.0 =, atanval);
}
55
cos()
The cos function returns the cosine of the specified argument.
Function Usage
cos(radians)
Prerequisites
None.
Required Arguments
radians
The cos function returns the cosine of the parameter (in radians)
passed. This function resembles the C mathematical function cos().
56
Example
This example assigns the cosine value of 1.04762 radians to the variable
cosval. It returns the value of cosval after execution.
main()
{
float cosval;
cosval = cos(1.04762);
print(// cos value of 1.04762 =, cosval);
}
sin()
The sin function returns the sine of the value.
Function Usage
sin(radians)
Prerequisites
None.
Required Arguments
radians
57
Description
The sin function returns the sine of the parameter (in radians). This
function resembles the C mathematical function sin().
Example
This example assigns the sine of 1.0 radians to the variable sinval. It
returns the value of sinval after execution.
main()
{
float sinval;
sinval = sin(1.0);
print(sin value of 1.0 =, sinval);
}
tan()
The tan function returns the tangent of the argument passed.
Function Usage
tan(radians)
Prerequisites
None.
Required Arguments
radians
58
Returned Value
The tan function returns the tangent of the radians passed. This function
resembles the C mathematical function tan().
Example
This example assigns the tangent of zero radians to the variable tanval.
It returns the value of tanval after execution.
main()
{
float tanval;
tanval = tan(0.0);
print(// tan value of 0.0 =, tanval);
}
59
fclose()
The fclose function closes the specified file.
Function Usage
fclose(filepointer)
Required Arguments
filepointer
Returns an integer
Description
The fclose function writes any buffered data for the named stream and
closes the stream. This function returns zero if successful and EOF if
any error is encountered.
60
Example
Related Functions
fopen()
fgetc()
The fgetc function reads the next character from the specified file.
Function Usage
fgetc(filepointer)
Required Arguments
filepointer
Returns an integer
61
Description
The fgetc function reads the next character (byte) from the named input
stream and moves the file pointer ahead by one character in the stream.
This function returns the character that it has read as an integer. If it
cannot read the character, it returns 1.
It accepts stdin (standard input) as file pointer, for example,
fgetc(stdin).
Example
This example reads from a file /tmp/dummy till it encounters the end of
the file and prints the contents of the file.
main()
{
int buffer,
string sentence, paragraph;
file fileread;
fileread = fopen ("/tmp/dummy", "r");
while ((buffer = fgetc(fileread))!= -1) {
paragraph += fgets( sentence, 80, fileread);
}
fclose(fileread);
print(paragraph);
}
62
Related Functions
fopen()
Opens a file
fclose()
Closes a file
fgets()
The fgets function reads characters from the specified file.
Function Usage
fgets(s, n, filepointer)
Required Arguments
s
Returns an integer
63
Description
The fgets function reads characters from the stream into the string s
until an n-1 characters is read, a new line character is read, or an
end-of-file condition is encountered.
The string s is then terminated with a null character. This function returns
zero, if an error is encountered.
Example
Related Functions
fopen()
fopen()
The fopen function opens the specified file.
64
Function Usage
fopen(filename, type)
Required Arguments
filename
The fopen function opens the specified file and assigns a string to it.
This function returns a pointer to the file structure associated with the
string. The filename points to a character string that contains the name
of the file to be opened.
The type is a character string having one of these values:
r
65
Example
This example opens the file /tmp/dummy in write mode and closes it.
main()
{
file filewrite;
filewrite
= fopen(/tmp/dummy,w);
fclose(filewrite);
}
Related Functions
fclose()
fprint()
The fprint function prints the output to the specified file.
Function Usage
66
Returns an integer
Description
This example writes 2, 2.5, hello, and the value of VCC to the file
/tmp/dummy.
main()
{
int a = 2;
float b = 2.5;
string c =hello;
file filewrite;
filewrite
= fopen(/tmp/dummy,w);
readpunch(mypunchfile);
vcc = $VCC;
fprint(filewrite,a,,, b,,, c,,, vcc);
fclose(filewrite);
67
Related Functions
fscan()
fprintf()
The fprintf function prints the output in the specified format.
Function Usage
68
Returned Value
Returns an integer
Description
The fprintf function prints the formatted output similar to the standard
C fprintf. The interpretation of the control string is the same as the
standard C except for the waveform variables that match the string
conversion specification %s.
Example
This example writes hello, 4 2.6, and the value of VCC to the file
/tmp/dummy according to the format specified in the control string.
main()
{
string
name =hello;
int
i = 4;
float
a = 2.65;
filewrite
= fopen(/tmp/dummy,w);
fprintf(filewrite,%s %d %2.1f %s, name, i, a, vcc);
fclose(filewrite);
}
69
Related Functions
fscan()
fscan()
The fscan function reads an integer, a float, and a string from the
specified file.
Function Usage
An integer
70
Description
This example reads an integer, a float, and a string from the file
/tmp/dummy.
main()
{
file fileread;
int intval;
float floatval;
string stringval;
fileread
= fopen(/tmp/dummy,r);
fscan(fileread,intval, floatval, stringval);
print(Integer value read =, intval);
print(Float value read =, floatval);
print(String value read =, stringval);
fclose(fileread);
}
71
Related Functions
fscanf()
fscanf()
The fscanf function reads an integer, a float, and a string from the file
in the specified format.
Function Usage
Returns an integer
CODAC Function Dictionary,
72
Description
The fscanf function scans the formatted input just like the standard C
fscanf function. The interpretation of the control string is same as the
standard C.
Example
This example reads a string, an integer, and a float from the file
/tmp/dummy according to the format specified by the control string.
main()
{
string
buffer;
int
in;
float
a;
file
fileread;
fileread
= fopen(/tmp/dummy,r);
fscanf(fileread,%s%d%lf, buffer, i, a);
print(fscanf variables, buffer, i, a);
fclose(fileread);
}
Related Functions
fprint()
print()
The print function prints the arguments to the standard output.
73
Function Usage
print(arg1, arg2,...)
Required Arguments
arg1, arg2,...
Returns an integer
Description
74
int a = 2;
float b = 2.5;
string c =hello;
readpunch(mypunchfile);
vcc = $VCC;
print(a,,, b,,, c,,, vcc);
}
Related Functions
scan()
printf()
The printf function prints the variables in the specified format.
Function Usage
75
Returned Value
Returns an integer
Description
The printf function prints the formatted output just like the standard C
printf function. The interpretation of the control string is the same as
the standard C except for the waveform variables that match the string
conversion specification %s.
Example
This example writes hello, 4, 2.400000, and the value of VCC to the
specified standard output, according to the format specified in the
control string.
main()
{
waveform vcc;
string
name =hello;
int
i = 2;
float
a = 2.4;
readpunch(mypunchfile);
vcc = $VCC;
printf(%s %d %f %s\n, name, i, a, vcc);
}
Related Functions
scanf()
76
scan()
The scan function reads the variables from the standard input.
Function Usage
scan(arg1, arg2,...)
Required Arguments
arg1, arg2,...
Returns an integer
Description
77
Example
Related Functions
print()
Outputs an integer
scanf()
The scanf function reads the variables from the standard input in the
specified format.
Function Usage
78
Returns an integer
Description
The scanf function scans the formatted input just like the standard C
scanf function. The interpretation of the control string is the same as
the standard C function.
Example
This example reads a string, an integer, and a float from the specified
standard input device according to the format specified in the control
string.
main()
{
string
buffer;
int
i;
float
a;
print(Enter string int float);
scanf(%s%d%lf, buffer, i, a);
print(scanf variables, buffer, i, a);
}
79
Related Functions
printf()
sprint()
The sprint function accepts and prints variables into a string.
Function Usage
Returns an integer
80
Description
This example writes the output hello, 5 2.7, and the value of VCC into
buffer.
main()
{
waveform vcc;
string buffer;
string
name =hello;
int
i = 5;
float
a = 2.7;
readpunch(mypunchfile);
vcc = $VCC;
sprint(buffer, name, i, a, vcc);
print(buffer);
}
Related Functions
sprintf()
81
sprintf()
The sprintf function prints the formatted output.
Function Usage
Returns an integer
Description
The sprintf function prints the formatted output just like the standard C
sprintf function.
82
This example outputs the string hello, 5, 2.700000, and the value of
VCC.
main()
{
waveform vcc;
string buffer;
string
name =hello;
int
i = 5;
float
a = 2.7;
readpunch(mypunchfile);
vcc = $VCC;
sprintf(buffer,%s %d %lf %s, name, i, a, vcc);
print(buffer);
}
sscan()
The sscan function reads integer, float, and string variables from the
specified string.
Function Usage
83
The sscan function accepts the variable number of arguments that may
be of different types and reads the variables from the string. The types
of arguments it accepts are integer, float, and a string. This function
does not accept the string format argument that is specified in the
standard C sscanf().
Example
This example reads from a string containing the time, date, month, and
year to corresponding data types.
main ()
{
string epoch = "10.30" 20 Feb 1997";
float time;
int date, year;
84
string month;
sscan (epoch,time,date,month,year);
print ("Time: % f" time);
print ("Date: % d" date);
print ("Month: % s" month);
print ("Year: % d" year);
}
Related Functions
sprint()
sscanf()
The sscanf function reads integer, float, and string variables from a
string in the specified format.
Function Usage
85
arg1, arg2,...
The sscanf function scans the formatted input from the string variable.
It accepts the variable number of arguments that may be of different
types and reads the variables from the string. The types of arguments
accepted are integer, float, and a string.
Example
This example reads the name and telephone number from a string and
prints them.
main()
{
string Details = "Thompson 2164857";
string name;
int tel;
sscanf (Details, "%s %d", Name, Tel);
print("Name: %s", Name);
print("Telephone No:%d", Tel);
}
86
Related Functions
sprintf()
String Functions
This subsection describes the available string functions.
str()
The str function returns a string of the specified integer or float.
Function Usage
str(var1)
Prerequisites
None.
Required Arguments
var1
Returns a string
87
Description
Related Functions
print()
Outputs an integer
strext()
The strext function returns the requested number of characters from
the specified string.
88
Function Usage
strext(str_val, index)
or
strext(str_val, index, num)
Required Arguments
str_val
Returns a string
Description
The strext function returns the num characters from the string str_val
starting from the position index. If you specify the function without the
89
argument num, the function returns the rest of the string str_val starting
from the position index.
Example
Related Functions
strrext()
strind()
The strind function returns an integer.
Function Usage
strind(str_val, pattern)
90
Required Arguments
str_val
Returns an integer
Description
91
Related Functions
strrext()
strlen()
The strlen function returns the length of a string.
Function Usage
strlen(s)
Required Arguments
s
Returns an integer
Description
92
Example
Related Functions
print()
Outputs an integer
strncat()
The strncat function concatenates two strings.
Function Usage
strncat(s1, s2, n)
Required Arguments
s1, s2
93
Returned Value
Returns a string
Description
The strncat function appends the most n characters from the string s2
to the end of the string s1. It returns a pointer to the null-terminated
result.
Example
Related Functions
print()
Outputs an integer
strncmp()
The strncmp function compares two strings.
Function Usage
strncmp(s1, s2, n)
CODAC Function Dictionary,
94
Required Arguments
s1, s2
Returns an integer
Description
95
Related Functions
print()
Outputs an integer
strncpy()
The strncpy function copies a string into another string.
Function Usage
strncpy(s1, s2, n)
Required Arguments
s1, s2
Returns a string
Description
The strncpy function copies string s2 to s1 until either the null character
has been copied or n characters have been copied. If the length of s2
96
Related Functions
print()
Outputs an integer
strrext()
The strrext function returns the requested number of characters from
the string str_val before the index position.
Function Usage
strrext(str_val, index)
or
strrext(str_val, index, num)
97
Required Arguments
str_val
The strrext function returns num characters from the string str_val
before the index position. If you specify the function without the
argument num, the initial part of the string str_val up to the index position
is returned.
Example
98
{
string
strval = FREQUENCY = 1MHz;
string
pattern =MHz;
int index = strind(strval, pattern);
/* extract the initial section of strval up to the
pattern */
print (strrext(strval, index));
}
Related Functions
strext()
strstr()
The strstr function finds the specified pattern in a string.
Function Usage
strstr(s1, s2)
Required Arguments
s1, s2
99
The strstr function returns a pointer to the first occurrence of the pattern
string s2 in s1. For example, if s1 is the string thing and s2 is ing, it
returns ing thing. If s2 does not occur in s1, then it returns NULL.
Example
Related Functions
print()
Outputs an integer
100
Waveform Functions
This subsection describes the available waveform functions.
addpoint()
The addpoint function adds the timevalue pair (xpoint, ypoint) to the
waveform that the signal represents.
Function Usage
None.
Required Arguments
signal
101
Returned Value
The addpoint function adds the timevalue pair (xpoint, ypoint) to the
waveform represented by the signal. If the signal is NULL, addpoint
creates a new waveform, and adds the timevalue pair (xpoint, ypoint)
to it. You can use this function to construct waveforms from a set of
data points.
Example
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function addpoints().
If you are using the C CODAC interface, see C CODAC Toplevel
Function addpoints()
102
area()
The area function returns the area under the curve as the float value.
Function Usage
area(signalname)
or
area(signalname, starttime, endtime)
Prerequisites
Represents the start time for calculating the area. This should be a
float.
endtime
103
Represents the end time for calculating the area. This should be a
float.
Returned Value
The area function returns area under the curve as a float value, if
successful; otherwise, it returns a large floating point value equal to
1.1e+34.
Description
The area function calculates the area between the signal curve and the
time axis.
If you specify the area without the starttime and the endtime for the
signal, this function calculates the total area for the signal. Figure 1
shows this.
Value
Signal
Area
Time
If you specify the area with the starttime and endtime, then it calculates
the area of the signal between the starttime and the endtime. Figure 2
shows this.
CODAC Function Dictionary,
104
Value
Signal
Endtime
Starttime
t1
t2
Time
In this example, the first area function calculates the total area under
the curve for signal vin. The second area function calculates the area
under vin between 1.0 ns to 2.0 ns.
main()
{
string punchfile =delay.pun;
waveform vin;
float areavalue;
readspicepunsh(punchfile);
vin = $VIN;
105
areavalue
print(//
areavalue
print(//
= area(vin);
Area under the curve =, areavalue);
= area(vin, 1.0e-9, 2.0e-9);
Area under the curve =, areavalue);
Related Functions
readspicepunch()
average()
average()
The average function returns the average value of the signal.
Function Usage
average(signalname)
or
average(signalname, starttime, endtime)
Prerequisites
106
Required Arguments
signalname
Represents the start time for calculating the average. This should be
a float.
endtime
Represents the end time for calculating the average. This should be
a float
Returned Value
The average function returns average under the curve as a float value,
if successful; otherwise, it returns a large floating point value equal to
1.1e+34.
Description
The average function calculates the average y-value of the signal within
the specified range. CODAC first calculates the area as explained in
the area() function. Then it calculates the average by dividing the area
with the range of x-values.
107
If you specify an average without the starttime and the endtime for the
signal, this function calculates the total average for the signal. Figure 3
shows this.
Value
Signal
Average
Time
If you specify the average with the starttime and the endtime, then it
calculates the average of the signal between the starttime and the
endtime. Figure 4 shows this.
Value
Signal
Endtime
Starttime
t1
t2
Time
108
Example
In this example, the first average function calculates the average under
the curve for the signal vcc. The second average function calculates
the average under the vcc between 1.0 ns to 2.0 ns.
main()
{
string punchfile =delay.pun;
waveform vcc;
float averagevalue;
readspicepunch(punchfile);
vcc = $VCC;
averagevalue = average(vcc);
print(// Average under the curve =, averagevalue);
averagevalue = average(vcc, 1.0e-9, 2.0e-9);
print(// Average under the curve =, averagevalue);
}
Related Functions
readspicepunch()
area()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function average().
If you are using the C CODAC interface, see C CODAC Toplevel
Function average().
109
diff()
The diff function returns the differentiated value of the signal.
Function Usage
diff(signalname)
Prerequisites
This example calculates the derivative of the signal V OUT and returns
the signal vdiffout.
110
main()
{
string punchfile =delay.pun;
waveform vout, vdiffout;
readspicepunch(punchfile);
vout = $VOUT;
vdiffout = diff(vout);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function diff().
If you are using the C CODAC interface, see C CODAC Toplevel
Function diff().
digitize()
The digitize function compares the waveform signals.
Function Usage
None.
CODAC Function Dictionary,
111
Required Arguments
Signal1, Signal2
Represents a string variable that can be one of these: <, >, <=, >=
Returned Value
The digitize function returns a digital waveform whose high and low
levels correspond to the values set by the setlevels() function. By
default, the high and low levels are set to 0 and 1, respectively.
Description
112
Value
Signal1
Signal2
Time
Value
Operand Waveforms
Time
Results of digitize
(Signal1, <, Signal2)
113
Example
This example creates a digital signal which stays at high level at all time
points when the value of signal V IN is greater than or equal to two.
main()
{
string punchfile =delay.pun;
waveform vin, vout;
readspicepunch(punchfile);
vin = $VIN;
vout = digitize (vin,>=, 2);
writesignal(vout);
}
Related Functions
readspicepunch()
writesignal()
setlevels()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function digitize().
If you are using the C CODAC interface, see C CODAC Toplevel
Function digitize().
114
fwdfft()
The fwdfft function computes the fast fourier transform of a signal.
Function Usage
115
Description
The fwdfft function computes the fast fourier transform (fft) of a signal
using a decimation in time algorithm. The fft is returned in magnitude
and phase form in the waveform variables, sigmag and sigphase,
respectively.
The sampling frequency determines the time steps at which the
specified signal is sampled. The window type variable determines the
particular windowing function to be applied to the signal prior to
computing the fft.
The relationships between the window type variable and the windowing
function applied are:
1
Rectangular
Triangular (Bartlett)
Hanning
Hamming
Blackman
Blackman-Harris
Papoulis
116
Example
Related Functions
readspicepunch()
revfft()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function fwdfft().
If you are using the C CODAC interface, see C CODAC Toplevel
Function fwdfft().
117
getanalysis()
The getanalysis function returns the analysis type of the specified
signal.
Function Usage
getanalysis(signal)
Required Arguments
signal
The getanalysis function returns the analysis type of the signal, read
in from the punchfile.
Example
This example prints the name and the analysis types of all of the signals
in the punchfile.
main()
{
waveform w1;
CODAC Function Dictionary,
118
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getanalysis().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getanalysis().
getcrosses()
This function returns the number of times signal1 and signal2 cross each
other.
Function Usage
119
This function calculates the number of points at which the two signals
intersect and returns the number of intersections.
Example
120
Related Functions
crosstime()
crossvalue()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getcrosses().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getcrosses().
getdate()
The getdate function returns the name of the specified signal and the
date the signal was punched.
Function Usage
getdate(signal)
Required Arguments
signal
Returns a string
CODAC Function Dictionary,
121
Description
The getdate function returns the name of the specified signal and the
date the signal was punched.
Example
This example prints the name of all the signals and the date the signals
were punched.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), getdate(w1));
}
Related Functions
readspicepunch()
122
gethightime()
The gethightime function returns the time at which the signal crosses
the high level for the specified transition.
Function Usage
gethightime(signal, transnum)
Prerequisites
Represents a waveform
transnum
The gethightime function returns the time at which a signal crosses the
high level for the specified transition. In Figure 6, the function returns
the time at which the signal crosses P1 level.
CODAC Function Dictionary,
123
Figure 6. Measuring the Signal that Crosses High Level for the
Transition
Transition level details
P1
M
P2
t1
t3
t4
H
C
L
Example
In this example, the time at which the first transition of VCC crosses the
high level, is returned.
main()
{
string
punchfile =delay.pun;
waveform
vcc;
float
delay1;
readspicepunch(punchfile);
vcc = $VCC;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = gethightime(vcc, 1);
print(// High time on transition, delay1);
}
124
Related Functions
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gethightime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function gethightime().
getlowtime()
The getlowtime function returns the time at which signal crosses the
low level for the specified transition.
Function Usage
getlowtime(signal, transnum)
Prerequisites
Represents a waveform
transnum
125
The getlowtime function returns the time at which a signal crosses the
low level for the specified transition. In Figure 7, it returns the time at
which the signal crosses P2 level.
Figure 7. Measuring the Signal that Crosses Low Level for the
Transition
Transition level details
t3
P1
M
P2
t1
t4
H
C
L
Example
In this example, the time at which the first transition of VCC crosses the
low level is returned.
main()
{
string
punchfile =delay.pun;
waveform
vcc;
float
delay1;
readspicepunch(punchfile);
vcc = $VCC;
126
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = getlowtime(vcc, 1);
print(// Low time on transition, delay1);
}
Related Functions
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getlowtime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getlowtime().
getmodify()
The getmodify function returns the modified number for a specified
signal.
Function Usage
getmodify(signal)
Required Arguments
signal
127
Returned Value
The getmodify function returns the name and the modified number as
found in the punchfile for the specified signal.
Example
This example prints the name and the modified numbers of all the
signals in the punchfile.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), getmodify(w1));
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getmodify().
128
getmodifynum()
The getmodifynum function returns the number of modify runs made
in the punchfile that the program reads.
Function Usage
getmodifynum()
or
getmodifynum(punchfile)
Required Arguments
punchfile
Returns an integer
Description
This function returns the number of modify runs in the punchfile that
you specify. If you do not specify a punchfile, the program uses the last
punchfile that it read as the default punchfile.
129
Example
This program prints all those signals that cross the threshold value that
you specify.
main()
{
int i, modnum;
waveform SigOut, Const;
readspicepunch("esd.pun");
modnum = getmodifynum("esd.pun");
Const = 3e-03;
for(i = 0; i < modnum; i++);
{
SigOut = $VY{modify=i};
if(!( SigOut < Const))
print("\nSignal,SigOut,"has crossed the threshold value");
}
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getmodifynum().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getmodifynum().
130
getpoints()
The getpoints function returns the number of data points for the signal.
Function Usage
getpoints(signal)
Prerequisites
While readspicepunch() reads the time and value pairs from the
punchfile, The getpoints function returns the number of data points
(time and value pairs) read for a waveform.
131
Example
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getpoints().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getpoints().
getrerun()
The getrerun function returns the rerun number of the specified signal.
132
Function Usage
getrerun(signal)
Required Arguments
signal
The getrerun function returns the name and the rerun number of the
signal read in from the punchfile.
Example
This example prints the name and the rerun numbers of all the signals
in the punchfile.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), getrerun(w1));
}
133
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getrerun().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getrerun().
getrerunnum()
The getrerunnum function returns the rerun number of the punchfile.
Function Usage
getrerunnum ()
or
getrerunnum (punchfile)
Required Arguments
punchfile
134
Returned Value
The getrerun function returns the number of the punchfile that the
program reads into the CODAC database. If you do not specify a
punchfile, the program uses the most recent punchfile that it read as
the default.
Example
This example prints the delay between the input and output signal for
all reruns.
main()
{
int Numrerun, i;
float delay1;
readspicepunch("delay.spi.pun");
Numrerun = getrerunnum();
for(i = 0; i < Numrerun; i++)
{
delay1 = delay($VOUTBE{rerun=i},1,$VINIE{rerun=i},1);
print("Delay = ", delay1);
}
}
135
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getrerunnum().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getrerunnum().
getrun()
The getrun function returns the run number of the specified signal.
Function Usage
getrun(signal)
Required Arguments
signal
136
Description
The getrun function returns the name and the run number of the signal
read in from the punchfile.
Example
This example prints the name and the run numbers of all the signals in
the punchfile.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), getrun(w1));
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getrun().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getrun().
137
getsigcent()
The getsigcent function returns the center level of the signal.
Function Usage
getsigcent(signal)
Prerequisites
Represents a waveform
Returned Value
The getsigcent function returns the center level value of the signal. If
you have not explicitly set this value earlier, then the function returns
the default center level value (2.5) of the signal.
Example
138
main()
{
string punchfile =in/rasbuf.pun;
waveform vr21;
float centvalue;
readspicepunch(punchfile);
vr21 = $VR21;
setsigcent(2.0, vr21,);
centvalue = getsigcent(vr21);
print(// Center value when set =, centvalue);
}
Related Functions
getsigcent()
gettransitiontime()
getsiggp()
The getsiggp function returns the glitch period of the signal.
Function Usage
getsiggp(signal)
Prerequisites
139
Required Arguments
signal
Represents a waveform
Returned Value
The getsiggp function returns the glitch period of a signal. If this value
is not set earlier, the function returns the default glitch (0.0).
Example
140
Related Functions
setsiggp()
For more details on glitch detection, see CODAC Manual (Chapter 2 Detecting Glitches in Transitions).
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsiggp().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getsiggp().
getsighigh()
The getsighigh function returns the high level value of the signal.
Function Usage
getsighigh(signal)
Prerequisites
Represents a waveform
141
Returned Value
The getsighigh function returns the high level value of the signal. If you
have not set this value earlier, this function returns the default high level
value of the signal.
Example
142
Related Functions
getsighigh()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsighigh().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getsighigh().
getsiglow()
The getsiglow function returns the low level value of the signal.
Function Usage
getsiglow(signal)
Prerequisites
Represents a waveform
143
Returned Value
The getsiglow function returns the low level of a signal. If this value is
not set earlier, the function returns the default low level value of the
signal.
Example
144
Related Functions
setsiglow()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsiglow().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getsiglow().
getsigname()
The getsigname function returns the name of the signal that the
waveform variable signal1 points to.
Function Usage
getsigname(signal1)
or
getsigname(signal1, int1);
Required Arguments
signal1
Represents a waveform
145
Options
int1
Returns a string
Description
The getsigname function returns the name of the signal that the
waveform variable signal1points to. If the integer argument is specified,
then it returns only the first int1 characters of the signal name.
Example
In this example, the first call returns MYSIG, while the second call
returns MY.
main()
{
string
waveform
punchfile =delay.pun;
vin;
readspicepunch(punchfile);
vin = $VIN;
setsigname(vin,MYSIG);
print(getsigname(vin));
print(getsigname(vin, 2));
}
146
Related Functions
setsigname()
readspicepunch()
print()
Outputs an integer
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsigname().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getsigname().
gettemp()
The gettemp function returns the temperature of the specified signal.
Function Usage
gettemp(signal)
Required Arguments
signal
147
Returned Value
The gettemp function returns the name and the temperature of the
signal, read in from the punchfile.
Example
This example prints the name and the temperature of all the signals in
the punchfile.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), gettemp(w1));
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettemp().
148
gettime()
The gettime function returns the time the signal was punched.
Function Usage
gettime(signal)
Required Arguments
signal
Returns a string
Description
The gettime function returns the name of the specified signal and the
time the signal was punched.
Example
This example prints the name of all the signals and the time the signals
were punched.
main()
149
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), gettime(w1));
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function gettime().
gettitle()
The gettitle function returns the title card of the specified signal.
Function Usage
gettitle(signal)
Required Arguments
150
Returned Value
Returns a string
Description
The gettitle function returns the name of the specified signal and its
title card.
Example
This example prints the name and the title card for all the signals in the
punchfile.
main()
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), gettitle(w1));
}
Related Functions
readspicepunch()
getdate()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettitle().
CODAC Function Dictionary,
151
gettransitions()
The gettransitions function returns the number of transitions in the
signal.
Function Usage
gettransitions(signal)
Prerequisites
Represents a waveform
Returned Value
152
Description
Related Functions
readspicepunch()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettransitions().
CODAC Function Dictionary,
153
gettransitiontime()
The gettransitiontime function returns the transition time of the signal.
Function Usage
gettransitiontime(signal, transnum)
Prerequisite
Represents a waveform
transnum
154
Description
P2
Signal
P1
M
P2
High
Center
Low
Time
The high and low values for the signal should have been set earlier
using the library functions, setsighigh() and setsiglow(), respectively.
155
If the high and the low values are not set, the default values of 4.5 for
high and 0.5 for low are assigned respectively.
Example
In this example, the first transition time of the signal vout is returned
from the call, gettransitiontime(vout, 1).
main()
{
string punchfile =delay.pun;
waveform
vout;
float transtime;
readspicepunch(punchfile);
vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
transtime = gettransitiontime(vout, 1);
print(// Transition time =, delay1);
}
Related Functions
gettransitions()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettransitiontime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function gettransitiontime().
156
getx()
The getx function returns the x value corresponding to a y value for the
signal.
Function Usage
Represents a waveform
yval
Represents the start time from which a search for y value begins
Returned Value
The getx function returns the x value (time) as a float, if the call is
successful; otherwise, it returns a large negative value.
157
Description
In this example, the getx(vout, 2.5, 0.0) returns the first time at which
the voltage is 2.5V of the signal, vout.
main()
{
string punchfile =delay.pun;
waveform vout;
float xvalue;
readspicepunch(punchfile);
print(// Completed reading punchfile);
vout = $VOUT;
xvalue = getx(vOUT, 2.5, 0);
print(// Value of X = 2.5 is, xvalue);
}
158
Related Functions
gety()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getx().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getx().
getxt()
The getxt function returns the x value of a signal at the given y value
for the specified transition.
Function Usage
159
The getxt function returns the x value of a signal at the given y value
for the specified transition. If the specified transition or y value does not
exist on the signal, then it returns the value 1.1e+34.
Example
In this example, the getxt(vcc, 2.5, 4) returns the time at which the
voltage is 2.5V on transition 4 of signal VCC .
main()
{
string
punchfile =delay.pun;
waveform
vcc;
float
xvalue;
readspicepunch(punchfile);
/* read punchfile and access signal VCC */
vcc = $VCC;
/* get x value when y value = 2.5 on transition 4 */
xvalue = getxt(vcc, 2.5, 4);
print(// Value of X at Y = 2.5 on transition 4 is =,
xvalue);
}
160
Related Functions
getx()
gety()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getxt().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getxt().
gety()
The gety function returns the y value corresponding to an x value.
Function Usage
gety(signal, xval)
Prerequisites
161
162
Related Functions
getx()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gety().
If you are using the C CODAC interface, see C CODAC Toplevel
Function gety().
interpolate()
The interpolate function interpolates on the input signal at the specified
time intervals corresponding to the sampling frequency and returns the
resultant signal.
Function Usage
interpolate(signal, samplingfrequency)
Required Arguments
signal
163
Returned Value
Returns a waveform
Description
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function interpolate().
164
intg()
The intg function returns the integrated signal corresponding to the
input signal
Function Usage
intg(signalname);
Prerequisites
Returns a waveform
Description
165
The y-value of integrated signal at each point is the area under the input
signal up to the corresponding point (with the same x-value on input
signal).
Therefore, the first point on the integrated signal has always a y-value
of zero and the last point on the integrated signal has a y-value that is
the total area under the input signal curve.
Example
This example integrates the signal V OUT and returns the signal voutintg.
main()
{
string punchfile =delay.pun;
waveform vout, voutintg;
readspicepunch(punchfile);
vout = $VOUT;
voutintg = intg(vout);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function intg().
If you are using the C CODAC interface, see C CODAC Toplevel
Function intg().
166
isfall()
The isfall function returns true, if the specified transition is falling for
the signal, else false, if it is not falling.
Function Usage
isfall(signal1, transition)
Prerequisites
Returns an integer 1 or 0
Description
The isfall function returns the value 1, if the specified transition number
exists in the signal and it is a valid falling transition; otherwise, it returns
a 0.
167
Example
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function isfall().
If you are using the C CODAC interface, see C CODAC Toplevel
Function isfall().
isrise()
The isrise function returns true, if the specified transition is rising;
otherwise, it returns false.
168
Function Usage
isrise(signal1, transition)
Prerequisites
Returns an integer 1 or 0
Description
The isrise function returns the value 1, if the specified transition number
exists in the signal and it is a valid rising transition; otherwise, it returns
a 0.
Example
This example prints the message if transition two of the signal vout is
a valid rising edge.
main()
CODAC Function Dictionary,
169
{
waveform vout;
readspicepunch(delay.pun);
vout = $VOUT;
if (isrise(vout, 2));
print(Transition 2 of signal VOUT is rising);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function isrise().
If you are using the C CODAC interface, see C CODAC Toplevel
Function isrise().
ivcurve()
The ivcurve function generates a transfer curve.
Function Usage
170
Prerequisites
171
Description
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function ivcurve().
172
loaddb()
The loaddb function loads the CODAC database file into the memory.
Function Usage
loaddb(punchpath, databasepath)
Required Arguments
punchpath
None.
Description
The loaddb function loads the CODAC database file into the memory.
This enables faster loading of signal data from the punchfile.
173
Example
This example loads the CODAC database file into the memory.
main()
{
waveform w1, w2;
loaddb(delay.pun,delay.pun.codacdb);
}
Related Functions
savedb()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function loaddb().
If you are using the C CODAC interface, see C CODAC Toplevel
Function loaddb().
nextsignal()
The nextsignal function iterates through the list of signals in the
currently active Spice punchfile.
Function Usage
nextsignal(signal)
Required Arguments
signal
CODAC Function Dictionary,
174
Returns an integer
Description
This example prints the signal names V IN and V OUT along with the time
of their first transition.
main()
{
/* punchfile delay.pun contains 2 signals VIN and VOUT */
string
punchfile =delay.pun;
waveform
vin;
/* read punchfile */
readspicepunch(punchfile);
/* iterate over the list of signals in delay.pun */
while(nextsignal(vin))
{
/* print signal names & transition times of all signals in
punchfile */
175
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function nextsignal().
If you are using the C CODAC interface, see C CODAC Toplevel
Function nextsignal().
range()
The range function returns a new waveform in the specified time range
from a signal.
Function Usage
range(signal1)
or
range(signal1, starttime)
or
range(signal1, starttime, endtime)
CODAC Function Dictionary,
176
Prerequisites
Returns a waveform
Description
177
You can access the specified window of the source waveform. Returns
the truncated waveform from the source waveform in the specified time
range.
Example
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function range().
If you are using the C CODAC interface, see C CODAC Toplevel
Function range().
178
readspicepunch()
The readspicepunch function reads the Spice punchfile and loads the
signals into the memory.
If your CODAC instruction file contains a loop with a function call to
readspicepunch(), then make sure that the punchfilename is unique for
every iteration or include a call to freepunchfile() at the end of the loop.
If the punchfilename values are similar, then CODAC reads the specified
punchfile only for the first iteration, even though the given punchfile
contents were changed for every iteration in the loop.
Function Usage
readspicepunch(punchfilename)
Required Arguments
punchfilename
None.
Description
179
Example
main()
{
string punchfile =delay.pun;
print(// Reading punchfile, punchfile);
readspicepunch(punchfile);
print(// Completed reading punchfile);
}
Related Functions
invokespice3()
Invokes TI Spice3
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function readspicepunch().
If you are using the C CODAC interface, see C CODAC Toplevel
Function readspicepunch().
readwave()
The readwave function reads a signal from a punchfile.
Function Usage
readwave(punchfilename, signalname)
or
readwave(punchfilename, signalname, temp)
180
or
readwave(punchfilename, signalname, temp, run)
or
readwave(punchfilename, signalname, temp, run, rerun)
Prerequisites
The punchfile should exist, and the signal should be present in the given
punchfile.
Required Arguments
punchfilename
181
rerun
182
Similarly, if you want to specify a rerun number but do not want to use
the temperature and run number, then invoke the function as shown
below:
readwave(punchfilename, signalname, 1.1e34, -1, rerun)
Where, -1.1e34 ignores the temperature and -1 ignores the run number
arguments.
This function accepts a new optional argument (at the end) that specifies
the modify number from the punchfile.
readwave ("addpt_modify.p", "vout", 1.1e34, -1, -1, 2)
The above command reads the signal VOUT corresponding to
MODIFY=2.
Example
This example reads the first V OUT signal from the file delay.pun at
temperature 27 and assigns this to the waveform variable vout.
main()
{
waveform vout;
vout = readwave(delay.pun,VOUT, 27);
}
183
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function readwave().
If you are using the C CODAC interface, see C CODAC Toplevel
Function readwave().
revfft()
The revfft function computes the inverse fourier transform of a signal.
Function Usage
revfft(sigmag, sigphase)
Required Arguments
sigmag
184
Returned value
Returns a waveform
Description
The revfft function computes the inverse fourier transform. The signals,
sigmag and sigphase, represent the fast fourier transform of a signal in
magnitude and phase form.
Example
This example computes the fft of the signal VCC and then computes the
inverse fourier transform using the function revfft() to return the original
signal.
main()
{
waveform w1, fftMag, fftPhase;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 = $VCC;
fwdfft(w1, 500e6, 3, fftMag, fftPhase);
w1=revfft(fftMag, fftPhase);
}
185
Related Functions
readspicepunch()
fwdfft()
interpolate()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function revfft().
If you are using the C CODAC interface, see C CODAC Toplevel
Function revfft().
savedb()
The savedb function saves the currently read in punchfile in the CODAC
database format.
Function Usage
savedb(path)
Required Arguments
path
186
Returned Value
None.
Description
187
Related Functions
loaddb()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function savedb().
If you are using the C CODAC interface, see C CODAC Toplevel
Function savedb().
setlevels()
The setlevels function sets the signal levels for digital waveform.
Function Usage
setlevels(float1, float2)
Prerequisites
None.
Required Arguments
float1, float2
188
Returned Value
None.
Description
The setlevels function sets the signal levels for the digitized waveform
output by the digitize function. The value of float1 is set as the low level
of the digital signal returned by digitize and the value of float2 is set as
the high level. By default the digital signal that digitize returns, has the
low and high level values of zero and one, respectively.
Example
189
Related Functions
readspicepunch()
writesignal()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setlevels().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setlevels().
setreftime()
The setreftime function sets the reference time for measuring
transitions.
Function Usage
setreftime(referencetime)
or
setreftime(referencetime, sig1, sig2)
Prerequisites
190
Required Arguments
referencetime
Represents the signals for which the reference time need to be set
Returned Value
None.
Description
The setreftime function sets the reference time from which the
transitions need to be measured. If no signals are specified, it sets the
reference time for all the signals read from the punchfile. Figure 9 shows
how to set the reference time.
191
Value
T
1
3
Ref
Time 3
4
4
5
5
6
6
Time
If you do not set a reference time, the transitions are numbered as shown
in Figure 9. If the reference time is set at T, then the third transition
becomes the first transition.
Example
In this example, the reference time for VCC is set to 5.0e-10 seconds.
main()
{
string
waveform
float
punchfile =delay.pun;
vcc;
hitime;
readspicepunch(punchfile);
vcc = $VCC;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
setreftime(5.0e-10, vcc);
hitime = gethightime(vcc, 1);
print(// High time on transition, hitime);
}
CODAC Function Dictionary,
192
Related Functions
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setreftime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setreftime().
setsigcent()
The setsigcent function sets the center level of the signals.
Function Usage
setsigcent(centval)
or
setsigcent(centval, sig1, sig2)
Prerequisites
193
sig1, sig2
None.
Description
The setsigcent function sets the center level of the signal(s) to the
specified value. If you do not specify the signal, then the center levels
of all the signals read from the punchfile are set. If you specify signals,
only the center level of the specified signals are set. By default, the
center level of signals is set to 2.5.
Example
In this example, the center levels of only vr21 and vr31 are set. The
center level of vr12 is assigned the default value of 2.5.
main()
{
string
punchfile =rasbuf.pun;
waveform
vr21, vr31, vr41, vr51, vr12;
float setvalue, notsetvalue;
print(// Reading punchfile, punchfile);
readspicepunch(punchfile);
print(// Completed reading punchfile);
vr21 = $VR21; vr31 = $VR31; vr12 = $VR12;
setsigcent(2.0, vr21, vr31); setvalue = getsigcent(vr21);
notsetvalue = getsigcent(vr12);
print(// Center value when set =, setvalue);
print(// Center value when not set =, notsetvalue);
194
Related Functions
getsigcent()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setsigcent().
If you are using the C CODAC interface, see C CODAC Toplevel
Function getsigcent().
setsiggp()
The setsiggp function sets the glitch period for the signals.
Function Usage
setsiggp(glitchperiod)
or
setsiggp(glitchperiod, sig1, sig2)
Prerequisites
195
Required Arguments
glitchperiod
None.
Description
The setsiggp function sets the glitch period of signal(s) to the specified
value. If you do not pass the signal, the glitch period of all signals read
from the punchfile are set.
If you pass signals, only the glitch period of the specified signals are
set. By default the glitch period of a signal is set to 0.0.
Example
In this example, glitch period of vr21 and vr31 are set to 1.0e-12. The
glitch period of vr12 is assigned the default value of 0.0.
main()
{
string punchfile =rasbuf.pun;
waveform
vr21, vr31, vr41, vr51, vr12;
float setvalue, notsetvalue;
print(// Reading punchfile, punchfile);
readspicepunch(punchfile);
196
Related Functions
getsiggp()
gettransitiontime()
Related Documentation
setsighigh()
The setsighigh function sets the high level of the signals for transition
measurement.
Function Usage
setsighigh(highval)
or
setsighigh(highval, sig1, sig2)
197
Prerequisites
None.
Description
The setsighigh function sets the high level of the signal(s) to the
specified value. If you do not pass the signal, the high level of all the
signals read from the punchfile are set. If you pass signals, only the
high level of the specified signals are set. By default the high level of a
signal is set to 4.5.
Example
In this example, the high levels of vr21 and vr31 are set. The high level
of vr12 is assigned the default value of 4.5.
main()
{
string punchfile =rasbuf.pun;
198
Related Functions
getsighigh()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setsighigh().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setsighigh().
setsiglow()
The setsiglow function sets the low level of the signals for transition
measurements
199
Function Usage
setsiglow(lowval)
or
setsiglow(lowval, sig1, sig2)
Prerequisites
None.
Description
The setsiglow function sets the low level of the signal(s) to the specified
value. If you do not specify signals, then the low level of all the signals
read from the punchfile are set. If you pass signals, only the low level
of the specified signals are set. By default, the low level of a signal is
set to 0.5.
200
Example
In this example, low levels of vr21 and vr31 are set. The low level of
vr12 is assigned the default value of 0.5.
main()
{
string punchfile =rasbuf.pun;
waveform vr21, vr31, vr41, vr51, vr12;
float setvalue, notsetvalue;
print(// Reading punchfile, punchfile);
readspicepunch(punchfile);
print(// Completed reading punchfile);
vr21 = $VR21; vr31 = $VR31; vr12 = $VR12;
setsiglow(0.4, vr21, vr31);
setvalue = getsiglow(vr21);
notsetvalue = getsiglow(vr12);
print(// Low value when set =, setvalue);
print(// Low value when not set =, notsetvalue);
}
Related Functions
getsiglow()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setsiglow().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setsiglow().
201
setsigname()
The setsigname function sets the name of the signal.
Function Usage
setsigname(signal1, string1)
Prerequisites
None.
Required Arguments
signal1
None.
Description
202
Example
In this example, the signal name for variable vout is set to MYSIG. This
is a new signal created by shifting the vin signal by a dc value of 5 v.
main()
{
string
waveform
punchfile =delay.pun;
vin, vout;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT + 5;
print(vin);
setsigname(vout,MYSIG);
print(vin);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setsigname().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setsigname().
settolerance()
The settolerance function sets the tolerance while comparing two
waveforms.
203
Function Usage
settolerance(float1)
Prerequisites
None.
Required Arguments
float1
The settolerance function sets the tolerance level for the logical
waveform operators: == and !=. For more details, see Chapter 2,
waveform operators.
The tolerance for comparison is 1.0E-14, by default. If this function is
called, then all the future waveform operators == and != compare the
values of the operand waveforms within the specified tolerance value
float1 to determine the success or failure of the comparison.
Example
This example prints the value of result as one since the dc signal v1 is
within the tolerance level of one when compared to the dc signal v2.
main()
{
waveform v1, v2, vout;
204
int result;
v1 = 3; v2 = 4;
settolerance(1.0);
result = v1 == v2;
print(result);
}
setxyunits()
The setxyunits function sets the x and y units of a signal.
Function Usage
None.
Required Arguments
signal_name
Specifies the waveform variable of the signal name
x_unit
Specifies the string variable of the x_unit name. If you need only
y_units, enter a null string for x_units.
Options
y_unit
205
The setxyunits function sets the x_units and/or y_units of the signal to
the values you specify.
Example
main()
{
string punchfile = "delay.pun";
waveform vin, vout;
string xunit, yunit;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT + 5;
print(vin);
xunit = "nano sec";
yunit = "volts";
setxyunits(vin, xunit, yunit);
yunit = "amps";
setxyunits(vout, "", yunit);
writesignal(vin, "units.pun");
writesignal(vout, "units.pun");
}
206
sigexists()
The sigexists functions returns true, if the specified signal exists;
otherwise, it returns false.
Function Usage
sigexists(signalname)
Prerequisites
None.
Required Arguments
signalname
207
Example
signalname =VCC;
punchfile =delay.pun;
readspicepunch(punchfile);
if (sigexists(signalname))
print(Signal, signalname, exists);
else
print(Error);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function sigexists().
If you are using the C CODAC interface, see C CODAC Toplevel
Function sigexists().
208
thresholdsignal()
The thresholdsignal function returns the set of signals that exceed the
threshold value.
Function Usage
thresholdsignal(thresholdvalue, sigtype)
Prerequisites
209
Description
This example reads the delay.pun file and prints all the current signals
that exceed 1mA current and all voltage signals that exceed 3.3v and
all signals that exceed 0.1.
main()
{
readspicepunch(delay.pun);
thresholdsignal(0.1, 1);
thresholdsignal(3.3, 2);
thresholdsignal(0.1, 0);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function thresholdsignal().
210
wabs()
The wabs functions returns the absolute waveform.
Function Usage
wabs(signal1)
Prerequisites
Returns a waveform
Description
211
Example
punchfile =delay.pun;
vin, absvin;
readspicepunch(punchfile);
vin = $VIN;
absvin = wabs(vin);
writesignal(absvin,/tmp/absvin);
}
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wabs().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wabs().
212
wacos()
The wacos function returns the arc cosine of the source signal.
Function Usage
wacos(signal1)
Prerequisites
Returns a waveform
Description
The wacos function returns the signal whose value points correspond
to the arc cosine function of the input signal value points. The name of
the returned signal would be the same as the argument signal name
and is assigned the prefix, acos.
213
Example
This example returns the waveform whose value corresponds to the arc
cosine of the signal V IN. The signal name of the returned waveform is,
acosvin.
main()
{
string
waveform
punchfile =delay.pun;
vin, acosvin;
readspicepunch(punchfile);
vin = $VIN;
acosvin = wacos(vin);
writesignal(acosvin,/tmp/acosvin);
}
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wacos().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wacos().
214
wasin()
The wasin function returns the arc sine of the source signal.
Function Usage
wasin(signal1)
Prerequisites
Returns a waveform
Description
215
Example
This example returns the waveform whose value corresponds to the arc
sine of the signal V IN. The signal name of the returned waveform is,
asinvin.
main()
{
string
punchfile =delay.pun;
waveform
vin, asinvin;
readspicepunch(punchfile);
vin = $VIN;
asinvin = wasin(vin);
writesignal(asinvin,/tmp/asinvin);
}
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wasin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wasin().
216
watan()
The watan returns the arc tangent of the source signal.
Function Usage
watan(signal1)
Prerequisites
Returns a waveform
Description
The watan returns the signal whose value points correspond to the arc
tangent function of the input signal value points. The name of the
returned signal would be the same as the argument signal name and is
assigned the prefix, atan.
217
Example
This example returns the waveform whose value corresponds to the arc
tangent of the signal VIN . The signal name of the returned waveform is
atanvin.
main()
{
string
waveform
punchfile =delay.pun;
vin, atanvin;
readspicepunch(punchfile);
vin = $VIN;
atanvin = watan(vin);
writesignal(atanvin,/tmp/atanvin);
}
Related Functions
readspicepunch()
writesignal()
wcos()
The wcos function returns the cosine of the source signal.
Function Usage
wcos(signal1)
218
Prerequisites
Returns a waveform
Description
The wcos function returns the signal whose value points correspond to
the cosine function of the input signal value points. The name of the
returned signal would be the same as the argument signal name and is
assigned the prefix, cos.
Example
punchfile =delay.pun;
vin, cosvin;
readspicepunch(punchfile);
vin = $VIN;
CODAC Function Dictionary,
219
cosvin = wcos(vin);
writesignal(cosvin,/tmp/cosvin);
}
Related Functions
readspicepunch()
writesignal()
wexp()
The wexp function returns the exponential of the source signal.
Function Usage
wexp(signal1)
Prerequisites
220
Returned Value
Returns a waveform
Description
The wexp function returns the signal whose value points correspond to
the real exponential function of the input signal value points. The name
of the returned signal would be the same as the argument signal name
and is assigned the prefix, exp.
Example
punchfile =delay.pun;
vin, expvin;
readspicepunch(punchfile);
vin = $VIN;
expvin = wexp(vin);
writesignal(expvin,/tmp/expvin);
}
221
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wexp().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wexp().
wlog()
The wlog function returns the natural logarithm of the source signal.
Function Usage
wlog(signal1)
Prerequisites
222
Returned Value
Returns a waveform
Description
The wlog function returns the signal whose value points correspond to
the natural logarithm of the input signal value points if successful. The
name of the returned signal would be the same as the argument signal
name and is assigned the prefix, log.
Example
punchfile =delay.pun;
vin, logvin;
readspicepunch(punchfile);
vin = $VIN;
logvin = wlog(vin);
writesignal(logvin,/tmp/logvin);
}
223
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wlog().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wlog().
wlog10()
The wlog10 function returns the signal whose value points correspond
to the logarithm base 10 of the input signal value points.
Function Usage
wlog10(signal1)
Prerequisites
224
Returned Value
Returns a waveform
Description
The wlog10 function returns the signal whose value points correspond
to the logarithm base 10 of the input signal value points if successful.
The name of the returned signal would be the same as the argument
signal name and is assigned the prefix, log10 .
Example
punchfile =delay.pun;
vin, log10vin;
readspicepunch(punchfile);
vin = $VIN;
log10vin = wlog10(vin);
writesignal(log10vin,/tmp/log10vin);
}
225
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wlog10().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wlog10().
wpow()
The wpow function returns the signal whose value points correspond
to the input signal value points raised to the power of float1 value.
Function Usage
wpow(signal1, float1)
Prerequisites
226
float1
Returns a waveform
Description
punchfile =delay.pun;
vin, powvin;
readspicepunch(punchfile);
vin = $VIN;
powvin = wpow(vin,2);
writesignal(powvin,/tmp/powvin);
}
227
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wpow().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wpow().
writepunch()
The writepunch function writes the signals present in the CODAC
database into a punchfile, according to the specified format.
Function Usage
You must load signals present in the inputfile into the CODAC database
using the readspicepunch() and nextsignal() functions.
Required Arguments
inputfile
228
None.
229
Description
You must load signals present in the CODAC database read from the
input punchfile onto a output file in punchfile format. The writepunch
function writes only the signals loaded into the CODAC database. It
does not write the signals that CODAC creates.
This function can write into a punchfile that data loaded into the CODAC
database by Spice jobs invoked through the invokespicesrvr() function.
Example
In this example, a punchfile is created for the signals loaded into the
CODAC database through the invokespicesrvr() function.
main()
{
int srvrid;
srvrid=invokespicesrvr("example Spi");
while(!getsrvrstatus(srvrID));
writepunch("example spi.pun",example.spi.out,");
stopspicesrvr(srvrid);
}
Related Functions
getsrvrstatus()
invokespicesrvr()
stopspicesrvr()
230
writesignal()
The writesignal function writes a signal in a punchfile.
Function Usage
None.
Required Arguments
signal
231
flt_dbl
None.
Description
In this example, vcc, <, 4.0 digitizes the waveform vcc. This signal is
written into the punchfile lvccflt.pun in the overwrite mode in an ASCII
format.
main()
{
waveform vcc, vmath, vcast;
float
delay1;
readspicepunch(in/delay.pun);
vcc = $VCC;
vmath = digitize (vcc,<, 4.0);
232
writesignal(vmath,lvccflt.pun,1);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function writesignal().
If you are using the C CODAC interface, see C CODAC Toplevel
Function writesignal().
wsin()
The wsin function returns the sine signal corresponding to the source
signal.
Function Usage
wsin(signal1)
Prerequisites
233
Returns a waveform
Description
This example returns the waveform whose value corresponds to the sin
of the signal V IN. The signal name of the returned waveform is sinvin.
main()
{
string
waveform
punchfile =delay.pun;
vin, sinvin;
readspicepunch(punchfile);
vin = $VIN;
sinvin = wsin(vin);
writesignal(sinvin,/tmp/sinvin);
}
234
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wsin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wsin().
wsqrt()
The wsqrt function returns the square root of the source signal.
Function Usage
wsqrt(signal1)
Prerequisites
235
Returned Value
Returns a waveform
Description
punchfile =delay.pun;
vin, sqrtvin;
readspicepunch(punchfile);
vin = $VIN;
sqrtvin = wsqrt(vin);
writesignal(sqrtvin,/tmp/sqrtvin);
}
236
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wsqrt().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wsqrt().
wtan()
The wtan function returns the tangent of the source signal.
Function Usage
wtan(signal1)
Prerequisites
237
Returned Value
Returns a waveform
Description
punchfile =delay.pun;
vin, tanvin;
readspicepunch(punchfile);
vin = $VIN;
tanvin = wtan(vin);
writesignal(tanvin,/tmp/tanvin);
}
238
Related Functions
readspicepunch()
writesignal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function wtan().
If you are using the C CODAC interface, see C CODAC Toplevel
Function wtan().
xpoint()
The xpoint function returns the x-point of the signal.
Function Usage
xpoint(signal, i)
Prerequisites
239
This example prints the value of the signal when time exceeds two (2)
nanoseconds.
main()
{
waveform vout;
readspicepunch(delay.pun);
vout = $VOUT;
num = getpoints(vout);
for(i=0; i < num; i++)
{
if (xpoint(vout, i) > 2.0e-9)
print(Time > 2 ns value =, ypoint(vout, i));
}
}
240
Related Functions
readspicepunch()
ypoint()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function xpoint().
If you are using the C CODAC interface, see C CODAC Toplevel
Function xpoint().
ypoint()
The ypoint function returns the y-point of the signal.
Function Usage
ypoint(signal, i)
Prerequisites
241
This example prints the value of the signal V OUT when the time exceeds
two (2) nanoseconds.
main()
{
waveform vout;
readspicepunch(delay.pun);
vout = $VOUT;
num = getpoints(vout);
for(i=0; i < num; i++)
{
if (xpoint(vout, i) > 2.0e-9)
print(Time > 2 ns value =, ypoint(vout, i));
}
}
242
Related Functions
readspicepunch()
xpoint()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function ypoint().
If you are using the C CODAC interface, see C CODAC Toplevel
Function ypoint().
243
Simulator Functions
This subsection describes the available simulator functions.
addcards()
The addcards function adds the specified cards to the given Spice deck.
Function Usage
None.
Required Arguments
spicedeck
Specifies the Spice netlist to which the given cards need to be added
card1, card2,...
The addcards function returns the modified Spice deck as a string value
that contains the name of the input Spice deck with a number n
appended to it; n stands for the Spice deck that the nth addcard creates.
CODAC Function Dictionary,
244
Description
The addcards function adds the specified cards to the given Spice deck.
The Spice deck should not contain the .END card, as CODAC adds this
card.
Thus, the modified Spice deck works with Spice2, though it requires the
base Spice deck to be flat (that is, it should not have .lib cards). This is
because the maximum nesting of .lib cards in Spice2 is only one level.
CODAC uses this logic to create the modified Spice decks:
1. Creates a new file for the modified Spice deck.
2. Adds the .LIB card to the original Spice deck.
3. Adds all the specified cards to this Spice deck.
4. Inserts the .END card.
5. Returns the modified Spice deck.
Example
This example adds the dc card, the V CC card, and the temperature card
to the Spice deck and returns the modified Spice deck name. The string
that addcard returns contains the modified Spice deck name, Amplifier.
0.
main()
{
float
string
dccard
245
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function addcards().
If you are using the C CODAC interface, see C CODAC Toplevel
Function addcards().
caddcards()
The caddcards function adds the specified cards to the given Spice
deck
Function Usage
None.
Required Arguments
basedeck
246
The caddcards function adds the specified cards to the given base
deck. The modified deck is written to the pathname specified in
moddeck. The basedeck should not contain the .END card, since
CODAC adds this card.
CODAC uses this logic to create the modified Spice decks:
1. Creates a new file for the modified Spice deck.
2. Adds the .LIB card to the original Spice deck.
3. Adds all the cards specified to this Spice deck.
4. Inserts the .END card.
5. Returns the modified Spice deck.
247
Spice2 does not support nested .lib cards. Before you invoke Spice2,
use the Spice deck flattener available in the pathname
/dad/spice3/spice3.ext/spice3.expand to flatten Spice decks.
Example
This example adds the dc card, the V CC card, and the temperature card
to the basedeck and returns the pathname specified in the variable
moddeck.
main()
{
float
voltage, temperature;
string
dccard, voltcard, tempcard;
/* initialize pathnames */
string
BaseDeck =/projects/sim/base/deck1;
string
ModDeck =/projects/sim/mod/deck1;
/* initialize cards to be added */
dccard
=.DC VDC2 0V 30V .2V;
voltcard =VCC VCC 0 + str(voltage);
tempcard =.TEMP
+ str(temperature);
/* add cards to basedeck and write modified deck to moddeck */
caddcards(basedeck, moddeck, dccard, voltcard, tempcard);
invokespice3(moddeck);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function caddcards().
If you are using the C CODAC interface, see C CODAC Toplevel
Function caddcards().
248
getsrvrstatus()
The getsrvrstatus function returns the status of the Spice job that you
invoke through the Spice server function.
Function Usage
getsrvrstatus(srvrid)
Required Arguments
srvrid
249
Related Functions
invokespicesrvr()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsrvrstatus().
250
getstatus()
The getstatus function returns the current status of the Spice job whose
task ID is provided.
Function Usage
getstatus(taskId)
Prerequisites
251
Description
When you invoke Spice through the invokespice3() library function within
the scope of a parallel block, it returns an integer value representing
the task identification number (task ID) of that job.
This function returns an integer value reflecting the status of the Spice
job whose task ID is specified as an argument. The return codes and
their explanations are:
0
Job concluded
No convergence in dc analysis
Job aborted
Job unscheduled
System error
Job blasted
Job active
Job inactive
Example
252
main()
{
int taskId1, taskId2;
/* set pathname of TI Spice3 executable */
setspice3path(/dad/com/spice3);
/* Initialization for task broker: load the service
definitions file, that is, serviceDefinition. Specify host
node for opening Task Broker connection, that is, node_3a273.
specify the service to be used for invoking subsequent Spice
jobs, that is, big. */
loadservice(serviceDefinition,node_3a273,big);
/* set up TI Spice3 invocations in parallel */
parallel
{
task1 = invokespice3(ras);
task2 = invokespice3(rasbuf);
}
/* check completion status of first Spice job */
if (getstatus(task1) == 0)
print(Spice job 1 completed successfully);
else
print(Spice job 1 returned bad status);
/* check completion status of second Spice job */
if (getstatus(task2) == 0)
print(Spice job 2 completed successfully);
else
print(Spice job 2 returned bad status);
}
Related Functions
invokespice3()
Invokes TI Spice3
253
loadservice()
setservice()
254
invokespice3()
The invokespice3 function invokes TI Spice3
Function Usage
None.
Required Arguments
deck_path
A string value specifying the pathname where the output of the Spice
print is to be written. The print output is written to the file deck_path.prt
by default.
punch_path
A string value specifying the pathname where the output of the Spice
punch is to be written. The punch output is written to the file
deck_path.pun by default.
255
udm_path1, udm_path2
256
Description
Job concluded
No convergence in dc analysis
Job aborted
Job unscheduled
System error
Job blasted
Example
257
Related Functions
getstatus()
loadservice()
setservice()
setspice3path()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function invokespice3().
If you are using the C CODAC interface, see C CODAC Toplevel
Function invokespice3().
258
invokespicesrvr()
The invokespicesrvr function invokes the TI Spice server.
Function Usage
invokespicesrvr(deck-path)
Required Arguments
deck-path
259
Example
This example finds the width of the pass transitor that matches the user
specified time constant of a simple circuit. This circuit consists of a
switch (pass transitor) and a capacitor.
main()
{
float Min = 10e-06, Max = 200e-06, Cwidth, Fwidth;
float CurrTC, RefTC;
string ModStr;
int SrvrId;
printf("Enter the Required Time Constant: \n");
scanf("%f",RefTC);
exit(1);
SrvrId = invokespicesrvr("pass.spi");
while(!getsrvrstatus(SrvrId));
while((Max - Min) < 0.1e-06)
{
Cwidth = (Min + Max)/2;
ModStr = "MPO1 W = " + str(Cwidth) + "\n";
ModStr += "MPO2 W = " + str(Cwidth) + "\n";
sndsrvrmodify(SrvrId,ModStr,1);
while(!getsrvrstatus(SrvrId));
readspicepunch("pass.spi.pun");
/* Calculates the time constant of the circuit. The
function is defined by the user */
CurrTC = CalculateTC();
if((CurrTC - RefTC)/RefTC)<0.01)
break;
else if(CurrTC < RefTC)
Max = Cwidth;
else
Min = Cwidth;
}
printf("The best possible Time Constant achieved was %2.3e for
transistor width %2.3e \n", CurrTC, Cwidth);
}
260
Related Functions
getsrvrstatus()
sndsrvrmodify()
stopspicesrvr()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function invokespicesrvr().
If you are using the C CODAC interface, see C CODAC Toplevel
Function invokespicesrvr().
261
setsockconfig()
The setsockconfig function allows you to set the configuration of the
Spice server that you want to invoke. You can choose the configuration
from a list of options in Table 12.
Function Usage
setsockconfig(int-val)
Prerequisites
None.
Required Arguments
int-val
Integer value specifying the configuration you set to invoke the Spice
server
Returned Value
None.
Description
262
SERVERmsgLvlError
SERVERmsgLvlWarn
SERVERmsgLvlAll
Example
This CODAC program runs the user specified Spice job using the Spice
server option. The configuration is set so that the server does not return
any error messages to CODAC, even if the Spice job fails.
The CODAC code checks if the Spice job has succeeded. If the Spice
job has succeeded, it computes the characterization data as per your
definition. If the Spice job has failed, it prints an error message and exits.
263
#include<config.k>
#includeMeasCharData.k"
/*MeasCharData.k file contains the function definition of
GetCharData() which is a user defined function.*/
main()
{
int Config, SockId, i = 0;
waveform Wav;
Config = SERVERconfigStopAfterModify | SERVERconfigSendPunch |
SERVERmsgLvlNone | SERVERconfigNoModifyMessages |
SERVERconfigSendAnalysisInfo | SERVERconfigResetResults;
setsockconfig(Config);
SockId = invokespicesrvr("example.spi");
while(!getsrvrstatus(SockId));
readspicepunch("example.spi.pun");
stopspicesrvr(SockId);
while(nextsignal(Wav))
i++;
if(!i)
{
print("Spice job failed ");
exit(1);
}
GetCharData();
}
Related Functions
invokespicesrvr()
264
setspice2path()
setspice2path(spice2_path)
Prerequisites
None.
Required Arguments
spice2_path
None.
Returned Value
None.
Description
265
266
sndsrvrmodify()
The sndsrvrmodify function sends the modify string to the Spice server.
Function Usage
sndsrvrmodify(srvrid,modifystring,speed-overwrite)
Required Arguments
srvrid
None.
Description
This function sends the modify statements to the Spice server that srvrid
specifies and executes the analysis again.
267
Example
This example determines the minimum time elapsed before which the
data must be present at the input of the flip flop, so that it latches to the
rising edge of the clock pulse.
main()
{
float Delay,LowDelay,RefDelay = 2.22e-10;
float High = 30.0e-09,Low = -10.0e-09;
float CurTrial;
string ModStr;
file fp;
int SrvrId;
fp = fopen("result","w");
fprintf(fp,"LowLimit HighLimit TrialValue Delay\n\n");
SrvrId = invokespicesrvr("clk_q.spi");
while(!getsrvrstatus(SrvrId));
while (fabs(High - Low) > 0.01e-9)
{
CurTrial = (High+Low)/2.0;
sprintf(ModStr,"VD PULSE TD=%e\n",(117.39e-09 - CurTrial));
sndsrvrmodify(SrvrId,ModStr,1);
while(!getsrvrstatus(SrvrId));
readspicepunch("clk_q.spi.pun");
setsiglow(0.46);
setsighigh(1.84);
setsigcent(1.08);
Delay = delay($VQ,1,$VCLK,1);
if(Delay != 1.1e34)
fprintf(fp,"%2.2e %2.2e %2.2e %2.2e\n", Low,
High,CurTrial,Delay);
else
fprintf(fp,"%2.2e %2.2e %2.2e NoTransition\n",Low,
High,CurTrial);
if (Delay < RefDelay)
{
High = CurTrial;
268
LowDelay = Delay;
}
else
Low = CurTrial;
}
stopspicesrvr();
fprintf(fp,"\nPARAMETER VALUE = %e\n",High);
}
}
Related Functions
invokespicesrvr()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function sndsrvrmodify().
If you are using the C CODAC interface, see C CODAC Toplevel
Function sndsrvrmodify().
stopspicesrvr()
The stopspicesrvr function stops invoked Spice servers.
Function Usage
stopspicesrvr()
or
stopspicesrvr(srvrid)
269
Required Arguments
srvrid
None.
Description
This example evaluates the delay between two signals using the
invokespicesrvr() function. The getsrvrstatus() function is used inside
a while loop to make the program wait till the Spice job is complete.
main()
{
int srvrid;
float Delay;
srvrid = invokespicesrvr("delay.spi");
while (!getsrvrstatus (srvrid));
readspicepunch (delay.spi.pun");
Delay = delay($VA, 1, $VY, 1);
printf("delay = %(e\n", Delay);
stopspicesrvr(srvrid);
}
270
Related Functions
invokespicesrvr()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function stopspicesrvr().
If you are using the C CODAC interface, see C CODAC Toplevel
Function stopspicesrvr().
setspice3path()
The setspice3path function sets the TI Spice3 executable path to the
specified pathname.
Function Usage
setspice3path(spice3_path)
Prerequisites
None.
Required Arguments
spice3_path
271
Options
None.
Returned Value
None.
Description
272
Related Functions
invokespice3()
Invokes TI Spice3
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setspice3path().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setspice3path().
273
loadservice()
The loadservice function loads the service definition file and opens a
Task Manager connection.
Function Usage
274
servicename
The example on the next page shows the usage of the loadservice
function to initialize the Task Manager, so that subsequent Spice
simulations can be submitted through the Task Manager.
main()
{
int taskId1, taskId2;
/* set pathname of TI Spice3 executable */
setspice3path(/dad/com/spice3);
275
Related Functions
invokespice3()
Invokes TI Spice3
loadservice()
setservice()
276
setservice()
The setservice function sets the specified service for all subsequent
jobs submitted to the SLIM Task Manager or the HP Task Broker.
Function Usage
setservice(servicename)
Prerequisites
The SLIM Task Manager and/or the HP Task Broker should be installed
or running on the network. In the case of the SLIM Task Manager, you
should have initialized the connection using the loadservice() function.
Required Arguments
servicename
277
Description
This example shows the usage of the setservice function to change the
service to be used for subsequent Spice simulations submitted through
the HP Task Broker.
main()
{
int taskId1, taskId2;
/* set pathname of TI Spice3 executable */
setspice3path(/dad/com/spice3);
/* use HP Task Broker */
usehptb(serviceName);
setservice(codacSmall);
/* set up TI Spice3 invocations in parallel */
parallel
{
task1 = invokespice3(ras);
/* change service to small for task2 */
setservice(small);
task2 = invokespice3(rasbuf);
}
/* check completion status of first Spice job */
if (getstatus(task1) == 0)
print(Spice job 1 completed successfully);
else
print(Spice job 1 returned bad status);
/* check completion status of second Spice job */
if (getstatus(task2) == 0)
print(Spice job 2 completed successfully);
else
CODAC Function Dictionary,
278
Related Functions
invokespice3()
Invokes TI Spice3
loadservice()
setservice()
uselsftb()
The uselsftb function tells CODAC to use the Load Sharing Facility
(LSF) for scheduling Spice jobs.
Function Usage
uselsftb (service_definition_file)
Prerequisites
None
279
Options
service_definition_file
A string variable or constant specifying the pathname of the LSF
service definition file.
Returned Value
By default the parallel construct of CODAC assumes that the SLIM task
manager is the management tool. If you use LSF, call uselsftb to specify
this.
The uselsftb function performs the initialization that CODAC needs to
use LSF to submit concurrent Spice simulations on the network.
It reads the service definition file to get the resource requirements that
you specify. In case of a parsing failure, it returns an integer value of
zero and assumes default values for the resources.
280
ac Functions
This subsection describes the available ac functions.
bandwidth()
The bandwidth function calculates the bandwidth in an ac analysis.
Function Usage
Represents the deviation at the low and high cutoff points in the middle
band gain
281
Returned Value
The bandwidth (bw) of gain and freq plot is defined as the difference
between the frequency at which the gain rises above the refdB limit and
the frequency at which the gain falls below the refdB limit.
CODAC uses this logic to measure the bandwidth.
First, the program finds the gain at the midfreq (gmid)
Then, it finds the lower frequency at which the gain is, gmid - refdB
(fldB)
Then, it finds the high frequency at which the gain is, gmid - refdB
(fudB)
Then, the bandwidth is given by,
bw = fudB - fldB
Figure 10 illustrates this.
282
Gain (dB) A
Gmid
Value
RefdB
Bandwidth
freqmin fldB
Freqm
Time
fudB freqmax
Example
This example returns the bandwidth measured with 1MHz as the mid
frequency with the cutoff points, three dB.
main()
{
string
punchfile =gain.pun;
waveform
vgain;
float
bw;
readspicepunch(punchfile);
vgain = $VGAIN;
bw = bandwidth(vgain, 1E6, 3.0);
print(// The bandwidth of gain, bw);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function bandwidth().
283
gainatphase()
The gainatphase function calculates the gain in dB at a specific phase
angle.
Function Usage
284
Returned Value
This example finds the gain when the phase angle equals135.
main()
{
string
punchfile =log.pun;
waveform
vgain, vphase;
float
firstpole;
readspicepunch(punchfile);
vgain = $VGAIN;
vphase = $VPHASE;
firstpole = gainatphase(vgain, vphase, 135.0);
print(// The Gain when Phase angle = 135.0 deg =, firstpole);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gainatphase().
285
gainmargin()
The gainmargin function calculates the gain margin in the ac analysis.
Function Usage
gainmargin(gainsignal, phasesignal)
or
gainmargin(gainsignal, phasesignal, flag)
Prerequisites
286
The gain margin is the difference between the value of the gain at -180
and 0 dB or unity gain.
You should choose one of the following two methods to calculate the
gain margin depending on which version of Spice generated the
punchfile.
In the case of Spice2 and all TI Spice3 versions below 1.13, wherein
the phase is not punched as a continuous curve, CODAC uses the
following logic to calculate the phase margin.
1. The program finds the frequency (f p) at which the phase angle is
180.
2. It finds the gain at fp is the gain margin.
This is not computed by default. You have to specify a non-zero integer
as the third optional flag variable to force this mode.
In the case of TI Spice3 versions 1.13 and above, wherein the phase
is not punched as a continuous curve, CODAC uses this logic to
calculate the gain margin.
287
288
fg
Gain 23 dB
-20
-90
Phase Margin
-180
-270
fp
289
Example
This example returns the gain margin for the signals, V GAIN and VPHASE.
main()
{
string
punchfile =gain.pun;
waveform
vgain, vphase;
float
gm;
readspicepunch(punchfile);
vgain = $VGAIN;
vphase = $VPHASE;
gm = gainmargin(vgain, vphase);
print(// The gain margin, gm);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gainmargin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function gainmargin().
phaseatgain()
The phaseatgain function calculates the phase angle at a specified
gain.
Function Usage
290
Prerequisites
291
Example
This example prints the phase when the gain equals to 10 dB.
main()
{
string
punchfile =log.pun;
waveform
vgain, vphase;
float
phase;
readspicepunch(punchfile);
vgain = $VGAIN;
vphase = $VPHASE;
phase = phaseatgain(vphase, vgain, 10.0);
print(// The Phase at Gain 10db =, phase);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function phaseatgain().
If you are using the C CODAC interface, see C CODAC Toplevel
Function phaseatgain().
phasemargin()
The phasemargin function calculates the phase margin in the ac
analysis.
Function Usage
phasemargin(gainsignal, phasesignal)
or
phasemargin(gainsignal, phasesignal, flag)
292
Prerequisites
The phase margin (pm) is the difference between the phase angle at
which the gain crosses the zero (0) db line and -180.
You should choose one of the following two methods to calculate the
gain margin depending on which version of Spice generated the
punchfile.
293
In the case of TI Spice3 versions 1.13 and above, where the phase is
not punched as a continuous curve, to calculate the phase margin,
CODAC:
1. Finds the frequency f g at which the gain is 0 dB.
2. Find the phase angle (p) at the frequency f g,
3. Finds the phase margin given by
phasemargin = (p 180)
This is computed by default. Figure 12 illustrates this.
294
dB (Gain)
20
fg
-20
-90
(p)
Phase Margin
-180
-270
fp
295
Example
This example returns the phase margin for signals, VGAIN and VPHASE.
main()
{
string
waveform
float
punchfile =gain.pun;
vgain, vphase;
pm;
readspicepunch(punchfile);
vgain = $VGAIN;
vphase = $VPHASE;
pm = phasemargin(vgain, vphase);
print(// The phase margin, pm);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function phasemargin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function phasemargin().
296
Transient Functions
This subsection describes the available Transient functions.
abspeak()
The abspeak function returns the absolute peak value of the signal.
Function Usage
Represents the signal for which the absolute peak value should be
calculated. The signal should be a waveform.
Optional Arguments
starttime
Represents the start time for calculating the absolute peak value. This
should be a float.
endtime
Represents the end time of the absolute peak value for calculation.
This should be a float.
297
Returned value
The abspeak function returns the absolute peak value of the signal by
default. If you specify the starttime and the endtime, the function returns
the absolute peak value in the specified time range. Figure 13 shows
this.
Value
abspeak()
Time
298
Example
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function abspeak().
If you are using the C CODAC interface, see C CODAC Toplevel
Function abspeak().
crosstime()
The crosstime function finds the time at which signal1 and signal2 cross.
Function Usage
299
Prerequisites
The crosstime function returns the time when signal1 crossed signal2,
if successful; otherwise, it returns a large floating point number
Description
The crosstime function finds the time when the signal1 crosses the
signal2. Figure 14 shows this.
300
IVA
Value
A1
V1
t2
t1
Time
This example returns the first crossing time of VXY and VAB.
main()
{
string
punchfile =delay.pun;
T1
T2
waveform
vxy, vab;
float
cross1;
readspicepunch(punchfile);
vxy = $VXY;
vab = $VAB;
cross1 = crosstime(vxy, vab, 1);
print(// The first cross time of Vxy and Vab, cross1);
}
301
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function crosstime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function crosstime().
crossvalue()
The crossvalue function finds the value at which signal1 crossed
signal2.
Function Usage
302
Returned Value
Value
IVA
V1
V2
t1
t2
Time
In the above figure, if the number is one, then V1 is returned and, if the
number is two, then V2 is returned.
303
Example
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function crossvalue().
If you are using the C CODAC interface, see C CODAC Toplevel
Function crossvalue().
delay()
The delay function returns the delay between two signals.
Function Usage
304
Prerequisites
Represent waveforms
transnum1, transnum2
The delay function accepts two signals and their transition numbers as
inputs and finds the delay between transnum1 of signal1 and transnum2
of signal2.
Figure 16 shows the delay, where:
A = Transition point on transnum1 of signal1
B = Transition point on transnum2 of signal2
305
Value
Signal2
B
Signal1
Center
Center
Delay = t1 - t2
t2
t1
Time
Example
This example calculates the delay from the first transition of V IN to the
first transition of V OUT .
main()
{
string punchfile =delay.pun;
waveform vin, vout;
float delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delay(vout, 1, vin, 1);
print(// Delay between transitions =, delay1);
}
306
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delay().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delay().
delaych()
The delaych function returns the delay between the center level of
signal1 and the high level of signal2.
Function Usage
Represent waveforms
307
transnum1, transnum2
The delaych function accepts two signals and their transition numbers
as inputs and finds the delay (center-high) between the specified
transitions of the two signals.
Figure 17 shows the delay, where:
A = Center level point on transnum1 of signal1
B = High level point on transnum2 of signal2
Value
Signal2
High
Signal1
Center
Low
delaych=t1 - t2
t2
t1
Time
308
Example
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delaych(vin, 1, vout, 1);
print(// Delay <Center-High> between transitions =, delay1);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delaych().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delaych().
309
delaycl()
The delaycl function returns the delay between the center level of
signal1 and the low level of signal2.
Function Usage
Represent waveforms
transnum1, transnum2
310
Description
The delaycl function accepts two signals and their transition numbers
as inputs and finds the delay (center-low) between the specified
transitions of the two signals.
Figure 18 shows the delay, where:
A = Center level point on transnum1 of signal1
B = Low level point on transnum2 of signal2
Value
Signal2
Signal1
High
A
B
Center
Low
delaycl=t1 - t2
t2
t1
Time
Example
punchfile =delay.pun;
311
waveform
vin, vout;
float
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delaycl(vin, 1, vout, 1);
print(// Delay <Center-Low> between transitions =, delay1);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delaycl().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delaycl().
delayhc()
The delayhc function returns the delay between the high level of signal1
and the center level of signal2.
Function Usage
312
Prerequisites
Represent waveforms
transnum1, transnum2
The delayhc function accepts two signals and their transition numbers
as inputs and finds the delay (high-center) between the specified
transitions of the two signals.
Figure 19 shows the delay, where:
A = High level point on transnum1 of signal1
B = Center level point on transnum2 of signal2
313
Value
Signal2
Signal1
High
Center
B
Low
delayhc=t1 - t2
t2
t1
Time
Example
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delayhc(vin, 2, vout, 1);
print(// Delay <High-Center> between transitions =, delay1);
}
314
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayhc().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delayhc().
delayhh()
The delayhh function returns the delay between the high level of signal1
and the high level of signal2.
Function Usage
Represent waveforms
315
transnum1, transnum2
The delayhh function accepts two signals and their transition numbers
as inputs and finds the delay (high-high) between the specified
transitions of the two signals.
Figure 20 shows the delay, where:
A = High level point on transnum1 of signal1
B = High level point on transnum2 of signal2
316
Value
Signal2
High
Signal1
Center
Low
delayhh=t1 - t2
t2
t1
Time
Example
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delayhh(vin, 1, vout, 1);
print(// Delay <High-High> between transitions =, delay1);
}
317
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayhh().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delayhh().
delayhl()
The delayhl function returns the delay between the high level of signal1
and the low level of signal2.
Function Usage
Represent waveforms
318
transnum1, transnum2
The delayhl function accepts two signals and their transition numbers
as inputs and finds the delay (high-low) between the specified
transitions of the two signals.
Figure 21 shows the delay, where:
A = High level point on transnum1 of signal1
B = Low level point on transnum2 of signal2
319
Value
Signal2
Signal1
High
Center
B
Low
delayhl=t1-t2
t2
t1
Time
Example
This example calculates the delay (high-low) between the first transition
of V IN and the first transition of V OUT .
main()
{
string
waveform
float
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delayhl(vin, 1, vout, 1);
print(// Delay <High-Low> between transitions =, delay1);
}
320
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayhl().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delayhl().
delaylc()
The delaylc function returns the delay between the low level of signal1
and the center level of signal2.
Function Usage
Represent waveforms
321
transnum1, transnum2
The delaylc function accepts two signals and their transition numbers
as inputs and finds the delay (low-center) between the specified
transitions of the two signals.
Figure 22 shows the delay, where:
A = Low level point on transnum1 of signal1
B = Center level point on transnum2 of signal2
322
Value
Signal2
Signal1
High
Center
B
A
Low
delaylc=t1-t2
t2
t1
Time
Example
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delaylc(vin, 1, vout, 1);
print(// Delay <Low-Center> between transitions =, delay1);
}
323
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delaylc().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delaylc().
delaylh()
The delaylh function returns the delay between the low level of signal1
and the high level of signal2.
Function Usage
Represent waveforms
324
transnum1, transnum2
The delaylh function accepts two signals and their transition numbers
as inputs and finds the delay (low-high) between the specified
transitions of the two signals.
Figure 23 shows the delay, where:
A = Low level point on transnum1 of signal1
B = High level point on n th transnum2 of signal2
325
Value
Signal2
High
Signal1
Center
A
Low
delaylh=t1-t2
t2
t1
Time
Example
This example calculates the delay (low-high) between the first transition
of V IN and the first transition of V OUT .
main()
{
string
waveform
float
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delaylh(vin, 1, vout, 1);
print(// Delay <Low-High> between transitions =, delay1);
}
326
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delaylh().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delaylh().
delayll()
The delayll function returns the delay between the low level of signal1
and the low level of signal2.
Function Usage
Represent waveforms
327
transnum1, transnum2
The delayll function accepts two signals and their transition numbers
as inputs and finds the delay (low-low) between the specified transitions
of the two signals.
Figure 24 shows the delay, where:
A = Low level point on transnum1 of signal1
B = Low level point on transnum2 of signal2
328
Value
Signal 2
Signal 1
High
Center
B
Low
delayll=t1 - t2
t1
t2
Time
Example
This example calculates the delay (low-low) between the first transition
of V IN and the first transition of V OUT .
main()
{
string
waveform
float
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = delayll(vin, 1, vout, 1);
print(// Delay <Low-Low> between transitions =, delay1);
}
329
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayll().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delayll().
delayoff()
The delayoff function returns the delay between two signals with
different offsets.
Function Usage
Represent waveforms
transnum1, transnum2
CODAC Function Dictionary,
330
The delayoff function accepts two signals and their transition numbers
as inputs, and finds the delay between the transnum1 of signal1 and the
transnum2 of the modified signal2.
The signal2 is the modified signal, shifted along the y-axis, so that its
offset becomes equal to the offset of signal1. The low, center, and high
values of signal2 are modified appropriately.
Figure 25 shows the delay, where:
A = Transition point on transnum1 of signal1
B = Transition point on transnum2 of signal2
This function returns the same value as the function delay(), if the two
signals have the same offsets.
331
Value
Offset2
Offset1
Signal 2
Signal 1
High
A
Center
Low
t2
Time
t1
Value
changed to
High
Offset1
Modified Signal 2
B
Signal 1
A
Center
Low
delayoff=t1 - t2
t1
t2
Time
332
Example
This example calculates the delay from the first transition of V IN to the
first transition of V OUT that is different from the value when calculated
as delay(vout, 1, vin, 1) because of different offsets.
main()
{
string
waveform
float
punchfile =delay.pun;
vin, vout;
delay1;
readspicepunch(punchfile);
vin = $VIN; /* offset = 2 */
vout = $VOUT; /* offset = 2.5 */
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
setsiglow(1.0, vout);
setsigsent(2.5, vout);
setsighigh(4.0, vout);
delay = delayoff(vout, 1, vin, 1);
print(// Delay between transitions =, delay1);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayoff().
333
delayxx()
The delayxx function computes the delay between the specified points
of two signal transitions.
Function Usage
Represents waveforms
trans1, trans2
334
Description
The delayxx function computes the delay between the specified points
of two signal transitions. You should specify two signals, two transition
numbers, and points on the two transitions as inputs.
Figure 26. Measuring Delay Between The Specified Points of Two
Signals
Value
Signal2
Signal1
y1
y2
Center
Low
delayxx=t1-t2
t2
t1
Time
Example
335
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayxx().
If you are using the C CODAC interface, see C CODAC Toplevel
Function delayxx().
dip()
The dip function calculates the dip value of the signal.
Function Usage
dip(signalname)
or
dip(signalname, starttime, endtime)
Prerequisites
336
Required Arguments
signalname
Represents the start time for calculating dip. This should be a float.
endtime
Represents the end time for calculating dip. This should be a float.
Returned Value
The dip function returns the minimum value of the signal between the
start time and the end time as a float value, if successful; otherwise, it
returns a large floating point value equal to 1.1e+34.
Description
The dip function calculates the dip value of the signal between the start
time and the end time. If you do not specify the start time and end time
of the signal, the function calculates the dip value between the minimum
time and the maximum time of the signal.
Figure 27 shows the dip between the starttime and the endtime.
337
Value
Signal
Dip
Starttime
Endtime
Time
Example
In this example, the first dip function calculates the dip value of the
signal between the minimum time and the maximum time. The second
dip function calculates the dip value between 1 nanosecond and 2
nanoseconds.
main()
{
string punchfile =delay.pun;
waveform vin;
float dipvalue;
readspicepunch(punchfile);
vin = $VIN;
dipvalue = dip(vin);
print(Dip of the signal vin = dipvalue);
dipvalue = dip(vin, 1.0e-9, 2.0e-9);
print(// Delay between 1ns to 2ns =, dipvalue);
}
338
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function dip().
If you are using the C CODAC interface, see C CODAC Toplevel
Function dip().
dutycycle()
The dutycycle function returns the duty cycle of the specified pulse.
Function Usage
dutycycle(pulse, number+n)
Prerequisites
Use the readspicepunch() to read the signal in using the function and
the specified transition number, number+1, and number+2 should exist.
Required Arguments
pulse
Represents the pulse for which CODAC should calculate the duty
cycle. The pulse should be of waveform data type.
339
number
The dutycycle function returns the duty cycle of the specified pulse as
a float value, if successful; otherwise, it returns a large floating point
value equal to 1.1e+34.
Description
The dutycycle function calculates the pulse duty cycle at the specified
transition number. The duty cycle is defined as the ratio between the
pulse width and the pulse period. Figure 28 shows how CODAC
calculates the pulse duty cycle.
Figure 28. Calculating the Pulse Duty Cycle
dutycycle = width/period
Value
Period
Width
number
number+1
number+2
Time
340
Example
Related Functions
readspicepunch()
pulsewidth()
pulseperiod()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function dutycycle().
If you are using the C CODAC interface, see C CODAC Toplevel
Function dutycycle().
341
falltime()
The falltime function returns the fall time of the signal.
Function Usage
falltime(signal, transnum)
Prerequisites
Represents a waveform
transnum
342
Description
The fall time of the signal is defined as the time difference by the signal
to transition from the high level to the low level. This function accepts
the signal name and the transition number for input. It finds the fall time
of the signal for that transition.
A fall time of the signal is defined as the time taken for the signal to fall
from point t1 to t2, where:
t1
t2
Value
Signal
Falltime = t2 - t1
P1
M
Center
P2
Falltime
t1
High
Low
t2
Time
343
The high and the low level values for the signal should have been set
earlier using the library functions, setsighigh() and setsiglow(),
respectively. If the high and the low values are not set, the default values
of 4.5 for high and 0.5 for low are assigned respectively.
Example
This example calculates the fall time of the second transition of the
signal V OUT. In this example, the values of high and low have been set
to 3.5 and 0.5, respectively.
main()
{
string punchfile =delay.pun;
waveform vout;
float fallvalue;
print(// Reading punchfile, punchfile);
readspicepunch(punchfile);
print(// Completed reading punchfile);
vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
fallvalue = falltime(vout, 2);
print(// Fall time of the signal =, fallvalue);
}
344
Related Functions
readspicepunch()
risetime()
setsigcent()
setsighigh()
setsiglow()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function falltime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function falltime().
peak()
The peak function calculates the peak value of the signal.
Function Usage
peak(signalname)
or
peak(signalname, starttime, endtime)
345
Prerequisites
Represents the start time for calculating the peak value. This should
be a float.
endtime
Represents the end time for calculating the peak value. This should
be a float.
Returned Value
The peak function returns the peak value of the signal between the start
time and end time of the signal as a float value, if successful; otherwise,
it returns a large floating point value equal to 1.1e+34.
346
Description
The peak function calculates the peak value of the signal between the
start time and the end time. Figure 30 shows this.
Figure 30. Measuring the Peak Value of the Signal
Value
Peak
Starttime
Endtime
Time
If you specify a peak without the start time and the end time for the
signal, this function calculates the peak value between the minimum
time and maximum time for the signal.
Example
In this example, the first peak function calculates the peak value of the
signal between the minimum time and maximum time. The second peak
function calculates the peak value between 1 nanosecond and 2
nanoseconds.
main()
{
string punchfile =delay.pun;
waveform vin;
347
float peakvalue;
readspicepunch(punchfile);
vin = $VIN;
peakvalue = peak(vin);
print(// Peak of the signal vin =, peakvalue);
peakvalue = peak(vin, 1.0e-9, 2.0e-9);
print(// Peak between 1ns to 2ns =, peakvalue);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function peak().
If you are using the C CODAC interface, see C CODAC Toplevel
Function peak().
peak2peak()
The peak2peak function calculates the peak-to-peak value of the signal.
Function Usage
peak2peak(signalname)
or
peak2peak(signalname, starttime, endtime)
348
Prerequisites
Represents the start time for calculating the peak2peak value. This
should be a float.
endtime
Represents the end time of the peak2peak value for calculation. This
should be a float.
Returned Value
349
Description
Value
Peak2peak
Starttime
Endtime
Time
If you specify the peak2peak without the start time and the end time for
the signal, this function calculates the peak value between the minimum
time and the maximum time for the signal.
Example
In this example, the first function calculates the peak2peak value of the
signal between the minimum time and the maximum time. The second
function calculates the peak2peak value between 1 nanosecond and 2
nanoseconds.
main()
{
string punchfile =delay.pun;
waveform vin;
float p2pvalue;
CODAC Function Dictionary,
350
readspicepunch(punchfile);
vin = $VIN;
p2pvalue = peak2peak(vin);
print(// peak2peak of the signal vin =, p2pvalue);
p2pvalue = peak2peak(vin, 1.0e-9, 2.0e-9);
print(// peak2peak between 1ns to 2ns =, p2pvalue);
}
Related Functions
readspicepunch()
peak()
dip()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function peak2peak().
If you are using the C CODAC interface, see C CODAC Toplevel
Function peak2peak().
pulsefrequency()
The pulsefrequency function calculates the pulse frequency of the
specified pulse.
Function Usage
pulsefrequency(pulse, transnumber)
351
Prerequisites
Read in the signal (pulse) using the readspicepunch() function, and the
specified transnumber and the +2 transnumber should exist.
Required Arguments
pulse
352
freq=1/period
Value
pulse period
number
number+2
Time
Example
353
Related Functions
readspicepunch()
gettransitiontime()
pulseperiod()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pulsefrequency().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pulsefrequency().
pulseperiod()
The pulseperiod function returns the pulse period of the specified pulse.
Function Usage
pulseperiod(pulse, transnumber)
Prerequisites
Read in the signal (pulse) using the readspicepunch() function, and the
specified transnumber and the +2 transnumber should exist.
Required Arguments
pulse
CODAC Function Dictionary,
354
Represents the signal for which CODAC calculates the pulse period.
This should be a waveform.
number
The pulseperiod function returns the pulse period of the specified pulse
as a float value, if successful; otherwise, it returns a large floating point
value equal to 1.1E+34
Description
355
Value
pulse period
number
number+2
Time
Example
356
Related Functions
readspicepunch()
gettransitiontime()
pulsewidth()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pulseperiod().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pulseperiod().
357
pulsewidth()
The pulsewidth function returns the pulse width of the specified pulse.
Function Usage
pulsewidth(pulse, transnumber)
Prerequisites
Read in the signal (pulse) using the readspicepunch() function, and the
specified transnumber and the +2 transnumber should exist.
Required Arguments
pulse
Represents the signal for which CODAC should calculate the pulse
width. This should be a waveform.
number
The pulsewidth function returns the pulse width of the specified pulse
as a float value, if successful; otherwise, it returns a large floating point
value equal to 1.1E+34
358
Description
The pulsewidth function calculates the pulse width of the pulse at the
specified transition number. You should specify the pulse width as the
delay between the transition number and number+1 of the pulse.
Figure 34 shows this.
Figure 34. Measuring the Pulse Width
pulse
width
Value
pulse
width
number
number+1
Time
Example
359
Related Functions
readspicepunch()
gettransitiontime()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pulsewidth().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pulsewidth().
risetime()
The risetime function returns the rise time of the signal.
Function Usage
risetime(signal, transnum)
Prerequisites
360
Represents a waveform
transnum
If the transition moves from high level to low level, an error message is
displayed, and a large positive value is returned. If it is true rising
transition, the rise time value (float) is returned.
Description
The rise time of the signal is the time taken by the signal to rise from
the low level to the high level. You should specify the signal name and
the transition number as input.
The function finds the rise time of the signal for that transition. Figure 35
gives the time taken by a signal to rise from the high level to the low level.
361
Figure 35. Measuring the Rise Time of the Signal During a Transient
Analysis
Risetime = t2 - t1
Value
Signal
P1
M
P2
t1
High
Center
Low
t2
Time
Example
main()
{
string punchfile =delay.pun;
waveform vin;
float risevalue;
readspicepunch(punchfile);
vin = $VIN;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
risevalue = risetime(vin, 1);
print(// Rise time of the signal =, risevalue);
}
362
Related Functions
readspicepunch()
falltime()
setsigcent()
setsighigh()
setsiglow()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function risetime().
If you are using the C CODAC interface, see C CODAC Toplevel
Function risetime().
rms()
The rms function returns the root mean square (rms) value of the signal.
Function Usage
rms(signal)
or
rms(signal, starttime, endtime)
363
Required Arguments
signal
Represents the start time for calculating the rms value. This should
be a float value.
endtime
Represents the end time for calculating the rms value. This should be
a float value.
Returned value
The rms function returns the rms value of the signal between the start
time and the end time of the signal as a float value, if successful;
otherwise, it returns a large floating point value equal to 1.1E+34.
Description
The rms function calculates the rms value of the signal between the
start time and the end time. It returns the square root of the mean of
the square of the input signal.
Example
364
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function rms().
If you are using the C CODAC interface, see C CODAC Toplevel
Function rms().
settle()
The settle function returns the settling time of the waveform.
Function Usage
365
Required Arguments
signal1
Represents the minimum time for which the signal should stay within
the tolerance band to be considered as settled
Returned Value
The settle function returns the time taken by the signal to enter the
tolerance band. If the signal does not enter the specified tolerance band
or if it does not stay within the tolerance band for the minimum specified
time, then the value of 1.1E+34 is returned.
Example
This example calculates the time taken by the signal to enter the 30%
variation band (and stay within the band for at least 3 nanoseconds.)
366
Figure 36 shows how CODAC calculates the settling time for this
example.
main()
{
string
punchfile =delay.pun;
waveform
vout;
float
settlingtime;
readspicepunch(punchfile);
vout = $VOUT;
settlingtime = settle(vout, 30, 3e-9);
print(// Settling time =, settlingtime);
}
Settled value
tolerance%
Signal
-tolerance%
mintime
Settling time
t1
t2
Time
367
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function settle().
If you are using the C CODAC interface, see C CODAC Toplevel
Function settle().
skew()
The skew function calculates the skew value between two signals.
Function Usage
368
signal2
The skew function returns the skew value between two signals as a
float value, if successful; otherwise, it returns a large floating point value
that is equal to 1.1E+34.
Description
The skew function calculates the skew value between two signals. Skew
is defined as the difference of delays d1 and d2 shown in Figure 37.
369
Value
Signal1
d2
T1
T3
d1
Signal2
T2
T4
Time
Example
This example calculates the skew between two signals V OUT and V IN
at transition 1, 1, 2, and 2 respectively.
main()
{
string
punchfile =delay.pun;
waveform vout, vin;
float
skewval;
readspicepunch(punchfile);
vout = $VOUT;
vin = $VIN;
skewval = skew(vout, vin, 1, 1, 2, 2);
print(// Skew value of the signal =, skewval);
}
370
Related Functions
readspicepunch()
threshold()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function skew().
If you are using the C CODAC interface, see C CODAC Toplevel
Function skew().
slewrate()
The slewrate function returns the rate of change of the transition.
Function Usage
slewrate(signal1, transition)
Prerequisites
371
transition
Slewrate = v / t
Value
Signal
High
Center
Low
t
Time
Example
This example prints the slew rate for transition two of signal vout.
main()
{
waveform vout;
372
float slewr;
readspicepunch(delay.pun);
vcc
= $VOUT;
slewr = slewrate(vout,2);
print(// Slew rate of transition 2 =, slewr);
}
Related Functions
readspicepunch()
pulsefrequency()
pulsewidth()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function slewrate().
If you are using the C CODAC interface, see C CODAC Toplevel
Function slewrate().
slope()
The slope function calculates the slope of a curve at a given x point.
Function Usage
slope(signal, time)
373
Prerequisites
The slope function calculates the slope of the curve at a given x point.
To measure slope, CODAC:
1. Finds the differentiated signal (diffsignal).
2. Finds the y point in diffsignal at the given x point (slopevalue).
3. Returns the slope value.
Example
374
string
punchfile =delay.pun
waveform
vcc;
float
slopeval;
readspicepunch(punchfile);
vcc = $VCC;
slopeval = slope(vcc, 2e-9);
print(// The slope of VCC at 2 NS =, slopeval);
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function slope().
If you are using the C CODAC interface, see C CODAC Toplevel
Function slope().
threshold()
The threshold function calculates the threshold value of the signal.
Function Usage
375
Represents the input node for measuring the threshold. This should
be a waveform.
Returned Value
The threshold function returns the threshold value of the input node as
a float value, if successful; otherwise, it returns a large floating point
value that is equal to 1.1E+34.
Description
The threshold function calculates the threshold value of the input node
signal when the switch node makes the specified transition.
The threshold is the value of input node signal calculated at a time equal
to the transition time of the switch node at the specified number.
Figure 39 shows this.
376
innode
Value
threshold
switchnode
makes a transition
number
Time
Example
This example calculates the threshold value for V BAT signal when V VSD
signal made the transition 1.
main()
{
string
waveform
float
punchfile =ovsd.pun;
innode, switchnode;
thrvalue;
readspicepunch(punchfile);
switchnode = $VVSD;
innode
= $VBAT;
thrvalue = threshold(switchnode, 1, innode);
print(// Threshold value =, thrvalue);
}
377
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function threshold().
If you are using the C CODAC interface, see C CODAC Toplevel
Function threshold().
thresholdhysteresis()
The thresholdhysteresis function calculates the threshold hysteresis
of the signal.
Function Usage
378
Represents the input node for measuring the threshold. This should
a waveform.
Returned Value
379
threshold hysteresis = v1 - v2
v1
innode
Value
v2
switchnode
number+1
number
Time
Example
punchfile =ovsd.pun;
innode, switchnode;
thrvalue;
readspicepunch(punchfile);
switchnode = $VVSD;
innode
= $VBAT;
thrvalue = thresholdhysteresis(switchnode, 1, innode);
print(// Threshold hysteresis =, thrvalue);
}
380
Related Functions
readspicepunch()
threshold()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function thresholdhysterisis().
If you are using the C CODAC interface, see C CODAC Toplevel
Function thresholdhysterisis().
381
Plot Functions
This subsection describes the available Plot functions.
plot()
The plot function generates a PostScript file for plotting signals.
Function Usage
None.
382
Description
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function plot().
383
pltcomment()
The pltcomment function plots the specified comments.
Function Usage
pltcomment(comment [x,y])
Required Arguments
comment
None.
384
Description
385
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltcomment().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltcomment().
pltdate()
The pltdate function plots the date and time.
Function Usage
pltdate(flag)
Required Arguments
flag
None.
386
Description
If the flag is set to non-zero, the date and the time are plotted. The date
(flag=0) is not plotted, by default.
Example
387
Related Functions
pltcomment()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltdate().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltdate().
pltgrid()
The pltgrid function plots the grid.
Function Usage
pltgrid(flag)
Required Arguments
flag
None.
388
Description
If the flag is set to non-zero, the grid is plotted by default. You can turn
the grid off by setting the flag to 0.
Example
389
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltygrid().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltgrid().
pltmjrgrid()
The plymjrgrid function plots the major grid.
Function Usage
pltmjrgrid(flag)
Required Arguments
flag
None.
390
Description
If the flag is set to non-zero, the major grid is plotted. The flag is set to
zero by default.
Example
391
Related Functions
pltgrid()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltymjrgrid().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltmjrgrid().
pltportrait()
The pltportrait function plots the file in the portrait mode.
Function Usage
pltportrait(flag)
Required Arguments
flag
None.
392
Description
If the flag is set to non-zero, signals are plotted in portrait mode. The
default mode (flag=0) is landscape.
Example
393
Related Functions
pltcomment()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltportrait().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltportrait().
pltprtres()
The pltprtres specifies the printer resolution.
Function Usage
None.
Required Arguments
xdpi
An integer value to specify the dots per inch in the x direction of the
printer. For example, 500.
CODAC Function Dictionary,
394
ydpi
An integer value to specify the dots per inch in the y direction of the
printer. For example, 600.
Returned Value
The pltprtres function sets the printer resolution to the values that you
specify. The plot function uses the resolution value set
Example
main()
{
waveform w1, w2;
readspicepunch("delay.pun");
w1 = $VCC(rerun=1);
/* Set the required printer resolution */
pltprtres(600, 600);
/* Generate postscript file tmp.ps1 for signal VCC at rerun 1 */
plot("tmp.ps", w1);
/* Queue the job to the printer */
system("prf -pr hplaser -trans tmp.ps");
}
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltprtres().
395
pltxgrid()
The pltxgrid function plots the grid along the x-axis.
Function Usage
pltxgrid(flag)
Required Arguments
flag
None.
Description
If the flag is set to non-zero, the grid on the x-axis is plotted. The flag
is set to zero, by default.
Example
396
pltgrid(0);
/* Turn on the x grid only */
pltxgrid(1);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
pltgrid()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxgrid().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltxgrid().
397
pltxmax()
The pltxmax function sets the maximum value on the x-axis for the plot.
Function Usage
pltxmax(x)
Required Arguments
x
None.
Description
The pltxmax function sets the maximum value on the x-axis for the plot
to the specified value, if it is greater than the smallest time point of the
signals and greater than the largest time point of the signals.
Example
398
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets maximum value of x-axis to 2. */
pltxmax(2);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxmax().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltxmax().
399
pltxmin()
The pltxmin function sets the minimum value on the x-axis for the plot.
Function Usage
pltxmin(x)
Required Arguments
x
None.
Description
The pltxmin function sets the minimum value on the x-axis for the plot
to the specified value, if it is greater than or equal to the smallest time
point of the signals and less than the largest time point of the signals.
Example
400
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets minimum value of x-axis to 2. */
pltxmin(2);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxmin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltxmin().
401
pltxmjrgrid()
The pltxmjrgrid function plots the major grid along the x-axis.
Function Usage
pltxmjrgrid(flag)
Required Arguments
flag
None.
Description
If the flag is set to non-zero, the major grid on the x-axis is plotted. The
flag is set to zero by default.
Example
402
pltgrid(0);
/* Turn on the x major grid only */
pltxmjrgrid(1);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
pltgrid()
readspicepunch()
pltxorigin()
The pltxorigin function sets the origin of x-axis of the plot.
Function Usage
pltxorigin(x)
Required Arguments
x
CODAC Function Dictionary,
403
None
Description
The pltxorigin function sets the origin of x-axis of the plot to the
specified point.
Example
404
Related Functions
readspicepunch()
pltxscale()
The pltxscale function plots the scale of the x-axis to the specified value.
Function Usage
pltxscale(x)
Required Arguments
x
None.
Description
The pltxscale function sets the scale on the x-axis of the plot to the
specified value.
405
Example
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxscale().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltxscale().
406
pltxunits()
The pltxunits function sets the units on the x-axis for the plot.
Function Usage
pltxunits(str)
Required Arguments
str
None.
Description
This example displays seconds as the unit for the x-axis of the plot.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
407
w1 =$VCC{rerun=1};
/* Displays seconds as the unit for the x-axis of the
plot */
pltxunits(seconds);
/* Generates postscript file tmp.ps1 for signal VCC at
rerun 1 */
plot(tmp.ps, w1);
/* Queues the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generates postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queues the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxunits().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltxunits().
pltygrid()
The pltygrid function plots the grid along the y-axis.
408
Function Usage
pltygrid(flag)
Required Arguments
flag
None.
Description
If the flag is set to non-zero, the grid on the y-axis is plotted. The flag
is set to zero by default.
Example
409
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
Related Functions
pltgrid()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltygrid().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltygrid().
pltymax()
The pltymax function sets the maximum value on the y-axis for the plot.
Function Usage
pltymax(y1)
410
Required Arguments
y1
None.
Description
The pltymax function sets the maximum value on the y-axis for the plot
to y1, if it is greater than the dip value of any of the signals and less
than or equal to the peak value of any of the signals.
Example
This example sets the maximum value of y-axis for a plot to two inches.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets maximum value of y-axis for plot to 2. */
pltymax(2);
/* Generates postscript file tmp.ps1 for signal VCC at
rerun 1 */
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generates postscript file tmp.ps2 for signal VCC at
411
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltymax().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltymax().
pltymin()
The pltymin function sets the minimum value on the y-axis for a plot.
Function Usage
pltymin(y1)
Required Arguments
y1
412
Returned Value
None.
Description
The pltymin function sets the minimum value on the y-axis for a plot to
y1, if it is greater than or equal to the dip value of any of the signals and
less than the peak value of any of the signals.
Example
This example sets the minimum value of y-axis for a plot to two inches.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets minimum value of y-axis for plot to 2. */
pltymin(2);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
413
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltymin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltymin().
pltymjrgrid()
The pltymjrgrid function plots the major grid along the y-axis.
Function Usage
pltxgrid(flag)
Required Arguments
flag
None.
414
Description
If the flag is set to non-zero, CODAC plots the major grid on the y-axis.
The flag is set to zero by default.
Example
415
Related Functions
pltgrid()
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltymjrgrid().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltymjrgrid().
pltyorigin()
The pltyorigin function sets the origin of y-axis of the plot.
Function Usage
pltyorigin(y)
Required Arguments
y
None.
416
Description
The pltyorigin function sets the origin of y-axis of the plot to the
specified point.
Example
417
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltyorigin().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltyorigin().
pltyscale()
The pltyscale function specifies the scale on the y-axis of the plot.
Function Usage
pltyscale(y)
Required Arguments
y
None.
418
Description
The pltyscale function sets the scale on the y-axis of the plot to the
specified value.
Example
419
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltyscale().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltyscale().
pltyunits()
The pltyunits function sets the units on the y-axis for the plot.
Function Usage
pltyunits(str)
Required Arguments
str
None.
420
Description
This example displays volts as the unit for the y-axis of the plot.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Displays volts as the unit for the y-axis of the plot */
pltyunits(volts);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/
plot(tmp.ps, w1);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
/* Generate postscript file tmp.ps2 for signal VCC at
rerun 1 and signal VGG */
plot(tmp.ps, w1, w2);
/* Queue the job to the printer */
system(prf -pr hplaser -trans tmp.ps);
}
421
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function pltxunits().
If you are using the C CODAC interface, see C CODAC Toplevel
Function pltyunits().
422
Miscellaneous Functions
This subsection describes the other functions available.
copyfile()
The copyfile function copies files.
Function Usage
copyfile(sourcefile, destinationfile)
Prerequisites
The sourcefile must exist and have read permissions. The destinationfile
must be valid and have write permissions to copy.
Required Arguments
sourcefile
Specifies the name of the target file where the specified source file
needs to be copied
Returned Value
423
Description
The copyfile function allows you to copy the specified source file to the
target file. The specified source file should exist, and you must have
the read permissions. The specified destination directory or file should
be valid, and you must have write permissions for copying.
Example
deletefile()
The deletefile function deletes the specified file from the directory.
Function Usage
deletefile(filename)
Prerequisites
The file should exist, and you must have the permissions to delete it.
Required Arguments
filename
424
Returned Value
The deletefile function deletes the specified file from a directory. This
file should exist, and you must have permissions to delete it.
Example
This example deletes the file delay.pun from the current directory.
main()
{
deletefile(delay.pun):
}
exit()
The exit function exits CODAC.
Function Usage
exit(int1)
Required Arguments
int1
425
Returned Value
The exit function exits the program with the input argument as the
returned code.
Example
freepunchfile()
The freepunchfile function frees up the memory occupied by signals
in a punchfile.
Function Usage
freepunchfile(punchfilename)
Prerequisites
426
Required Arguments
punchfilename
None.
Description
In this example, CODAC deletes the punchfile from the memory after it
calculates the performance functions.
main()
{
string
waveform
float
punchfile =delay.pun;
vcc;
delay1;
readspicepunch(punchfile);
vcc = $VCC;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
setreftime(5.0e-10, vcc);
427
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function freepunchfile().
If you are using the C CODAC interface, see C CODAC Toplevel
Function freepunchfile().
freewave()
The freewave function releases the memory that the specified signal
occupies.
Function Usage
freewave (signal_name)
Prerequisites
None
428
Required Arguments
signal_name
No return value.
Description
The freewave function frees up the memory that the specified signal
occupies. CODAC may either read the signal from the punch file or
generate it.
Example
main()
{
string punchfile = "delay.pun";
waveform vcc;
float
delay1;
readspicepunch(punchfile);
vcc = $VCC;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
setreftime(5.0e-10, vcc);
delay1 = gethightime(vcc, 1);
print("// High time on transition ", delay1);
freewave(vcc);
}
429
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function freewave().
If you are using the C CODAC interface, see C CODAC Toplevel
Function freewave().
histogram()
The histogram function converts the input signal values to histogram
format.
Function Usage
histogram(signal, [noofbins])
Required Arguments
signal
Returns a waveform
430
Description
This example converts signal VCC into histogram format with four bins.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 = $VCC;
w2 = histogram(w1,4);
}
431
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function histogram().
If you are using the C CODAC interface, see C CODAC Toplevel
Function histogram().
rbinomial()
The rbinomial function returns a random integer value drawn from a
binomial distribution of n trials each of probability pp
Function Usage
432
Description
This example runs a Spice deck multiple times and reports the time at
which the signal reaches the high value in the first transition. The
program specifies the value of the parameter, PWMI according to the
random number it generates. The random numbers generated are
between zero and hundred.
main()
{
string basedeck = "delay.spi", Newdeck, ModStr;
waveform vcc;
float
delay1;
int i, Index = 10, BinNum;
while(i < Index)
{
BinNum = rbinomial(0.3, 99);
ModStr = "PWM1 " + str(1 + BinNum);
Newdeck = addcards(basedeck, ModStr);
invokespice3(Newdeck);
readspicepunch(Newdeck + ".pun");
vcc = $VCC;
delay1 = gethightime(vcc, 1);
print("// High time on transition ", delay1);
freewave(vcc);
i++;
433
Related Functions
rnormal()
rpoisson()
runiform()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function rbinomial().
If you are using the C CODAC interface, see C CODAC Toplevel
Function rbinomial().
rnormal()
The rnormal function returns a normally distributed random number.
Function Usage
rnormal(sigma)
Required Arguments
sigma
434
Description
Related Functions
setseed()
rnormal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function rnormal().
If you are using the C CODAC interface, see C CODAC Toplevel
Function rnormal().
435
rpoisson()
The rpoisson function returns a random integer value drawn from a
poisson distribution of mean xm.
Function Usage
rpoisson(float xm)
Required Arguments
xm
The rpoisson function returns an integer value that is close to the mean
that you specify.
Example
This example runs a spicedeck multiple times and reports the time at
which the signal reaches the high value in the first transition. The
program generates this value, using rpoisson with mean xm, for the
different set of parameters that you specify.
main()
{
string basedeck = "delay.spi", Newdeck, ModStr;
waveform vcc;
float
delay1;
int i, Index = 100;
436
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function rpoisson().
If you are using the C CODAC interface, see C CODAC Toplevel
Function rpoisson().
runiform()
The runiform function returns an evenly distributed random number.
Function Usage
runiform(sigma, algorithm)
Required Arguments
sigma
437
algorithm
The runiform function returns a random number with an even (0, sigma)
distribution. Pierre LEcuyers multiplicative linear congruential
algorithm is used by default.
The period of this generator is
(m1 - 1)(m2 - 1)/2 ~ 2.3e+18. If the value of the algorithm is set to
non-zero, D.H. Lehmers parametric multiplicative linear congruential
algorithm is used. The period of this generator is 2^31 - 1.
Example
Related Functions
setseed()
rnormal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function runiform().
CODAC Function Dictionary,
438
setpath()
The setpath function sets the current working directory pathname.
Function Usage
setpath(str_val)
Required Arguments
str_val
None.
Description
The setpath function sets the current working directory to the pathname
specified by the argument str_val.
Example
*/
CODAC Function Dictionary,
439
Related Functions
invokespice3()
Invokes TI Spice3
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setpath().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setpath().
setreltol()
The setreltol function sets the relative tolerance for the floating point
logical operators.
Function Usage
setreltol(float1)
440
Required Arguments
float1
A float variable
Description
The setreltol function sets the relative tolerance for the floating point
logical operators == and !=. By default, the tolerance for comparison is
zero.
If you invoke this function all the future waveform == and != operators
compare the values of the operand waveforms within the relative
tolerance value float to determine success or failure of the comparison.
Example
main()
{
int result;
float f1 = 5.0;
float f2 = 4.0;
setreltol(0.2);
result = f1 == f2;
print(result);
}
The above program prints the value 1 since the relative difference =
(f1-f2)/f1 is less than or equal to the relative tolerance value specified.
441
setseed()
The setseed function sets the seed for the runiform() and rnormal()
functions.
Function Usage
setseed(seed)
Required Arguments
seed
None.
Description
The setseed function sets the seed for the random number generator
for the functions runiform() and rnormal().
Example
This example initializes the seed for the normal random number
generator to 32.
main()
{
float rand;
setseed(32);
442
rand = rnormal(3);
}
Related Functions
rbinomial()
rnormal()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function setseed().
If you are using the C CODAC interface, see C CODAC Toplevel
Function setseed().
sigcase()
The sigcase function toggles between upper and lowercase for signal
names.
Function Usage
sigcase()
Required Arguments
None.
Returned Value
None.
CODAC Function Dictionary,
443
Description
In this example, calling sigcase() the first time makes the signal V IN in
the punchfile accessible as vin. Calling sigcase() the second time
restores the default mode. You have to specify the signal name as V IN
to be accessible.
main()
{
string
punchfile =spice.pun;
waveform
vin;
readspicepunch(punchfile);
sigcase();
/* signal names are case insensitive beyond this point */
vin = $vin;
sigcase();
/* signal names are case sensitive beyond this point */
vin = $VIN;
}
444
Related Functions
readspicepunch()
If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function sigcase().
If you are using the C CODAC interface, see C CODAC Toplevel
Function sigcase().
system()
The system function executes any command typed in the shell prompt.
Function Usage
system(command_string)
Prerequisites
None.
Required Arguments
445
Description
446
Optimizer Functions
The optimizer functions are:
getmeasval()
The getmeasval function returns the value of the variable you specify.
Function Usage
getmeasval(variable_id, access_type)
Prerequisites
Use the punch command to punch the variable before using this
function.
Required Arguments
variable_id
Specifies the integer variable containing the return value of the punch
function, for the variable you need the program to punch.
access_type
Specifies the access type of the integer variable. You can set it to an
integer value of either one or zero.
Returned Value
447
Description
The getmeasval function returns the best value of the variable upto the
current iteration, if you have set access_type to an integer value of zero.
If you set access_type to an integer value of non-zero, getmeasval
returns the value of the variable in the current iteration.
Example
#include "CalDCTRvals.k"
main()
{
float Iwdith, Cwdith;
int RiseDel_Id, FallDel_Id, Vih_Id, Vil_Id;
optspicedeck("Buffer.dc","Buffer.tr");
optiterations(800);
optparameter("mphv1 l", 1.2, 100, 1.7);
optparameter("mphv1 w", 2.0, 200, 30);
optparameter("mphv1 l", 1.2, 100, 1.8);
optparameter("mphv1 w", 2.0, 200, 20);
optsimplex
{
RiseDel_Id = optimize(RiseDel, 1.5e-9, 2.4e-9);
/* Returns the best value till the current iteration */
optgetobj( RiseDel_Id, 0);
FallDel_Id = optimize(FallDel, 1.5e-9, 2.4e-9);
/* Returns the value in the current iteration */
optgetobj(FallDel_Id, 1);
Vih_Id = punch(Vih);
/* Returns the best value till the current iteration */
getmeasval(Vih_Id, 0);
Vil_Id = punch(Vil);
/* Returns the value in the current iteration */
print("Vil = ",getmeasval(Vil_Id, 1));
448
}
}
readspicepunch("delay.spi.weak.pun");
Tplh_w = delay($VY, 1, $VA, 1);
Tphl_w = delay($VY, 2, $VA, 2);
Tavg_w = Oper((Tplh_w+Tphl_w)/2);
optimize(Tphl_w, 3.55, 5,"=");
optimize(Tplh_w, 3.55, 5,"=");
optconstraint(Tavg_w, 2.00, 5);
}
}
Related Functions
punch()
optconstraint()
The optconstraint function allows you to specify objectives as
constraints. This function generates an optimized solution that satisfies
the constraint condition.
Function Usage
None.
449
Required Arguments
objective
Returns the integer one if the objective value is outside the range, and
zero if it lies within the range.
Description
450
optspicedeck("delay.spi.weak");
optparameter("PWMN1", 1.0, 100, 2.7, 0.10, 2.0);
optparameter("PWMN3", 1.0, 100, 23.7, 0.10, 2.0);
optgangparam("PWMN2",
1.00,
"PWMN1");
optiterations(300);
optsimplex
{
readspicepunch("delay.spi.weak.pun");
Tplh_w = delay($VY, 1, $VA, 1);
Tphl_w = delay($VY, 2, $VA, 2);
Tavg_w = Oper((Tplh_w+Tphl_w)/2);
optimize(Tphl_w, 3.55, 5,"=");
optimize(Tplh_w, 3.55, 5,"=");
optconstraint(Tavg_w, 2.00, 5);
}
}
Related Functions
optimize()
optgangparam()
The optgangparam function sets the dependent parameter value as a
ratio of independent parameter value.
Function Usage
451
Required Arguments
dependent_param
452
Example
453
Related Functions
optparameter()
optgetiterval()
The optgetiterval function returns the current iteration number.
Function Usage
optgetiterval()
Prerequisites
None.
Required Arguments
None.
Returned Value
454
Description
455
printf("Cin
=%e\n\n",CinVal);
Related Functions
optgetobj()
The optgetobj function returns the objective value you specify.
Function Usage
None.
Required Arguments
objective_id
Specifies the integer variable that has the return value of the optimize
function for the objective function.
access_type
Specifies the access type of the integer variable. You can set it either
to an integer value of either one or zero.
456
Returned Value
In this example, the program optimizes the delay, Vih, Vil of the of the
The function definition of CalDC() and CalTR() are present in the file,
CalDCTRvals.k.
#include "CalDCTRvals.k"
main()
{
float Iwdith, Cwdith;
int RiseDel_Id, FallDel_Id, Vih_Id, Vil_Id;
optspicedeck("Buffer.dc","Buffer.tr");
optiterations(800);
optparameter("mphv1 l", 1.2, 100, 1.7);
optparameter("mphv1 w", 2.0, 200, 30);
optparameter("mphv1 l", 1.2, 100, 1.8);
optparameter("mphv1 w", 2.0, 200, 20);
optsimplex
{
RiseDel_Id = optimize(RiseDel, 1.5e-9, 2.4e-9);
/* Returns the best value till the current iteration */
optgetobj( RiseDel_Id, 0);
FallDel_Id = optimize(FallDel, 1.5e-9, 2.4e-9);
/* Returns the value in the current iteration */
CODAC Function Dictionary,
457
optgetobj(FallDel_Id, 1);
Vih_Id = optimize(Vih, 1.95, 2.00);
/* Returns the best value till the current iteration */
optgetobj(Vih_Id, 0);
Vil_Id = optimize(Vil, 0.80, 0.75);
/* Returns the value in the current iteration */
print("Vil_Id = ",optgetobj(Vil_Id, 1));
}
}
Related Functions
optimize()
optgetparam()
The optgetparam function returns the parameter value you specify.
Function Usage
access_type
Specifies the access type of the integer variable. You can set it either
to an integer value of zero or one.
CODAC Function Dictionary,
458
Returned Value
In this example, the program optimizes the delay, Vih, Vil, and the area
of the transistors. The function definition of CalDC() and CalTR() are
present in the file, CalDCTRvals.k.
#include"CalDCTRvals.k"
main()
{
float Iwdith, Cwdith;
optspicedeck("Buffer.dc","Buffer.tr");
optiterations(800);
optparameter("mphv1 l", 1.2, 100, 1.7);
optparameter("mphv1 w", 2.0, 200, 30);
optparameter("mnhv1 l", 1.2, 100, 1.8);
optparameter("mnhv1 w", 2.0, 200, 20);
Iwidth = optgetparam("mphv1 w");
Iwidth += optgetparam("mnhv1 w");
optsimplex
{
459
}
Related Functions
optparameter()
optimize()
optimize()
The optimize function specifies the circuit performance variable to be
optimized.
Function Usage
460
Required Arguments
objective
Specifies the final value that you want the optimizer to achieve
wt
461
Example
main()
{
float ug_bandwidth, phase_margin;
string acspicedeck, punchfile;
waveform vpout, vdout;
acspicedeck = "opamp.spi";
punchfile
= acspicedeck + ".pun";
optspicedeck(acspicedeck);
optparameter("PCC",0.1e-06);
optiteration(200);
optsimplex
{
readspicepunch(punchfile);
vpout = $VPOUT;
vdout = $VDOUT;
ug_bandwidth = getx(vdout,xpoint(vdout,0));
phase_margin = phasemargin(vdout,vpout);
optimize(ug_bandwidth,100e06,2,">");/* Higher priority,twice
important */
/* than phase_margin
*/
optimize(phase_margin,60,1,"<");
/* Low priority */
}
}
}
462
Related Functions
optparameter()
optiterations()
The optiterations function specifies the maximum number of iterations
during the optimization process.
Function Usage
optiteration (num_of_iterations)
Prerequisites
None.
Required Argument
num_of_iterations
463
Description
In this example, the function optimizes the bandwidth at unit gain and
phase margin of an operational amplifier.
main()
{
float ug_bandwidth, phase_margin;
string acspicedeck, punchfile;
waveform vpout, vdout;
acspicedeck = "opamp.spi";
punchfile = acspicedeck + ".pun";
optspicedeck(acspicedeck);
optparameter("PCC", 0, 1e-06);
optiterations(200);
optsimplex
{
readspicepunch(punchfile);
vpout = $VPOUT;
vdout = $VDOUT;
ug_bandwidth
= getx(vdout,0.0,xpoint(vdout,0));
phase_margin
= phasemargin(vdout,vpout);
optimize(ug_bandwidth, 100e+06, 1);
optimize(phase_margin, 059.5, 360);
}
}
464
Related Functions
optimize()
optparameter()
optparameter()
The optparameter function specifies the circuit components to be varied
in the optimization process.
Function Usage
465
Optional Arguments
start_value
min_length
variance
term_value
Returned Value
466
Description
467
Related Functions
optimize()
optspicedeck()
The optspicedeck function specifies the Spice decks used in the
optimization process.
Function Usage
None.
Required Arguments
spicedeck1, spicedeck2,......
468
Returned Value
469
Description
The Spice decks you specify in the arguments are taken as the input to
the optimizer. It should consist of:
Netlist specifications
Control sources and analysis
Punch statement
Input stimuli
Use the function outside the Optsimplex Construct block (See Chapter
5 of CODAC Manual - CODAC Optimizer - Optsimplex Construct).
Example
This example finds the difference between the source and sink current.
It optimizes to match them and tries to increase these currents. Isource
and Isink are measured using simulation of two different Spice decks
namely Iso.spi and Isi.spi.
float lsou, lsin;
float IsoDiffIsi(string IsoPunch,string IsiPunch)
{
waveform Iso, Isi;
float IsoVal, IsiVal;
readspicepunch(IsoPunch);
Iso = $IVY;
Isou = fabs(ypoint(Iso,0));
readspicepunch(IsiPunch);
Isi = $IVY;
Isin = fabs(ypoint(Isi,0));
return (fabs(Isou - Isin));
470
}
main()
{
float DiffCurnt;
optspicedeck("Isi.spi","Iso.spi");
optparameter("MO1 W",10,150,25.00);
optparameter("MO2 W",10,150,35.00);
optparameter("MO3 W",10,150,100.00);
optparameter("MO4 W",10,150,70.00);
optiterations(800);
optsimplex
{
DiffCurnt = IsoDiffIsi("Iso.spi.pun","Isi.spi.pun");
optimize(Isin,9e-03,8e-03);
optimize(Isou,9e-03,8e-03);
optimize(DiffCurnt,0,4e-03);
}
Related Functions
optimize()
optparameter()
471
optsumparam()
The optsumparam function returns the sum of the parameter values at
current iteration.
Function Usage
optsumparam();
or
optparamsum (param_name1, param_name2,...)
Optional Arguments
param_name1, param_name2,...
472
Related Functions
optparameter()
473
punch()
The punch function prints the value of the variable specified as its
argument, at the end of each iteration, into the data file that the optimizer
generates.
Function Usage
punch (variable)
Prerequisites
Declare only float or int type variables. Specify at least one optimize
function for the program to run.
Required Arguments
At the end of every iteration, the optimizer updates the data file that
CODAC generates, with the value of the punch function argument .The
optimizer simulates the given circuit and prints the value of this
argument at the best vertex, for each iteration.
474
Related Functions
optimize()
475
delay()
For the function description, see delay(). An example for the delay()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac qw(delay readspicepunch);
my $punch = readspicepunch("inv.pun");
# the following line selects v2 with temp=25 and run=1
my $v2 = $punch->findsignal("V2", -temp => 25, -run => 1);
# the following line selects v3 with temp=25 and rerun = 0 and run =1
my $v3 = $punch->findsignal
("V3", -temp => -55, -run => 1, -rerun => 0);
my $delay1 = delay($v3, 1, $v2, 1);
print("// Delay between ", $v2->getsigname, " and ",
$v3->getsigname, " = ", $delay1 * 1e09, " ns\n");
476
delaych()
For the function description, see delaych(). An example for the delaych()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib $ENV{PERLCODACLIB};
#this requires the environment variable PERLCODACLIB to be set to the
#library path
#or
#the conventional way to do access the library
#use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delaych);
my $punch = Codac::readspicepunch("examples/input/invt.pun");
my $vin = $punch->find("VIN");
my $vout = $punch->findsignal("VOUT");
my $vc;
# set signal levels for transition measurements
$vc = $vin +$vout;
$vc->writesignal("../output/delaych.out",1);
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delaych($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delaylc()
For the function description, see delaylc(). An example for the delaylc()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delaycl);
my $punch = Codac::readspicepunch("invt.pun");
CODAC Function Dictionary,
477
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delaycl($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delayhc()
For the function description, see delayhc(). An example for the delayhc()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delayhc);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayhc($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
478
delayhh()
For the function description, see delayhh(). An example for the
delayhh() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delayhh);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayhh($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delayhl()
For the function description, see delayhl(). An example for the delayhl()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delayhl);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayhl($vout, 1, $vin, 1);
CODAC Function Dictionary,
479
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delaycl()
For the function description, see delaycl(). An example for the delaycl()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delaylc);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delaylc($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delaylh()
For the function description, see delaylh(). An example for the delaylh()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delaylh);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
480
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delaylh($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delayll()
For the function description, see delayll(). An example for the delayll()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delayll);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayll($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n")
delayoff()
For the function description, see delayoff(). An example for the delay()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
#use Codac;
use Codac qw(delayoff);
481
Codac::setpath("/user/perluser/proj_data/perl/codac/demo/demo1");
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayoff($vout, 1, $vin, 1);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
delayxx()
For the function description, see delayxx(). An example for the delayxx()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(delayxx);
my $punch = Codac::readspicepunch("invt.pun");
my $vin
= $punch->findsignal("VIN");
my $vout = $punch->findsignal("VOUT");
# set signal levels for transition measurements
$punch->setsiglow (0.5);
$punch->setsigcent(2.5);
$punch->setsighigh(4.5);
# calculate delay between IN and OUT node
my $delay1 = delayxx($vout, 1,1.0, $vin, 1,1.0);
# print delay
print("// Delay between IN and OUT = ", $delay1,"\n");
482
freewave()
For the function description, see freewave(). An example for the
freewave() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $punch = Codac::readspicepunch("input/inpbuf.stim.pun");
my $vin;
my $vout;
my $vb;
$vin = $punch->findsignal("VIN");
$vout = $punch->findsignal("VOUT");
$vb = Codac::Waveform::getcrosses($vin, $vout);
print("num crosses = ", $vb,"\n");
Codac::Waveform::freewave($vin);
Codac::Waveform::freewave($vout);
getsrvrstatus()
For the function description, see getsrvrstatus(). An example for the
getsrvrstatus() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(invokespicesrvr getsrvrstatus sndsrvrmodify
stopspicesrvr setspice3path);
my $deck = "delay.spi";
my $va = "*SPICE DECK TO TEST SERVER FUNCTIONS\n";
$id = invokespicesrvr($deck);
while(!getsrvrstatus($id)) {print("wait\n");};
sndsrvrmodify($id, $va);
while(!getsrvrstatus($id)) {print("wait\n");};
stopspicesrvr($id);
483
invokespicesrvr()
For the function description, see invokespicesrvr(). The example for the
invokespicesrvr() function in Perl CODAC is the same as
getsrvrstatus().
invokespice3()
For the function description, see invokespice3(). An example for the
invokespice3() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(invokespice3);
my $deck = "amp";
my $vb = "amp.mod";
my $test = "print";
my $test1 = "punch";
my $va = "*SPICE DECK TO TEST ADDCARDS FUNCTION";
Codac::Punch::caddcards($deck, $vb, $va);
invokespice3($vb, $test, $test1);
readspicepunch()
For the function description, see readspicepunch(). The returned value
is a punch file. An example for the readspicepunch() function in Perl
CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $punch = Codac::readspicepunch("input/inpbuf.stim.pun");
my $vb = $punch->firstsignal();
my $vd;
484
while($vd = $vb->nextsignal()) {
$vc = Codac::Waveform::getsigname($vd);
print("signalname is ",$vc,"\n");
$vb = $vd;
}
readwave()
For the function description, see readwave(). An example for the
readwave() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $punch = Codac::readspicepunch("input/test.pun");
my $vc = "VA";
my $test = "105.000";
my $test2 = "1";
my $rr = 0;
$vb = Codac::readwave("../input/test.pun", $vc,$test,$test2,$rr);
$vb->writesignal("../output/result.pun",1);
rbinomial()
For the function description, see rbinomial(). An example for the
rbinomial() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $prob = "0.5";
my $trial = 10;
my $mean = "1";
Codac::setseed(52);
my $rand = Codac::rnormal(3);
print($rand, "\n");
485
rnormal()
For the function description, see rnormal(). The example for the
rnormal() function in Perl CODAC is the same as rbinomial().
rpoisson()
For the function description, see rpoisson(). The example for the
rpoisson() function in Perl CODAC is the same as rbinomial().
486
runiform()
For the function description, see runiform(). The example for the
runiform() function in Perl CODAC is the same as rbinomial().
setlevels()
For the function description, see setlevels(). An example for the
setlevels() function in Perl CODAC is:
#!/usr/local/bin/perl
#this is for the function diff
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(readspicepunch);
my $punch = readspicepunch("example/example.pun");
my $va = $punch->findsignal("VX11Y");
my $vb = $punch->findsignal("VX31Y");
my $vc;
$va->writesignal("orig.pun");
Codac::setlevels(2,5);
$vc = Codac::Waveform::digitize($va,">=",$vb);
$vc->writesignal("result.pun",1);
setpath()
For the function description, see setpath(). An example for the setpath()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(readwave);
Codac::setpath("examples/input");
my $punch = Codac::readspicepunch("inpbuf.stim.pun");
if (my $vin = Codac::Waveform::sigexists("VIN")) {
$vin = readwave("inpbuf.stim.pun","VIN");
487
my $vc;
$vc = Codac::Waveform::getsigcent($vin);
print("sigcent= ", $vc,"\n");
$vc = Codac::Waveform::getsiggp($vin);
print("getsiggp= ", $vc,"\n");
$vc = Codac::Waveform::getsighigh($vin);
print("sighigh= ", $vc,"\n");
$vc = Codac::Waveform::getsiglow($vin);
print("siglow= ", $vc,"\n");
$vc = Codac::Waveform::getsigname($vin);
print("signame = ", $vc,"\n");
Codac::setreftime(1.00e-9, $vin);
Codac::setsiglow(0.2, $vin);
Codac::setsigcent(1.00, $vin);
Codac::setsighigh(3.00, $vin);
Codac::setsiggp(1.00e-9, $vin);
Codac::Waveform::setsigname($vin,"MYSIG");
$vc = Codac::Waveform::getsigcent($vin);
print("sigcent= ", $vc,"\n");
$vc = Codac::Waveform::getsiggp($vin);
print("getsiggp= ", $vc,"\n");
$vc = Codac::Waveform::getsighigh($vin);
print("sighigh= ", $vc,"\n");
$vc = Codac::Waveform::getsiglow($vin);
print("siglow= ", $vc,"\n");
$vc = Codac::Waveform::getsigname($vin);
print("signame = ", $vc,"\n");
Codac::Punch::setreftime($punch,2.00e-9);
Codac::Punch::setsiglow($punch ,0.4 );
Codac::Punch::setsigcent($punch ,3.00);
Codac::Punch::setsighigh($punch ,3.50);
Codac::Punch::setsiggp($punch ,2.00e-9);
$vc = Codac::Waveform::getsigcent($vin);
488
setseed()
For the function description, see setseed(). The example for the
setseed() function in Perl CODAC is the same as rbinomial().
setspice3path()
For the function description, see setspice3path(). An example for the
setspice3path() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw(invokespice3 setspice3path);
my $deck = "amp";
my $vb = "amp.mod";
my $test = "print";
my $test1 = "punch";
my $va = "*SPICE DECK TO TEST ADDCARDS FUNCTION";
Codac::Punch::caddcards($deck , $vb , $va);
setspice3path("/user/csraghu/open");
invokespice3($vb , $test , $test1);
489
sigcase()
For the function description, see sigcase(). An example for the sigcase()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
Codac::sigcase();
my $vc = "va";
$vb = Codac::readwave("examples/input/test.pun", $vc);
Codac::Waveform::writesignal($vb ,"result.pun",1);
stopspicesrvr()
For the function description, see stopspicesrvr(). The example of the
stopspicesrvr() function in Perl CODAC is the same as getsrvrstatus().
sndsrvrmodify()
For the function description, see sndsrvrmodify(). The example for the
sndsrvrmodify() function in Perl CODAC is the same as getsrvrstatus().
stopsrvrstatus()
The example for the stopsrvrstatus() function in Perl CODAC is the
same as getsrvrstatus().
490
thresholdsignal()
For the function description, see thresholdsignal(). The returned value
is int. The example for the thresholdsignal() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib $ENV{PERLLIB};
use Codac ;
my $punch = Codac::readspicepunch("../input/test.pun");
my $va = Codac::thresholdsignal(1.0,1);
print $va;
my $vb = Codac::thresholdsignal(1.0,2);
print $vb;
my $vc = Codac::thresholdsignal(1,0);
print $vc;
491
abspeak()
For the function description, see abspeak(). An example for the
abspeak() function in Perl CODAC is :
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac ;
my $punch = Codac::readspicepunch("input/inpbuf.stim.pun");
my $va = $punch->findsignal("VIN");
my $vb = $punch->findsignal("VOUT");
my $vc;
$vc = Codac::Waveform::peak2peak($va ,0.00, 1e-7 );
print("peak to peak value = ",$vc,"\n");
$vc = Codac::Waveform::abspeak($va ,0.00, 1e-7 );
print("abspeak value = ",$vc,"\n");
$vc = Codac::Waveform::dip($va ,0.00, 1e-7 );
print("dip = ",$vc,"\n");
$vc = Codac::Waveform::crosstime($va ,$vb, 1 );
print("crosstime = ",$vc,"\n");
$vc = Codac::Waveform::crossvalue($vb ,$va, 1 );
print("crossvalue = ",$vc,"\n");
$vc = Codac::Waveform::dutycycle($va , 1 );
print("dutycycle = ",$vc,"\n");
$vc = Codac::Waveform::pulsefrequency($va , 1 );
print("pulsefrequency = ",$vc,"\n");
$vc = Codac::Waveform::pulseperiod($va , 1 );
print("pulseperiod = ",$vc,"\n");
$vc = Codac::Waveform::pulsewidth($va , 1 );
print("pulsewidth = ",$vc,"\n");
CODAC Function Dictionary,
492
$vc = Codac::Waveform::risetime($va , 1 );
print("risetime = ",$vc,"\n");
$vc = Codac::Waveform::falltime($va , 2 );
print("dutycycle = ",$vc,"\n");
$vc = Codac::Waveform::slewrate($va , 2 );
print("slewrate at second transition = ",$vc,"\n");
$vc = Codac::Waveform::slope($va ,1.00e-7 );
print("slope at time 1e-7 = ",$vc,"\n");
$vc = Codac::Waveform::peak($va ,0.00, 1e-7 );
print("peak = ",$vc,"\n");
$vc = Codac::Waveform::rms($va ,0.00, 1e-7 );
print("rms value = ",$vc,"\n");
$vc = Codac::Waveform::settle($va ,5, 1e-9 );
print("settle = ",$vc,"\n");
$vc = Codac::Waveform::skew($va ,$vb , 1,1 ,2,2 );
print("skew = ",$vc,"\n");
$vc = Codac::Waveform::peak($va );
print("peak = ",$vc,"\n");
addpoints()
For the function description, see addpoint(). An example for the
addpoints() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac;
my $newwav = Codac::Waveform::getnewwave();
$newwav = Codac::Waveform::addpoints( $newwav, 0.0,0.0);
Codac::Waveform::getsigname($newwav);
$newwav = Codac::Waveform::addpoints($newwav,1.0,1.0);
Codac::Waveform::writesignal($newwav,"addpt.pun");
$newwav = Codac::Waveform::addpoints($newwav,2.0,2.0);
Codac::Waveform::writesignal($newwav,"addpt.pun");
$newwav = Codac::Waveform::addpoints($newwav,3.0,3.0);
Codac::Waveform::writesignal($newwav,"addpt.pun");
493
average()
For the function description, see average(). An example for the
average() function in Perl CODAC is:
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = Codac::readspicepunch("inbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $iv1 = $punch->findsignal("IV1");
my $vb;
$vb= Codac::Waveform::average($vin, $start = "0.00",
$end = "1.00e-6");
print "average = ", $vb ,"\n";
bandwidth()
For the function description, see bandwidth(). An example for the
bandwidth() function in Perl CODAC is:
#!/usr/local/bin/perl
, 0 );
494
print("gainmargin = ",$vc,"\n");
$vc = Codac::Waveform::phaseatgain($vb ,$va, 1 );
print("phase at gain = ",$vc,"\n");
$vc = Codac::Waveform::phasemargin($va ,$vb, 0 );
print("phasemargin = ",$vc,"\n");
crosstime()
For the function description, see crosstime(). The example for the
abspeak() function in Perl CODAC is the same as in abspeak().
crossvalue()
For the function description, see crossvalue(). The example for the
crossvalue() function in Perl CODAC is the same as in abspeak().
diff()
For the function description, see diff(). An example for the diff() function
in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = new
Codac::readspicepunch("/input/inpbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $iv1 = $punch->findsignal("IV1");
my $vb;
$vb= Codac::Waveform::diff($vin);
$vb->writesignal("../output/diff.pun",1)
495
digitize()
For the function description, see digitize() . An example for the digitize()
function in Perl CODAC is:
#!/usr/local/bin/perl
#this is for the function diff
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = new Codac::readspicepunch("/input/test.pun");
my $va = $punch->findsignal("VA");
my $vb = $punch->findsignal("VB");
my $vc;
$va->writesignal("../output/orig.pun");
Codac::setlevels(2,5);
$vc = Codac::Waveform::digitize($va,">=",$vb);
$vc->writesignal("../output/result.pun",1);
dip()
For the function description, see dip(). The example for the dip() function
in Perl CODAC is the same as in abspeak().
dutycycle()
For the function description, see dutycycle(). The example for the
dutycycle() function in Perl CODAC is the same as in abspeak().
falltime()
For the function description, see falltime(). The example for the
falltime() function in Perl CODAC is the same as in abspeak().
CODAC Function Dictionary,
496
findsignal()
Use this function instead of the $ and @ character representation of
waveforms.
Function usage
signal_name, punchfile
Prerequisite
Before using this function, read the punchfile containing the waveform
signal_name into the punch file variable.
Returned value
Waveform in $waveform
Description
None
Example
firstsignal()
Returns the first signal in a punchfile.
497
Function usage
punchfile_name
Optional arguments
None
Prerequisite
fwdfft()
For the function description, see fwdfft(). An example for the fwdfft()
function in Perl CODAC is:
#!/usr/local/bin/perl
#this is an example to calculate the fwdfft of a signal
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $punch = new Codac::readspicepunch("/input/test.pun");
CODAC Function Dictionary,
498
my $va = $punch->findsignal("VA");
my $vb;
my $fftmag;
my $fftphase;
Codac::Waveform::fwdfft($va,500e6,3, $fftmag , $fftphase);
$va->writesignal("fft.pun",1);
$fftmag->writesignal("fft.pun",0);
$fftphase->writesignal("fft.pun",0);
$vb = Codac::revfft($fftmag, $fftphase);
$vb->writesignal("fft.pun",0);
gainatphase()
For the function description, see gainatphase(). The example for the
gainatphase() function in Perl CODAC is the same as in bandwidth().
gainmargin()
For the function description, see gainmargin(). The example for the
gainatphase() function in Perl CODAC is the same as in bandwidth().
getanalysis()
For the function description, see getanalysis(). An example for the
getanalysis() function in Perl CODAC is:
#!/usr/local/bin/perl
#this is an example to illustrate getanalysis
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = Codac::readspicepunch(" inpbuf.stim.pun");
my $vout;
my $vb;
$vout = $punch->findsignal("VOUT");
499
$vb = Codac::Waveform::getanalysis($vout);
print("analysis = ", $vb ,"\n ");
getcrosses()
For the function description, see getcrosses(). An example for the
getcrosses() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = Codac::readspicepunch("inpbuf.stim.pun");
my $vin;
my $vout;
my $vb;
$vin = $punch->findsignal("VIN");
$vout = $punch->findsignal("VOUT");
$vb = Codac::Waveform::getcrosses($vin , $vout);
print("num crosses = ", $vb ,"\n");
Codac::Waveform::freewave($vin);
Codac::Waveform::freewave($vout);
gethightime()
For the function description, see gethightime(). An example for the
gethightime() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac qw ( readspicepunch);
my $punch = readspicepunch("inpbuf.stim.pun");
my $vin;
my $vc;
$vin = $punch->findsignal("VOUT");
$vc = Codac::Waveform::gethightime($vin, 1);
500
getlowtime()
For the function description, see getlowtime(). An example for the
getlowtime() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = Codac::readspicepunch("/input/inpbuf.stim.pun");
my $vin;
my $vc;
$vin = $punch->findsignal("../input/inpbuf.stim.pun","VOUT");
$vc = Codac::Waveform::getlowtime($vin, 1);
print("lowtime= ", $vc ,"\n");
getmodify()
For the function description, see getmodify(). An example for the
getmodify() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac qw( readspicepunch);
my $punch = readspicepunch("/inpbuf.stim.pun");
my $vin;
my $vc;
$vin = $punch->findsignal("VOUT");
$vc = Codac::Waveform::getmodify($vin);
print("modify= ", $vc ,"\n");
501
getmodifynum()
For the function description, see getmodifynum(). An example for the
getmodifynum() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = "inpbuf.stim.pun";
Codac::readspicepunch($punch);
my $vb;
$vb = Codac::Waveform::getmodifynum($punch);
print("num modifies = ", $vb ,"\n");
getnewwave()
Creates a null waveform
Function usage
None
Optional arguments
None
Prerequisite
None
Returned value
502
Description
getpoints()
For the function description, see getpoints(). An example for the
getpoints() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac qw( readspicepunch);
my $punch = readspicepunch("inpbuf.stim.pun");
my $vin;
my $vc;
$vin = $punch->findsignal("VOUT");
$vc = Codac::Waveform::getpoints($vin);
print("points= ", $vc ,"\n");
$vc = Codac::Waveform::getrerun($vin);
print("rerun= ", $vc ,"\n");
$vc = Codac::Waveform::getrun($vin);
print("run= ", $vc ,"\n");
$vc = Codac::Waveform::getsiggp($vin);
print("getsiggp= ", $vc ,"\n");
$vc = Codac::Wavefrom::getsigcent($vin);
print("getsigcent = ",$vc,"\n");
$vc = Codac::Waveform::getsighigh($vin);
print("sighigh= ", $vc ,"\n");
$vc = Codac::Waveform::getsiglow($vin);
print("siglow= ", $vc ,"\n");
$vc = Codac::Waveform::gettemp($vin);
print("temp= ", $vc ,"\n");
503
$vc = Codac::Waveform::gettitle($vin);
print("title= ", $vc ,"\n");
getrerun()
For the function description, see getrerun(). The example for the
getrerun() function in Perl CODAC is the same as in getpoints().
getrerunnum()
For the function description, see getrerunnum(). An example for the
getrerunnum() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = ("inpbuf.stim.pun");
Codac::readspicepunch($punch);
my $vb;
$vb = Codac::Waveform::getrerunnum($punch);
print("num rerun = ", $vb ,"\n");
getrun()
For the function description, see getrun(). The example for the getrun()
function in Perl CODAC is the same as in getpoints().
504
getsigcent()
For the function description, see getsigcent(). The example for the
getsigcent() function in Perl CODAC is the same as in getpoints().
getsiggp()
For the function description, see getsiggp(). The example for the
getsiggp() function in Perl CODAC is the same as in getpoints().
getsighigh()
For the function description, see getsighigh(). The example for the
getsighigh() function in Perl CODAC is the same as in getpoints().
getsiglow()
For the function description, see getsiglow(). The example for the
getsiglow() function in Perl CODAC is the same as in getpoints().
getsigname()
For the function description, see getsigname(). An example for the
getsigname() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac ;
my $punch =
Codac::readspicepunch("/input/inpbuf.stim.pun");
my $vin;
505
my $vb;
my $vc;
$vin = $punch->findsignal("VOUT");
$vb = Codac::Waveform::getanalysis($vin);
$vc = Codac::Waveform::getsigname($vin);
print("analysis = ", $vb ,"\n signal name = ",$vc,"\n");
undef($vin);
gettemp()
For the function description, see gettemp(). The example for the
gettemp() function in Perl CODAC is the same as in getpoints().
gettime()
For the function description, see gettime(). An example for the gettime()
function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch =
Codac::readspicepunch("input/inpbuf.stim.pun");
my $vin;
my $vb;
my $vc;
$vin = $punch->findsignal("VOUT");
$vb = Codac::Waveform::getanalysis($vin);
$vc = Codac::Waveform::gettime($vin);
print("analysis = ", $vb ,"\n time = ",$vc,"\n");
undef($vin);
506
gettitle()
For the function description, see gettitle(). The example for the gettitle()
function in Perl CODAC is the same as in getpoints().
gettransitions()
For the function description, see gettransitions(). An example for the
gettransitons() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch =
Codac::readspicepunch("input/inpbuf.stim.pun");
my $vin;
my $vb;
my $vc;
$vin = $punch->findsignal("VOUT");
$vb = Codac::Waveform::gettransitions($vin);
$vc = Codac::Waveform::gettransitiontime($vin, 2);
print("transitions = ", $vb ,"
\n transition time = ",$vc,"\n");
undef($vin);
gettransitiontime()
For the function description, see gettransitiontime(). The example for
the gettransitiontime() function in Perl CODAC is the same as in
gettransitions().
507
getx()
For the function description, see getx().An example for the getx()
function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch=Codac:: readspicepunch ("inpbuf.stim.pun");
my $vin;
my $vb;
my $vc;
$vin = $punch->findsignal("VOUT");
$vb = Codac::Waveform::getx($vin ,4.7,0.00 );
print("x value = ", $vb ,"\n");
$vb = Codac::Waveform::getxt($vin ,1.7,1 );
print("x value in 4th transition = ", $vb ,"\n");
$vb = Codac::Waveform::gety($vin ,1.5e-7);
print("y value = ", $vb ,"\n");
getxt()
For the function description, see getxt(). The example for the getxt()
function in Perl CODAC is the same as in getx().
gety()
For the function description, see gety(). The example for the gety()
function in Perl CODAC is the same as in getx().
508
histogram()
For the function description, see histogram(). An example for the
histogram() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac qw( readwave);
my $punchfile = "example.pun";
my $signal = "VX11Y";
my $analysis = "TR";
my $wav1 =
readwave($punchfile,$signal,25.00,1,0,0,$analysis);
my $wav2 = Codac::Waveform::histogram($wav1 );
Codac::Waveform::writesignal($wav2 , "histogram.out", 1);
interpolate()
For the function description, see interpolate(). The example for the
interpolate() function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = Codac::readspicepunch("input/test.pun");
my $va = $punch->findsignal("VA");
my $vb;
$va->writesignal("../output/orig.pun");
$vb = $va->interpolate(500e6);
#or
#$vb = Codac::Waveform::interpolate($va,500e6);
#both ways work
$vb->writesignal("../output/result.pun",1);
509
intg()
For the function description, see intg(). An example for the intg()
function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch =
Codac::readspicepunch("input/inpbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $vb;
$vb= $vin->intg();
$vb->writesignal("../output/intg.pun",1);
isfall()
For the function description, see isfall(). The example for the isfall()
function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl.004";
use Codac ;
my $punch =
Codac::readspicepunch("input/inpbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $vb;
$vb= $vin->isrise( 2);
print ("signal is rising",$vb," \n");;
$vb= Codac::Waveform::isfall($vin , 2);
print "signal is rising", $vb," \n";
510
isrise()
For the function description, see isrise(). The example for the isrise()
function in Perl CODAC is the same as isfall().
ivcurve()
For the function description, see ivcurve(). An example for the ivcurve()
function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch =
Codac::readspicepunch("/input/inpbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $iv1 = $punch->findsignal("IV1");
my $vb;
$vb = Codac::ivcurve($vin,$iv1,0.00,1.00e-7,$vb);
$vb->writesignal("../output/result.pun",1);
loaddb()
For the function description, see loaddb(). The returned value is a punch
file. An example for the loaddb() function in Perl CODAC is:
#!/usr/local/bin/perl
#use lib $ENV{PERLCODACLIB};
#this requires the environment variable PERLCODACLIB to be set to the
#library path
#or
#the conventional way to do access the library
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
511
my $file = "invt.pun";
my $db =codac.pun my $punch =
Codac::readspicepunch($file);
Codac::Punch::savedb($punch,$db);
Codac::Punch::loaddb($file,$db);
Codac::Punch::freepunchfile($punch);
nextsignal()
For the function description, see nextsignal(). The returned value is a
waveform. An example for the nextsignal() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = Codac::readspicepunch("inpbuf.stim.pun");
my $vb = $punch->firstsignal();
my $vd;
while($vd = $vb->nextsignal()) {
$vc = Codac::Waveform::getsigname($vd);
print("signalname is ",$vc,"\n");
$vb = $vd;
peak()
For the function description, see peak(). The example for the peak()
function in Perl CODAC is the same as in abspeak().
peak2peak()
For the function description, see peak2peak(). The example for the
peak2peak() function in Perl CODAC is the same as in abspeak().
512
phaseatgain()
For the function description, see phaseatgain(). The example for the
phaseatgain() function in Perl CODAC is the same as in bandwidth().
phasemargin()
For the function description, see phasemargin(). The example for the
phasemargin() function in Perl CODAC is the same as in bandwidth().
pulsefrequency()
For the function description, see pulsefrequency(). The example for the
pulsefrequency() function in Perl CODAC is the same as in abspeak().
pulseperiod()
For the function description, see pulseperiod(). The example for the
pulseperiod() function in Perl CODAC is the same as in abspeak().
pulsewidth()
For the function description, see pulsewidth(). The example for the
pulsewidth() function in Perl CODAC is the same as in abspeak().
range()
For the function description, see range(). An example for the range()
function in Perl CODAC is:
CODAC Function Dictionary,
513
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
my $punch = Codac::readspicepunch("/inpbuf.stim.pun");
my $vin = $punch->findsignal("VIN");
my $iv1 = $punch->findsignal("IV1");
my $vb;
$vb= $vin->range( 1.5e-8 ,1.5e-7);
$vb->writesignal("../output/range.pun",1);
514
revfft()
For the function description, see revfft(). The example for the revfft()
function in Perl CODAC is the same as fwdfft().
risetime()
For the function description, see risetime(). The example for the
risetime() function in Perl CODAC is the same as in abspeak().
rms()
For the function description, see rms(). The example for the rms()
function in Perl CODAC is the same as in abspeak().
setreftime()
For the function description, see setreftime(). The example for the
setreftime() function in Perl CODAC is the same as in setpath().
setsigcent()
For the function description, see setsigcent(). The example for the
setsigcent() function in Perl CODAC is the same as in setpath().
setsighigh()
For the function description, see setsiglow(). The example for the
setsighigh() function in Perl CODAC is the same as in setpath().
CODAC Function Dictionary,
515
setsiglow()
For the function description, see setsiglow(). The example for the
setsiglow() function in Perl CODAC is the same as in setpath().
setsigname()
For the function description, see setsigname(). The example for the
setsigname() function in Perl CODAC is the same as in setpath().
settle()
For the function description, see settle(). The example for the settle()
function in Perl CODAC is the same as in abspeak().
sigexists()
For the function description, see sigexists(). The example for the
sigexists() function in Perl CODAC is the same as in setpath().
skew()
For the function description, see skew(). The example for the skew()
function in Perl CODAC is the same as in abspeak().
slewrate()
For the function description, see slope(). The example for the slewrate()
function in Perl CODAC is the same as in abspeak().
CODAC Function Dictionary,
516
slope()
For the function description, see slope(). The example for the slope()
function in Perl CODAC is the same as in abspeak().
threshold()
For the function description, see threshold(). An example for the
threshold() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch = Codac::readspicepunch("inpbuf.stim.pun");
my $va = $punch->findsignal("VIN");
my $vb = $punch->findsignal("VOUT");
my $vc;
$vc = Codac::Waveform::threshold($vb ,1, $va );
print("threshold = ",$vc,"\n");
$vc = Codac::Waveform::thresholdhysteresis($va ,2, $vb );
print("threshold hysteresis = ",$vc,"\n");
thresholdhysterisis()
For the function description, see thresholdhysteresis(). The example for
the thresholdhysterisis() function in Perl CODAC is the same as in
threshold().
wabs()
For the function description, see wabs(). An example for the wabs()
function in Perl CODAC is;
517
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $punch =
Codac::readspicepunch("input/inpbuf.stim.pun");
my $va = $punch->findsignal("VIN");
my $vb = $punch->findsignal("VOUT");
my $vc;
$vc = Codac::Waveform::wabs($va);
$vc->writesignal("wmath.pun",1);
$vc = Codac::Waveform::wacos($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wasin($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::watan($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wcos($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wexp($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wlog($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wlog10($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wpow($va , 2);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wsin($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wsqrt($va);
$vc->writesignal("wmath.pun",0);
$vc = Codac::Waveform::wtan($va);
$vc->writesignal("wmath.pun",0);
$va = Codac::Waveform::histogram($va , 4);
va->writesignal("histogram.pun",0);
518
wacos()
For the function description, see wacos(). The example for the wacos()
function in Perl CODAC is the same as wabs().
wasin()
For the function description, see wasin(). The example for the wasin()
function in Perl CODAC is the same as wabs().
wexp()
For the function description, see wexp(). The example for the wexp()
function in Perl CODAC is the same as wabs().
wlog()
For the function description, see wlog(). The example for the wlog()
function in Perl CODAC is the same as wabs().
wlog10()
For the function description, see wlog10(). The example for the wlog10()
function in Perl CODAC is the same as wabs().
wpow()
For the function description, see wpow(). The example for the wpow()
function in Perl CODAC is the same as wabs().
CODAC Function Dictionary,
519
wsin()
For the function description, see wsin(). The example for the wsin()
function in Perl CODAC is the same as wabs().
wsqrt()
For the function description, see wsqrt(). The example for the wsqrt()
function in Perl CODAC is the same as wabs().
wtan()
For the function description, see wtan(). The example for the wtan()
function in Perl CODAC is the same as wabs().
writesignal()
For the function description, see writesignal(). The returned value is int.
The example for the writesignal() functions in Perl CODAC is the same
as wabs().
xpoint()
For the function description, see xpoint(). An example for the xpoint()
function in Perl CODAC is:
#!/usr/local/bin/perl
use FindBin qw($Bin);
use lib $Bin . "/../../lib/perl5.004";
use Codac ;
520
my $punch = Codac::readspicepunch("input/test.pun");
my $va = $punch->findsignal("VA");
my $vb;
$vb = $va->xpoint(20);
print("value of x at 20th point = ",$vb,"\n");
$vb = $va->ypoint(20);
print("value of y at 20th point = ",$vb,"\n");
ypoint()
For the function description, see addcards(). The example for the
ypoint() function in Perl CODAC is the same as xpoint().
521
addcards()
For the function description, see addcards(). An example for the
addcards() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $deck = "amp";
my $vb;
my $va = "*SPICE DECK TO TEST ADDCARDS FUNCTION";
$vb = Codac::Punch::addcards($deck, $va);
system('spice3' , $vb);
caddcards()
For the function description, see caddcards(). An example for the
caddcards() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $deck = "amp";
my $vb = "amp.mod";
my $va = "*SPICE DECK TO TEST ADDCARDS FUNCTION";
Codac::Punch::caddcards($deck , $vb , $va);
system('spice3' , $vb);
522
freepunchfile()
For the function description, see freepunchfile(). The returned value is
int. An example for the freepunchfile() function in Perl CODAC is:
#!/usr/local/bin/perl
#use lib $ENV{PERLCODACLIB};
#this requires the environment variable PERLCODACLIB to be set to the
#library path
#or the conventional way to do access the library
#use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac ;
my $file = "invt.pun";
my $db = "codacdb.pun";
my $punch = Codac::readspicepunch($file);
Codac::Punch::savedb($punch,$db);
Codac::Punch::loaddb($file,$db);
Codac::Punch::freepunchfile($punch);
plot()
For the function description, see plot(). The returned value is int. An
example for the plot() function in Perl CODAC is:
#!/usr/local/bin/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac;
my $wavptr =
Codac::readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
my $wavptr1 =
Codac::readwave("example.pun","VX12Y",25.00,1,0,0,"TR");
Codac::Punch::pltcomment("CODAC.PLT");
Codac::Punch::pltdate(1);
Codac::Punch::pltgrid(0);
Codac::Punch::pltportrait(1);
Codac::Punch::pltmjrgrid(1);
Codac::Punch::pltprtres(500, 500);
523
Codac::Punch::plot("test.ps",$wavptr , $wavptr1);
pltcomment()
For the function description, see pltcomment(). The example for the
pltcomment() function in Perl CODAC is the same as plot().
pltdate()
For the function description, see pltdate(). The example for the pltdate()
function in Perl CODAC is the same as plot().
pltgrid()
For the function description, see pltgrid(). The example for the pltgrid()
function in Perl CODAC is the same as plot().
pltmjrgrid()
For the function description, see pltmjrgrid(). The example for the
pltmjrgrid() function in Perl CODAC is the same as plot().
pltportrait()
For the function description, see pltportrait(). The example for the
pltportrait() function in Perl CODAC is the same as plot().
524
pltprtres()
For the function description, see pltprtres(). The returned value is int.
The example for the pltprtres() function in Perl CODAC is the same as
plot().
pltxgrid()
For the function description, see pltxgrid(). An example for the pltxgrid()
function in Perl CODAC is:
#!/usr/local/lib/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004;
use Codac;
my $wav =
Codac::readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
Codac::Punch::pltxmax(0.06e-06);
Codac::Punch::pltxmin(0.02e-06);
Codac::Punch::pltxgrid(0);
Codac::Punch::pltxorigin(1);
Codac::Punch::pltxmjrgrid(0);
Codac::Punch::pltportrait(1);
Codac::Punch::pltxscale(2.5);
Codac::Punch::pltxunits("TIME");
Codac::Punch::plot("test1.ps",$wav);
pltxmax()
For the function description, see pltxmax(). An example for the pltmax()
function in Perl CODAC is the same as in pltxgrid().
525
pltxmin()
For the function description, see pltxmin(). The example for the
pltxmin() function in Perl CODAC is the same as pltxgrid().
pltxscale()
For the function description, see pltxscale(). The example for the
pltxscale() function in Perl CODAC is the same as pltxgrid().
pltxunits()
For the function description, see pltxunits(). The example for the
pltxunits() function in Perl CODAC is the same as pltxgrid().
pltygrid()
For the function description, see pltygrid(). An example for the pltygrid()
function in Perl CODAC is:
#!/usr/local/lib/perl
use lib '/apps/dad/codac/lib/libperl/lib.sol/lib/perl5.004
use Codac;
my $wav =
Codac::readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
Codac::Punch::pltymax(4);
Codac::Punch::pltymin(1);
Codac::Punch::pltyorigin(2);
Codac::Punch::pltygrid(1);
Codac::Punch::pltymjrgrid(1);
Codac::Punch::pltportrait(1);
Codac::Punch::pltyscale(1.5);
Codac::Punch::pltyunits("VOLT");
CODAC Function Dictionary,
526
Codac::Punch::plot("test.ps",$wav);
pltymax()
For the function description, see pltymax(). The example for the
pltymax() function in Perl CODAC is the same as pltygrid().
pltymin()
For the function description, see pltymin(). The example for the
pltymin() function in Perl CODAC is the same as pltygrid().
pltymjrgrid()
For the function description, see pltymjrgrid(). The example for the
pltymjrgrid() function in Perl CODAC is the same as pltygrid()
pltyorigin()
For the function description, see pltyorigin(). The example for the
pltyorigin() function in Perl CODAC is the same as pltygrid().
pltyscale()
For the function description, see pltyscale(). The example for the
pltyscale() function in Perl CODAC is the same as pltygrid().
527
pltyunits()
For the function description, see pltyunits(). The example for the
pltyunits() function in Perl CODAC is the same as pltygrid().
savedb()
For the function description, see savedb(). The example for the savedb()
function in Perl CODAC is the same as for freepunchfile().
setreftime()
For the function description, see setreftime(). The example for the
setreftime() function in Perl CODAC is the same as in setpath().
setsigcent()
For the function description, see setsigcent(). The example for the
setsigcent() function in Perl CODAC is the same as in setpath().
setsiglow()
For the function description, see setsiglow(). The example for the
setsiglow() function in Perl CODAC is the same as in setpath().
528
setsighigh()
For the function description, see setsiglow(). The example for the
setsighigh() function in Perl CODAC is the same as in setpath().
529
C CODAC Functions
The C CODAC functions are:
C CODAC String Functions
C CODAC AC Functions
C CODAC Simulator Functions
C CODAC Transient Functions
C CODAC Plot Functions
C CODAC Waveform Functions
C CODAC Miscellaneous Functions
char *
An example of the str() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
double float1 = 3.5;
530
strext(str_val, index)
Required arguments
str_val
char * variable
index
Integer
Returned value
char *
An example of the strext() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
char *strval = "FREQUENCY =1MHz";
char *pattern = "=";
int index = strind(strval,pattern)
printf("%s \n",strext(strval,index + strlen(pattern)
,-1)
strind()
For the function description, see strind().
531
Function usage
strind(str_val, pattern)
Required arguments
str_val
char *
pattern
String
strrext()
For the function description, see strrext().
Function usage
strrext(str_val, index)
Required arguments
str_val
char *
index
Integer
Returned value
char *
An example of the strrext() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
char *strval = "FREQUENCY =1MHz";
CODAC Function Dictionary,
532
C CODAC AC Functions
bandwidth()
For the function description, see bandwidth().
Function usage
gainsignal
Waveform *
midfreq
double
refdB
double
Returned value
Double
An example of the bandwidth() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1 ,*wav2;
int result;
533
gainatphase()
For the function description, see gainatphase().
Function usage
phasesignal
Waveform *
gainsignal
Waveform *
phase
double
Returned value
Double
The example of the gainatphase() function in C CODAC is the same
as bandwidth()
534
gainmargin()
For the function description, see gainmargin().
Function usage
gainmargin(gainsignal, phasesignal)
Required arguments
gainsignal
Waveform *
phasesignal
Waveform *
Returned value
Double
Usage details
phaseatgain()
For the function description, see phaseatgain().
Function usage
phasesignal
Waveform *
535
gainsignal
Waveform *
gain
double
Returned value
Double
Usage details
phasemargin()
For the function description, see phasemargin().
Function usage
phasemargin(gainsignal, phasesignal)
Required arguments
gainsignal
Waveform *
phasesignal
Waveform *
Returned value
Double
Usage details
536
addcards(spicedeck, , cards)
Required arguments
phasesignal
char **
cards
char **
Returned value
char *
Usage details
537
cards[1] = NULL;
strcpy(cards[0],"*SPICE DECK TO TEST ADDCARDS FUNCTION\n");
modspicedeck = addcards("../amp", cards );
setspice3path("/apps/dad_sys/spice3/bin/spice3");
invokespice3(modspicedeck,NULL,NULL,NULL,NULL,NULL);
cards[0] = (char *)malloc( strlen("*SPICE DECK TO TEST
CADDCARDS FUNCTION\n") );
strcpy(cards[0],"*SPICE DECK TO TEST CADDCARDS
FUNCTION\n");
modspicedeck = caddcards("../amp","amp_cadd", cards );
setspice3path("/user/codac/spice3/bin/spice3");
invokespice3(modspicedeck,NULL,NULL,NULL,NULL,NULL);
}
caddcards()
For the function description, see caddcards().
Function usage
basedeck
char *
moddeck
char *
cards
char **
Returned value
char *
Usage details
538
getsrvrstatus()
For the function description, see getsrvrstatus().
An example of the getsrvrstatus() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
int srvrid;
int getid;
char *ModStr;
float Delay;
setspice3path("/apps/dad_sys/spice3/bin/spice3");
srvrid = invokespicesrvr("../delay.spi");
printf("%d\n",srvrid);
while (!(getid = getsrvrstatus(srvrid)));
ModStr = (char *)malloc(strlen("*This is a dummy string\n") + 1);
sprintf(ModStr,"*This is a dummy string\n");
sndsrvrmodify(srvrid,ModStr,1);
while (!(getid = getsrvrstatus(srvrid)));
stopspicesrvr(srvrid);
}
invokespice3()
For the function description, see invokespice3().
Function usage
539
All
Usage details
invokespicesrvr()
For the function description, see invokespicesrvr().
Function usage
invokespicesrvr(deckpath)
Required arguments
deckpath
char *
540
setspice3path()
For the function description, see setspice3path().
Function usage
setspice3path (path)
Required arguments
path
char *
sndsrvrmodify()
For the function description, see sndsrvrmodify().
Function usage
srvrid
Spice server
modifystring
char *
append-overwrite
541
stopspicesrvr()
For the function description, see stopspicesrvr(). The example of the
stopspicesrvr() function in C CODAC is the same as getsrvrstatus().
542
signal
Waveform *
starttime, endtime
double
Returned value
Double
Usage details
Specifiy starttime and endtime as 1 if you want the abspeak for the
whole time range of the waveform.
An example of the abspeak() function in C CODAC is:
#include<stdio.h>
#include "codac.h"
main()
{
Waveform *wav[3] = {NULL};
double val;
wav[0] =
readwave("example.pun","VX11Y",-1,-1,-1,-1,"TR");
wav[1] =
readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
543
val = strlen(wav);
printf("val = %lf\n",val);
setsigcent(1.2,&wav[0]);
setsighigh(2.5,&wav[0]);
setsiglow(0.1, &wav[0]);
printf("Abspeak = %e\n",abspeak(wav[0],0,2.8e-08));
printf("Crosstime = %e\n",crosstime(wav[0],wav[1],1));
printf("Crossvalue = %e\n",crossvalue(wav[0],wav[1],1));
}
crosstime()
For the function description, see crosstime().
Function usage
signal1, signal2
Waveform *
number
Occurrence of crossing
Returned value
Double
The example of the crosstime() function in C CODAC is the same as
abspeak().
crossvalue()
For the function description, see crossvalue().
544
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Occurrence of crossing
Returned value
Double
The example of the crossvalue() function in C CODAC is the same as
abspeak().
delay()
For the function description, see delay().
Function usage
signal1, signal2
Waveform *
Returned value
Double
An example of the delay() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
545
main()
{
Waveform *wav, *wav1;
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav1 = readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
setsigcent(1.2, NULL);
setsighigh(2.5,NULL);
setsiglow(0.0,NULL);
printf("Delay = %e\n",delay(wav,1,wav1,1));
printf("Delaych = %e\n",delaych(wav,1,wav1,1));
printf("Delaycl = %e\n",delaycl(wav,1,wav1,1));
printf("Delayhc = %e\n",delayhc(wav,1,wav1,1));
printf("Delayhh = %e\n",delayhh(wav,1,wav1,1));
printf("Delayhl = %e\n",delayhl(wav,1,wav1,1));
printf("Delaylc = %e\n",delaylc(wav,1,wav1,1));
printf("Delaylh = %e\n",delaylh(wav,1,wav1,1));
printf("Delayll = %e\n",delayll(wav,1,wav1,1));
printf("Delayxx = %e\n",delayxx(wav,1,1.5,wav1,1,1.0));
}
delaych()
For the function description, see delaych().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
546
delaycl()
For the function description, see delaycl().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
The example of the delaycl() function in C CODAC is the same as
delaych().
delayhc()
For the function description, see delayhc().
Function usage
signal1, signal2
Waveform *
547
transnum1, transnum2
Returned value
Double
The example of the delayhc() function in C CODAC is the same as
delaych().
delayhh()
For the function description, see delayhh().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
The example of the delayhh() function in C CODAC is the same as
delaych().
delayhl()
For the function description, see delayhl().
Function usage
CODAC Function Dictionary,
548
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
The example of the delayhl() function in C CODAC is the same as
delaych().
delaylc()
For the function description, see delaylc().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
The example of the delaylc() function in C CODAC is the same as
delay().
549
delaylh()
For the function description, see delaylh().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
The example of the delaylh() function in C CODAC is the same as
delaych().
delayll()
For the function description, see delayll().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
CODAC Function Dictionary,
550
Double
The example of the delayll() function in C CODAC is the same as
delaych().
delayoff()
For the function description, see delayoff().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
Returned value
Double
An example of the delayoff() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
int i , NumCross;
Waveform *wav1 , *wav2;
readspicepunch("example.pun");
wav1 = readwave("invt.pun","VIN",27.00 ,1,0,0,"TR");
wav2 = readwave("invt.pun","VOUT",27.00 ,1,0,0,"TR");
setsighigh(4.5 , NULL);
setsiglow(0.5 , NULL);
551
setsigcent(2.5, NULL);
NumCross = getcrosses(wav1 , wav2);
for(i = 0;i<NumCross;i++)
printf("Y value at %d crossing = %e\n",i ,
crossvalue(wav1 ,wav2 , 1));
printf("modifynum = %d \n",getmodifynum("example.pun"));
printf("delay = %e\n",delayoff(wav2,1,wav1,1));
freewave(wav1);
freewave(wav2);
}
delayxx()
For the function description, see delayxx().
Function usage
signal1, signal2
Waveform *
transnum1, transnum2
y1, y2
double
Returned value
Double
The example of the delayxx() function in C CODAC is the same as
delaych().
552
dip()
For the function description, see dip().
Function usage
signalname
Waveform *
Double
The example of the dip() function in C CODAC is the same as
dutycycle().
dutycycle()
For the function description, see dutycycle().
Function usage
dutycycle(pulse, number)
Required arguments
pulse
Waveform *
number
553
Returned value
Double
An example of the dutycycle() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *wav, *wav1;
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav1 = readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
setsigcent(1.2,NULL);
setsighigh(2.5,NULL);
setsiglow(0.0,NULL);
printf("Dip = %e\n",dip(wav,0,2.8e-08));
printf("Dip = %e\n",dip(wav,-1 , -1));
printf("Dutycycle = %e\n",dutycycle(wav,1));
printf("FallTime = %e\n",falltime(wav,1));
printf("Peak = %e\n",peak(wav,0,2.8e-08));
printf("Peak = %e\n",peak(wav,-1 , -1));
printf("Peak2Peak = %e\n",peak2peak(wav,0,2.8e-08));
printf("Peak2Peak = %e\n",peak2peak(wav,-1 , -1));
printf("PulseFrequency = %e\n",pulsefrequency(wav,1));
printf("PulsePeriod = %e\n",pulseperiod(wav,1));
printf("PulseWidth = %e\n",pulsewidth(wav,1));
printf("RiseTime = %e\n",risetime(wav,2));
printf("RMS = %e\n",rms(wav,0,2.8e-08));
printf("RMS = %e\n",rms(wav,-1 , -1));
printf("Skew = %e\n",skew(wav,wav1,1,1,2,2));
}
falltime()
For the function description, see falltime().
Function usage
CODAC Function Dictionary,
554
falltime(signal, transnum)
Required arguments
signal
Waveform *
transnum
Returned value
Double
The example of the falltime() function in C CODAC is the same as
dutycycle().
peak()
For the function description, see peak().
Function usage
signalname
Waveform *
starttime, endtime
double
Returned value
Double
Usage details
Specify starttime and endtime as 1 if you want to get the peak in the
signal for its entire time range.
CODAC Function Dictionary,
555
peak2peak()
For the function description, see peak2peak().
Function usage
signalname
Waveform *
starttime, endtime
double
Returned value
Double
Usage details
pulsefrequency()
For the function description, see pulsefrequency().
Function usage
556
pulsefrequency(pulse, transnumber)
Required arguments
pulse
Waveform *
transnumber
Returned value
Double
The example of the pulsefrequency() function in C CODAC is the same
as dutycycle().
pulseperiod()
For the function description, see pulseperiod().
Function usage
pulseperiod(pulse, transnumber)
Required arguments
pulse
Waveform *
transnumber
Returned value
Double
557
pulsewidth()
For the function description, see pulsewidth().
Function usage
pulsewidth(pulse, transnumber)
Required arguments
pulse
Waveform *
transnumber
Returned value
Double
The example of the pulsewidth() function in C CODAC is the same as
dutycycle()
risetime()
For the function description, see risetime().
Function usage
risetime(signal, transnum)
Required arguments
558
signal
Waveform *
transnum
Returned value
Double
The example of the risetime() function in C CODAC is the same as
dutycycle().
rms()
For the function description, see rms().
Function usage
pulse
Waveform *
starttime, endtime
double
Returned value
Double
Usage details
Specify starttime and endtime as 1 if you want to get the rms value
for the signal for its entire time range.
An example of the rms() function in C CODAC is:
559
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *newwav;
newwav = addpoints(newwav,0.0,0.0);
addpoints(newwav,1.0,1.0);
addpoints(newwav,2.0,2.0);
addpoints(newwav,3.0,3.0);
printf("Area = %f\n",area(newwav,-1,-1));
printf("average = %f\n",average(newwav,0,3));
printf("average = %e\n",average(newwav,0,3));
printf("rms = %f\n",rms(newwav, 0,3 ));
printf("Area = %f\n",area(newwav, 0, 3));
printf("average = %e\n",average(newwav,-1,-1));
printf("rms = %f\n",rms(newwav,-1,-1));
}
settle()
For the function description, see settle().
Function usage
signal1
Waveform *
tolerance, mintime
double
Returned value
Double
An example of the settle() function in C CODAC is:
560
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1 ,*wav2;
float settlingtime ;
wav1 = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav2 = readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
settlingtime = settle(wav1 ,30 , 3e-9);
printf("settlingtime = %f \n",settlingtime);
}
skew()
For the function description, see skew().
Function usage
signal1, signal2
Waveform *
Returned value
Double
The example of the skew() function in C CODAC is the same as
dutycycle().
561
slewrate()
For the function description, see slewrate().
Function usage
slewrate(signal1, transition)
Required arguments
signal1
Waveform *
transition
Returned value
Double
An example of the slewrate() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *wav, *wav1;
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav1 = readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
printf("Slew Rate = %e\n",slewrate(wav,1));
printf("Slope
= %e\n",slope(wav,2.7e-08));
}
slope()
For the function description, see slope().
Function usage
562
slope(signal, time)
Required arguments
signal1
Waveform *
time
double
Returned value
Double
The example of the slope() function in C CODAC is the same as
slewrate().
threshold()
For the function description, see threshold().
Function usage
switchnode,innode
Waveform *
transnumber
Returned value
Double
An example of the threshold() function in C CODAC is:
563
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
float thrval;
int num = 1;
Waveform *wav1 ,*wav2;
wav1 = readwave("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
wav2 = readwave("../inpbuf.stim.pun","VOUT",27.00,1,0,0,"TR");
thrval = threshold(wav2 ,num , wav2);
printf("threshold = %f \n",thrval);
thrval = thresholdhysteresis(wav1 ,1 , wav2);
printf("threshold hysteresis = %f \n",thrval);
}
thresholdhysterisis()
For the function description, see thresholdhysteresis().
Function usage
switchnode,innode
Waveform *
transnumber
Returned value
Double
564
plot(psfilepath, signals
Required arguments
psfilepath
char *
signal1
Waveform **
Usage details
565
pltportrait(1);
pltprtres(500, 500);
wavptr[1] = NULL;
plot("test.ps",wavptr);
}
pltcomment()
For the function description, see pltcomment().
Function usage
pltcomment(comment x, y)
Required arguments
comment
char *
x, y
integer
Usage details
pltdate()
For the function description, see pltdate(). The example of the pltdate()
function in C CODAC is the same as plot().
566
pltgrid()
For the function description, see pltgrid(). The example of the pltgrid()
function in C CODAC is the same as plot().
pltmjrgrid()
For the function description, see pltmjrgrid(). The example of the
pltmjrgrid() function in C CODAC is the same as plot().
pltportrait()
For the function description, see pltportrait(). The example of the
pltportrait() function in C CODAC is the same as plot().
pltxgrid()
For the function description, see pltxgrid(). An example of the pltxgrid()
function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *wav[2];
wav[0] = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav[1] = NULL;
pltgrid(0);
pltxmax(10e-09);
pltxmin(1e-09);
pltxgrid(1);
pltxorigin(1);
567
pltxmjrgrid(1);
pltportrait(0);
pltxscale(1.5);
pltxunits("TIME");
plot("test.ps",wav);
}
pltxmax()
For the function description, see pltxmax()
Function usage
pltxmax(x)
Required arguments
double
pltxmin()
For the function description, see pltxmin().
Function usage
pltxmin(x)
Required arguments
double
568
pltxmjrgrid()
For the function description, see pltxmjrgrid(). The example of the
pltxmjrgrid() function in C CODAC is the same as plot().
pltxorigin()
For the function description, see pltxorigin().
Function usage
pltxorigin(x)
Required arguments
double
pltxscale()
For the function description, see pltxscale().
Function usage
pltxscale(x)
Required arguments
double
569
pltxunits()
For the function description, see pltxunits().
Function usage
pltxunits(str)
Required arguments
str
char *
pltygrid()
For the function description, see pltygrid(). An example of the pltygrid()
function in C CODAC is:
#include<stdio.h> include"codac.h"
main()
{
Waveform *wav[2];
wav[0] = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav[1] = NULL;
plotgrid(0);
pltymax(2);
pltymin(1);
pltyorigin(1);
pltygrid(1);
pltymjrgrid(1);
pltportrait(1);
pltyscale(1.5);
pltyunits("VOLT");
plot("test.ps",wav);
570
pltymax()
For the function description, see pltymax().
Function usage
pltymax(y1)
Required arguments
y1
double type
pltymin()
For the function description, see pltymin().
Function usage
pltymin(y1)
Required arguments
y1
double type
571
pltymjrgrid()
For the function description, see pltymjrgrid().
The example of the pltymjrgrid() function in C CODAC is the same as
pltxgrid().
pltyorigin()
For the function description, see pltyorigin().
Function usage
pltyorigin(y)
Required arguments
double type
pltyscale()
For the function description, see pltyscale().
Function usage
pltyscale(y)
Required arguments
double type
572
pltyunits()
For the function description, see pltyunits().
Function usage
pltyunits(str)
Required arguments
str
char *
573
signal
Waveform *
xpoint
double
ypoint
double
Returned value
Waveform *
Usage details
574
addpoints(newwav,2.0,2.0);
addpoints(newwav,3.0,3.0);
printf("Area = %f\n",area(newwav,-1,-1));
/*printf("average = %f\n",average(newwav,0,3));
printf("average = %e\n",average(newwav,0,3));
printf("rms = %f\n",rms(newwav, 0,3 ));
printf("Area = %f\n",area(newwav, 0, 3));*/
printf("average = %e\n",average(newwav,-1,-1));
printf("rms = %f\n",rms(newwav,-1,-1));
}
area()
For the function description, see area().
Function usage
signalname
Waveform *
starttime
double
endtime
double
Returned value
Double
Usage details
Set starttime and endtime as 1 if you want the area under the whole
signal.
The example for the area() function C CODAC is the same as
addpoints().
CODAC Function Dictionary,
575
average()
For the function description, see average().
Function usage
signalname
Waveform *
starttime
double
endtime
double
Returned value
Double
Usage details
Set starttime and endtime as 1 if you want the average value of the
whole signal.
The example for the average() function C CODAC is the same as
addpoints().
diff()
For the function description, see diff().
Function usage
diff(signalname)
Required arguments
CODAC Function Dictionary,
576
signalname
Waveform *
Returned value
Waveform *
An example for the diff() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *newwav, *newwav1 = NULL , *diffwav;
newwav1 = addpoints(newwav1,0.0,3.0);
newwav = addpoints(newwav,0.0,0.0);
addpoints(newwav,1.0,1.0);
addpoints(newwav,2.0,2.0);
addpoints(newwav,3.0,3.0);
diffwav = diff(newwav);
writesignal(diffwav,"diff.out",1,0,0);
writesignal(diffwav,"diff.out",-1,-1,-1);
addpoints(newwav1,1.0,2.0);
addpoints(newwav1,2.0,1.0);
addpoints(newwav1,3.0,0.0);
setlevels(2,5);
diffwav = digitize(newwav,">",newwav1);
writesignal(diffwav,"diff.out",0,0,0);
}
digitize()
For the function description, see digitize().
Function usage
577
signal1
Waveform *
signal2
Waveform *
string1
char *
Returned value
Waveform *
An example for the digitize() function C CODAC is the same as diff().
fwdfft()
For the function description, see fwdfft().
Function usage
signal1
Waveform *
samplingfrequency
double
windowtype
double
sigmag
Waveform **
sigphase
Waveform **
Returned value
Waveform *
An example for the fwdfft() function C CODAC is;
578
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1 , *wav2 , *fftmag[1] , *fftphase[1];
readspicepunch("example.pun");
wav1 = readwave("example.pun", "VX11Y",25.00,1,0,0,"TR");
writesignal(wav1 ,"input.out",1,0,0);
fwdfft(wav1, 500e6 , 3 , fftmag , fftphase);
writesignal(*fftmag ,"fft.out",1,0,0);
writesignal(*fftphase ,"fft.out",1,0,0);
wav2 = revfft(*fftmag , *fftphase);
writesignal(wav2 ,"revfft.out",1,0,0);
}
getanalysis()
For the function description, see getanalysis().
Function usage
getanalysis(signal)
Required arguments
signal
Waveform *
Returned value
char *
An example for the getanalysis() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
579
int val, i;
double val1, val2;
Waveform *wav;
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
printf("Analysis = %s\n",getanalysis(wav));
printf("Date = %s\n",Getdate(wav));
printf("Modify = %d\n",getmodify(wav));
printf("Rerun = %d\n",getrerun(wav));
printf("Run = %d\n",getrun(wav));
printf("Name = %s\n",getsigname(wav,3));
printf("Temp = %f\n",gettemp(wav));
printf("Time = %s\n",gettime(wav));
printf("Title = %s\n",gettitle(wav));
printf("Num Reruns = %d\n",getrerunnum("example.pun"));
}
getcrosses()
For the function description, see getcrosses().
Function usage
signal1
Waveform *
signal2
Waveform *
580
getdate()
For the function description, see getdate().
Function usage
getdate(signal)
Required arguments
signal
Waveform *
Returned value
char *
The example for the getdate() function C CODAC is the same as
getanalysis().
581
gethightime()
For the function description, see gethightime().
Function usage
gethightime(signal, transnum)
Required arguments
signal
Waveform *
transnum
Returned value
Double
An example for the gethightime() function C CODAC is:
#include<stdio.h>
#include"codac.h"
/* Testcase to check the functionality of readwave, signal high,
low, cent
setting & getpoints function */
main()
{
int val, i;
double val1, val2;
Waveform *wav[2];
wav[1] = NULL;
wav[0] =
readwave("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
setsiggp(1e-12,wav);
printf("LowTime = %e\n",getlowtime(wav[0],1));
printf("HighTime = %e\n",gethightime(wav[0],1));
printf("Glitch Period = %e\n",getsiggp(wav[0]));
printf("No. Transitions = %d\n",gettransitions(wav[0]));
582
printf("Transition Time=
%e\n",gettransitiontime(wav[0],1));
}
getlowtime()
For the function description, see getlowtime().
Function usage
getlowtime(signal, transnum)
Required arguments
signal
Waveform *
transnum
Returned value
Double
The example for the getlowtime() function C CODAC is the same as
gethightime().
getmodify()
For the function description, see getmodify().
Function usage
getmodify(signal)
Required arguments
signal
Waveform *
CODAC Function Dictionary,
583
getmodifynum()
For the function description, see getmodifynum().
Function usage
getmodifynum(punchfile)
Required arguments
punchfile
char *
getpoints()
For the function description, see getpoints().
Function usage
getpoints(signal)
Required arguments
signal
Waveform *
584
getrerun()
For the function description, see getrerun().
Function usage
getrerun(signal)
Required arguments
signal
Waveform *
585
getrerunnum()
For the function description, see getrerunnum().
Function usage
getrerunnum (punchfile)
Required arguments
punchfile
char *
getrun()
For the function description, see getrun().
Function usage
getrun(signal)
Required arguments
signal
Waveform *
getsigcent()
For the function description, see getsigcent().
586
Function usage
getsigcent(signal)
Required arguments
signal
Waveform *
Returned value
Double
The example for the getsigcent() function C CODAC is the same as
getpoints().
getsiggp()
For the function description, see getsiggp().
Function usage
getsiggp(signal)
Required arguments
signal
Waveform *
Returned value
Double
An example for the getsiggp() function C CODAC is:
#include<stdio.h>
#include"codac.h"
/* Testcase to check the functionality of readwave, signal high,
low, cent
587
setting
main()
{
int val, i;
double val1, val2;
Waveform *wav[2];
wav[1] = NULL;
wav[0] =
readwave("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
setsiggp(1e-12,wav);
printf("LowTime = %e\n",getlowtime(wav[0],1));
printf("HighTime = %e\n",gethightime(wav[0],1));
printf("Glitch Period = %e\n",getsiggp(wav[0]));
printf("No. Transitions = %d\n",gettransitions(wav[0]));
printf("Transition Time=
%e\n",gettransitiontime(wav[0],1));
}
getsighigh()
For the function description, see getsighigh().
Function usage
getsighigh(signal)
Required arguments
signal
Waveform *
Returned value
Double
The example for the getsighigh() function C CODAC is the same as
getpoints().
588
getsiglow()
For the function description, see getsiglow().
Function usage
getsiglow(signal)
Required argument
signal
Waveform *
Returned value
Double
The example for the getsiglow() function C CODAC is the same as
getpoints().
589
getsigname()
For the function description, see getsigname().
Function usage
getsigname(signal1, int1);
Required arguments
signal
Waveform *
Returned value
char * variable
Usage details
gettemp()
For the function description, see gettemp().
Function usage
gettemp(signal)
Required arguments
signal
Waveform *
Returned value
CODAC Function Dictionary,
590
Double
The example for the gettemp() function C CODAC is the same as
getanalysis().
gettime()
For the function description, see gettime().
Function usage
gettime(signal)
Required arguments
signal
Waveform *
Returned value
char *
The example for the gettime() function C CODAC is the same as
getanalysis().
gettitle()
For the function description, see gettitle().
Function usage
gettitle(signal)
Required arguments
signal
Waveform *
CODAC Function Dictionary,
591
Returned value
char *
The example for the gettitle() function C CODAC is the same as
getanalysis().
gettransitions()
For the function description, see gettransitions().
Function usage
gettransitions(signal)
Required arguments
signal
Waveform *
gettransitiontime()
For the function description, see gettransitiontime().
Function usage
gettransitiontime(signal, transnum)
Required arguments
signal
Waveform *
transnum
592
Returned value
Double
The example for the gettransitiontime() function C CODAC is the same
as getsiggp().
getx()
For the function description, see getx().
Function usage
signal
Waveform *
yval, reftime
double
Returned value
Double
An example for the getx() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
int val, i;
double val1, val2;
Waveform *wav[2] ;
wav[1] = NULL;
wav[0] = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
setsigcent(1.2,wav);
593
setsighigh(2.5,wav);
setsiglow(0.0,wav);
printf("x-value = %e\n",getx(wav[0],1.5,0));
printf("x-value at transition 1 =
%e\n",getxt(wav[0],1.5,1));
printf("y-value = %e\n",gety(wav[0],9.7e-11));
}
getxt()
For the function description, see getxt().
Function usage
signal
Waveform *
yval, trans_no
double
Returned value
Double
The example for the getxt() function C CODAC is the same as getx().
gety()
For the function description, see gety().
Function usage
gety(signal, xval)
594
Required arguments
signal
Waveform *
xval
double
Returned value
Double
The example for the gety() function C CODAC is the same as getx().
interpolate()
For the function description, see interpolate().
Function usage
interpolate(signal, samplingfrequency)
Required arguments
signal
Waveform *
samplingfrequency
double
Returned value
Waveform *
An example for the interpolate() function C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *w1, *w2;
CODAC Function Dictionary,
595
w1 = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
w2 = interpolate(w1,500e6);
writesignal(w2,"interpolate.out",1,0,0);
}
intg()
For the function description, see intg().
Function usage
intg(signal);
Required arguments
signal
Waveform *
Returned value
Waveform *
An example for the intg() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *newwav, *Intwav;
newwav = addpoints(newwav,0.0,0.0);
addpoints(newwav,1.0,1.0);
addpoints(newwav,2.0,2.0);
addpoints(newwav,3.0,3.0);
Intwav = intg(newwav);
writesignal(Intwav,"int.out",1,0,0);
}
596
isfall()
For the function description, see isfall().
Function usage
isfall(signal1, transition)
Required arguments
signal1
Waveform *
transition
Transition number
597
isrise()
For the function description, see isrise().
Function usage
isrise(signal1, transition)
Required arguments
signal1
Waveform *
transition
Transition number
The example for the isrise() function C CODAC is the same as isfall().
ivcurve()
For the function description, see ivcurve().
Function usage
volsig, cursig
Waveform *
double
Returned value
Waveform *
An example for the ivcurve() function C CODAC is:
#include<stdio.h>
CODAC Function Dictionary,
598
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1, *wav2, *wav3;
char *reswave = "OUT";
wav1 = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
wav2 = readwave("example.pun","VX31Y",25.00,1,0,0,"TR");
wav3 = ivcurve(wav1 ,wav2, 0.0, 2.0e-07 , reswave);
writesignal(wav3,"ivcurve.out",1,0,0);
}
loaddb()
For the function description, see loaddb().
Function usage
loaddb(punchpath, databasepath)
Required arguments
punchpath, databasepath
char *
599
nextsignal()
For the function description, see nextsignal().
Function usage
nextsignal(signal)
Required arguments
signal
Waveform *
Returned value
Waveform *
An example for the nextsignal() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
int val, i;
double val1, val2;
Waveform *wav = NULL , *truncwav;
readspicepunch("example.pun");
while(wav = nextsignal(wav))
printf("Sig name is %s\n",getsigname(wav,-1));
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
truncwav = range(wav,0.0,2.8e-08);
truncwav = range(wav,-1 , -1);
writesignal(truncwav,"range.out",1,0,0);
}
range()
For the function description, see range().
CODAC Function Dictionary,
600
Function usage
signal1
Waveform *
starttime, endtime
double *
Returned value
Waveform *
Usage details
readspicepunch()
For the function description, see readspicepunch().
Function usage
readspicepunch(punchfilename)
Required arguments
punchfilename
char *
Returned value
Integer
601
602
readwave()
For the function description, see readwave().
Function usage
punchfilename
char *
signalname
char *
modify
char *
analysis
char *
double
Returned value
Waveform *
Usage details
603
revfft()
For the function description, see revfft().
Function usage
revfft(sigmag, sigphase)
Required arguments
sigmag
Waveform *
sigphase
Waveform *
Returned value
Waveform *
The example for the revfft() function C CODAC is the same as fwdfft().
savedb()
For the function description, see savedb(). The example for the savedb()
function C CODAC is the same as loaddb().
setlevels()
For the function description, see setlevels(). The example for the
setlevels() function C CODAC is the same as diff().
604
setreftime()
For the function description, see setreftime().
Function usage
setreftime(reftime, signals)
Required arguments
reftime
Reference time
signals
Waveform **
Usage details
605
setsigcent()
For the function description, see setsigcent().
Function usage
setsigcent(centval, signals)
Required arguments
centval
double
signals
Waveform **
Usage details
606
printf("Sig_high = %lf\n",getsighigh(wav1[0]));
printf("Sig_low = %lf\n",getsiglow(wav1[0]));
printf("Sig_cent = %lf\n",getsigcent(wav1[0]));
}
setsiggp()
For the function description, see setsiggp().
Function usage
setsiggp(glitchperiod, signals)
Required arguments
glitchperiod
double
signals
Waveform *
Usage details
setsighigh()
For the function description, see setsighigh().
Function usage
setsighigh(highval, signals)
607
Required arguments
highval
double
signals
Waveform **
Usage details
setsiglow()
For the function description, see setsiglow().
Function usage
lowval
double
signals
Waveform *
Usage details
608
setsigname()
For the function description, see setsigname().
Function usage
setsigname(signal1, string1)
Required arguments
string1
char *
signal!
Waveform *
sigexists()
For the function description, see sigexists().
Function usage
sigexists(signalname)
Required arguments
signalname
char *
609
#include"codac.h"
main()
{
int val, i;
double val1, val2;
Waveform *wav; char * name = "VX11y"
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
thresholdsignal(0.5,0);
printf("Check sig VX11Y exists %d\n",sigexists(name));
}
thresholdsignal()
For the function description, see thresholdsignal().
Function usage
thresholdsignal(thresholdvalue, sigtype)
Required arguments
thresholdvalue
Double value
sigtype
Returned value
Waveform *
The example for the thresholdsignal() function C CODAC is the same
as sigexists().
wabs()
For the function description, see wabs().
610
Function usage
wabs(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
An example for the wabs() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *wav, *triwav;
wav =
readwave("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
triwav = wabs(wav);
writesignal(triwav,"Trig.out",1,0,0);
triwav = wacos(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wasin(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = watan(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wcos(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wexp(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wlog(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wlog10(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wpow(wav,2);
writesignal(triwav,"Trig.out",0,0,0);
611
triwav = wsin(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wcos(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wsqrt(wav);
writesignal(triwav,"Trig.out",0,0,0);
triwav = wtan(wav);
writesignal(triwav,"Trig.out",0,0,0);
}
wacos()
For the function description, see wacos().
Function usage
wacos(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wacos() function C CODAC is the same as in
wabs().
wasin()
For the function description, see wasin().
Function usage
wasin(signal1)
CODAC Function Dictionary,
612
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wasin() function C CODAC is the same as in wabs().
watan()
For the function description, see watan().
Function usage
watan(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the watan() function C CODAC is the same as in wabs() .
wcos()
For the function description, see wcos().
Function usage
wcos(signal1)
CODAC Function Dictionary,
613
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wcos() function C CODAC is the same as in wabs().
wexp()
For the function description, see wexp().
Function usage
wexp(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wexp() function C CODAC is the same as in wabs().
wlog()
For the function description, see wlog().
Function usage
wlog(signal1)
614
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wlog() function C CODAC is the same as in wabs().
wlog10()
For the function description, see wlog10().
Function usage
wlog10(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wlog10() function C CODAC is the same as in
wabs().
wpow()
For the function description, see wpow().
Function usage
615
wpow(signal1, float1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wpow() function C CODAC is the same as in wabs().
writepunch()
For the function description, see writepunch().
Function usage
inputfile, outputfile
char *
See writepunch()
Usage details
616
writesignal()
For the function description, see writesignal().
Function usage
signal
Waveform *
filename
char *
See writesignal()
Usage details
wsin()
For the function description, see wsin().
Function usage
wsin(signal1)
Required arguments
signal1
Waveform *
CODAC Function Dictionary,
617
Returned value
Waveform *
The example for the wsin() function C CODAC is the same as in wabs().
wsqrt()
For the function description, see wsqrt().
Function usage
wsqrt(signal1)
Required arguments
signal1
Waveform *
Returned value
Waveform *
The example for the wsqrt() function C CODAC is the same as in wabs().
wtan()
For the function description, see wtan().
Function usage
wtan(signal1)
Required arguments
signal1
Waveform *
618
Returned value
Waveform *
The example for the wtan() function C CODAC is the same as in wabs().
xpoint()
For the function description, see xpoint().
Function usage
xpoint(signal, i)
Required arguments
signal1
Waveform *
Returned value
Double
An example for the xpoint() function C CODAC is:
#include<stdio.h>
#include"codac.h"
/* Testcase to check the functionality of readwave, signal high,
low, cent
setting & getpoints function */
main()
{
int val, i;
double val1, val2;
Waveform *wav ;
wav = readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
val = getpoints(wav);
printf("%d\n",val);
619
ypoint()
For the function description, see ypoint().
Function usage
ypoint(signal, i)
Required arguments
signal1
Waveform *
Integer
Returned value
Double
An example for the ypoint() function C CODAC is the same as xpoint().
620
copyfile(sourcefile, dstfile)
Required arguments
deletefile()
For the function description, see deletefile().
Function usage
deletefile(filename)
Required arguments
char * filename
621
freepunchfile()
For the function description, see freepunchfile().
Function usage
freepunchfile(punchfilename)
Required arguments
char * punchfilename
An example for the freepunchfile() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
readspicepunch("example.pun");
freepunchfile("example.pun");
}
freewave()
For the function description, see freewave().
Function usage
freewave(signalname)
Required arguments
Waveform * signalname
CODAC Function Dictionary,
622
histogram()
For the function description, see histogram().
Function usage
histogram(signal, no_of_bins)
Required arguments
Waveform *
Usage details
Use 1 for no_of_bins if you want CODAC to use the default value.
An example for the histogram() function C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1, *wav2 ;
char xname[12], yname[12];
char punchname[] = "example.pun";
char SigName[] = "VX11Y";
char Anal[] = "TR";
wav1 = readwave(punchname,SigName,25.00,1,0,0,Anal);
wav2 = Histogram(wav1 , -1 );
writesignal(wav2 , "histogram.out", 1,0,0);
623
rnormal()
For the function description, see rnormal().
Function usage
rnormal(sigma)
Required arguments
Double sigma
An example for the rnormal() function C CODAC is:
#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
float rand;
int trial = 10;
float mean = 3.5;
float prob = 1;
setseed(52);
rand = rnormal(3 );
printf("%f\n",rand);
rand = runiform(3 , 0 );
printf("%f\n",rand);
rand = rbinomial(prob , trial);
printf("%f\n",rand);
rand = rpoisson(mean);
printf("%f\n",rand);
}
624
rbinomial()
For the function description, see rbinomial().
Function usage
rbinomial(pp, n)
Required arguments
Integer
The example for the rbinomial() function C CODAC is the same as
rnormal().
rpoisson()
For the function description, see rpoisson().
Function usage
rpoisson(xm)
Required arguments
Double xm
Returned value
Integer
625
runiform()
For the function description, see runiform().
Function usage
runiform(sigma, algorithm)
Required arguments
Double sigma
Integer algorithm
The example for the runiform() function C CODAC is the same as
rnormal().
setpath()
For the function description, see setpath().
Function usage
setpath(str_val)
Required arguments
char * str_val
An example for the setpath() function C CODAC is:
#include<stdio.h>
626
#include"codac.h"
#include<string.h>
main()
{
setpath("/user/myid");
system("pwd");
invokespice3("delay.spi",NULL,NULL,NULL,NULL,NULL);
}
setseed()
For the function description, see setseed().
Function usage
setseed (seed)
Required arguments
Integer seed
The example for the setseed() function in C CODAC is the same as
rnormal().
sigcase()
For the function description, see sigcase().
Function usage
sigcase()
627
#include<string.h>
main()
{
sigcase();
readwave("example.pun","vx11y",25.00,1,0,0,"TR");
readwave("example.pun","vx12y",25.00,1,0,0,"TR");
readwave("example.pun","vx13y",25.00,1,0,0,"TR");
readwave("example.pun","vx14y",25.00,1,0,0,"TR");
sigcase();
readwave("example.pun","vx11y",25.00,1,0,0,"TR");
}
628