0% found this document useful (0 votes)
53 views628 pages

Codacfd

This document describes functions in the CODAC Function Dictionary. It is organized alphabetically and includes mathematical, trigonometric, file/IO, string, waveform and other functions. Each function has a description and parameters to outline how it works.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views628 pages

Codacfd

This document describes functions in the CODAC Function Dictionary. It is organized alphabetically and includes mathematical, trigonometric, file/IO, string, waveform and other functions. Each function has a description and parameters to outline how it works.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 628

CODAC Function Dictionary

This dictionary describes CODAC application functions in alphabetical


order, CODAC Optimizer functions, PERL CODAC functions, and C
CODAC functions.
Function Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Function Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
abs() . .
ceil() . .
exp() . .
fabs() .
floor() .
log() . .
log10()
max() .
min() . .
pow() .
sqrt() . .

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

38
39
40
42
43
44
45
47
48
49
51

Trigonometric Functions.
acos() . . . . . . . . . . . . . . .
asin() . . . . . . . . . . . . . . .
atan() . . . . . . . . . . . . . . .

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

.
.
.
.

..
..
..
..

.
.
.
.

52
52
53
54

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

Plot Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377


plot() . . . . . .
pltcomment()
pltdate() . . .
pltgrid() . . . .
pltmjrgrid() .
pltportrait() .
pltprtres() . .
pltxgrid() . . .
pltxmax() . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..

377
379
381
383
385
387
389
391
393

CODAC Function Dictionary,

pltxmin() . . .
pltxmjrgrid()
pltxorigin() . .
pltxscale() . .
pltxunits() . .
pltygrid() . . .
pltymax() . . .
pltymin() . . .
pltymjrgrid()
pltyorigin() . .
pltyscale() . .
pltyunits() . .

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

395
397
398
400
402
403
405
407
409
411
413
415

Miscellaneous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 418


copyfile() . . . .
deletefile() . . .
exit() . . . . . . .
freepunchfile()
freewave() . .
histogram() . .
rbinomial() . .
rnormal() . . . .
rpoisson() . . .
runiform() . . .
setpath() . . . .
setreltol() . . .
setseed() . . .
sigcase() . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..
..
..

418
419
420
421
423
425
427
428
431
432
434
435
437
438

CODAC Function Dictionary,

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

Perl CODAC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469


Perl CODAC Toplevel Functions . . . . . . . . . . . . . . . . . . . . . . 470
delay() . .
delaych() .
delaylc() .
delayhc() .
delayhh()
delayhl() .
delaycl() .
delaylh() .
delayll() . .
delayoff()
delayxx() .

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

470
471
471
472
473
473
474
474
475
475
476

CODAC Function Dictionary,

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

Perl CODAC Waveform Functions .


abspeak() . . . . . . . . . . . . . . . . . .
addpoints() . . . . . . . . . . . . . . . . .
average() . . . . . . . . . . . . . . . . . .
bandwidth() . . . . . . . . . . . . . . . . .
crosstime() . . . . . . . . . . . . . . . . .
diff() . . . . . . . . . . . . . . . . . . . . . .
digitize() . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

486
486
487
488
488
489
489
490

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

Perl CODAC Punch Functions .


addcards() . . . . . . . . . . . . . .
caddcards() . . . . . . . . . . . . . .
freepunchfile() . . . . . . . . . . . .
plot() . . . . . . . . . . . . . . . . . . .

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

516
516
516
517
517

CODAC Function Dictionary,

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

C CODAC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524


C CODAC String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 524
str() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
strind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
CODAC Function Dictionary,

14

strrext() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
C CODAC AC Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
bandwidth() . .
gainatphase()
gainmargin() .
phaseatgain()
phasemargin()

.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

.
.
.
.
.

.
.
.
.
.

..
..
..
..
..

527
528
529
529
530

C CODAC Simulator Functions . . . . . . . . . . . . . . . . . . . . . . . 531


addcards() . . . . .
caddcards() . . . . .
getsrvrstatus() . . .
invokespice3() . .
invokespicesrvr()
setspice3path() . .
sndsrvrmodify() . .
stopspicesrvr() . .

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..

531
532
533
533
534
535
535
536

C CODAC Transient Functions


abspeak() . . . . . . . . . . . . . . .
crosstime() . . . . . . . . . . . . . .
crossvalue() . . . . . . . . . . . . .
delay() . . . . . . . . . . . . . . . . .
delaych() . . . . . . . . . . . . . . . .
delaycl() . . . . . . . . . . . . . . . .
delayhc() . . . . . . . . . . . . . . . .
delayhh() . . . . . . . . . . . . . . .
delayhl() . . . . . . . . . . . . . . . .
delaylc() . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..

537
537
538
538
539
540
541
541
542
542
543

CODAC Function Dictionary,

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

C CODAC Plot Functions


plot() . . . . . . . . . . . . . .
pltcomment() . . . . . . . .
pltdate() . . . . . . . . . . . .
pltgrid() . . . . . . . . . . . .
pltmjrgrid() . . . . . . . . . .
pltportrait() . . . . . . . . . .

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

.
.
.
.
.
.
.

.
.
.
.
.
.
.

..
..
..
..
..
..
..

558
558
559
560
560
560
560

CODAC Function Dictionary,

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

C CODAC Waveform Functions . . . . . . . . . . . . . . . . . . . . . . . 567


addpoints() .
area() . . . . .
average() . .
diff() . . . . . .
digitize() . . .
fwdfft() . . . .
getanalysis()
getcrosses()
getdate() . . .
gethightime()
getlowtime()
getmodify() .

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

..
..
..
..
..
..
..
..
..
..
..
..

567
568
569
569
570
571
572
573
574
575
576
576

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

CODAC Function Dictionary,

20

Function Summary
This subsection contains an alphabetized table of functions.
Table 1. Mathematical Function Summary
Function

Description

abs()

Returns the absolute value of an integer

ceil()

Returns the smallest integer greater than its read


argument

exp()

Returns the e power of the value passed

fabs()

Returns the absolute value of a float

floor()

Returns the greatest integer less than its real


argument

log()

Returns the natural logarithm of a value

log10()

Returns the log10 of a value

max()

Returns the maximum value of the two specified


arguments

min()

Returns the minimum value of the two specified


arguments

pow()

Returns the power of a value

sqrt()

Returns the positive square root of a value

CODAC Function Dictionary,

21

Table 2. Trigonometric Function Summary


Function

Description

acos()

Returns the arccosine of a value

asin()

Returns the arcsine of a value

atan()

Returns the arctangent of a value

cos()

Returns the cosine of a value

sin()

Returns the sine of a value

tan()

Returns the tangent of the argument passed

Table 3. File and I/O Function Summary


Function

Description

fclose()

Closes the specified file

fgetc()

Reads the next character from the specified file

fgets()

Reads characters from the specified file

fopen()

Opens the specified file

fprint()

Outputs to the specified file

fprintf()

Outputs to the specified file, according to the


specified control string format

fscan()

Reads an integer, float, and string from the


specified file
CODAC Function Dictionary,

22

Table 3. File and I/O Function Summary (Continued)


Function

Description

fscanf()

Reads from the specified file, according to the


specified control string format

print()

Outputs to the stdout

fprintf()

Outputs to stdout, according to the specified


control string format

scan()

Reads from stdin

scanf()

Reads from stdin, according to the specified


control string format

sprint()

Outputs to string buffer

sprintf()

Outputs to string buffer, according to specified


control string format

sscan()

Reads integer, float, and string variables from the


specified string

sscanf()

Reads integer, float, and string variables from a


string in the specified format

CODAC Function Dictionary,

23

Table 4. String Function Summary


Function

Description

str()

Returns a string

strext()

Returns the requested number of characters from


the specified string

strind()

Returns an integer

strlen()

Returns an integer

strncat()

Returns a string

strncmp()

Returns an integer

strncpy()

Returns a variable

strrext()

Returns the requested number of characters from


the string str_val before the index position

strstr()

Returns a string

Table 5. Waveform Function Summary


Function

Description

addpoint()

Adds the timevalue pair (xpoint, ypoint) to the


waveform represented by the signal

area()

Returns the area under the curve as a float value

CODAC Function Dictionary,

24

Table 5. Waveform Function Summary (Continued)


Function

Description

average()

Returns the average value of the signal

diff()

Returns the differentiated signal

digitize()

Compares two waveform signals and returns a


digital waveform reflecting the success or failure
of the specified operator

fwdfft()

Computes the fast fourier transform of a signal

getanalysis()

Returns the analysis type of the specified signal

getcrosses()
getdate()

Returns the date when the signal was punched

gethightime()

Returns the time at which the signal crosses the


high level for the specified transition

getlowtime()

Returns the time at which the signal crosses the


low level for the specified transition

getmodify()

Returns the modified number for a specified signal

getmodifynum()

Returns the number of points for a signal

getrerun()

Returns the rerun number of the specified signal

getrerunnum()

Returns the run number of the specified signal

getsigcent()

Returns the center level signal value

CODAC Function Dictionary,

25

Table 5. Waveform Function Summary (Continued)


Function

Description

getsiggp()

Returns the glitch period set for a signal

getsighigh()

Returns the high level signal value

getsiglow()

Returns the low level signal value

getsigname()

Returns the name of the signal

gettemp()

Returns the temperature of the specified signal

gettime()

Returns the time when the signal was punched

gettitle()

Returns the title card for the specified signal

gettransitions()

Returns the number of transitions in a signal

gettransitiontime()

Returns the transition time of a signal

getx()

Returns an x value corresponding to a y value

getxt()

Returns an x value of a signal at the given y value


for the specified transition

gety()

Returns a y value corresponding to an x value

interpolate()

Interpolates on the signal at the specified time


intervals corresponding to the sampling frequency

intg()

Returns the integrated signal corresponding to the


input waveform

CODAC Function Dictionary,

26

Table 5. Waveform Function Summary (Continued)


Function

Description

isfall()

Returns 1, if the specified transition is falling; else


returns 0

isrise()

Returns 1, if the specified transition is rising; else


returns 0

ivcurve()

Generates a transfer curve

loaddb()

Loads the punch data base

nextsignal()

Iterates the list of signals in the currently active


Spice punchfile

range()

Returns a waveform

readspicepunch()

Loads the Spice punchfile into the memory

readwave()

Returns the waveform variable

revfft()

Computes the inverse fourier transform of a signal

savedb()

Saves the currently read-in punchfile

setlevels()

Sets the signal levels for digital waveform

setreftime()

Sets the reference time for measuring transition

setsigcent()

Sets the center level of the signals

setsiggp()

Sets the glitch period for the signals

setsighigh()

Sets the high level of the signals

CODAC Function Dictionary,

27

Table 5. Waveform Function Summary (Continued)


Function

Description

setsiglow()

Sets the low level of the signals

setsigname()

Sets the name of the signal

settolerance()

Sets the tolerance for comparison of logical


waveforms and float values

setxyunits()

Returns an integer

thresholdsignal()

Returns the set of signals that exceed the


threshold value

wabs()

Returns a waveform whose value corresponds to


the absolute value of the signal passed

wacos()

Returns a waveform whose value corresponds to


the arccosine of the signal passed

wasin()

Returns a waveform whose value corresponds to


the arcsine of the signal passed

watan()

Returns a waveform whose value corresponds to


the arctangent of the signal passed

wcos()

Returns a waveform whose value corresponds to


the cos of the signal passed

wexp()

Returns a waveform whose value corresponds to


the exponential of the signal passed

CODAC Function Dictionary,

28

Table 5. Waveform Function Summary (Continued)


Function

Description

wlog()

Returns a waveform whose value corresponds to


the logarithm of the signal passed

wlog10()

Returns a waveform whose value corresponds to


the logarithm to the base 10 of the signal passed

wpow()

Returns a waveform whose value corresponds to


the signal passed raised to the power of float1

writesignal()

Writes the punchfile for the signal

wsin()

Returns a waveform whose value corresponds to


the sin function of the signal passed

wsqrt()

Returns a waveform whose value corresponds to


the sqrt function of the signal passed

wtan()

Returns a waveform whose value corresponds to


the tan function of the signal passed

xpoint()

Returns the x point of the signal

ypoint()

Returns the y point of the signal

CODAC Function Dictionary,

29

Table 6. Simulator Function Summary


Function

Description

addcards()

Adds the specified cards to the given Spice deck

caddcards()

Adds the specified cards to the given Spice deck

getsrvrstatus()

Returns the status of the Spice job that you invoke


through the Spice server function

getstatus()

Returns the status of the Spice job whose task ID


is specified

invokespice3()

Invokes TI Spice3

invokespicesrvr()

Invokes the TI Spice server

setsockconfig()

Sets the Spice2 executable pathname

setspice3path()

Sets the TI Spice3 executable pathname

sndsrvrmodify()

Sends the modify string to the Spice server

stopspicesrvr()

Stops invoked Spice servers

Table 7. Task Broker/Manager Function Summary


Function

Description

loadservice()

Loads the service definition file, and opens a task


manager connection

setservice()

Sets the specified service for all subsequent jobs


submitted to the task manager

CODAC Function Dictionary,

30

Table 8. AC Function Summary


Function

Description

bandwidth()

Calculates the bandwidth in an ac analysis

gainatphase()

Calculates the gain in dB at the specified phase


angle

gainmargin()

Calculates the gain margin in the ac analysis

phaseatgain()

Calculates the phase angle at the specified gain

phasemargin()

Calculates the gain margin in the ac analysis

Table 9. Transient Function Summary


Function

Description

abspeak()

Returns the absolute peak value of the signal

crosstime()

Finds the time at which signal1 crosses signal2

crossvalue()

Finds the value at which signal1 crosses signal2

delay()

Returns the delay between two signals

delaych()

Returns the delay between the center level of


signal1 and high level of signal2

delaycl()

Returns the delay between the center level of


signal1 and low level of signal2

CODAC Function Dictionary,

31

Function

Description

delayhc()

Returns the delay between the high level of signal1


and center level of signal2

delayhh()

Returns the delay between the high level of signal1


and high level of signal2

delayhl()

Returns the delay between the high level of signal1


and low level of signal2

delaylc()

Returns the delay between the low level of signal1


and center level of signal2

delaylh()

Returns the delay between the low level of signal1


and high level of signal2

delayll()

Returns the delay between the low level of signal1


and low level of signal2

delayoff()

Returns the delay between two signals with


different offsets

delayxx()

Computes the delay between the specified points


of two signal transitions

dip()

Calculates the dip value of the signal

dutycycle()

Returns the duty cycle of the specified pulse

falltime()

Returns the fall time of a signal

peak()

Returns the peak value of the signal

setlevels()

Returns the peak2peak value of the signal

CODAC Function Dictionary,

32

Function

Description

pulsefrequency()

Returns the pulse frequency of the specified pulse

pulseperiod()

Returns the pulse period of the specified pulse

pulsewidth()

Returns the pulse width of the specified pulse

risetime()

Returns the rise time of a signal

rms()

Returns the root mean square value of the signal

settle()

Returns the settling time of the waveform

skew()

Returns the skew value between two signals

slewrate()

Returns the rate of change of the specified


transition in the signal

slope()

Calculates the slope of a curve at the given x point

threshold()

Returns the threshold value of the signal

thresholdhysteresis() Returns the threshold hysteresis of the signal

Table 10. Plot Function Summary


Function

Description

plot()

Generates a postscript file for plotting signals

pltcomment()

Outputs specified comments on the plot

CODAC Function Dictionary,

33

Table 10. Plot Function Summary (Continued)


Function

Description

pltdate()

Plots the date and time

pltgrid()

Plots the grids

pltmjrgrid()

Plots the major grids

pltportrait()

Plots the file in a portrait mode

pltxgrid()

Plots the grid along the x-axis

pltxmax()

Specifies the maximum value on the x-axis of the


plot

pltxmin()

Specifies the minimum value on the x-axis of the


plot

pltxmjrgrid()

Plots the major grid along the x-axis

pltxorigin()

Specifies the x-origin of the plot

pltxscale()

Plots the scale of the x-axis to the specified value

pltxunits()

Sets the units on the x-axis for the plot

pltxgrid()

Plots the grid along the y-axis

pltxmax()

Sets the maximum value on the y-axis for the plot

pltymin()

Sets the minimum value on the y-axis for the plot

pltymjrgrid()

Plots the major grid along the y-axis

pltyorigin()

Sets the y-origin of the plot

CODAC Function Dictionary,

34

Table 10. Plot Function Summary (Continued)


Function

Description

pltyscale()

Sets the scale of the y-axis to the specified value

pltyunits()

Sets the units on the y-axis for the plot

Table 11. Miscellaneous Function Summary


Function

Description

copyfile()

Copies files

deletefile()

Deletes the specified file from the directory

exit()

Exits the program

freepunchfile()

Frees up the memory occupied by signals in a


punchfile

histogram()

Converts the input signal values to histogram


format

rbinomial()

Returns an evenly distributed random number

rnormal()

Returns a normally distributed random number

setpath()

Sets the current working directory pathname

setreltol()

Sets the relative tolerance for the floating point


logical operators

CODAC Function Dictionary,

35

Table 11. Miscellaneous Function Summary (Continued)


Function

Description

setseed()

Sets the seed for the functions, rnormal() and


rbinomial()

sigcase()

Toggles between upper and lowercase for signal


names

system()

Specifies the shell command to be executed

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

Represents an integer variable


Returned Value

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

Represents a float value

CODAC Function Dictionary,

39

Returned Value

Returns a float value


Description

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);

CODAC Function Dictionary,

40

Prerequisites

None.
Required Arguments
floatval

Represents a float value


Returned Value

Returns a float value


Description

The exp function returns the e raised to the power of the value passed.
This function resembles the C mathematical function exp().
Example

This example assigns the exponential raised to the power of 10 to the


variable expval. The value of expval is returned after execution.
main()
{
float expval;
expval = exp(10.0);
print(exp value of 10.0 =, expval);
}

CODAC Function Dictionary,

41

fabs()
The fabs function returns the absolute value of the specified argument.
Function Usage

fabs(float1)
Prerequisites

None.
Required Arguments
float1

Represents a float variable


Returned Value

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.

CODAC Function Dictionary,

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

Represents a float value


Returned Value

Returns a float value

CODAC Function Dictionary,

43

Description

The floor function returns the smallest integer as the double-precision


number that is not greater than the value passed. This function
resembles the C mathematical function floor().
Example

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

CODAC Function Dictionary,

44

Represents a float value


Returned Value

Returns a float value


Description

The log function returns the natural logarithm of the value passed. This
function resembles the C mathematical function log().
Example

This example assigns the natural log of 10 to the variable logval. It


returns the value of logval after execution.
main()
{
float logval;
logval = log(10.0);
print(// log value of 10.0 =, logval);
}

log10()
The log10 function returns the log10 of the value.
Function Usage

log10(floatval)

CODAC Function Dictionary,

45

Prerequisites

None.
Required Arguments
floatval

Represents a float value


Returned Value

Returns a float value


Description

The log10 function returns the logarithm base 10 of the value passed.
This function resembles the C mathematical function log 10().
Example

This example assigns the logarithm to base 10 of 10.0 to the variable


log 10 val. It returns the value of log10 val after execution.
main()
{
float log10val;
log10val = log10(10.0);
print(// log10 value of 10.0 =, log10val);
}

CODAC Function Dictionary,

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

The max function returns the maximum value of the specified


arguments, flt1, flt2,.....fltn.

CODAC Function Dictionary,

47

Example

This example prints the value 2.55 to the standard output.


main()
{
float flt1 = 2.5;
float flt2 = 2.55;
print(max(flt1, flt2));
}

Related Functions

min()

Returns the minimum of the specified arguments

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

CODAC Function Dictionary,

48

Returned Value

A float
Description

The min function returns the minimum of the specified arguments, flt1,
flt2,.....fltn.
Example

This example prints the value 2.5 to the standard output.


main()
{
float flt1 = 2.5;
float flt2 = 2.55;
print(min(flt1, flt2));
}

Related Functions

max()

Returns the maximum value of the specified arguments

pow()
The pow function raises a number to a power.
Function Usage

pow(x, y)

CODAC Function Dictionary,

49

Prerequisites

None.
Required Arguments
x, y

Represents two float values


Returned Value

Returns a float value


Description

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);
}

CODAC Function Dictionary,

