3 Notes on output files from hspice (.tr0, .sw0, .ac0)
6 Header includes an integer that seems to indicate the type of a variable.
7 It doesn't seem to mean much for an independent variable.
11 3 voltage as independent var in sweep
12 1 voltage as dependent var in sweep or transient
13 2 voltage as dependent var in AC analysis
18 hspice file format "9601" is the default in hspice 98.2 (9007 was
19 previous). Difference is in how nodenames 16 characters and longer
20 are handled. As written, our filereader always does 9601 correctly,
21 and does 9007 correctly if nodnames are 15 characters or shorter.
22 I don't think the 9007/exactly-16 case is worth fixing.
25 -----------------------------------------------------------------------------
27 About Binary Hspice files:
28 generate with ".options POST=1"
30 Appear to have 16-byte binary header, then an ascii header similar
31 (identical?) to that from an ascii hspice file, followed by binary
35 ascii has 292 floating-point values - 97 rows of three, plus one extra.
36 binary has 1192 bytes in the binary data section - could be 149 doubles or
37 298 floats, or maybe some is some sort of header/trailer/control info.
40 00 00 00 04 00 00 00 2b 00 00 00 04 00 00 01 58 .......+.......X
43 fourth one is length in bytes of the ascii header portion. In this case,
44 binary data starts at offset 0x0168.
46 confirmed by adding another output item to test1.hsp - start of binary data
47 moves to offset 0x0180, 4th integer in header is 0x170.
48 With four plotted items, the pattern in the binary data is real obvious.
50 Looks like there are 5 more 32-bit longwords, then binary floats.
53 000170 20 20 20 20 20 20 20 20 24 26 25 23 20 20 20 20 $&%#
54 000180 00 00 01 70 00 00 00 04 00 00 01 85 00 00 00 04 ...p............
55 000190 00 00 06 14 00 00 00 00 00 00 00 00 00 00 00 00 ................
56 0001a0 80 00 00 00 2f 09 70 5f 00 00 00 00 00 00 00 00 ..../.p_........
57 0001b0 80 00 00 00 2f 89 70 5f 00 00 00 00 00 00 00 00 ..../.p_........
59 floating-point data appears to start at offset 0x194 here.
60 could be that the value 0x195 (word at 0x188) is related to this offset.
61 the value 0x614 at offset 0x190 appears related to the size of the floating-point
62 data. At the end of the file we have:
64 000780 af c5 1b fa 34 54 d0 cd 00 00 00 00 00 00 00 00 ....4T..........
65 000790 af 6c 87 f9 34 56 bf 95 00 00 00 00 00 00 00 00 .l..4V..........
66 0007a0 af 24 5e 7d 71 49 f2 ca 00 00 06 14 .$^}qI......
68 Data block size is 0x7a8-0x194, or 0x614.
69 Last word is 0x614 - matches word at 0x190. Clearly is block-size.
71 Pattern for both the ascii header and the floating point data appears to be:
72 4-word header, last word indicating data size, followed by data, then a 1-word
73 trailer consisting of the size-word.
75 last question: what are the 32-bit floating-point values?
76 single-precision IEEE? single-precision native floating point? On HP,
77 these are the same so we really can't tell. We haven't got any hspice
78 binaries for other architectures, so lets blow this off for now.
80 -----------------------------------------------------------------------------
82 More complications in both ascii and binary files without ".options probe".
84 First bit of quickAC.ac0:
86 00050004000000009601 a simple ac run
87 09/17/9816:07:48 Copyright (C) 1985-1997 by Avant! Corporation.
91 I(v1 v(1 v(2 i(r2 i(c1
92 $&%# v(1 v(2 i(r2 i(c1
93 .10000E+04 .00000E+00 .00000E+00 .10000E+01 .00000E+00 .50000E+00-.15708E-02
94 -.50000E-03-.15708E-05 .10000E+01 .50000E+00 .50000E-03 .31416E-05 .12589E+04
95 .00000E+00 .00000E+00 .10000E+01 .00000E+00 .49999E+00-.19775E-02-.50001E-03
96 -.19775E-05 .10000E+01 .50000E+00 .50000E-03 .39550E-05 .15849E+04 .00000E+00
97 .00000E+00 .10000E+01 .00000E+00 .49999E+00-.24895E-02-.50001E-03-.24895E-05
98 .10000E+01 .49999E+00 .49999E-03 .49790E-05 .19953E+04 .00000E+00 .00000E+00
99 .10000E+01 .00000E+00 .49998E+00-.31340E-02-.50002E-03-.31340E-05 .10000E+01
102 For the first time, the first number in the header line is not 1. The
103 sum of those two numbers, less 1 (for the independent var), seems to
104 be the number of dependent variables that we have column headings for.
106 New variable type - 8 - seems to be another current.
108 Problem is that there are 13 columns, as determined by looking for the
109 repeating pattern of the frequency column.
112 first number in header is number of things put in automaticly.
113 independent variable counts for 1. The rest of them (four, in this case)
114 are complex, responsible for two columns.
116 Works for quickAC.ac0, chokes on quickINV.tr0:
120 00070002000000009601 inverter circuit
121 09/17/9818:22:46 Copyright (C) 1985-1997 by Avant! Corporation.
125 vcc I(vcc I(vin v(in v(out
126 $&%# I(vcc I(vin v(in v(out
127 .00000E+00 .00000E+00 .20000E+00 .49989E+01 .50000E+01-.90576E-06 .00000E+00
128 .20000E+00 .49989E+01 .50000E-10 .00000E+00 .20000E+00 .49989E+01 .50000E+01
129 -.90576E-06-.54210E-19 .20000E+00 .49989E+01 .10000E-09 .00000E+00 .20000E+00
130 .49989E+01 .50000E+01-.90576E-06-.54210E-19 .20000E+00 .49989E+01 .30000E-09
131 .00000E+00 .20000E+00 .49989E+01 .50000E+01-.90576E-06-.54210E-19 .20000E+00
132 .49989E+01 .80000E-09 .00000E+00 .20000E+00 .49989E+01 .50000E+01-.90576E-06
133 .00000E+00 .20000E+00 .49989E+01 .13000E-08 .00000E+00 .20000E+00 .49989E+01
134 .50000E+01-.90576E-06 .00000E+00 .20000E+00 .49989E+01 .20000E-08 .00000E+00
135 .20000E+00 .49989E+01 .50000E+01-.90576E-06-.13553E-19 .20000E+00 .49989E+01
136 .21000E-08 .00000E+00 .66000E+00 .49940E+01 .50000E+01 .11557E-04-.54467E-04
139 Header indicates 8 dependent variables, column headings for:
142 vcc I(vcc I(vin v(in v(out
144 Only 9 columns of data - looks like none of them are complex.
145 I've got no idea how to differentiate these cases from this header info.