50

sqrt()
The sqrt function returns the square root of the value.
Function Usage

sqrt(x)
Prerequisites

None.
Required Arguments
x

Represents a float or an integer value


Returned Value

Returns a float value


Description

The sqrt function returns the positive square root of x. The value of x
should be positive.

CODAC Function Dictionary,

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

Represents a float value


CODAC Function Dictionary,

52

Returned Value

Returns a float value


Description

The acos function returns an arccosine (inverse cosine) of the value


passed. This function resembles the C mathematical function acos().
Example

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.

CODAC Function Dictionary,

53

Required Arguments
floatval

Represents a float value


Returned Value

Returns a float value


Description

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

Represents a float value


Returned Value

Returns a float value


Description

The atan function returns an arctangent (inverse tangent) of the value


passed. This function resembles the C mathematical function atan().
Example

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);
}

CODAC Function Dictionary,

55

cos()
The cos function returns the cosine of the specified argument.
Function Usage

cos(radians)
Prerequisites

None.
Required Arguments
radians

A float value representing radians


Returned Value

Returns a float value


Description

The cos function returns the cosine of the parameter (in radians)
passed. This function resembles the C mathematical function cos().

CODAC Function Dictionary,

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

A float value indicating radians


Returned Value

Returns a float value

CODAC Function Dictionary,

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

A float value representing radian.


CODAC Function Dictionary,

58

Returned Value

Returns a float value


Description

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);
}

CODAC Function Dictionary,

59

File and I/O Functions


This subsection describes the available functions for file handling and
general I/O handling.

fclose()
The fclose function closes the specified file.
Function Usage

fclose(filepointer)
Required Arguments
filepointer

Represents a file type variable invoked using the fopen() function


Returned Value

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.

CODAC Function Dictionary,

60

Example

This example opens and closes the file /tmp/dummy.


main()
{
file fileread;
fileread = fopen(/tmp/dummy,r);
fclose(fileread);
}

Related Functions

fopen()

Opens the specified file

fgetc()
The fgetc function reads the next character from the specified file.
Function Usage

fgetc(filepointer)
Required Arguments
filepointer

Represents a file type variable that specifies the file to be read


Returned Value

Returns an integer

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

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

Represents a string variable


n

Represents an integer variable specifying the number of characters


to be read
filepointer

Represents a file type variable specifying the file to be read


Returned Value

Returns an integer

CODAC Function Dictionary,

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

This example reads the file /tmp/dummy line-by-line up to a maximum


of 79 characters per line into the string variable buffer and prints them.
main()
{
string buffer;
file fileread;
fileread
= fopen(/tmp/dummy,r);
while(fgets(buffer, 80, fileread))
printf(%s, buffer);
fclose(fileread);
}

Related Functions

fopen()

Opens the specified file

fopen()
The fopen function opens the specified file.

CODAC Function Dictionary,

64

Function Usage

fopen(filename, type)
Required Arguments
filename

Specifies the file to be opened


type

Specifies the mode


Returned Value

Returns a file data type


Description

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

Open for reading

Truncate or create for writing

Append/open for writing at the end of the file, or create for


writing

CODAC Function Dictionary,

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()

Closes the specified file

fprint()
The fprint function prints the output to the specified file.
Function Usage

fprint(fp, arg1, arg2,...)


Required Arguments
fp

Specifies a pointer to the file the output is written to


Options
arg1, arg2,...

CODAC Function Dictionary,

66

Represents a number of arguments of any data type


Returned Value

Returns an integer
Description

The fprint function accepts the variable number of arguments of any


data type and outputs them to the specified file. The type of arguments
accepted are integer, float, waveform, and string.
In the case of a waveform variable, the fprint function prints only the
signal name of the signal that the waveform variable references.
The function fprint does not accept the string format argument that is
specified in the standard C fprintf.
Example

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);

CODAC Function Dictionary,

67

Related Functions

fscan()

Reads an integer, a float, and a string from the


specified file

fprintf()
The fprintf function prints the output in the specified format.
Function Usage

fprintf(fp, format, arg1, arg2,...)


Required Arguments
fp

Specifies a pointer to the file the output is written to


format

Specifies the control string that contains the conversion specifications


for a formatted output
arg1, arg2,...

Represents variables that correspond to the conversion specifications


specified in the control string

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

69

Related Functions

fscan()

Reads an integer, a float, and a string from the file in the


specified format

fscan()
The fscan function reads an integer, a float, and a string from the
specified file.
Function Usage

fscan(fp, arg1, arg2,...)


Required Arguments
fp

Specifies a pointer to the file the output is written to


Options
arg1, arg2,...

Represents a number of arguments of any data type


Returned Value

An integer

CODAC Function Dictionary,

70

Description

The fscan function accepts the variable number of arguments which


may be of different types and reads the variables from the file referenced
by the file pointer, fp. The types of arguments accepted are integer,
float, and string.
The function fscan does not accept the string format argument that is
specified in the standard C fscanf.
Example

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);
}

CODAC Function Dictionary,

71

Related Functions

fscanf()

Outputs an integer to the specified file

fscanf()
The fscanf function reads an integer, a float, and a string from the file
in the specified format.
Function Usage

fscanf (fp, format, arg1, arg2,...)


Required Arguments
fp

Specifies a pointer to the file the output is written to


format

Specifies the control string that contains the conversion specifications


for a formatted output
arg1, arg2,...

Represents variables that correspond to the conversion specifications


specified in the control string
Returned Value

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()

Prints the formatted output in the specified format

print()
The print function prints the arguments to the standard output.

CODAC Function Dictionary,

73

Function Usage

print(arg1, arg2,...)
Required Arguments
arg1, arg2,...

Specify at least one argument. You can specify any number of


arguments of any data type.
Returned Value

Returns an integer
Description

The print function accepts the variable number of arguments of any


data type and outputs them to the specified standard output device. The
types of arguments accepted are an integer, a float, a waveform, and
a string.
In the case of a waveform variable, the print function prints only the
signal name of the signal referenced by the waveform variable. The
print function does not accept the string format argument that is
specified in the standard C printf.
Example

This example prints 2, 2.5, hello and the value of VCC.


main()
{

CODAC Function Dictionary,

74

int a = 2;
float b = 2.5;
string c =hello;
readpunch(mypunchfile);
vcc = $VCC;
print(a,,, b,,, c,,, vcc);
}

Related Functions

scan()

Accepts an integer, a float, and a string as the input

printf()
The printf function prints the variables in the specified format.
Function Usage

printf(format, arg1, arg2,...)


Required Arguments
format

Represents the control string specifying the conversion specifications


for the formatted output
arg1, arg2,...

Represents variables that correspond to the conversion specifications


specified in the control string

CODAC Function Dictionary,

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()

Accepts an integer, a float, and a string as the input in the


specified format

CODAC Function Dictionary,

76

scan()
The scan function reads the variables from the standard input.
Function Usage

scan(arg1, arg2,...)
Required Arguments
arg1, arg2,...

Specify at least one argument. You can specify any number of


arguments of any data type.
Returned Value

Returns an integer
Description

The scan function accepts the variable number of arguments of any


data type and reads the variables from the specified standard input
device. The types of arguments accepted are an integer, a float, and a
string.
The function scan does not accept the string format argument that is
specified in the standard C scanf function.

CODAC Function Dictionary,

77

Example

This program prompts for an integer, a float, and a string input.


main()
{
int intval;
float floatval;
string stringval;
scan(intval, floatval, stringval);
print(Integer value read =, intval);
print(Float
value read =, floatval);
print(String value read =, stringval);
}

Related Functions

print()

Outputs an integer

scanf()
The scanf function reads the variables from the standard input in the
specified format.
Function Usage

scanf(format, arg1, arg2,...)


Required Arguments
format

CODAC Function Dictionary,

78

Represents the control string specifying the conversion specifications


for the formatted output
arg1, arg2,...

Represents variables that correspond to the conversion specifications


specified in the control string
Returned Value

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);
}

CODAC Function Dictionary,

79

Related Functions

printf()

Outputs an integer in the specified


format

sprint()
The sprint function accepts and prints variables into a string.
Function Usage

sprint(buffer, arg1, arg2,...)


Required Arguments
buffer

Represents a string variable


Options
arg1, arg2,...

Represents a number of arguments of any data type


Returned Value

Returns an integer

CODAC Function Dictionary,

80

Description

The sprint function accepts the variable number of arguments of any


data type and writes them to the string buffer. The types of arguments
accepted are an integer, a float, a waveform, and a string.
In the case of a waveform variable, the sprint function writes only the
signal name of the signal referenced by the waveform variable. The
sprint function does not accept the string format argument that is
specified in the standard C sprintf function.
Example

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()

Prints the formatted output

CODAC Function Dictionary,

81

sprintf()
The sprintf function prints the formatted output.
Function Usage

sprintf(buffer, format, arg1, arg2,...)


Required Arguments
buffer

Represents a string variable


format

Represents the control string specifying the conversion specifications


for the formatted output
arg1, arg2,...

Represents variables that correspond to the conversion specifications


specified in the control string
Returned Value

Returns an integer
Description

The sprintf function prints the formatted output just like the standard C
sprintf function.

CODAC Function Dictionary,

82

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 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

sscan(buf, arg1, arg2,...)


Required Arguments
buf
CODAC Function Dictionary,

83

Represents a string variable from which the program reads the


variables
arg1, arg2,...

Represents a number of arguments of any data type


Returned Value

The sscan function returns an integer corresponding to the number of


successfully matched and assigned input items. This number can be 0,
if there is an early matching failure between an input character and the
control string. If the input ends before the first matching failure or
conversion, the program returns 1.
Description

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;

CODAC Function Dictionary,

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()

Prints the output onto a string

sscanf()
The sscanf function reads integer, float, and string variables from a
string in the specified format.
Function Usage

fscanf(buf, format, arg1, arg2,...)


Required Arguments
buf

Represents a string variable from which the program reads the


variables
format

Specifies the control string that contains the conversion specifications


for a formatted output

CODAC Function Dictionary,

85

arg1, arg2,...

Represents a number of arguments of any data type


Returned Value

The sscanf function returns an integer corresponding to the number of


successfully matched and assigned input items. This number can be
zero if there is an early matching failure between an input character and
the control string. If the input ends before the first matching failure or
conversion, the program returns 1.
Description

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);
}

CODAC Function Dictionary,

86

Related Functions

sprintf()

Prints the formatted output onto a string

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

Specifies an integer or a float variable or constant


Returned Value

Returns a string

CODAC Function Dictionary,

87

Description

The str function accepts an integer or a float variable or constant and


returns that value as string.
Example

This example outputs 1 2.5E+10.


main()
{
int int1 = 1;
float float1 = 2.5e+10;
string str1, str2;
str1 = str(int1);
str2 = str(float1);
print(str1 + + str2);
}

Related Functions

print()

Outputs an integer

If you are using the C CODAC interface, see C CODAC Toplevel


Function str().

strext()
The strext function returns the requested number of characters from
the specified string.

CODAC Function Dictionary,

88

Function Usage

strext(str_val, index)
or
strext(str_val, index, num)
Required Arguments
str_val

Specifies a string value/variable


index

An integer specifying a position in the string str_val


Optional Arguments
num

An integer specifying the number of characters to be extracted from


the str_val starting from position index
Returned Value

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

CODAC Function Dictionary,

89

argument num, the function returns the rest of the string str_val starting
from the position index.
Example

This example extracts the string1 from FREQUENCY = 1MHz.


main()
{
string strval =FREQUENCY = 1MHz;
string
pattern = = ;
int index = strind(strval, pattern);
/* extract at most 1 character from the tail of strval
immediately after the end of the first occurrence of pattern */
print (strext(strval, index + strlen(pattern), 1));
}

Related Functions

strrext()

Returns the requested number of characters from the


string str_val before the index position

strind()
The strind function returns an integer.
Function Usage

strind(str_val, pattern)

CODAC Function Dictionary,

90

Required Arguments
str_val

Specifies a string value/variable


pattern

Specifies a string value/variable


Returned Value

Returns an integer
Description

The strind function returns an integer corresponding to the position of


the first occurrence of the pattern in the string str_val. If the specified
pattern is not found, the function returns 1.
Example

This example prints 10 that corresponds to the position of pattern =


in string FREQUENCY = 1MHz.
main()
{
string
strval =FREQUENCY = 1MHz;
string
pattern = = ;
/* get the position of pattern in strval */
print(strind(strval, pattern));
}

CODAC Function Dictionary,

91

Related Functions

strrext()

Returns the requested number of characters from the


string str_val before the index position

If you are using the C CODAC interface, see C CODAC Toplevel


Function strind().

strlen()
The strlen function returns the length of a string.
Function Usage

strlen(s)
Required Arguments
s

Represents a string variable


Returned Value

Returns an integer
Description

The strlen function returns the number of characters in s, not including


the null-terminating character.

CODAC Function Dictionary,

92

Example

The example outputs 6.


main()
{
string s =strlen;
print(strlen(s));
}

Related Functions

print()

Outputs an integer

strncat()
The strncat function concatenates two strings.
Function Usage

strncat(s1, s2, n)
Required Arguments
s1, s2

Represents string variables


n

Represents an integer variable

CODAC Function Dictionary,

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

This example outputs the string, string thinging.


main()
{
string str1 =string thing;
string str2 =ing;
print(strncat(str1, str2, 2));
}

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

Represents string variables


n

Represents an integer variable


Returned Value

Returns an integer
Description

The strncmp function compares the arguments and returns an integer


greater than, equal to, or less than zero. For example, s1 is
lexicographically greater than, equal to, or less than s2 in its first n
characters.
Example

This example outputs a zero.


main()
{
string str1 =string thing;
string str2 =str;
print(strncmp(str1, str2, 2));
}

CODAC Function Dictionary,

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

Represents string variables


n

Represents an integer variable


Returned Value

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

CODAC Function Dictionary,

96

is less than n, then it pads s1 with null characters. If the length of s2 is


greater or equal to n, then s1 will not be null-terminated. It returns s1.
Example

This example outputs in.


main()
{
string str1 =string thing;
string str2 =ing;
print(strncpy(str1, str2, 2));
}

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)

CODAC Function Dictionary,

97

Required Arguments
str_val

Represents a string value/variable


index

Represents an integer specifying a position in the string str_val


Optional Arguments
num

An integer value specifying the number of characters to extract in


str_val before the index position
Returned Value

Returns a string value


Description

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

This example extracts the string FREQUENCY = 1 from FREQUENCY


= 1 MHz.
main()

CODAC Function Dictionary,

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()

Returns the requested number of characters from the


specified string

If you are using the C CODAC interface, see C CODAC Toplevel


Function strrext().

strstr()
The strstr function finds the specified pattern in a string.
Function Usage

strstr(s1, s2)
Required Arguments
s1, s2

Represents string variables


n

CODAC Function Dictionary,

99

Represents an integer variable


Returned Value

Returns a string or NULL


Description

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

This example outputs ing thing.


main()
{
string str1 =string thing;
string str2 =ing;
print(strstr(str1, str2));
}

Related Functions

print()

Outputs an integer

CODAC Function Dictionary,

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

addpoint(signal, xpoint, ypoint)


Prerequisites

None.
Required Arguments
signal

Specifies a waveform variable


xpoint

Specifies a float variable representing the x coordinate of a point


ypoint

Specifies a float variable representing the y coordinate of a point

CODAC Function Dictionary,

101

Returned Value

Returns an integer value 1


Description

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

The example below illustrates the usage of the addpoint function to


construct a waveform using a set of time value pairs. This example
constructs a single pulse and writes the same to the file,
GeneratedWave.
main()
{
waveform sig1;
addpoint(sig1, 0.0, 1.0);
addpoint(sig1, 1.0, 4.0);
addpoint(sig1, 4.0, 4.0);
addpoint(sig1, 5.0, 1.0);
writesignal(sig1,GeneratedWave);
}

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()

CODAC Function Dictionary,

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

Read the signals in using the readspicepunch() function. Specify the


starttime and endtime within the signal time bounds.
Required Arguments
signalname

Represents the signal whose area should be calculated. The signal


should be a waveform.
Options
starttime

Represents the start time for calculating the area. This should be a
float.
endtime

CODAC Function Dictionary,

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

Figure 1. Measuring the Total Area of the Signal

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

Figure 2. Measuring the Area Between the Starttime and Endtime


of the Signal

Signal

Endtime
Starttime
t1

t2
Time

While calculating the area, the signal curve is assumed to be linear


between any two Spice punch points. If the y-value is negative, then
the portion of the area calculated will also be negative.
If there is a negative y-value for every positive y-value (of the same
magnitude) in a signal within the specified interval, then the area of the
curve will be zero.
Example

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;

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

average()

Returns the average value of the signal

average()
The average function returns the average value of the signal.
Function Usage

average(signalname)
or
average(signalname, starttime, endtime)
Prerequisites

Read the signals in using the readspicepunch() function. Specify the


starttime and endtime within the signal time bounds.

CODAC Function Dictionary,

106

Required Arguments
signalname

Represents the signal whose average should be calculated. The


signal should be a waveform.
Options
starttime

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.

CODAC Function Dictionary,

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

Figure 3. Measuring the Total Average of the Signal

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

Figure 4. Measuring the Average Between the Starttime and the


Endtime of the Signal

Signal

Endtime
Starttime
t1

t2
Time

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

area()

Returns the area under the curve as the


float value.

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().

CODAC Function Dictionary,

109

diff()
The diff function returns the differentiated value of the signal.
Function Usage

diff(signalname)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signalname

Name of the signal to be differentiated. This should be a waveform.


Returned Value

The diff function returns the differentiated signal or it returns NULL if


the program cannot access the specified signal.
Description

The diff function calculates the derivative of the specified signal.


Example

This example calculates the derivative of the signal V OUT and returns
the signal vdiffout.

CODAC Function Dictionary,

110

main()
{
string punchfile =delay.pun;
waveform vout, vdiffout;
readspicepunch(punchfile);
vout = $VOUT;
vdiffout = diff(vout);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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

digitize(Signal1, string1, Signal2)


Prerequisites

None.
CODAC Function Dictionary,

111

Required Arguments
Signal1, Signal2

Represent waveform variables


string1

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

The digitize function compares the waveform Signal1 against the


waveform Signal2 according to the operator specified by the string
variable string1.
If the string variable passed is <, a digital waveform is output whose
transition to high level occurs at time points where the value of Signal1
is less than the value of Signal2 and transition to low level occurs at
time points where the value of Signal1 is not less than the value of
Signal2.
The digitize function also filters all the time points where a transition
does not occur. The other three operators >, <=, and >= perform similar
operations.

CODAC Function Dictionary,

112

Value

Figure 5. Measuring Digitize for Signal1, <, Signal2

Signal1
Signal2

Time

Value

Operand Waveforms

Time
Results of digitize
(Signal1, <, Signal2)

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

setlevels()

Sets the signal levels for digital waveform

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().

CODAC Function Dictionary,

114

fwdfft()
The fwdfft function computes the fast fourier transform of a signal.
Function Usage

fwdfft(signal, samplingfrequency, windowtype, sigmag, sigphase)


Required Arguments
signal

Represents a waveform variable


samplingfrequency

A float variable representing the time steps at which the specified


signal is sampled
windowtype

Represents an integer variable containing a particular windowing


function that fwdfft applies to the signal. The range is between 1 and 7.
sigmag

Represents a waveform variable


sigphase

Represents a waveform variable

CODAC Function Dictionary,

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

CODAC Function Dictionary,

116

Example

This example returns the magnitude and phase components of signal


V CC as the waveform variables, fftmag and fftphase. The sampling
frequency used is 500 MHz. The windowing function applied prior to
computing the fft is the Hanning window.
main()
{
waveform w1, fftMag, fftPhase;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 = $VCC;
fwdfft(w1, 500e6, 3, fftMag, fftPhase);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

revfft()

Computes the inverse fourier transform of a


signal

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().

CODAC Function Dictionary,

117

getanalysis()
The getanalysis function returns the analysis type of the specified
signal.
Function Usage

getanalysis(signal)
Required Arguments
signal

Represents a waveform variable


Returned Value

The getanalysis function returns a string representing the analysis type


of the signal.
Description

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

/* Read Spice punchfile */


readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), getanalysis(w1));
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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

getcrosses (signal1, signal2)


Required Arguments
signal1, signal2

CODAC Function Dictionary,

119

Represents two waveform variables. This function returns the number


of crossings of these variables.
Returned value

Returns an integer value


Description

This function calculates the number of points at which the two signals
intersect and returns the number of intersections.
Example

This function prints the y-value corresponding to each crossing of the


two signals VY and VIN.
main()
{
int i, NumCross;
readspicepunch("phase.pun");
NumCross = getcrosses($VOUT, $VIN);
for(i = 0;i < NumCross; i++)
print("Y value at ",i ,"crossing is:",crossvalue
($VOUT, $VIN, i));
}

CODAC Function Dictionary,

120

Related Functions

crosstime()

Finds the time at which signal1 and signal2 cross each


other

crossvalue()

Finds the value at which signal1 crosses signal2

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

Represents a waveform variable


Returned Value

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()

Reads the Spice punchfile, and loads the


signal into the memory

CODAC Function Dictionary,

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
transnum

Represents the transition number specified as an integer


Returned Value

The high time (float) is returned, if successful; otherwise, it returns a


large negative value.
Description

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);
}

CODAC Function Dictionary,

124

Related Functions

gettransitiontime()

Returns the transition time of the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
transnum

CODAC Function Dictionary,

125

Represents the transition number specified as an integer


Returned Value

The low time (float) is returned, if successful; otherwise, it returns a


large negative value.
Description

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;

CODAC Function Dictionary,

126

setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
delay1 = getlowtime(vcc, 1);
print(// Low time on transition, delay1);
}

Related Functions

gettransitiontime()

Returns the transition time of the signal

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

Represents a waveform variable

CODAC Function Dictionary,

127

Returned Value

The getmodify function returns an integer representing the modified


number of the signal.
Description

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()

Reads the Spice punchfile, and loads the


signal into the memory.

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getmodify().

CODAC Function Dictionary,

128

If you are using the C CODAC interface, see C CODAC Toplevel


Function getmodify().

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

String that specifies the pathname of the punchfile


Returned Value

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.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

130

getpoints()
The getpoints function returns the number of data points for the signal.
Function Usage

getpoints(signal)
Prerequisites

The signal should be read in using the readspicepunch() function.


Required Arguments
signal

Specifies a waveform argument


Returned Value

The getpoints function returns an integer representing the number of


data points.
Description

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.

CODAC Function Dictionary,

131

Example

In this example, the getpoints(vout) returns the number of data points


read from the punchfile delay.pun for the signal, vout.
main()
{
string punchfile =delay.pun;
waveform vout;
int numpoints;
readspicepunch(punchfile);
vout = $VOUT;
numpoints = getpoints(vout);
print(// Number of points in the signal =, numpoints);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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.

CODAC Function Dictionary,

132

Function Usage

getrerun(signal)
Required Arguments
signal

Represents a waveform variable


Returned Value

The getrerun function returns an integer representing the rerun number


of the signal.
Description

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));
}

CODAC Function Dictionary,

133

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

String that specifies the pathname of the punchfile

CODAC Function Dictionary,

134

Returned Value

Returns an integer value


Description

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);
}
}

CODAC Function Dictionary,

135

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents a waveform variable


Returned Value

The getrun function returns an integer representing the run number of


the signal.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

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().

CODAC Function Dictionary,

137

getsigcent()
The getsigcent function returns the center level of the signal.
Function Usage

getsigcent(signal)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
Returned Value

Returns the center level value as a float


Description

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

In this example, getsigcent(vr21) returns the value 2.0.

CODAC Function Dictionary,

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()

Sets the center level of the signals

gettransitiontime()

Returns the transition time of the signal

getsiggp()
The getsiggp function returns the glitch period of the signal.
Function Usage

getsiggp(signal)
Prerequisites

Read the signal in using the readspicepunch() function.

CODAC Function Dictionary,

139

Required Arguments
signal

Represents a waveform
Returned Value

Returns the glitch period as a float


Description

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

In this example, getsiggp(vr21) returns the value 1.0e-12.


main()
{
string punchfile =rasbuf.pun;
waveform vr21;
float gpvalue,
readspicepunch(punchfile);
vr21 = $VR21;
setsiggp(1.0e-12, vr21, vr31);
gpvalue = getsiggp(vr21);
print(// High value when set =, gpvalue);
}

CODAC Function Dictionary,

140

Related Functions

setsiggp()

Sets the glitch period of the signals

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform

CODAC Function Dictionary,

141

Returned Value

Returns the high level value as a float


Description

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

In this example, getsighigh(vr21) returns the value of 3.5.


main()
{
string punchfile =in/rasbuf.pun;
waveform vr21, vr31;
float setvalue;
readspicepunch(punchfile);
vr21 = $VR21;
vr31 = $VR31;
setsighigh(3.5, vr21, vr31);
setvalue = getsighigh(vr21);
print(// High value when set =, setvalue);
}

CODAC Function Dictionary,

142

Related Functions

getsighigh()

Sets the high level of the signals

gettransitiontime()

Returns the transition time of the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform

CODAC Function Dictionary,

143

Returned Value

Returns the low level value as a float


Description

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

In this example, getsiglow (vr21) returns the value of 0.4.


main()
{
string
punchfile =rasbuf.pun;
waveform
vr21, vr31;
float lowvalue;
readspicepunch(punchfile);
vr21 = $VR21;
vr31 = $VR31;
setsiglow(0.4, vr21, vr31);
lowvalue = getsiglow(vr12);
print(// Low value when set =, lowvalue);
}

CODAC Function Dictionary,

144

Related Functions

setsiglow()

Sets the low level of the signals

gettransitiontime()

Returns the transition time of the signal

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

CODAC Function Dictionary,

145

Options
int1

Represents a string variable


Returned Value

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));
}

CODAC Function Dictionary,

146

Related Functions

setsigname()

Sets the name of the signals

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents a waveform variable

CODAC Function Dictionary,

147

Returned Value

The gettemp function returns a float representing the temperature of


the signal.
Description

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()

Reads the Spice punchfile, and loads the signal


into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettemp().

CODAC Function Dictionary,

148

If you are using the C CODAC interface, see C CODAC Toplevel


Function gettemp().

gettime()
The gettime function returns the time the signal was punched.
Function Usage

gettime(signal)
Required Arguments
signal

Represents a waveform variable


Returned Value

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()

CODAC Function Dictionary,

149

{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(getsigname(w1), gettime(w1));
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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

Represents a waveform variable

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

getdate()

Returns the date when the signal was


punched

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettitle().
CODAC Function Dictionary,

151

If you are using the C CODAC interface, see C CODAC Toplevel


Function gettitle().

gettransitions()
The gettransitions function returns the number of transitions in the
signal.
Function Usage

gettransitions(signal)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
Returned Value

The gettransitions function returns the number of transitions in the


signal (integer). If any glitch is found, this function outputs an error
message.

CODAC Function Dictionary,

152

Description

The gettransitions function returns the number of transitions in a given


signal. It scans through the data points and calculates the transitions.
Example

In this example, the gettransitions(vout) returns the number of


transitions for the signal, vout.
main()
{
string punchfile =delay.pun;
waveform vout;
int numtrans;
readspicepunch(punchfile);
vout = $VOUT;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);
numtrans = gettransitions(vout);
print(// Number of transitions in signal vout =, numtrans);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

gettransitiontime()

Returns the transition time of the signal

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function gettransitions().
CODAC Function Dictionary,

153

If you are using the C CODAC interface, see C CODAC Toplevel


Function gettransitions().

gettransitiontime()
The gettransitiontime function returns the transition time of the signal.
Function Usage

gettransitiontime(signal, transnum)
Prerequisite

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
transnum

Specifies a transition number represented as an integer


Returned Value

The gettransitiontime function returns the transition time (float), if


successful; otherwise, it returns a large negative value. If any glitches
are detected during the calculation of transition time, the function
outputs error messages.

CODAC Function Dictionary,

154

Description

The gettransitiontime function returns the transition time of the signal.


A transition is valid only when a signal goes from a low level to a high
level or vice-versa and stays stable at a new level at least for a period
equal to the glitch period. If this criterion is not met, then the transition
is considered as a glitch.
To detect valid transitions, specify information on points P1, P2, and M.
Where:
P1

High point on transition

P2

Low point on transition

Measurement point of transition

Figure 8 shows the transition level details for a rising signal.


Figure 8. Transition Level Details for a Rising Signal
Transition level details
Value

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.

CODAC Function Dictionary,

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()

Returns the number of transitions in the signal

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().

CODAC Function Dictionary,

156

getx()
The getx function returns the x value corresponding to a y value for the
signal.
Function Usage

getx (signal, yval, reftime)


Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
yval

Specifies the y value of the signal at which the corresponding x value


needs to be calculated
reftime

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.

CODAC Function Dictionary,

157

Description

The getx function returns the specified number of occurrence of the x


value for a specified signal at the given y value (voltage or current).
Returns the x value of a signal corresponding to the y value.
The value of x and y can be anything, whereas, in the transient analysis
x represents time, and in the ac analysis x represents frequency. If the
reftime is specified, then the search for the given y value starts from
the reftime.
Example

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);
}

CODAC Function Dictionary,

158

Related Functions

gety()

Returns the y point

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

getxt(signal, yval, trans_no)


Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform specifying a signal read from the punchfile


yval

CODAC Function Dictionary,

159

Represents a float value/variable specifying the y value on the signal


trans_no

Represents an integer specifying a transition number on the signal


Returned Value

Returns a floating point number


Description

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);
}

CODAC Function Dictionary,

160

Related Functions

getx()

Returns the x point

gety()

Returns the y point

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a variable containing the signal data


xval

CODAC Function Dictionary,

161

Specifies the x value of the signal at which the corresponding y value


needs to be calculated
Returned Value

The gety function returns the y value (voltage or current) as a float, if


the call is successful; otherwise, it returns a large negative value.
Description

The gety function returns the y value (voltage or current) corresponding


to the x value. In the transient analysis, y represents voltage and x
represents time, whereas, in the ac analysis, y represents gain, and x
represents frequency.
Example

In this example, the gety(vout, 2.5e-10) returns the voltage at time


2.5e- 10 of the signal, vout.
main()
{
string punchfile =delay.pun;
waveform vout;
float yvalue;
readspicepunch(punchfile);
vout = $VOUT;
yvalue = gety(vout, 2.5e-10);
print(// Value of Y = 2.5e-10 is, yvalue);
}

CODAC Function Dictionary,

162

Related Functions

getx()

Returns the x point

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

Represents a waveform variable


samplingfrequency

A float variable representing the time steps at which the specified


signal is sampled

CODAC Function Dictionary,

163

Returned Value

Returns a waveform
Description

The interpolate function interpolates on the input signal at the specified


time intervals corresponding to the sampling frequency and returns the
resultant signal.
Example
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 = $VCC;
w2 = interpolate(w1, 500e6);
}

The above example obtains sample points on the signal V CC at time


intervals of 1/500e6 or 2e-9.
Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function interpolate().

CODAC Function Dictionary,

164

If you are using the C CODAC interface, see C CODAC Toplevel


Function interpolate().

intg()
The intg function returns the integrated signal corresponding to the
input signal
Function Usage

intg(signalname);
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signalname

Represents the signal to be integrated. This should be a waveform.


Returned Value

Returns a waveform
Description

The intg function returns the integrated signal corresponding to the


input waveform. The integrated signal points have the same x-values
as the input signal.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

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().

CODAC Function Dictionary,

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

Read the signal signal1 in using the readspicepunch() function.


Required Arguments
signal1

A waveform variable representing the specified signal


transition

Specifies the transition number


Returned Value

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.

CODAC Function Dictionary,

167

Example

This example prints the message if transition 2 of the signal vout is a


valid falling edge.
main()
{
waveform vout;
readspicepunch(delay.pun);
vout = $VOUT;
if (isfall(vout, 2));
print(Transition 2 of signal VOUT is falling);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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.

CODAC Function Dictionary,

168

Function Usage

isrise(signal1, transition)
Prerequisites

Read the signal signal1 in using the readspicepunch() function.


Required Arguments
signal1

A waveform variable representing the specified waveform


transition

Represents an integer variable specifying the transition number


Returned Value

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()

Reads the Spice punchfile, and loads the signal


into the memory

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

ivcurve(volsig, cursig, starttime, endtime, name)

CODAC Function Dictionary,

170

Prerequisites

Read the signals volsig and cursig in using the readspicepunch()


function. The starttime and the endtime should be within the signal time
bounds.
Required Arguments
volsig

A waveform variable representing the voltage signal


cursig

A waveform variable representing the current signal


starttime

Specifies the start time of the signal


endtime

Specifies the end time of the signal


name

Name of the resultant signal


Returned Value

The ivcurve function returns a waveform, if the input parameters are


valid, if successful; otherwise, it returns a null value.

CODAC Function Dictionary,

171

Description

The ivcurve function generates a Y-Y graph or curve. If you specify


current and voltage as input signals, this function generates an I-V
curve. This function helps you to plot the y-values of one signal against
the y-values of another signal (for the same x-points). Thus, a new signal
is created.
Example

This example generates an I-V curve corresponding to VFGATE and


IVDS between 0 to 0.11 amperes and calls it S1. This signal is printed
using the function writesignal into the file new.pun.
main()
{
waveform vfgate, ivds, iv;
float slope, v1, i1, vt;
readspicepunch(iv.pun);
vfgate = $VFGATE;
ivds = $IVDS;
iv = ivcurve(vfgate, wabs(ivds), 0.0, 0.11,S1);
writesignal(iv,new.pun);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function ivcurve().

CODAC Function Dictionary,

172

If you are using the C CODAC interface, see C CODAC Toplevel


Function ivcurve().

loaddb()
The loaddb function loads the CODAC database file into the memory.
Function Usage

loaddb(punchpath, databasepath)
Required Arguments
punchpath

A string variable/constant specifying the pathname of the punchfile


databasepath

A string variable/constant specifying the pathname of the CODAC


database file, produced by the savedb() function
Returned Value

None.
Description

The loaddb function loads the CODAC database file into the memory.
This enables faster loading of signal data from the punchfile.

CODAC Function Dictionary,

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()

Saves the currently read in punchfile

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

Represents a waveform specifying a signal read from the punchfile


Returned value

Returns an integer
Description

The nextsignal function iterates through the list of signals in the


currently active Spice punchfile (the punchfile last read in using the
readspicepunch() function). Successive calls to this function return
successive signals from the punchfile in the waveform.
The function returns the integer 0, when there are no more signals in
the punchfile; otherwise, it returns 1.
Example

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 */

CODAC Function Dictionary,

175

printf(%s =%g\n, getsigname(vin),


gettransitiontime(vin,1));
}
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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

Read the signal in using the readspicepunch() function. The starttime


and the endtime should be within the signal time bounds.
Required Arguments
signal1

Represents the signal that should be of waveform data type


Options
starttime

Represents the start time of the resultant waveform. By default, the


start time is the minimum time point of the source waveform.
endtime

Represents the end time of the resultant waveform. By default, the


end time is the maximum time point of the source waveform.
Returned Value

Returns a waveform
Description

The range function returns a waveform with values. These values


correspond to the time points between the start time and the end time
specified in the source waveform.

CODAC Function Dictionary,

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

In this example, the voutwindow is a copy of the source waveform in


the time window between 3 nanoseconds and 7 nanoseconds.
main()
{
string punchfile =delay.pun;
waveform vout, voutwindow;
float areavalue;
readspicepunch(punchfile);
vout = $VOUT;
voutwindow = range(vout, 3e-9, 7e-9);
}

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().

CODAC Function Dictionary,

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

A string indicating a punchfile name


Returned Value

None.
Description

The readspicepunch function reads a punchfile and loads the signal


information into the memory. You can specify both binary and ASCII
formats of punchfiles.
CODAC Function Dictionary,

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)

CODAC Function Dictionary,

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

Name of a punchfile from where the specified signal should be read


in. This is a string.
signalname

Name of the signal to be read in from the punchfile. This is a string.


Options
temp

An integer specifying the temperature of the signal signalname to be


read in
run

An integer specifying the run number of the signal signalname to be


read in
CODAC Function Dictionary,

181

rerun

An integer specifying the rerun number of the signal signalname to


be read in
modify

An integer specifying the modify number of the signal signalname to


be read in
Returned Value

The readspicepunch function returns the waveform variable, if


successful; otherwise, it returns a null waveform.
Description

The readspicepunch function assigns the signal name, read in from


the punchfile, to the waveform variable in CODAC language. The
temperature, run number, rerun number, and modify number are
optional. If you do not specify any of them, then CODAC reads the first
signal in the punchfile, whose name matches the signalname.
If you want to specify temperature, run number, rerun number, and
modify number, then choose the corresponding function usage. If you
want to specify a run number, but do not want to use the temperature,
then invoke the function as shown below:
readwave(punchfilename, signalname, -1.1e34, run)
Where, -1.1e34 ignores the temperature argument.

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

183

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents a waveform variable


sigphase

Represents a waveform variable

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

185

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

fwdfft()

Computes the fast fourier transform of a signal

interpolate()

Interpolates on the signal at time intervals


corresponding to the sampling frequency

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

A string variable/constant representing the pathname where the


punchfile will be saved

CODAC Function Dictionary,

186

Returned Value

None.
Description

The savedb function saves the currently read in punchfile in the


specified file in the CODAC database format. This facility enables faster
reading of signal data during subsequent CODAC runs that use the
same punchfile.
Example

This example saves the currently read in punchfile delay.pun in the


CODAC data base format.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
savedb(delay.pun.codacdb);
}

CODAC Function Dictionary,

187

Related Functions

loaddb()

Reads the punch data base

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents float variables

CODAC Function Dictionary,

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

This example creates a digitized output with transitions to high level at


all time points where value of signal V IN is greater than or equal to two
and transition to low level at all time points where value of signal V IN is
less than two. The low and high levels of the signal vout are two and
five respectively.
main()
{
string punchfile =delay.pun;
waveform vin, vout;
readspicepunch(punchfile);
setlevels(2, 5);
vin = $VIN;
vout = digitize(vin,>=, 2);
writesignal(vout);
}

CODAC Function Dictionary,

189

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

gettransitiontime()

Returns the transition time of the signal

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

The signals should be read in using the readspicepunch() function.

CODAC Function Dictionary,

190

Required Arguments
referencetime

Represents the reference time to be set


Options
sig1, sig2

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.

CODAC Function Dictionary,

191

Value

Figure 9. Setting the Reference Time

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()

Returns the transition time of the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
centval

Specifies the center level of the signal

CODAC Function Dictionary,

193

sig1, sig2

Specifies the waveforms for which the center level is to be set


Returned Value

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);

CODAC Function Dictionary,

194

Related Functions

getsigcent()

Returns the center level of the signal

gettransitiontime()

Returns the transition time of the signal

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

Read the signal in using the readspicepunch() function.

CODAC Function Dictionary,

195

Required Arguments
glitchperiod

Specifies the glitch period for the signal


sig1, sig2

Specifies the waveforms for which the glitch period is to be set


Returned Value

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);

CODAC Function Dictionary,

196

print(// Completed reading punchfile);


vr21 = $VR21; vr31 = $VR31; vr12 = $VR12;
setsiggp(1.0e-12, vr21, vr31);
setvalue = getsiggp(vr21);
notsetvalue = getsiggp(vr12);
print(// High value when set =, setvalue);
print(// High value when not set =, notsetvalue);
}

Related Functions

getsiggp()

Returns the glitch period of the signal

gettransitiontime()

Returns the transition time of the signal

Related Documentation

For more details on glitch detection, see Chapter 2 of the CODAC


Manual (Detecting glitches in transitions).

setsighigh()
The setsighigh function sets the high level of the signals for transition
measurement.
Function Usage

setsighigh(highval)
or
setsighigh(highval, sig1, sig2)

CODAC Function Dictionary,

197

Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
highval

Specifies the high value of the signal


sig1, sig2

Specifies the waveforms for which the high level is to be set


Returned Value

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;

CODAC Function Dictionary,

198

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;
setsighigh(3.5, vr21, vr31);
setvalue = getsighigh(vr21);
notsetvalue = getsighigh(vr12);
print(// High value when set =, setvalue);
print(// High value when not set =, notsetvalue);
}

Related Functions

getsighigh()

Returns the high level of the signal

gettransitiontime()

Returns the transition time of the


signal

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

CODAC Function Dictionary,

199

Function Usage

setsiglow(lowval)
or
setsiglow(lowval, sig1, sig2)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
lowval

Specifies the low value of the signal


sig1, sig2

Specifies the waveforms for which the low level is to be set


Returned Value

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.

CODAC Function Dictionary,

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()

Returns the low level of the signal

gettransitiontime()

Returns the transition time of the signal

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().

CODAC Function Dictionary,

201

setsigname()
The setsigname function sets the name of the signal.
Function Usage

setsigname(signal1, string1)
Prerequisites

None.
Required Arguments
signal1

Specifies the signal for which the name is to be set


string1

Represents the name of the signal


Returned Value

None.
Description

The setsigname function sets the name of the signal1 to string1.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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.

CODAC Function Dictionary,

203

Function Usage

settolerance(float1)
Prerequisites

None.
Required Arguments
float1

Specifies the float variable


Description

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;

CODAC Function Dictionary,

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

setxyunits (signal_name, x_unit, [y_unit])


Prerequisites

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

CODAC Function Dictionary,

205

Specifies the string variable of the y_unit name


Returned Value

Returns an integer value of zero on success; otherwise the integer value


of 1.
Description

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");
}

CODAC Function Dictionary,

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

Represents a string variable


Returned Value

Returns 1 (one), if successful; otherwise, it returns a 0 (zero)


Description

The sigexists functions returns 1 (one), if the specified signal


signalname exists in the last read in punchfile; otherwise, it returns a 0
(zero).

CODAC Function Dictionary,

207

Example

In this example, the message Signal VCC exists is printed if the


signal with the name V CC exists in the punchfile delay.pun. Otherwise,
the message Error is written to the standard output.
main()
{
string
string

signalname =VCC;
punchfile =delay.pun;

readspicepunch(punchfile);
if (sigexists(signalname))
print(Signal, signalname, exists);
else
print(Error);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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().

CODAC Function Dictionary,

208

thresholdsignal()
The thresholdsignal function returns the set of signals that exceed the
threshold value.
Function Usage

thresholdsignal(thresholdvalue, sigtype)
Prerequisites

Read the signals in the punchfile using the readspicepunch() function.


Required Arguments
thresholdvalue

Represents the threshold value of the signal. This is of a float data


type.
sigtype

Represents the type of the signals to be checked. If you specify zero,


all the signals will be checked. If you specify one, all the current signals
will be checked. If you specify two, all the voltage signals will be
checked.
Returned Value

The thresholdsignal function returns a set of signals that exceeds the


threshold value, if successful.

CODAC Function Dictionary,

209

Description

The thresholdsignal function returns the set of signals that exceeds


the threshold value. If you specify the signal type as zero, all the signals
from the recently read punchfile will be checked.
If you specify the signal type as one, all the current signals will be
checked. If you specify the signal type as two, all the voltage signals
will be checked. The set of signals are printed to standard output.
Example

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()

Reads the Spice punchfile, and loads the


signal into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function thresholdsignal().

CODAC Function Dictionary,

210

If you are using the C CODAC interface, see C CODAC Toplevel


Function thresholdsignal().

wabs()
The wabs functions returns the absolute waveform.
Function Usage

wabs(signal1)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


Returned Value

Returns a waveform
Description

The wabs functions returns a signal whose value points correspond to


the absolute value 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, ABS.

CODAC Function Dictionary,

211

Example

This example returns the waveform whose value corresponds to the


absolute value of the signal V IN . The signal name of the returned
waveform is ABSVIN.
main()
{
string
waveform

punchfile =delay.pun;
vin, absvin;

readspicepunch(punchfile);
vin = $VIN;
absvin = wabs(vin);
writesignal(absvin,/tmp/absvin);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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().

CODAC Function Dictionary,

212

wacos()
The wacos function returns the arc cosine of the source signal.
Function Usage

wacos(signal1)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


Returned Value

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.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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().

CODAC Function Dictionary,

214

wasin()
The wasin function returns the arc sine of the source signal.
Function Usage

wasin(signal1)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


Returned Value

Returns a waveform
Description

The wasin function returns a signal whose value points correspond to


the arc sine 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, asin.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

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().

CODAC Function Dictionary,

216

watan()
The watan returns the arc tangent of the source signal.
Function Usage

watan(signal1)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


Returned Value

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.

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

wcos()
The wcos function returns the cosine of the source signal.
Function Usage

wcos(signal1)

CODAC Function Dictionary,

218

Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


Returned Value

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

This example returns the waveform whose value corresponds to the


cosine of the signal V IN . The signal name of the returned waveform is
cosvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, cosvin;

readspicepunch(punchfile);
vin = $VIN;
CODAC Function Dictionary,

219

cosvin = wcos(vin);
writesignal(cosvin,/tmp/cosvin);
}

Related Functions

readspicepunch()

Reads the Spice punch file, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

wexp()
The wexp function returns the exponential of the source signal.
Function Usage

wexp(signal1)
Prerequisites

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable

CODAC Function Dictionary,

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

This example returns the waveform whose value corresponds to the


exponential of the signal V IN. The signal name of the returned waveform
is expvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, expvin;

readspicepunch(punchfile);
vin = $VIN;
expvin = wexp(vin);
writesignal(expvin,/tmp/expvin);
}

CODAC Function Dictionary,

221

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable

CODAC Function Dictionary,

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

This example returns the waveform whose value corresponds to the


natural logarithm of the signal V IN. The signal name of the returned
waveform is logvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, logvin;

readspicepunch(punchfile);
vin = $VIN;
logvin = wlog(vin);
writesignal(logvin,/tmp/logvin);
}

CODAC Function Dictionary,

223

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


CODAC Function Dictionary,

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

This example returns the waveform whose value corresponds to the


logarithm to the base 10 of the signal V IN . The signal name of the
returned waveform would be log 10 vin.
main()
{
string
waveform

punchfile =delay.pun;
vin, log10vin;

readspicepunch(punchfile);
vin = $VIN;
log10vin = wlog10(vin);
writesignal(log10vin,/tmp/log10vin);
}

CODAC Function Dictionary,

225

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable


CODAC Function Dictionary,

226

float1

Represents the power to be raised


Returned Value

Returns a waveform
Description

The wpow function returns a signal whose value points correspond to


the input signal value points raised to the power of float1 if successful.
The name of the returned signal would be the same as the argument
signal name and is assigned the prefix, pow.
Example

This example returns the waveform whose value corresponds to the


signal VIN raised to the power two. The signal name of the returned
waveform is powvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, powvin;

readspicepunch(punchfile);
vin = $VIN;
powvin = wpow(vin,2);
writesignal(powvin,/tmp/powvin);
}

CODAC Function Dictionary,

227

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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

writepunch(inputfile, outputfile, append-overwrite, ascii-bin, flt-dbl)


Prerequisites

You must load signals present in the inputfile into the CODAC database
using the readspicepunch() and nextsignal() functions.
Required Arguments
inputfile

CODAC Function Dictionary,

228

Represents a string indicating the input punchfile


outputfile

Represents a string indicating the output punchfile


Options
append-overwritemode

Represents an argument that can be either 0 (zero) (append mode)


or 1 (one) (overwrite mode). The default is 0.
ascii-binmode

Represents an argument that can be either 0 (zero) (ASCII mode) or


1 (one) (binary mode). By default, 0 is assigned.
flt-dbl

Represents an argument that can be either 0 (zero) (single precision)


or 1 (one) (double precision). By default, 0 is assigned. Creation of a
double-precision punchfile is supported only from the 1.8 version of
Spice3.
Specify these arguments in the order shown in the syntax.
Returned Value

None.

CODAC Function Dictionary,

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()

Returns the status of the Spice job

invokespicesrvr()

Invokes the TI Spice3 server

stopspicesrvr()

Stops the Spice servers invoked

CODAC Function Dictionary,

230

writesignal()
The writesignal function writes a signal in a punchfile.
Function Usage

writesignal(signal, filename, append_overwritemode, ascii_binmode,


flt_dbl)
Prerequisites

None.
Required Arguments
signal

Represents a waveform variable


filename

Represents a string indicating the filename


Options
append_overwritemode

Represents an argument that can be either 0 (zero) (append mode)


or 1 (one) (overwrite mode). By default, 0 is assigned.
ascii_binmode

Represents an argument that can be either 0 (zero) (ASCII mode) or


1 (one) (binary mode). By default, 0 is assigned.
CODAC Function Dictionary,

231

flt_dbl

Represents an argument that can be either 0 (zero) (single precision)


or 1 (one) (double precision). By default, 0 is assigned. Creation of a
double-precision punchfile is supported only from the 1.8 version of
Spice3.
Specify these arguments in the order shown in the syntax.
Returned Value

None.
Description

The writesignal function writes the specified signal in a punchfile


format. This signal might have been read in directly from a punchfile or
could a result of waveform operation (addition, subtraction,
multiplication, and division) of two signals.
Example

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);

CODAC Function Dictionary,

232

writesignal(vmath,lvccflt.pun,1);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

CODAC Function Dictionary,

233

Represents a waveform variable


Returned Value

Returns a waveform
Description

The wsin function returns a signal whose value points correspond to


the sine function 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, sin.
Example

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);
}

CODAC Function Dictionary,

234

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable

CODAC Function Dictionary,

235

Returned Value

Returns a waveform
Description

The wsqrt function returns a signal whose value points correspond to


the square root function 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, sqrt.
Example

This example returns the waveform whose value corresponds to the


square root of the signal VIN . The signal name of the returned waveform
is sqrtvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, sqrtvin;

readspicepunch(punchfile);
vin = $VIN;
sqrtvin = wsqrt(vin);
writesignal(sqrtvin,/tmp/sqrtvin);
}

CODAC Function Dictionary,

236

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal1

Represents a waveform variable

CODAC Function Dictionary,

237

Returned Value

Returns a waveform
Description

The wtan function returns a signal whose value points correspond to


the tangent function 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, tan.
Example

This example returns the waveform whose value corresponds to the


tangent of the signal VIN . The signal name of the returned waveform is
tanvin.
main()
{
string
waveform

punchfile =delay.pun;
vin, tanvin;

readspicepunch(punchfile);
vin = $VIN;
tanvin = wtan(vin);
writesignal(tanvin,/tmp/tanvin);
}

CODAC Function Dictionary,

238

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

writesignal()

Writes the punchfile for the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform variable

CODAC Function Dictionary,

239

Represents an integer variable


Returned Value

Returns a float value


Description

The xpoint function returns the x-value corresponding to the i point of


the specified signal read from the punchfile.
Example

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));
}
}

CODAC Function Dictionary,

240

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

ypoint()

Returns the y-point of the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

Represents a waveform variable

CODAC Function Dictionary,

241

Represents an integer variable


Returned Value

Returns a float value


Description

The ypoint function returns the y-value corresponding to the i point of


the specified signal read from the punchfile.
Example

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));
}
}

CODAC Function Dictionary,

242

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

xpoint()

Returns the x-point of the signal

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().

CODAC Function Dictionary,

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

addcards(spicedeck, card1, card2,....)


Prerequisites

None.
Required Arguments
spicedeck

Specifies the Spice netlist to which the given cards need to be added
card1, card2,...

Represents the number of cards. All these cards should be string


variables.
Returned Value

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

voltage = 5, temperature = 32;


dccard, voltcard, tempcard, ModDeck;
= .DC VDC2 0V 30V .2V;

CODAC Function Dictionary,

245

voltcard = VCC VCC 0 + str(voltage);


tempcard = .TEMP
+ str(temperature);
ModDeck = addcards("Amplifier", dccard, voltcard, tempcard);
invokespice3(ModDeck);
}

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

caddcards(basedeck, moddeck, card1, card2,....)


Prerequisites

None.
Required Arguments
basedeck

A string value/variable specifying the pathname of a Spice netlist file


moddeck

CODAC Function Dictionary,

246

A string value/variable specifying the pathname to which the modified


deck needs to be written
card1, card2,...

String values/variables containing the Spice cards to be added to the


basedeck
Returned Value

Returns the modified Spice deck as a string


Description

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.

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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

Specifies the status of the Spice server


Returned Value

The getsrvrstatus function returns an integer value depending on the


status of the Spice job.
Description

The getsrvrstatus function returns 1 (one), if the Spice job is complete,


or it returns 0 (zero).
Example

This example evaluates the delay between two signals using


invokespicesrvr() function.
#include"CinCpd.k"
main()
{
CODAC Function Dictionary,

249

float Cin, Cpd;


int i=0, srvrid[2], Flag[2]={0,0};
string Spicedeck[2], Punchfile[2];
Spicedeck[0]="Cin.spi";
Spicedeck[1]="Cpd.spi";
Punchfile[0]="Cin.spi.pun";
Punchfile[1]="Cpd.spi.pun.";
srvrid[0]=invokespicesrvr(Spicedeck[0]);
srvrid[1]=invokespicesrvr(Spicedeck[1]);
while (!Flag[0] ||!Flag[1])
{
i=i%2;
if(!Flag[i] && getsrvrstatus(srvrid[i]))
{
if(i)
Cpd=CalculateCpd(punchfile[i];
else
Cin=CalculateCin(punchfile[i];
stopspicesrvr(srvrid[i]);
Flag[i]=1;
}
i++;
}
printf("Cin = %e\n",Cin);
printf("Cpd = %e\n",Cpd);
}

Related Functions

invokespicesrvr()

Invokes the TI Spice3 server

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function getsrvrstatus().

CODAC Function Dictionary,

250

If you are using the C CODAC interface, see C CODAC Toplevel


Function getsrvrstatus().

getstatus()
The getstatus function returns the current status of the Spice job whose
task ID is provided.
Function Usage

getstatus(taskId)
Prerequisites

The SLIM Task Manager or the HP Task Broker should be installed or


running on the network. In the case of SLIM Task Manager, you should
have initialized the connection using the loadservice() function. You
should invoke a Spice job within a parallel construct before calling this
function.
Required Arguments
taskId

Specifies an integer variable


Returned Value

The getstatus function returns an integer value depending on the status


of the Spice job submitted through the Task Broker or Task Manager.

CODAC Function Dictionary,

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

Invalid pathname of the Spice deck

No convergence in dc analysis

Job aborted

Job unscheduled

System error

Job blasted

Job active

Job inactive

Example

This example shows the usage of the getstatus function to determine


the completion status of Spice jobs submitted in parallel through the
SLIM Task Manager.

CODAC Function Dictionary,

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

CODAC Function Dictionary,

253

loadservice()

Loads the service definition file, and opens a


Task Manager connection

setservice()

Sets the specified service for all subsequent


jobs submitted to the Task Manager

CODAC Function Dictionary,

254

invokespice3()
The invokespice3 function invokes TI Spice3
Function Usage

invokespice3(deck_path, [[[print_path], punch_path], udm_path1,


udm_path2], [spice_options])
Prerequisites

None.
Required Arguments
deck_path

A string value specifying the pathname of the Spice deck


Options
print_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.

CODAC Function Dictionary,

255

udm_path1, udm_path2

The string values specifying the pathnames of the UDM (User-Defined


Module) libraries. You can specify only two pathnames. The third UDM
pathname is reserved for future internal use by CODAC.
spice_options

A string value specifying the command-line options of TI Spice3.


Include all the command-line options in one string. For example, to
specify the modify deck, give these command-line options:
string spice_options =modify file_name;
If you need to pass -rule also as the command-line option, then specify
string spice_options =modify file_name rule;
If you want to specify only the spice_options parameter, enter empty
strings (" ") for the print, punch, and udm file name parameters as:
invokespice3 (spice_deck, " ", " ", " ", " ", spice_options);
Returned Value

The invokespice3 function returns an integer value depending on the


completion status of the Spice job. If the Spice job is submitted within
the scope of a parallel block, the returned value is the task ID of the job
submitted and not the completion status of the job.

CODAC Function Dictionary,

256

Description

The invokespice3 function invokes TI Spice3 on the specified Spice


deck and returns an integer value. The returned integer value denotes
the completion status of the Spice job.
If the Spice job is within the scope of a parallel block, the returned value
is the task ID of the job. The return codes and their explanations are:
0

Job concluded

Invalid pathname of the Spice deck

No convergence in dc analysis

Job aborted

Job unscheduled

System error

Job blasted

Example

This example sets the TI Spice3 executable pathname to ~/myspice3,


so that the customized version of TI Spice3 is run. Then, it invokes TI
Spice3 on ~/myspicedeck.
The output of Spice print is written to the file ~/myspiceprint. The output
of Spice punch is written to the ~/myspicedeck.pun.
main()
{

CODAC Function Dictionary,

257

string spice3executable =~/myspice3;


string spicedeck
=~/myspicedeck;
string spiceprint
=~/myspiceprint;
print(//Setting TI Spice3 executable path to,
spice3executable);
setspice3path(spice3executable);
print(// Invoking customized version of Spice3);
if (invokespice3(spicedeck,spiceprint) == 0)
print(// TI Spice3 completed successfully);
else
print(// Bad job completion status from TI Spice3);
}

Related Functions

getstatus()

Returns the current status of the Spice job


whose task ID is provided

loadservice()

Loads the service definition file, and opens a


Task Manager connection

setservice()

Sets the specified service for all subsequent


jobs submitted to the Task Manager

setspice3path()

Sets the TI Spice3 executable path to the


specified pathname

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().

CODAC Function Dictionary,

258

invokespicesrvr()
The invokespicesrvr function invokes the TI Spice server.
Function Usage

invokespicesrvr(deck-path)
Required Arguments
deck-path

A string value specifying the pathname of the Spice deck


Returned Value

The invokespicesrvr function returns an integer value representing the


Spice3 server ID.
Description

The invokespicesrvr function invokes TI Spice3 server on the specified


Spice deck and returns an integer value. You can invoke this function
several times to create multiple Spice screens, each of which return a
unique integer value.
Other Spice server function calls use this value to identify the
corresponding servers.

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

260

Related Functions

getsrvrstatus()

Returns the status of the Spice job that you


invoke through the Spice server

sndsrvrmodify()

Sends the modify string to the Spice server

stopspicesrvr()

Stops invoked Spice servers

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().

CODAC Function Dictionary,

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

The setssockconfig() function sets the configuration of the Spice


server. You can use a single option or a combination of options specified
in Table 12.

CODAC Function Dictionary,

262

Include the config.k file, to specify the configuration variables. For


example, use #include config.k in the CODAC instruction file to execute
the setsockconfig() function.
If you do not use the config.k file, CODAC flags an error message.
CODAC assumes the default configuration given below, if you do not
set the configuration bit using this function.
SERVERconfigStopAfterModify|SERVERconfigSendPunch|
SERVERmsgLvlError |SERVERconfigNoModifyMessages|
SERVERconfigSendAnalysisInfo|SERVERconfigResetResults

Table 12. Configuration Options for the Spice Servers


SERVERmsgLvlNone

Send no error or warning


messages from Spice3.

SERVERmsgLvlError

Send Spice3 errors.

SERVERmsgLvlWarn

Send Spice3 errors and


warnings.

SERVERmsgLvlAll

Send Spice3 errors, warnings,


and messages.

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.

CODAC Function Dictionary,

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()

Invokes the TI Spice3 server

CODAC Function Dictionary,

264

setspice2path()

The setspice2path function sets the Spice2 executable path to the


specified pathname.
Function Usage

setspice2path(spice2_path)
Prerequisites

None.
Required Arguments
spice2_path

A string value specifying the valid pathname of the Spice2 executable


Options

None.
Returned Value

None.
Description

The setspice2path function sets the executable pathname of the Spice2


to the specified string value, if the pathname is valid.

CODAC Function Dictionary,

265

If the pathname is not valid, it is considered as an error. In such cases,


the previous settings of the Spice2 executable pathname is retained.
The Spice2 executable pathname is set to /dad/com/spice2 by default.
Example

In this example, the executable pathname of the Spice2 is set to


~/myspice2. The customized version of the Spice2 is run.
main()
{
string spice2executable =~/myspice2;
string spicedeck
=~/myspicedeck;
print(// Setting Spice2 executable path to,spice2executable);
setspice2path(spice2executable);
print(// Invoking customized version of Spice2);
invokespice2(spicedeck);
}

CODAC Function Dictionary,

266

sndsrvrmodify()
The sndsrvrmodify function sends the modify string to the Spice server.
Function Usage

sndsrvrmodify(srvrid,modifystring,speed-overwrite)
Required Arguments
srvrid

Represents the Spice server


modifystring

Represents the string containing the modify statements. Separate


each statement using \n.
append_overwritemode

Represents an argument that can be either 0 (zero) (append mode)


or 1 (one) (overwrite mode). By default, the program assigns 0.
Returned Value

None.
Description

This function sends the modify statements to the Spice server that srvrid
specifies and executes the analysis again.

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

268

LowDelay = Delay;
}
else
Low = CurTrial;
}
stopspicesrvr();
fprintf(fp,"\nPARAMETER VALUE = %e\n",High);
}
}

Related Functions

invokespicesrvr()

Invokes the TI Spice3 server

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)

CODAC Function Dictionary,

269

Required Arguments
srvrid

Specifies the Spice server to be terminated


Returned Value

None.
Description

The stopspicesrvr function terminates the Spice server that srvrid


specifies. If the program does not pass arguments to this function, it
terminates all the invoked Spice servers.
Example

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);
}

CODAC Function Dictionary,

270

Related Functions

invokespicesrvr()

Invokes the TI Spice3 server

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

A string value specifying the pathname of the TI Spice3 executable file

CODAC Function Dictionary,

271

Options

None.
Returned Value

None.
Description

The setspice3path function sets the executable pathname of TI Spice3


to the specified string value if the pathname is valid.
In such cases the previous settings of the TI Spice3 executable
pathname is retained. By default the TI Spice3 executable pathname is
set to /dad/com/spice3.
Example

In this example, the executable pathname of the TI Spice3 is set to


~/myspice3. The customized version of TI Spice3 is run.
main()
{
string spice3executable =~/myspice3;
string spicedeck
=~/myspicedeck;
print(// Setting TI Spice3 executable path to,
spice3executable);
setspice3path(spice3executable);
print(// Invoking customized version of TI Spice3);
invokespice3(spicedeck);
}

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

273

Task Broker/Manager Functions


This subsection describes the task broker/manager functions.

loadservice()
The loadservice function loads the service definition file and opens a
Task Manager connection.
Function Usage

loadservice(servicedefinitionfile, brokernode, servicename)


Prerequisites

The SLIM Task Manager should be installed on the network.


Required Arguments
servicedefinitionfile

A string variable or constant specifying the pathname of theTask


Manager service definition file
brokernode

A string specifying the node on which connection to the Task Manager


needs to be opened

CODAC Function Dictionary,

274

servicename

A string specifying the particular service in the service definition file


that needs to be used for all subsequent jobs submitted through the
Task Manager
Returned Value

The loadservice function returns the integer value zero, if successful


in opening the connection to the Task Manager; otherwise, it returns
one.
Description

The loadservice function performs the initialization necessary for using


the Task Manager to submit concurrent Spice simulations on the
network. It reads the service definitions file, and opens a connection to
the Task Manager on the specified node.
It also determines the specific service to be used for all future jobs
submitted through the Task Manager.
Example

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);

CODAC Function Dictionary,

275

/* Initialization for Task Manager: load the service


definitions file, that is, serviceDefinition. Specify
host node for opening task manager 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

loadservice()

Loads the service definition file, and opens a Task


Manager connection

setservice()

Sets the specified service for all subsequent jobs


submitted to the Task Manager

CODAC Function Dictionary,

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

A string specifying the particular service in the service definition file


(in the case of SLIM Task Manager) or in the configuration file (in the
case of HP Task Broker) that needs to be used for all subsequent jobs
submitted through the Task Manager or the Task Broker.
Returned Value

Returns an integer value of zero

CODAC Function Dictionary,

277

Description

The setservice function is used to set or modify the service to be used


for all future jobs submitted through the SLIM Task Manager or the HP
Task Broker.
Example

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

print(Spice job 2 returned bad status);


}

Related Functions

invokespice3()

Invokes TI Spice3

loadservice()

Loads the service definition file and opens a Task


Manager connection

setservice()

Sets the specified service for all subsequent jobs


submitted to the Task Manager

uselsftb()
The uselsftb function tells CODAC to use the Load Sharing Facility
(LSF) for scheduling Spice jobs.
Function Usage

uselsftb (service_definition_file)
Prerequisites

Ensure that the LSF is installed in the network.


Required Arguments

None

CODAC Function Dictionary,

279

Options

service_definition_file
A string variable or constant specifying the pathname of the LSF
service definition file.

Returned Value

The uselsftb function returns the integer value zero, if it is successful


in initializing lsftb; otherwise, it returns one.
Description

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.

CODAC Function Dictionary,

280

ac Functions
This subsection describes the available ac functions.

bandwidth()
The bandwidth function calculates the bandwidth in an ac analysis.
Function Usage

bandwidth(gainsignal, midfreq, refdB)


Prerequisites

Read the signal gainsignal in using the readspicepunch() function.


Required Arguments
gainsignal

Represents the signal whose bandwidth you want to calculate. The


signal should be punched in the data base.
midfreq

Specifies the middle band frequency for determining the bandwidth


refdB

Represents the deviation at the low and high cutoff points in the middle
band gain

CODAC Function Dictionary,

281

Returned Value

The bandwidth function returns the bandwidth of the gain signal as a


floating point value.
Description

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.

CODAC Function Dictionary,

282

Figure 10. Calculating the Bandwidth

Gain (dB) A
Gmid

Gain - Freq plot


dB down

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().

CODAC Function Dictionary,

283

If you are using the C CODAC interface, see C CODAC Toplevel


Function bandwidth().

gainatphase()
The gainatphase function calculates the gain in dB at a specific phase
angle.
Function Usage

gainatphase(gainsignal, phasesignal, phase)


Prerequisites

Read in the signals, gainsignal and phasesignal using the


readspicepunch() function.
Required Arguments
phasesignal

Specifies the phase signal as a waveform


gainsignal

Specifies the gain signal as a waveform


phase

Represents the phase at which gain is calculated

CODAC Function Dictionary,

284

Returned Value

Returns the gain as a floating point value


Description

The gainatphase function calculates the gain in dB at a specific phase


angle given in the signals. To calculate this, CODAC:
1. Finds the frequency at the given phase (fp).
2. Finds the gain at the frequency f g.
3. Returns the gain.
Example

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().

CODAC Function Dictionary,

285

If you are using the C CODAC interface, see C CODAC Toplevel


Function gainatphase().

gainmargin()
The gainmargin function calculates the gain margin in the ac analysis.
Function Usage

gainmargin(gainsignal, phasesignal)
or
gainmargin(gainsignal, phasesignal, flag)
Prerequisites

Read in the signals gainsignal and phasesignal using the


readspicepunch() function.
Required Arguments
gainsignal

Represents the gain signal punched in database


phasesignal

Represents the phase signal


Optional Arguments
flag
CODAC Function Dictionary,

286

Specifies an integer variable


Returned Value

Returns the gainmargin as a floating point value


Description

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.

CODAC Function Dictionary,

287

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 the default mode of
computation.
Figure 11 shows this.

CODAC Function Dictionary,

288

Figure 11. Calculating the Gain Margin


dB (Gain)
20

fg

Freq (Hz) (log Scale)

Gain 23 dB
-20

Phase Angle (Degrees)

-90
Phase Margin
-180

-270

fp

Freq (Hz) (log Scale)

CODAC Function Dictionary,

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

phaseatgain(phasesignal, gainsignal, gain)

CODAC Function Dictionary,

290

Prerequisites

Read in the signals gainsignal and phasesignal using the


readspicepunch() function.
Required Arguments
phasesignal

Specifies the phase signal as a waveform


gainsignal

Specifies the gain signal as a waveform


phase

Represents the phase at which gain is calculated


Returned Value

Returns the phase as a floating point value


Description

The phaseatgain function calculates the phase angle at the specified


gain, given by the signals. To calculate this CODAC:
1. Finds the frequency at the given gain, (f g).
2. Finds the phase angle at fg frequency, (p angle).
3. Returns p angle as the phase angle.

CODAC Function Dictionary,

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)

CODAC Function Dictionary,

292

Prerequisites

Read in the signals gainsignal and phasesignal using the


readspicepunch() function.
Required Arguments
gainsignal

Represents the gain signal punched in database


phasesignal

Represents the phase signal


Optional Arguments
flag

Specifies an integer variable


Returned Value

Returns the gainmargin as a floating point value


Description

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.

CODAC Function Dictionary,

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.

CODAC Function Dictionary,

294

Figure 12. Calculating the Phase Margin

dB (Gain)
20

fg

Freq (Hz) (log Scale)


Gain 23 dB

-20

Phase Angle (Degrees)


0

-90

(p)
Phase Margin

-180

-270

fp

Freq (Hz) (log Scale)

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

296

Transient Functions
This subsection describes the available Transient functions.

abspeak()
The abspeak function returns the absolute peak value of the signal.
Function Usage

abspeak(signal, [starttime, endtime])


Required Arguments
signal

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.

CODAC Function Dictionary,

297

Returned value

Returns a floating point variable


Description

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

Figure 13. Measuring the Absolute Peak Value of the Signal

abspeak()

Time

The difference between abspeak() and peak() is that peak() function


returns the largest positive swing of the signal while the abspeak()
function returns the largest magnitude swing that could be positive or
negative.

CODAC Function Dictionary,

298

Example

This example returns the largest magnitude swing of signals in the


specified punchfile.
main(
{
waveform w1;
/* Read Spice punchfile */
readspicepunch(delay.pun);
while (nextsignal(w1))
print(abspeak(w1));
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

crosstime(signal1, signal2, number)

CODAC Function Dictionary,

299

Prerequisites

Read the signals in using the readspicepunch() function.


Required Arguments
signal1, signal2

Represents the signals whose time of crossing needs to be measured


number

Represents the occurrence of the crossing


Returned Value

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.

CODAC Function Dictionary,

300

Figure 14. Measuring the Time When Signal1 Crosses Signal2

IVA
Value

A1
V1

t2

t1
Time

If the first crossing is desired, then T1 is returned and if the second


crossing is desired, then T2 is returned.
Example

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);
}

CODAC Function Dictionary,

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

crossvalue(signal1, signal2, number)


Prerequisites

Read the signals in using the readspicepunch() function.


Required Arguments
signal1, signal2

Represents the signals whose value of crossing needs to be measured


number

Represents the occurrence of the crossing

CODAC Function Dictionary,

302

Returned Value

The crossvalue function returns the value when signal1 crossed


signal2, if successful; otherwise, it returns a large floating point number.
Description

The crossvalue function finds the voltage or current when signal1


crosses signal2. Figure 15 shows this.
Figure 15. Measuring the Value When Signal1 Crosses Signal2

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.

CODAC Function Dictionary,

303

Example

This example returns the voltage at which V CC crosses V SS .


main()
{
string
punchfile =delay.pun;
waveform
vcc, vss;
float
cross1;
readspicepunch(punchfile);
vcc = $VCC;
vss = $VSS;
cross1 = crossvalue(vcc, vss, 1);
print(// The first cross value of VCC and VSS, cross1);
}

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

delay(signal1, transnum1, signal2, transnum2)

CODAC Function Dictionary,

304

Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms
transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delay function returns delay, if both signal transitions can be


successfully detected; otherwise, it returns a large floating point number
equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

305

Figure 16. Measuring Delay Between Two Signals During a


Transient Analysis

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);
}

CODAC Function Dictionary,

306

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delaych(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

307

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delaych function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1E+34.
Description

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

Figure 17. Measuring Delay (center-high) Between Two Signals


During a Transient Analysis

Value

Signal2
High

Signal1

Center
Low

delaych=t1 - t2
t2

t1
Time

CODAC Function Dictionary,

308

Example

This example calculates the delay (center-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 = delaych(vin, 1, vout, 1);
print(// Delay <Center-High> between transitions =, delay1);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

309

delaycl()
The delaycl function returns the delay between the center level of
signal1 and the low level of signal2.
Function Usage

delaycl(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms
transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delaycl function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.

CODAC Function Dictionary,

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

Figure 18. Measuring Delay (center-low) Between Two Signals


During a Transient Analysis

Value

Signal2

Signal1

High
A
B

Center

Low
delaycl=t1 - t2

t2

t1
Time

Example

This example calculates the delay (center-low) between the first


transition of V IN and the first transition of V OUT .
main()
{
string

punchfile =delay.pun;

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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

delayhc(signal1, transnum1, signal2, transnum2)

CODAC Function Dictionary,

312

Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms
transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delayhc function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

313

Figure 19. Measuring Delay (high-center) Between Two Signals


During a Transient Analysis

Value

Signal2

Signal1
High

Center

B
Low
delayhc=t1 - t2
t2

t1
Time

Example

This example calculates the delay (high-center) 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 = delayhc(vin, 2, vout, 1);
print(// Delay <High-Center> between transitions =, delay1);
}

CODAC Function Dictionary,

314

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the


signal into the memory

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

delayhh(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

315

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delayhh function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

316

Figure 20. Measuring Delay (high-high) Between Two Signals


During a Transient Analysis

Value

Signal2
High

Signal1

Center
Low
delayhh=t1 - t2
t2

t1
Time

Example

This example calculates the delay (high-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 = delayhh(vin, 1, vout, 1);
print(// Delay <High-High> between transitions =, delay1);
}

CODAC Function Dictionary,

317

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delayhl(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

318

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delayhl function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

319

Figure 21. Measuring Delay (high-low) Between Two Signals


During a Transient Analysis

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);
}

CODAC Function Dictionary,

320

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delaylc(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

321

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delaylc function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

322

Figure 22. Measuring Delay (low-center) Between Two Signals


During a Transient Analysis

Value

Signal2

Signal1

High
Center

B
A

Low

delaylc=t1-t2
t2

t1
Time

Example

This example calculates the delay (low-center) 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 = delaylc(vin, 1, vout, 1);
print(// Delay <Low-Center> between transitions =, delay1);
}

CODAC Function Dictionary,

323

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delaylh(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

324

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delaylh function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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

Two signals are involved in this measurement.

CODAC Function Dictionary,

325

Figure 23. Measuring Delay (low-high) Between Two


Signals During a Transient Analysis

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);
}

CODAC Function Dictionary,

326

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delayll(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in the signals signal1 and signal2 using the readspicepunch()


function.
Required Arguments
signal1, signal2

Represent waveforms

CODAC Function Dictionary,

327

transnum1, transnum2

The transition numbers represented as integers


Returned Value

The delayll function returns the delay, if successful; otherwise, it returns


a large floating point number equal to 1.1e+34.
Description

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

CODAC Function Dictionary,

328

Figure 24. Measuring Delay (low-low) Between Two Signals During


a Transient Analysis

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);
}

CODAC Function Dictionary,

329

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

delayoff(signal1, transnum1, signal2, transnum2)


Prerequisites

Read in signals signal1 and signal2 using the readspicepunch() function.


Required Arguments
signal1, signal2

Represent waveforms
transnum1, transnum2
CODAC Function Dictionary,

330

The transition numbers represented as integers


Returned Value

The delayoff function returns the delay, if successful; otherwise, it


returns a large floating point number equal to 1.1e+34.
Description

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.

CODAC Function Dictionary,

331

Value

Figure 25. Measuring Delay (offset) Between Two Signals During a


Transient Analysis

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

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function delayoff().

CODAC Function Dictionary,

333

If you are using the C CODAC interface, see C CODAC Toplevel


Function delayoff().

delayxx()
The delayxx function computes the delay between the specified points
of two signal transitions.
Function Usage

delayxx(sig1, trans1, y1, sig2, trans2, y2)


Required Arguments
sig1, sig2

Represents waveforms
trans1, trans2

The transition numbers represented as integers


y1, y2

A float representing points on the two transitions


Returned Value

Returns a floating point value

CODAC Function Dictionary,

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

This example computes the delay between transition 1 and transition 2


of the signal V CC.
main()
{
string
punchfile =delay.pun;
waveform
vcc;
float
delay1;
readspicepunch(punchfile);
vcc = $VCC;
setsiglow(0.5);
setsigcent(2.0);
setsighigh(3.5);

CODAC Function Dictionary,

335

delay1 = delayxx(vcc, 2, 1.5, vcc, 1, 3);


print(// Delay between transitions =, delay1);
}

Related Functions

readspicepunch()

Reads the Spicepunchfile, and loads the signal into


the memory

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

Read in the signalname using the readspicepunch() function. The


starttime and endtime should be within signal name bounds.

CODAC Function Dictionary,

336

Required Arguments
signalname

Represents the signal whose dip should be calculated. The signal


should be a waveform.
Options
starttime

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.

CODAC Function Dictionary,

337

Figure 27. Calculating the Dip Value of the Signal

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);
}

CODAC Function Dictionary,

338

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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.

CODAC Function Dictionary,

339

number

Represents the transition number at which CODAC should calculate


the pulse duty cycle
Returned Value

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

CODAC Function Dictionary,

340

Example

This example calculates the pulse duty cycle of V IN starting at transition


1.
main()
{
string punchfile =delay.pun;
waveform vin;
float duty;
readspicepunch(punchfile);
vin = $VIN;
duty = dutycycle(vin, 1);
print(Pulse duty cycle of the pulse vin = duty);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

pulsewidth()

Returns the pulse width of the specified pulse

pulseperiod()

Returns the pulse period of the specified pulse

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().

CODAC Function Dictionary,

341

falltime()
The falltime function returns the fall time of the signal.
Function Usage

falltime(signal, transnum)
Prerequisites

Read in the signal using the readspicepunch() function.


Required Arguments
signal

Represents a waveform
transnum

Represents the transition number specified as an integer


Returned Value

If the specified transition moves from low to high, an error message is


displayed, and a large value is returned. If it is a true falling transition,
the function returns the fall time (float) value.

CODAC Function Dictionary,

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

High level on the transition

t2

Low level on the transition

Figure 29 shows how the fall time is measured during a transient


analysis.
Figure 29. Measurement of Falltime of a Signal During a Transient
Analysis

Value

Signal

Falltime = t2 - t1
P1
M

Center
P2
Falltime

t1

High

Low

t2
Time

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

344

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

risetime()

Returns the rise time of the signal

setsigcent()

Sets the center level of the signals

setsighigh()

Sets the high level of the signals

setsiglow()

Sets the low level of the signals

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)

CODAC Function Dictionary,

345

Prerequisites

Read in the signalname using the readspicepunch() function. Specify


the starttime and endtime within the signal time bounds.
Required Arguments
signalname

Represents the signal whose peak value should be calculated. The


signal should be a waveform.
Options
starttime

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.

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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)

CODAC Function Dictionary,

348

Prerequisites

Read in the signalname using the readspicepunch() function. Specify


the starttime and endtime within the signal time bounds.
Required Arguments
signalname

Represents the signal for which the peak2peak value should be


calculated. The signal should be a waveform.
Options
starttime

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

The peak2peak function returns the peak2peak value of the signal


between the start time and the end time as a float value; otherwise, it
returns a large floating point value equal to 1.1e+34.

CODAC Function Dictionary,

349

Description

The peak2peak function calculates the peak2peak value of the signal


between the start time and the end time. Figure 31 shows this.

Value

Figure 31. Measuring the Peak2Peak Value of the Signal

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()

Reads the Spice punchfile, and loads the signal


into the memory

peak()

Calculates the peak value of the signal

dip()

Calculates the dip value of the signal

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)

CODAC Function Dictionary,

351

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 calculates the pulse


frequency
number

Represents the transition number at which CODAC calculates the


pulse frequency
Returned Value

The pulsefrequency function returns the pulse frequency 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 pulsefrequency function calculates the pulse frequency of the


pulse at the specified transition number. You should specify the pulse
frequency as an inverse of the pulse period. Figure 32 shows this.

CODAC Function Dictionary,

352

Figure 32. Measuring the Pulse Frequency

freq=1/period
Value

pulse period

number

number+2
Time

Example

This example calculates the pulse width of V IN at transition 2.


main()
{
string punchfile =delay.pun;
waveform vin;
float freq;
readspicepunch(punchfile);
vin = $VIN;
freq = pulsefrequency(vin, 1);
print(// Pulse frequency of the pulse vin =, freq);
}

CODAC Function Dictionary,

353

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

gettransitiontime()

Returns the transition time of the signal

pulseperiod()

Returns the pulse period of the specified pulse

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

Represents the transition number at which CODAC calculates the


pulse period
Returned Value

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

The pulseperiod function calculates the pulse period of the pulse at


the specified transition number. You should specify the pulse period as
the delay between the transition number and number+2 of the pulse.
Figure 33 shows this.

CODAC Function Dictionary,

355

Figure 33. Measuring the Pulse Period

Value

pulse period

number

number+2
Time

Example

This example calculates the pulse period of vin at transition 1.


main()
{
string punchfile =delay.pun;
waveform vin;
float period;
readspicepunch(punchfile);
vin = $VIN;
period = pulseperiod(vin, 1);
print(// Pulse period of the pulse vin =, period);
}

CODAC Function Dictionary,

356

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

gettransitiontime()

Returns the transition time of the signal

pulsewidth()

Returns the pulse width of the specified pulse

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().

CODAC Function Dictionary,

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

Represents the transition number at which CODAC should calculate


the pulse width
Returned Value

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

CODAC Function Dictionary,

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

This example calculates the pulse period of vin at transition 2.


main()
{
string punchfile =delay.pun;
waveform vin;
float width;
readspicepunch(punchfile);
vin = $VIN;
width = pulsewidth(vin, 3);
print(// Pulse width of the pulse vin =, width);

CODAC Function Dictionary,

359

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

gettransitiontime()

Returns the transition time of the signal

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

Read the signal in using the readspicepunch() function.


Required Arguments
signal

CODAC Function Dictionary,

360

Represents a waveform
transnum

Transition number expressed as an integer


Returned Value

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.

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

362

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

falltime()

Returns the fall time of the signal

setsigcent()

Sets the center level of the signal

setsighigh()

Sets the high level of the signals

setsiglow()

Sets the low level of the signals

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)

CODAC Function Dictionary,

363

Required Arguments
signal

Represents a waveform variable


starttime

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

This example finds the rms value for the signal V CC .


main()
{

CODAC Function Dictionary,

364

waveform w1, w2;


/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 = $VCC;
print(rms(w1));

}
Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

settle(signal1, tolerance, mintime)


Prerequisites

Read the signal in using the readspicepunch() function.

CODAC Function Dictionary,

365

Required Arguments
signal1

Represents a waveform variable


tolerance

Represents a percentage. It is the range within which the specified


signal can oscillate from the settled value.
mintime

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 a float value corresponding to the settling


time for the waveform.
Description

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.)

CODAC Function Dictionary,

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);
}

Figure 36. Calculating the Settling Time

Settled value
tolerance%

Signal

-tolerance%
mintime
Settling time
t1

t2
Time

CODAC Function Dictionary,

367

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

skew(signal1, signal2, T1, T2, T3, T4)


Prerequisites

Read the signals in using the readspicepunch() function. The specified


transitions T1, T2, T3, T4 should exist.
Required Arguments
signal1

Specifies the first signal for measuring skew. This should be a


waveform.

CODAC Function Dictionary,

368

signal2

Specifies the second signal for measuring skew. This should be a


waveform.
T1

Represents the first transition number of signal1 in integer type


T2

Represents the first transition number of signal2 in integer type.


T3

Represents the second transition number of signal1 in integer type


T4

Represents the second transition number of signal2 in integer type


Returned Value

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.

CODAC Function Dictionary,

369

Figure 37. Measuring the Slew Value Between Two Signals

skew = abs (d1 - d2)or d1 ~ d2

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);
}

CODAC Function Dictionary,

370

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

threshold()

Calculates the threshold value of the signal

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

Read the signal, signal1 in using the readspicepunch() function.


Required Arguments
signal1

A waveform variable representing the specified waveform

CODAC Function Dictionary,

371

transition

An integer variable specifying the transition number


Returned Value

Returns a floating point value


Description

The slewrate function returns the rate of change of the specified


transition in the signal. If the specified transition does not exist, it returns
the value of 1.1E+34. Figure 38 calculates the slew rate.
Figure 38. Slew Rate

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;

CODAC Function Dictionary,

372

float slewr;
readspicepunch(delay.pun);
vcc
= $VOUT;
slewr = slewrate(vout,2);
print(// Slew rate of transition 2 =, slewr);
}

Related Functions

readspicepunch()

Reads the Spice punch fil, and loads the signal


into the memory

pulsefrequency()

Returns the pulse period of the specified pulse

pulsewidth()

Returns the pulse width of the specified pulse

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)

CODAC Function Dictionary,

373

Prerequisites

The signal should be read in using the readspicepunch() function.


Required Arguments
signal

Specifies the signal for which the slope needs to be calculated


time

Specifies the x point where slope is needed


Returned Value

Returns the slope as a floating point value


Description

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

This example prints the slope of V CC at two (2) nanoseconds.


main()
{

CODAC Function Dictionary,

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

threshold(switchnode, transnumber, innode)


Prerequisites

Read the signals switchnode and innode in using the readspicepunch()


function. The specified transnumber should exist in the switchnode
signal.
Required Arguments
switchnode

CODAC Function Dictionary,

375

Represents the switching node for measuring the threshold. This


should be a waveform.
transnumber

Represents the transition number at which threshold should be.


Calculates the threshold value of the signal. This should be an integer.
innode

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.

CODAC Function Dictionary,

376

Figure 39. Measuring the Threshold Value

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);
}

CODAC Function Dictionary,

377

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

thresholdhysteresis(switchnode, transnumber, innode)


Prerequisites

Read the signals switchnode and innode in using the readspicepunch()


function. The specified transnumber should exist in the switchnode
signal.
Required Arguments
switchnode

CODAC Function Dictionary,

378

Represents the switching node for measuring the threshold. This


should be a waveform.
transnumber

Represents the transition number at which threshold should be


calculated. This should an integer.
innode

Represents the input node for measuring the threshold. This should
a waveform.
Returned Value

The thresholdhysteresis function returns the threshold hysteresis 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 thresholdhysteresis function calculates the threshold hysteresis


of the input node signal when the switch node makes the specified
transition.
The threshold hysteresis is defined as the difference of the threshold
value of the input node signal when the switch node made the transitions
number and number+1. Figure 40 shows this.

CODAC Function Dictionary,

379

Figure 40. Measuring the Threshold Hysteresis Value

threshold hysteresis = v1 - v2
v1

innode

Value

v2
switchnode

number+1

number
Time

Example

This example calculates the threshold hysteresis of VBAT signal when


the VVSD signal made the transitions 1 and 2.
main()
{
string
waveform
float

punchfile =ovsd.pun;
innode, switchnode;
thrvalue;

readspicepunch(punchfile);
switchnode = $VVSD;
innode
= $VBAT;
thrvalue = thresholdhysteresis(switchnode, 1, innode);
print(// Threshold hysteresis =, thrvalue);
}

CODAC Function Dictionary,

380

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

threshold()

Calculates the threshold value of the signal

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().

CODAC Function Dictionary,

381

Plot Functions
This subsection describes the available Plot functions.

plot()
The plot function generates a PostScript file for plotting signals.
Function Usage

plot(psfilepath, signal1 [, signal2 [, signal3 ...])


Required Arguments
psfilepath

A string variable/constant specifying the pathname of the file to which


CODAC writes the PostScript output
signal1

Represents a waveform variable that specifies the signal to be plotted


Optional Arguments
signal2, signal3,...

Represents waveform variables that specify the signals to be plotted


Returned Value

None.

CODAC Function Dictionary,

382

Description

The plot function writes the PostScript output corresponding to signal1,


signal2, signal3... to the file specified using the argument, psfilepath.
Example

This example generates a PostScript file for plotting signals.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
w2 =$VGG;
/*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()

Reads the Spice punchfile, and loads the signal


into the memory

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function plot().

CODAC Function Dictionary,

383

If you are using the C CODAC interface, see C CODAC Toplevel


Function plot().

pltcomment()
The pltcomment function plots the specified comments.
Function Usage

pltcomment(comment [x,y])
Required Arguments
comment

A string variable/constant containing the comment to be returned


Optional Arguments
x

Represents a float variable/constant specified in inches


y

Represents a float variable/constant specified in inches


Returned Value

None.

CODAC Function Dictionary,

384

Description

The pltcomment function returns the specified string argument at the


center of the bottom of the plot by default. If you specify x and y values,
the plot is output at the point (x, y). The x and y values are interpreted
in inches.
Example

This example outputs the comment, CODAC PLOT centered at the


bottom of the plot.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Outputs the commentCODAC PLOT centered at the
bottom of the plot */
pltcomment(CODAC PLOT);
/*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);
}

CODAC Function Dictionary,

385

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents an integer variable or a constant


Returned Value

None.

CODAC Function Dictionary,

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

This example plots the date.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Prints the date on the plot */
pltdate(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);
}

CODAC Function Dictionary,

387

Related Functions

pltcomment()

Plots the specified comments

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents an integer variable/constant


Returned Value

None.

CODAC Function Dictionary,

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

This example plots the grid.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
pltgrid(0);
/*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);
}

CODAC Function Dictionary,

389

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents an integer variable/constant


Returned Value

None.

CODAC Function Dictionary,

390

Description

If the flag is set to non-zero, the major grid is plotted. The flag is set to
zero by default.
Example

This example plots the major grid.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
pltgrid(0);
/* Turn on the major grid only */
pltmjrgrid(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);
}

CODAC Function Dictionary,

391

Related Functions

pltgrid()

Plots the grid

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents an integer variable/constant


Returned Value

None.

CODAC Function Dictionary,

392

Description

If the flag is set to non-zero, signals are plotted in portrait mode. The
default mode (flag=0) is landscape.
Example

This example plots the signals in the portrait mode.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Plots signals in portrait mode */
pltportrait(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);
}

CODAC Function Dictionary,

393

Related Functions

pltcomment()

Plots the specified comments

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

plrprtres (xdpi, ydpi)


Prerequisites

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

Returns an integer value of one.


Description

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().

CODAC Function Dictionary,

395

pltxgrid()
The pltxgrid function plots the grid along the x-axis.
Function Usage

pltxgrid(flag)
Required Arguments
flag

Represents an integer variable or a constant


Returned Value

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

This example plots the grid on the x-axis.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
CODAC Function Dictionary,

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()

Plots the grid

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

397

pltxmax()
The pltxmax function sets the maximum value on the x-axis for the plot.
Function Usage

pltxmax(x)
Required Arguments
x

A float variable or a constant representing the maximum value on the


x-axis for the plot
Returned Value

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

This example sets the maximum value of x-axis to two inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

399

pltxmin()
The pltxmin function sets the minimum value on the x-axis for the plot.
Function Usage

pltxmin(x)
Required Arguments
x

A float variable or constant representing the minimum value on the


x-axis for the plot
Returned Value

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

This example sets the minimum value of x-axis to two inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the


signal into the memory

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().

CODAC Function Dictionary,

401

pltxmjrgrid()
The pltxmjrgrid function plots the major grid along the x-axis.
Function Usage

pltxmjrgrid(flag)
Required Arguments
flag

Represents an integer variable or a constant


Returned Value

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

This example plots the major grid on the x-axis.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
CODAC Function Dictionary,

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()

Plots the grid

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

pltxorigin()
The pltxorigin function sets the origin of x-axis of the plot.
Function Usage

pltxorigin(x)
Required Arguments
x
CODAC Function Dictionary,

403

Represents a float variable or a constant


Returned Value

None
Description

The pltxorigin function sets the origin of x-axis of the plot to the
specified point.
Example

This example sets the origin of x-axis to two (2) inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets origin of x-axis to 2 inches. */
pltxorigin(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);
}

CODAC Function Dictionary,

404

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

pltxscale()
The pltxscale function plots the scale of the x-axis to the specified value.
Function Usage

pltxscale(x)
Required Arguments
x

Represents a float variable or a constant


Returned Value

None.
Description

The pltxscale function sets the scale on the x-axis of the plot to the
specified value.

CODAC Function Dictionary,

405

Example

This example sets the scale of x-axis to two (2) inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets scale of x-axis to 2 */
pltxscale(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()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

406

pltxunits()
The pltxunits function sets the units on the x-axis for the plot.
Function Usage

pltxunits(str)
Required Arguments
str

A string variable or a constant representing the units to be displayed


on the x-axis for the plot
Returned value

None.
Description

The pltxunits function sets the units to be displayed on the x-axis of


the plot to string. The string units is displayed by default.
Example

This example displays seconds as the unit for the x-axis of the plot.
main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);

CODAC Function Dictionary,

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()

Reads the Spice punchfile, and loads the signal


into the memory

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.

CODAC Function Dictionary,

408

Function Usage

pltygrid(flag)
Required Arguments
flag

Represents an integer variable or a constant


Returned Value

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

This example plots the grid on the y-axis.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
pltgrid(0);
/* Turn on the y grid only */
pltygrid(1);
/*Generate postscript file tmp.ps1 for signal VCC at
rerun 1*/

CODAC Function Dictionary,

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()

Plots the grid

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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)

CODAC Function Dictionary,

410

Required Arguments
y1

A float variable or a constant representing the maximum value on the


y-axis for the plot
Returned Value

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

CODAC Function Dictionary,

411

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()

Reads the Spice punchfile, and loads the signal


into the memory

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

A float variable or a constant representing the minimum value on the


y-axis for the plot

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

413

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents an integer variable or a constant


Returned Value

None.

CODAC Function Dictionary,

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

This example plots the major grid on the y-axis.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Turn off the grid on the plot */
pltgrid(0);
/* Turn on the y major grid only */
pltymjrgrid(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);
}

CODAC Function Dictionary,

415

Related Functions

pltgrid()

Plots the grid

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents a float variable or a constant


Returned Value

None.

CODAC Function Dictionary,

416

Description

The pltyorigin function sets the origin of y-axis of the plot to the
specified point.
Example

This example sets the origin of y-axis to two inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets origin of y-axis to 2 inches. */
pltyorigin(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);
}

CODAC Function Dictionary,

417

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

Represents a float variable or a constant


Returned Value

None.

CODAC Function Dictionary,

418

Description

The pltyscale function sets the scale on the y-axis of the plot to the
specified value.
Example

This example sets the scale of y-axis to two inches.


main()
{
waveform w1, w2;
/* Read Spice punchfile */
readspicepunch(delay.pun);
w1 =$VCC{rerun=1};
/* Sets scale of y-axis to 2 */
pltyscale(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);
}

CODAC Function Dictionary,

419

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

A string variable or a constant representing the units to be displayed


on the y-axis for the plot
Returned Value

None.

CODAC Function Dictionary,

420

Description

The pltyunits function sets the units to be displayed on the y-axis of


the plot to the specified string. The string units is displayed by default.
Example

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);
}

CODAC Function Dictionary,

421

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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().

CODAC Function Dictionary,

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 source file that needs to be copied


destinationfile

Specifies the name of the target file where the specified source file
needs to be copied
Returned Value

Returns zero, if successful; otherwise, it returns one.

CODAC Function Dictionary,

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

This example copies the file delay.pun to the file temp.pun.


main()
{
copyfile(delay.pun,temp.pun);
}

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

Name of the file to be deleted

CODAC Function Dictionary,

424

Returned Value

Returns zero if successful; otherwise, it returns one


Description

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

Represents an integer variable specifying the status

CODAC Function Dictionary,

425

Returned Value

Returns the integer specified as its argument


Description

The exit function exits the program with the input argument as the
returned code.
Example

This example exits with status 1 if invokespice2 does not return a 0.


main()
{
if (!invokespice2(mypunchfile))
exit(1);
}

freepunchfile()
The freepunchfile function frees up the memory occupied by signals
in a punchfile.
Function Usage

freepunchfile(punchfilename)
Prerequisites

Read the punchfile in using the readspicepunch() function.

CODAC Function Dictionary,

426

Required Arguments
punchfilename

Specifies the name of the punchfile


Returned Value

None.
Description

The freepunchfile function frees up the memory occupied by the signals


from the specified punchfile. You can use this function, if the signals
from a punchfile are not required. This reduces the memory that CODAC
locks and increases the program speed. It also allows you to read
multiple punchfiles with limited memory.
Example

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);

CODAC Function Dictionary,

427

delay1 = gethightime(vcc, 1);


print(// High time on transition , delay1);
freepunchfile(punchfile);
}

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

CODAC Function Dictionary,

428

Required Arguments
signal_name

Specifies the waveform variable to be freed


Returned Value

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);
}

CODAC Function Dictionary,

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

Represents a waveform variable


Optional Arguments
noofbins

Represents an integer variable specifying the subranges into which


the range of these signals will be divided
Returned Value

Returns a waveform

CODAC Function Dictionary,

430

Description

The histogram function determines the range of the signal of y values.


The range is divided into 50 subranges by default. If you specify the
argument noofbins, the range is divided into a specified number of
subranges.
CODAC increments the appropriate bin counter, depending on the
subrange into which the signal sample values fall.
The output is a signal variable whose x points correspond to the bin
subranges and the y values correspond to the number of signal values
that fall within the particular bin subrange.
Example

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);
}

CODAC Function Dictionary,

431

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

rbinomial(float pp, int n)


Required Arguments
pp

Specifies the probability of n trials


n

Integer specifying the number of trials

CODAC Function Dictionary,

432

Description

The rbinomial function returns an integer value. This function returns


m, an integer value between zero and n
Example

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++;

CODAC Function Dictionary,

433

Related Functions

rnormal()

Returns a uniformly distributed random number

rpoisson()

Returns a random integer value

runiform()

Returns an evenly distributed random number

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

Represents a float variable

CODAC Function Dictionary,

434

Description

The rnormal function returns a normally (Gaussian) distributed random


number with mean value 0 (zero) and the standard deviation sigma. The
polar method for random number generation is used.
Example

This example returns a normally distributed random number with the


mean value 0 (zero) and the standard deviation of 3.
main()
{
float rand;
rand = rnormal(3);
}

Related Functions

setseed()

Sets the seed for the runiform and rnormal functions

rnormal()

Returns a uniformly distributed random number

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().

CODAC Function Dictionary,

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

Float variable specifying the mean of the poisson distribution


Description

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;

CODAC Function Dictionary,

436

while(i < Index)


{
ModStr = "PW " + str(rpoisson(6));
Newdeck = addcards(basedeck, ModStr);
invokespice3(Newdeck);
readspicepunch(Newdeck + ".pun");
vcc = $VCC;
delay1 = gethightime(vcc, 1);
print("// High time on transition ", delay1);
freewave(vcc);
i++;
}

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

Represents a float variable


CODAC Function Dictionary,

437

algorithm

Represents an integer variable


Description

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

This example returns an evenly distributed random number in (0,3).


main()
{
float rand;
rand = runiform(3);
}

Related Functions

setseed()

Sets the seed for the runiform and rnormal functions

rnormal()

Returns a normally distributed random number

If you are using the PERL CODAC interface, see Perl CODAC Toplevel
Function runiform().
CODAC Function Dictionary,

438

If you are using the C CODAC interface, see C CODAC Toplevel


Function runiform().

setpath()
The setpath function sets the current working directory pathname.
Function Usage

setpath(str_val)
Required Arguments
str_val

Represents a string value or a variable specifying the pathname


Returned value

None.
Description

The setpath function sets the current working directory to the pathname
specified by the argument str_val.
Example

This example sets the pathname to deck1 and deck2.


main()
{
/* current working directory /work

*/
CODAC Function Dictionary,

439

/* full pathname of spice.deck1 is /decks1/spice.deck1 */


string
deckfile1 =spice.deck1;
/* full pathname of spice.deck2 is /decks2/spice.deck2 */
string
deckfile2 =spice.deck1;
/* change current working directory to /decks1 */
setpath(/decks1);
invokespice3(spice.deck1);
/* change current working directory to /decks2 */
setpath(/decks2);
invokespice3(spice.deck2);
}

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)

CODAC Function Dictionary,

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.

CODAC Function Dictionary,

441

setseed()
The setseed function sets the seed for the runiform() and rnormal()
functions.
Function Usage

setseed(seed)
Required Arguments
seed

Represents an integer variable


Returned value

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);

CODAC Function Dictionary,

442

rand = rnormal(3);
}

Related Functions

rbinomial()

Returns a uniformly distributed random number

rnormal()

Returns a normally distributed random number

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

By default, CODAC treats signal names as case-sensitive. This function


is a switch that toggles between upper and lower case for signal names.
When you call the function the first time, it makes the signal names
case-insensitive (implicitly converted to uppercase). Calling the function
a second time makes the signal names case sensitive.
Example

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;
}

CODAC Function Dictionary,

444

Related Functions

readspicepunch()

Reads the Spice punchfile, and loads the signal


into the memory

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

A string containing the shell command to be executed


Returned Value

Returns an integer value

CODAC Function Dictionary,

445

Description

The system function executes a shell command. The current process


waits until the shell has completed, then returns the exit status of the
shell.
The system returns 0, if the command is executed successfully and
non-zero otherwise. The integer value returned, is the same as that of
the value returned by the Unix system() call.
Example

This example lists the contents of the current directory.


main()
{
system(/bin/ls x);
}

CODAC Function Dictionary,

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

Returns a float value.

CODAC Function Dictionary,

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));

CODAC Function Dictionary,

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()

Prints the value of the variable specified as its


argument, at the end of each iteration in the datafile
that the optimizer generates

optconstraint()
The optconstraint function allows you to specify objectives as
constraints. This function generates an optimized solution that satisfies
the constraint condition.
Function Usage

optconstraint (objective, min_val, max_val)


Prerequisites

None.

CODAC Function Dictionary,

449

Required Arguments
objective

Specifies the value of the objective in the current iteration. It can be


either a float or an integer variable.
min_val

Specifies the minimum value of the objective range. It can be either


a float or an integer variable.
max_val

Specifies the maximum value of the objective range. It can be a float


or an integer variable.
Returned Value

Returns the integer one if the objective value is outside the range, and
zero if it lies within the range.
Description

The optconstraint function allows you to specify certain objectives as


constraints. The optimizer checks if these constraints are satisfied.
If any one of the constraints is not satisfied, the optimizer does not
optimize that particular set of parameter values.
Example
main()
{
float Tplh_w, Tphl_w, Tavg_w;

CODAC Function Dictionary,

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()

Specifies the circuit performance variable to be


optimized

optgangparam()
The optgangparam function sets the dependent parameter value as a
ratio of independent parameter value.
Function Usage

optgangparam (dependent_param, mult_factor, independent_param)

CODAC Function Dictionary,

451

Required Arguments
dependent_param

Represents a string variable that specifies the dependent parameter


name
mult_factor

Represents a float variable that specifies the ratio of the dependent


parameter variable to the independent variable
independent_param

Represents a string variable that specifies the independent variable


Returned Value

The optgangparam function returns the number of dependent


parameters you have specified up to this function.
Description

The optgangparam function specifies the relation between the


dependent parameter variable and the independent parameter value:
dependent_variable = mult_factor * independent_variable
Define the independent variable using optparameter() before it is used
in this function.

CODAC Function Dictionary,

452

Example

This example shows a simple optimization program that tries to optimize


the V OH and V OL voltages so that they are within the specified range in
the optimize() function.
float Voh, Vol;
CalVohVol(string VohPunch,string VolPunch)
{
waveform VOH, VOL;
readspicepunch(VohPunch);
VOH = $VY;
Voh = ypoint(VOH,0);
readspicepunch(VolPunch);
VOL = $VY;
Vol = ypoint(VOL,0);
return 0;
}
main()
{
int Index;
string punchfile;
optspicedeck("Voh.spi","Vol.spi");
optparameter("PMO01W",70,90,83.00);
optgangparam("PMO02W",1,"PMO01W");
optgangparam("PMO03W",1,"PMO01W");
optparameter("PMO09W",10,40,30.00);
optgangparam("PMO10W",1,"PMO09W");
optgangparam("PMO11W",1,"PMO09W");
optiterations(800);
optsimplex
{
CalVohVol("Voh.spi.pun","Vol.spi.pun");
optimize(Voh,2.7,2.3);
optimize(Vol,0,0.4);
}

CODAC Function Dictionary,

453

Related Functions

optparameter()

Specifies the circuit components to vary in the


optimization process

optgetiterval()
The optgetiterval function returns the current iteration number.
Function Usage

optgetiterval()
Prerequisites

None.
Required Arguments

None.
Returned Value

Returns an integer value.

CODAC Function Dictionary,

454

Description

The optgetiterval function returns the number of iterations that the


optimizer has completed out of the number of iterations that you specify.
If you use it inside the optsimplex block, it returns the number of
iterations until the current iteration. If you specify it outside the
optsimplex block, it returns the number of iterations the optimizer uses
to converge to the final value.
Example
#include<Cin.k>
main()
{
int CurrIterVal = 0;
float Delay, CinVal;
optspicedeck("Delay.spi","Cin.spi");
optparameter("PWM1",0.1,30,10.5,0.3,0.1);
optparameter("PWM2",0.1,30,10.5,0.3,0.1);
optiteration(300);
optsimplex
{
if(CurrIterVal == optgetiterval())
{
printf("Information on iteration
=%d\n",CurrIterVal);
CurrIterVal++;
}
readspicepunch("Delay.spi.pun");
Delay = delay($VIN,1,$VY,1) * 1e09;
readspicepunch("Cin.spi.pun");
CinVal = Cinff($VX,$IY);
optimize(Delay,0,3.5,3,"<");
optimize(CinVal,0,20.0,2,"<");
printf("Delay =%e ns\n",Delay);

CODAC Function Dictionary,

455

printf("Cin

=%e\n\n",CinVal);

Related Functions

Specifies the maximum number of iterations during


the optimization process

optgetobj()
The optgetobj function returns the objective value you specify.
Function Usage

optgetobj (objective_id, access_type)


Prerequisites

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.

CODAC Function Dictionary,

456

Returned Value

Returns a float value.


Description

If you set access_type to an integer value of zero, optgetobj returns


the optimized value of the objective upto the current iteration.
If you set access_type to an integer value of non-zero, optgetobj returns
the value of the objective in the current iteration.
Example

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()

Specifies the circuit performance variable to be


optimized

optgetparam()
The optgetparam function returns the parameter value you specify.
Function Usage

optgetparam (parameter_name, access_type)


Required Arguments
parameter_name

Specifies the string variable of the parameter to change

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

Returns a float value


Description

The optgetparam function returns the value of the parameter at the


current iteration.
If you set access_type to an integer value of zero, optgetparam returns
the optimized value of the parameter obtained till the current iteration.
If you set access_type to an integer value of non-zero, optgetparam
returns the value of the parameter in the current iteration.
Example

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
{

CODAC Function Dictionary,

459

CalDC("Buffer.dc.pun", "VTTLIN", "VOUT");


CalDel("Buffer.tr",
"VTTLIN", "VOUT");
Cwidth = optgetparam("mphv1 w");
Cwidth += optgetparam("mnhv1 w");
/* RiseDel, FallDel,Vih, Vil are all global variables
*
* defined in CalDCTRvals.k file along with the function *
* definitions of CalDC() & CalDel()
*/
optimize(RiseDel, 1.5e-9, 2.4e-9);
optimize(FallDel, 1.5e-9, 2.4e-9);
optimize(Vih, 1.95, 2.00);
optimize(Vil, 0.80, 0.75);
optimize(Cwidth,0,Iwidth);

}
Related Functions

optparameter()

Specifies the circuit components to be varied in


the optimization process

optimize()

Specifies the circuit performance variable to be


optimized

optimize()
The optimize function specifies the circuit performance variable to be
optimized.
Function Usage

optimize (objective, goal, wt, [rel-op])

CODAC Function Dictionary,

460

Required Arguments
objective

Specifies the value of the objective function in the current iteration. It


can be an integer or a float data type.
goal

Specifies the final value that you want the optimizer to achieve
wt

Weight is a positive value representing the priority of the objective. It


can be either a float or an integer.
rel_op

The relational operator specifies whether the optimizer should


optimize the objective to the specified goal or go beyond the goal
value. This is a string variable and can be =, <, or > The default is =
Returned Value

The optimize function returns an integer id that is an input to the


optgetobj function.
Description

The optimize function specifies the objective value to the optimizer


along with the goal and the priority of the objective. CODAC punches
the best value of the objective obtained at the end of each iteration, into
a data file that you can view on the optimizer user interface. CODAC
creates this data file, codac_inst._file_name.data.

CODAC Function Dictionary,

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 */
}
}
}

CODAC Function Dictionary,

462

Related Functions

optparameter()

Specifies the circuit components to vary in the


optimization process

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

Represents an integer variable


Returned Value

The optiterations function returns the number of iterations actually set


inside the program.

CODAC Function Dictionary,

463

Description

The optiterations function specifies the maximum number of iterations


allowed during the optimization process. It should be outside the block
construct for the optimization process. This process terminates either
after the specified number of iterations or when all the parameters have
converged, whichever occurs first.
Example

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);
}
}

CODAC Function Dictionary,

464

Related Functions

optimize()

Specifies the circuit performance variable to


optimize

optparameter()

Specifies the circuit components to vary in the


optimization process

optparameter()
The optparameter function specifies the circuit components to be varied
in the optimization process.
Function Usage

optparameter (parameter_name, min_value, max_value, start_value,


min_length, variance, term_value)
Required Arguments
parameter_name

A string datatype variable that specifies the circuit component to be


varied
min_value

Represents the lower limit the variable can take


max_value

Specifies the upper limit the variable can take

CODAC Function Dictionary,

465

Optional Arguments

start_value

Float or integer variable that specifies the initial value


the optimizer should use

min_length

Specifies the minimum length of the parameter. The


parameter value the optimizer generates is a multiple
of this length. If not defined, the parameter value takes
any value between min_value and max_value. The
min_length should be a positive float value.

variance

Specifies the percentage of the start value. CODAC


computes the distance of the values that it generates
while forming the initial simplex, using the starting
values that you specify. This argument allows you to
specify the initial setup value and avoid any existing
local minimum.

term_value

Float or integer variable specifying the termination


condition for convergence of the parameter
If the distance of all other parameters from a particular
parameter is within its term value, the parameter
reaches its termination condition. Optimization stops
when all parameters satisfy their termination
conditions.

Returned Value

The optparameter function returns the number of circuit parameters


you specify up to this function.

CODAC Function Dictionary,

466

Description

The optparameter function specifies circuit parameter to be varied


during the optimization process and the range of the parameter. The
start value is an optional argument.
CODAC chooses a random value between the minimum and maximum
value specified by default. However, for faster convergence, a good
initial value is essential. The min_length specifies the minimum length
of the parameter of which the parameter value should be a multiple.
Example

In this example, a simple CODAC instruction file optimizes delay.


Change the widths of transistors MO1 and MO2 as shown below:
main()
{
string spicedeck = "example.spi";
waveform sig1, sig2;
float Delay;
optspicedeck(spicedeck);
/* To specify the transitor widths, the range(min,max) and the
start value */
optparameter("MO1 W",2.5,200,43.0);
optparameter("MO2 W",2.5,200,33.0);
optiterations(100);/* No. of iterations */
optsimplex
{
sig1 = $VOUT;
sig2 = $VIN;
Delay = delay(wav2,2,wav1,2);
/* constrains on the objective functions */
optimize(Delay,0,5.0e-09);
}

CODAC Function Dictionary,

467

Related Functions

optimize()

Specifies the circuit performance variable to


optimize

optspicedeck()
The optspicedeck function specifies the Spice decks used in the
optimization process.
Function Usage

optsplcedeck (spicedeck1, spicedeck2,......)


Prerequisites

None.
Required Arguments
spicedeck1, spicedeck2,......

Represent string datatype. Each variable specifies the full pathname


of the Spice decks. In a single function call there is a minimum of 1
Spice deck path and a maximum of seven Spice deck paths.

CODAC Function Dictionary,

468

Returned Value

The optspicedeck function returns the number of Spice decks defined


up to this function.

CODAC Function Dictionary,

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));

CODAC Function Dictionary,

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()

Specifies the circuit performance variable to


optimize

optparameter()

Specifies the circuit components to vary in the


optimization process

CODAC Function Dictionary,

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,...

Represents string variables that specifies the parameter names


Returned Value

Returns a float value


Description

If no arguments are present, the optsumparam function returns the sum


of all the parameters you specify in optparameter(). If arguments are
present, it returns the sum of the arguments you specify.
You can specify only seven parameter names in a single function. If
there are more than seven parameter names, use this function multiple
times.

CODAC Function Dictionary,

472

You should define these arguments using optparameter() and


optconstraint() before it is used in this function.
Example
main()
{
float Iwidth,Width, Isou;
optspicedeck("Isource.spi");
optparameter("MO1 W",10,150,25.00);
optparameter("MO2 W",10,150,35.00);
optiterations(500);
Iwidth = getparamsum();
optsimplex
{
readspicepunch(Isource.spi.pun");
Isou = ypoint($IVY,0);
Width = getparamsum();
optimize(Isou,90e-03,79e-03);
optimize(Width,0,Iwidth);
}
}

Related Functions

optparameter()

Specifies the circuit components to vary in the


optimization process

CODAC Function Dictionary,

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

Specify a variable name.


Returned Value

Returns an integer id that is an input to the getmeasval function.


Description

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.

CODAC Function Dictionary,

474

You can use this function to monitor the variation of performance


measures that are not being optimized.
Example
main()
{
float Tplh_w, Tphl_w, Tavg_w;
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,"=");
optconstraint(Tavg_w, 2.00, 5);
punch(Tplh_w);
}
}

Related Functions

optimize()

Specifies the circuit performance variable to


optimize

CODAC Function Dictionary,

475

Perl CODAC Functions


The Perl CODAC functions are:
Perl CODAC Toplevel Functions
Perl CODAC Waveform Functions
Perl CODAC Punch Functions

Perl CODAC Toplevel Functions


The Perl CODAC top level functions are:

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");

CODAC Function Dictionary,

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");

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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");

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

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");

CODAC Function Dictionary,

485

$rand = Codac::runiform(3, 0);


print($rand, "\n");
$rand = Codac::rbinomial($prob, $trial);
print($rand, "\n");
$rand = Codac::rpoisson($mean);
print($rand, "\n");

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().

CODAC Function Dictionary,

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");

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

488

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");
} else {
print("signal not found");

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);

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

491

Perl CODAC Waveform Functions


The Perl CODAC waveform functions are:

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");

CODAC Function Dictionary,

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

use lib $ENV{PERLLIB};


use Codac ;
my $punch = Codac::readspicepunch("../input/ac.pun");
my $va = $punch->findsignal("VDBOUT_0");
my $vb = $punch->findsignal("VPOUT_0");
my $vc;
$vc = Codac::Waveform::bandwidth($va ,1e3
print("bandwidth = ",$vc,"\n");

, 0 );

$vc = Codac::Waveform::gainatphase($va ,$vb, 1 );


print("gain at phase = ",$vc,"\n");
$vc = Codac::Waveform::gainmargin($va ,$va, 1 );
CODAC Function Dictionary,

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)

CODAC Function Dictionary,

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

$waveform = $punchfile ->find signal (signal_name


[-temp=> value], [ -run=. value] , [-rerun => value],
[-modify =>value], [-analysis => value])
Required argument

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

See for an example.

firstsignal()
Returns the first signal in a punchfile.

CODAC Function Dictionary,

497

Function usage

$waveform_name = $punchfile_name-> firstsignal()


Required arguments

punchfile_name
Optional arguments

None
Prerequisite

Load the the punchfile using readspicepunch()


Returned value

Returns a waveform in the variable waveform_name


Description

Returns the first signal in the last loaded punchfile


Example

See nextsignal() for an example.

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");

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

500

print("hightime = ", $vc ,"\n");

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");

CODAC Function Dictionary,

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

$waveform_name = Codac:: Waveform::getnewwave()


Required arguments

None
Optional arguments

None
Prerequisite

None
Returned value

Returns a waveform in $waveform_name


CODAC Function Dictionary,

502

Description

Creates a new null waveform and sets its name to GEN.


Example

See for an example.

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");

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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";

CODAC Function Dictionary,

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 ;

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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;

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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 ;

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

521

Perl CODAC Punch Functions


The Perl CODAC punch functions are:

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);

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

528

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,

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

C CODAC String Functions


str()
For the function description, see str().
Returned value

char *
An example of the str() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
double float1 = 3.5;

CODAC Function Dictionary,

530

double float2 = 2.5;


char *str1, *str2;
str1 = str(float2);
str2 = str(float1);
printf("%s %s\n",str1,str2);

See strext() for details.


Function usage

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().

CODAC Function Dictionary,

531

Function usage

strind(str_val, pattern)
Required arguments

str_val

char *

pattern

String

The example of the strind() function in C CODAC is the same as strind().

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

char *pattern = "=";


int index = strind(strval,pattern);
printf("%s \n",strrext(strval,index + strlen(pattern),10));
printf("%s \n",strrext(strval,index + strlen(pattern),-1));
}

C CODAC AC Functions
bandwidth()
For the function description, see bandwidth().
Function usage

bandwidth(gainsignal, midfreq, refdB)


Required arguments

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;

CODAC Function Dictionary,

533

float bdwidth , gain , gmargin , phase , pmargin;


wav1 = readwave("ac.pun","VDBOUT_0",-1,-1,-1,-1,"");
wav2 = readwave("ac.pun","VPOUT_0",-1,-1,-1,-1,"");
bdwidth = bandwidth(wav1 , 1e6 ,0.3);
gain = gainatphase(wav1 , wav2 , 1);
gmargin = gainmargin(wav1 , wav2, -1);
phase = phaseatgain(wav2, wav1 ,1.0);
pmargin = phasemargin(wav1, wav2 , -1);
printf("bandwidth = %f \n",bdwidth);
printf("gainatphase = %f \n",gain);
printf("gainmargin = %f \n",gmargin);
printf("phaseatgain = %f \n",phase);
printf("phasemargin= %f \n",pmargin);
}

gainatphase()
For the function description, see gainatphase().
Function usage

gainatphase(gainsignal, phasesignal, phase)


Required arguments

phasesignal

Waveform *

gainsignal

Waveform *

phase

double

Returned value

Double
The example of the gainatphase() function in C CODAC is the same
as bandwidth()

CODAC Function Dictionary,

534

gainmargin()
For the function description, see gainmargin().
Function usage

gainmargin(gainsignal, phasesignal)
Required arguments

gainsignal

Waveform *

phasesignal

Waveform *

Returned value

Double
Usage details

If you want the flag to be set to the default value use 1


The example of the gainmargin() function in C CODAC is the same as
bandwidth().

phaseatgain()
For the function description, see phaseatgain().
Function usage

phaseatgain(phasesignal, gainsignal, gain)


Required arguments

phasesignal

Waveform *

CODAC Function Dictionary,

535

gainsignal

Waveform *

gain

double

Returned value

Double
Usage details

If you want the flag to be set to the default value use 1


The example of the phaseatgain() function in C CODAC is the same
as bandwidth().

phasemargin()
For the function description, see phasemargin().
Function usage

phasemargin(gainsignal, phasesignal)
Required arguments

gainsignal

Waveform *

phasesignal

Waveform *

Returned value

Double
Usage details

If you want the flag to be set to the default value use 1

CODAC Function Dictionary,

536

The example of the phasemargin() function in C CODAC is the same


as bandwidth().

C CODAC Simulator Functions


addcards()
For the function description, see addcards().
Function usage

addcards(spicedeck, , cards)
Required arguments

phasesignal

char **

cards

char **

Returned value

char *
Usage details

Enter NULL for the last element of the char ** variable


An example of the addcards() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
char *cards[100], *modspicedeck;
cards[0] = (char *)malloc( strlen("*SPICE DECK TO TEST
DDCARDS FUNCTION\n") );

CODAC Function Dictionary,

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

caddcards(basedeck, moddeck, cards)


Required arguments

basedeck

char *

moddeck

char *

cards

char **

Returned value

char *
Usage details

Enter NULL for the last element of the char ** variable

CODAC Function Dictionary,

538

The example of the caddcards() function in C CODAC is the same as


addcards().

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

CODAC Function Dictionary,

539

invokespice3(deck_path, print_path, punch_path, udm_path1,


udm_path2, spice_options)
Required arguments

All
Usage details

Enter NULL if you do not want to specify any arguments.


The example of the invokespice3() function in C CODAC is the same
as addcards().

invokespicesrvr()
For the function description, see invokespicesrvr().
Function usage

invokespicesrvr(deckpath)
Required arguments

deckpath

char *

The example of the invokespicesrvr() function in C CODAC is the same


as getsrvrstatus().

CODAC Function Dictionary,

540

setspice3path()
For the function description, see setspice3path().
Function usage

setspice3path (path)
Required arguments

path

char *

The example of the setspice3path() function in C CODAC is the same


as getsrvrstatus().

sndsrvrmodify()
For the function description, see sndsrvrmodify().
Function usage

sndsrvrmodify(srvrid, modifystring, append-overwrite)


Required arguments

srvrid

Spice server

modifystring

char *

append-overwrite

Either one (overwrite mode or zero


append mode)

The example of the sndsrvrmodify() function in C CODAC is the same


as getsrvrstatus().

CODAC Function Dictionary,

541

stopspicesrvr()
For the function description, see stopspicesrvr(). The example of the
stopspicesrvr() function in C CODAC is the same as getsrvrstatus().

CODAC Function Dictionary,

542

C CODAC Transient Functions


abspeak()
For the function description, see abspeak().
Function usage

abspeak(signal, starttime, endtime)


Required arguments

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");

CODAC Function Dictionary,

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

crosstime(signal1, signal2, number)


Required arguments

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().

CODAC Function Dictionary,

544

Function usage

crossvalue(signal1, signal2, transnum1, transnum2)


Required arguments

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

delay (signal1, signal2)


Required arguments

signal1, signal2

Waveform *

Returned value

Double
An example of the delay() function in C CODAC is:
#include<stdio.h>
#include"codac.h"

CODAC Function Dictionary,

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

delaych(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

Returned value

Double

CODAC Function Dictionary,

546

The example of the delaych() function in C CODAC is the same as


delay().

delaycl()
For the function description, see delaycl().
Function usage

delaycl(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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

delayhc(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

CODAC Function Dictionary,

547

transnum1, transnum2

Transition numbers represented as integers

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

delayhh(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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

delayhl(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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

delaylc(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

Returned value

Double
The example of the delaylc() function in C CODAC is the same as
delay().

CODAC Function Dictionary,

549

delaylh()
For the function description, see delaylh().
Function usage

delaylh(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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

delayll(signal1, signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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

delayoff(signal1,signal2, transnum1, transnum2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

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);

CODAC Function Dictionary,

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

delayxx(signal1, signal2, transnum1, transnum2, y1, y2)


Required arguments

signal1, signal2

Waveform *

transnum1, transnum2

Transition numbers represented as integers

y1, y2

double

Returned value

Double
The example of the delayxx() function in C CODAC is the same as
delaych().

CODAC Function Dictionary,

552

dip()
For the function description, see dip().
Function usage

dip(signalname, starttime, endtime)


Required arguments

signalname

Waveform *

double starttime, endtime


Returned value

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

Transition number at which CODAC should


calculate the pulse duty cycle

CODAC Function Dictionary,

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

Transition number specified as an integer

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

peak(signalname, starttime, endtime)


Required arguments

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

The example of the peak() function in C CODAC is the same as


dutycycle().

peak2peak()
For the function description, see peak2peak().
Function usage

peak2peak(signalname, starttime, endtime)


Required arguments

signalname

Waveform *

starttime, endtime

double

Returned value

Double
Usage details

Specify starttime and endtime as 1 if you want to get the peak2peak


in the signal for its entire time range.
The example of the peak2peak() function in C CODAC is the same as
dutycycle().

pulsefrequency()
For the function description, see pulsefrequency().
Function usage

CODAC Function Dictionary,

556

pulsefrequency(pulse, transnumber)
Required arguments

pulse

Waveform *

transnumber

Transition number at which CODAC should


calculate the pulse duty cycle

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

Transition number at which CODAC should


calculate the pulse duty cycle

Returned value

Double

CODAC Function Dictionary,

557

The example of the pulseperiod() function in C CODAC is the same as


dutycycle().

pulsewidth()
For the function description, see pulsewidth().
Function usage

pulsewidth(pulse, transnumber)
Required arguments

pulse

Waveform *

transnumber

Transition number at which CODAC should


calculate the pulse duty cycle

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

CODAC Function Dictionary,

558

signal

Waveform *

transnum

Transition number at which CODAC should


calculate the pulse duty cycle

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

rms(signal, starttime, endtime)


Required arguments

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:

CODAC Function Dictionary,

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

settle(signal1, tolerance, mintime)


Required arguments

signal1

Waveform *

tolerance, mintime

double

Returned value

Double
An example of the settle() function in C CODAC is:

CODAC Function Dictionary,

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

skew(signal1, signal2, T1, T2, T3, T4)


Required arguments

signal1, signal2

Waveform *

T1, T2, T3, T4

Transition numbers of the signals


in integer type

Returned value

Double
The example of the skew() function in C CODAC is the same as
dutycycle().

CODAC Function Dictionary,

561

slewrate()
For the function description, see slewrate().
Function usage

slewrate(signal1, transition)
Required arguments

signal1

Waveform *

transition

Integer variable specifying the transition number

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

CODAC Function Dictionary,

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

threshold(switchnode, transnumber, innode)


Required arguments

switchnode,innode

Waveform *

transnumber

Transition number at which threshold


should be. Calculates the threshold
value of the signal. Must be an integer.

Returned value

Double
An example of the threshold() function in C CODAC is:

CODAC Function Dictionary,

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

thresholdhysteresis(switchnode, transnumber, innode)


Required arguments

switchnode,innode

Waveform *

transnumber

Transition number at which threshold


should be. Calculates the threshold
value of the signal. Must be an integer.

Returned value

Double

CODAC Function Dictionary,

564

The example of the thresholdhysteris() function in C CODAC is the


same as threshold().

C CODAC Plot Functions


plot()
For the function description, see plot().
Function usage

plot(psfilepath, signals
Required arguments

psfilepath

char *

signal1

Waveform **

Usage details

Enter NULL as the last element in the Waveform ** variable.


An example of the plot() function in C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *wavptr[2];
wavptr[0] =
readwave("example.pun","VX11Y",25.00,1,0,0,"TR");
pltcomment("CODAC.PLT",0.5,1.00);
pltdate(1);
pltgrid(0);
pltmjrgrid(1);

CODAC Function Dictionary,

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

Specify x and y as 1 if you want the program to use their default


values.
The example of the pltcomment() function in C CODAC is the same as
plot().

pltdate()
For the function description, see pltdate(). The example of the pltdate()
function in C CODAC is the same as plot().

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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

The example of the pltxmax() function in C CODAC is the same as plot().

pltxmin()
For the function description, see pltxmin().
Function usage

pltxmin(x)
Required arguments

double

The example of the pltxmin() function in C CODAC is the same as plot().

CODAC Function Dictionary,

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

The example of the pltxorigin() function in C CODAC is the same as


plot().

pltxscale()
For the function description, see pltxscale().
Function usage

pltxscale(x)
Required arguments

double

The example of the pltxscale() function in C CODAC is the same as


plot().
CODAC Function Dictionary,

569

pltxunits()
For the function description, see pltxunits().
Function usage

pltxunits(str)
Required arguments

str

char *

The example of the pltxunits() function in C CODAC is the same as


plot().

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);

CODAC Function Dictionary,

570

pltymax()
For the function description, see pltymax().
Function usage

pltymax(y1)
Required arguments

y1

double type

The example of the pltymax() function in C CODAC is the same as


pltxgrid().

pltymin()
For the function description, see pltymin().
Function usage

pltymin(y1)
Required arguments

y1

double type

An example of the pltymin() function in C CODAC is the same as


pltxgrid().

CODAC Function Dictionary,

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

The example of the pltyorigin() function in C CODAC is the same as


pltxgrid().

pltyscale()
For the function description, see pltyscale().
Function usage

pltyscale(y)
Required arguments

double type

CODAC Function Dictionary,

572

The example of the pltyscale() function in C CODAC is the same as


pltxgrid().

pltyunits()
For the function description, see pltyunits().
Function usage

pltyunits(str)
Required arguments

str

char *

The example of the pltyunits() function in C CODAC is the same as


pltxgrid().

CODAC Function Dictionary,

573

C CODAC Waveform Functions


addpoints()
For the function description, see addpoint().
Function usage

addpoint(signal, xpoint, ypoint)


Required arguments

signal

Waveform *

xpoint

double

ypoint

double

Returned value

Waveform *
Usage details

Assign the returned value of addpoints() to the waveform pointer that


you want to access the waveform from when you create a new
waveform.
An example for the addpoints() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
Waveform *newwav;
newwav = addpoints(newwav,0.0,0.0);
addpoints(newwav,1.0,1.0);

CODAC Function Dictionary,

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

area(signalname, starttime, endtime)


Required arguments

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

average(signalname, starttime, endtime)


Required arguments

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

digitize(signal1, signal2, string1)


Required arguments
CODAC Function Dictionary,

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

fwdfft(signal, samplingfrequency, windowtype, sigmag, sigphase)


Required arguments

signal1

Waveform *

samplingfrequency

double

windowtype

double

sigmag

Waveform **

sigphase

Waveform **

Returned value

Waveform *
An example for the fwdfft() function C CODAC is;

CODAC Function Dictionary,

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()
{

CODAC Function Dictionary,

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

getcrosses (signal1, signal2)


Required arguments

signal1

Waveform *

signal2

Waveform *

An example for the getcrosses() function C CODAC is;


#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
int i , NumCross;

CODAC Function Dictionary,

580

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);
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);
}

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().

CODAC Function Dictionary,

581

gethightime()
For the function description, see gethightime().
Function usage

gethightime(signal, transnum)
Required arguments

signal

Waveform *

transnum

Transition number represented as an integer

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]));

CODAC Function Dictionary,

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

Transition number represented as an integer

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

The example for the getmodify() function C CODAC is the same as


getanalysis().

getmodifynum()
For the function description, see getmodifynum().
Function usage

getmodifynum(punchfile)
Required arguments

punchfile

char *

The example for the getmodifynum() function C CODAC is the same


as getcrosses().

getpoints()
For the function description, see getpoints().
Function usage

getpoints(signal)
Required arguments

signal

Waveform *

An example for the getpoints() function C CODAC is:


#include<stdio.h>
#include"codac.h"

CODAC Function Dictionary,

584

/* 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);
for( i = 0; i < val; i++ )
{
val1 = xpoint(wav,i);
val2 = ypoint(wav,i);
printf("x = %le, y = %le\n",val1,val2);
}
printf("Sig_high = %lf\n",getsighigh(wav));
printf("Sig_low = %lf\n",getsiglow(wav));
printf("Sig_cent = %lf\n",getsigcent(wav));
}

getrerun()
For the function description, see getrerun().
Function usage

getrerun(signal)
Required arguments

signal

Waveform *

The example for the getrerun() function C CODAC is the same as


getanalysis().

CODAC Function Dictionary,

585

getrerunnum()
For the function description, see getrerunnum().
Function usage

getrerunnum (punchfile)
Required arguments

punchfile

char *

The example for the getrerunnum() function C CODAC is the same as


getanalysis().

getrun()
For the function description, see getrun().
Function usage

getrun(signal)
Required arguments

signal

Waveform *

The example for the getrun() function C CODAC is the same as


getanalysis().

getsigcent()
For the function description, see getsigcent().

CODAC Function Dictionary,

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

CODAC Function Dictionary,

587

setting
main()
{

& getpoints function */

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().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

589

getsigname()
For the function description, see getsigname().
Function usage

getsigname(signal1, int1);
Required arguments

signal

Waveform *

Returned value

char * variable
Usage details

If you want the full name of the signal, specify int1 as 1


The example for the getsigname() function C CODAC is the same as
getanalysis().

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 *

The example for the gettransitions() function C CODAC is the same


as getsiggp().

gettransitiontime()
For the function description, see gettransitiontime().
Function usage

gettransitiontime(signal, transnum)
Required arguments

signal

Waveform *

transnum

Transition number represented as an integer


CODAC Function Dictionary,

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

getx(signal, yval, reftime)


Required arguments

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);

CODAC Function Dictionary,

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

getxt(signal, yval, trans_no)


Required arguments

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)

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

596

isfall()
For the function description, see isfall().
Function usage

isfall(signal1, transition)
Required arguments

signal1

Waveform *

transition

Transition number

An example for the isfall() 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("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
setsigcent(1.2,&wav[0]);
setsighigh(2.5,&wav[0]);
setsiglow(0.0,&wav[0]);
printf("Is first Transition is Rise Transition =
%d\n",isrise(wav[0],1));
printf("Is first Transition is Fall Transition =
%d\n",isfall(wav[0],1));
}

CODAC Function Dictionary,

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

ivcurve(volsig, cursig, starttime, endtime, name)


Required arguments

volsig, cursig

Waveform *

starttime, endtime, name

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 *

An example for the loaddb() function C CODAC is:


#include<stdio.h>
#include"codac.h"
#include<string.h>
main()
{
Waveform *wav1 , *wav2;
readspicepunch("example.pun");
savedb("example.pun.codacdb");
loaddb("example.pun","example.pun.codacdb");
}

CODAC Function Dictionary,

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

range(signal1, starttime, endtime)


Required arguments

signal1

Waveform *

starttime, endtime

double *

Returned value

Waveform *
Usage details

Assign 1 to starttime and endtime if you do not want to use them.


The example for the range() function C CODAC is the same as
nextsignal().

readspicepunch()
For the function description, see readspicepunch().
Function usage

readspicepunch(punchfilename)
Required arguments

punchfilename

char *

Returned value

Integer

CODAC Function Dictionary,

601

The example for readspicepunch() in C CODAC is the same as


getcrosses().

CODAC Function Dictionary,

602

readwave()
For the function description, see readwave().
Function usage

readwave(punchfilename, signalname, temp, run, rerun, modify,


analysis)
Required arguments

punchfilename

char *

signalname

char *

modify

char *

analysis

char *

temp, run, rerun

double

Returned value

Waveform *
Usage details

Assign 1 to temp, run, rerun, and modify and NULL to analysis if


you do not want to use them.
The example for the readwave() function C CODAC is the same as
getcrosses().

CODAC Function Dictionary,

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().

CODAC Function Dictionary,

604

setreftime()
For the function description, see setreftime().
Function usage

setreftime(reftime, signals)
Required arguments

reftime

Reference time

signals

Waveform **

Usage details

The last element of the Waveform * variable must be NULL. If you


want to set the center value of all the signals in the punchfile specify
the Waveform ** variable with a single element NULL.
An example for the setreftime() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
int val, i;
double val1, val2;
Waveform *wav[2], *truncwav;
wav[1]= NULL;
wav[0] =
readwave("../inpbuf.stim.pun","VIN",27.00,1,0,0,"TR");
setreftime(2.8e-08,wav);
printf("x-alue of first transition is =
%e\n",gettransitiontime(wav[0],1));
}

CODAC Function Dictionary,

605

setsigcent()
For the function description, see setsigcent().
Function usage

setsigcent(centval, signals)
Required arguments

centval

double

signals

Waveform **

Usage details

The last element of the Waveform ** variable must be NULL. If you


want to set the center value of all the signals in the punchfile specify
the Waveform ** variable with a single element NULL.
The example for the setsigcent() function C CODAC is:
#include<stdio.h>
#include"codac.h"
main()
{
int val, i;
double val1, val2;
Waveform *wav1[2];
wav1[1] = NULL;
wav1[0] =
readwave("example.pun","VX11Y",-1,-1,-1,-1,"TR");
setsigcent(2.7,NULL);
setsighigh(4.0,NULL);
setsiglow(0.7,NULL);
printf("Original sig name is %s\n",getsigname(wav1[0],-1));
setsigname(wav1[0],"MODSIGNAME");
printf("Modified sig name is %s\n",getsigname(wav1[0],-1));
CODAC Function Dictionary,

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

The last element of the Waveform ** variable must be NULL. If you


want to set the glitch period of all the signals in the punchfile specify
the Waveform ** variable with a single element NULL.
The example for the setsiggp() function C CODAC is the same as
setsiggp().

setsighigh()
For the function description, see setsighigh().
Function usage

setsighigh(highval, signals)

CODAC Function Dictionary,

607

Required arguments

highval

double

signals

Waveform **

Usage details

The last element of the Waveform * variable must be NULL. If you


want to set the high value of all the signals in the punchfile specify
the Waveform ** variable with a single element NULL.
The example for the setsighigh() function C CODAC is the same as
setsigcent().

setsiglow()
For the function description, see setsiglow().
Function usage

setsiglow(lowval, signal1, signal2)


Required arguments

lowval

double

signals

Waveform *

Usage details

The last element of the Waveform ** variable must be NULL. If you


want to set the low value of all the signals in the punchfile specify the
Waveform ** variable with a single element NULL.

CODAC Function Dictionary,

608

The example for the setsiglow() function C CODAC is the same as


setsigcent().

setsigname()
For the function description, see setsigname().
Function usage

setsigname(signal1, string1)
Required arguments

string1

char *

signal!

Waveform *

The example for the setsigname() function C CODAC is the same as


setsigcent().

sigexists()
For the function description, see sigexists().

Function usage
sigexists(signalname)

Required arguments

signalname

char *

An example for the sigexists() function C CODAC is:


#include<stdio.h>

CODAC Function Dictionary,

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

Type of signals to check

Returned value

Waveform *
The example for the thresholdsignal() function C CODAC is the same
as sigexists().

wabs()
For the function description, see wabs().

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

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)

CODAC Function Dictionary,

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

CODAC Function Dictionary,

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

writepunch(inputfile, outputfile, append-overwrite, ascii-bin, flt-dbl)


Required arguments

inputfile, outputfile

char *

append-overwrite, ascii-bin, flt-dbl

See writepunch()

Usage details

Set append-overwrite, ascii-bin and flt-dbl to -1 if you want the default.


The example for the writepunch() function C CODAC is the same as
in wabs().

CODAC Function Dictionary,

616

writesignal()
For the function description, see writesignal().
Function usage

writesignal(signal, filename, append_overwritemode,


ascii_binmode, flt_dbl)
Required arguments

signal

Waveform *

filename

char *

append-overwrite, ascii-bin, flt-dbl

See writesignal()

Usage details

Set the append_overwritemode, ascii_binmode, and flt-db to 1 if


you want the default mode
The example for the writesignal() function C CODAC is the same as in
wabs().

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 *

CODAC Function Dictionary,

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);

CODAC Function Dictionary,

619

for( i = 0; i < val; i++ )


{
val1 = xpoint(wav,i);
val2 = ypoint(wav,i);
printf("x = %le, y = %le\n",val1,val2);
}
printf("Sig_high = %lf\n",getsighigh(wav));
printf("Sig_low = %lf\n",getsiglow(wav));
printf("Sig_cent = %lf\n",getsigcent(wav));
}

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().

CODAC Function Dictionary,

620

C CODAC Miscellaneous Functions


copyfile()
For the function description, see copyfile().
Function usage

copyfile(sourcefile, dstfile)
Required arguments

char * sourcefile, dstfile


An example for the copyfile() function C CODAC is:
#include<stdio.h>
main()
{
copyfile("CodFunctions.txt","CopyCod.txt");
copyfile("CopyCod.txt","CopyCod1.txt");
deletefile("CopyCod.txt");
}

deletefile()
For the function description, see deletefile().
Function usage

deletefile(filename)
Required arguments

char * filename

CODAC Function Dictionary,

621

The example for the deletefile() function C CODAC is the same as


copyfile().

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

The example for the freewave() function C CODAC is the same as in


getcrosses().

histogram()
For the function description, see histogram().
Function usage

histogram(signal, no_of_bins)
Required arguments

waveform * signal, no_of_bins


Returned value

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);

CODAC Function Dictionary,

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);
}

CODAC Function Dictionary,

624

rbinomial()
For the function description, see rbinomial().
Function usage

rbinomial(pp, n)
Required arguments

Double pp, int n


Returned value

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

CODAC Function Dictionary,

625

The example for the rpoisson() function C CODAC is the same as


rnormal().

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>

CODAC Function Dictionary,

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()

An example for the sigcase() function C CODAC is


#include<stdio.h>
#include"codac.h"

CODAC Function Dictionary,

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");
}

CODAC Function Dictionary,

628

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy