This section describes how to use the G and E Elements.
Use the Star-Hspice G and E Elements (controlled behavioral sources) as linear functional blocks or elements with specific frequency responses in the following forms:
The frequency response is called the impulse response and is denoted by H(s), where s is a complex frequency variable ( ). In Star-Hspice, the frequency response is obtained by performing an AC analysis with AC=1 in the input source (the Laplace transform of an impulse is 1). The input and output of the G and E Elements with specified frequency response are related by the expression:
where X, Y and H are the input, the output, and the transfer function at
frequency f.
For AC analysis, the frequency response is determined by the above relation at any frequency. For operating point and DC sweep analysis, the relation is the same, but the frequency is zero.
The transient analysis is more complicated than the frequency response. The output is a convolution of the input waveform with the impulse response h(t):
In discrete form, the output is
where the h(t) can be obtained from H(f) by the inverse Fourier integral:
The inverse discrete Fourier transform is given by
where N is the number of equally spaced time points and is the time interval or time resolution.
For the frequency response table form (FREQ) of the LAPLACE function, Star-Hspice`s performance-enhanced algorithm is used to convert H(f) to h(t). This algorithm requires N to be a power of 2. The frequency point f
where n > N/2 represents the negative frequencies. The Nyquist critical frequency is given by
Since the negative frequencies responses are the image of the positive ones, only N/2 frequency points are required to evaluate N time points of h(t). The larger f
Once f
Notice the frequency resolution
is inversely proportional to the maximum time (N· ) over which h(t) is evaluated. Therefore, the transient analysis accuracy also depends on the frequency resolution or the number of points (N).You can specify the frequency resolution DELF and maximum frequency MAXF in the G or E Element statement. N is calculated by 2·MAXF/DELF. Then, N is modified to be a power of 2. The effective DELF is determined by 2·MAXF/N to reflect the changes in N.
The syntax of the LAPLACE function is:
Gxxx n+ n- LAPLACE in+ in- k0, k1, ..., kn / d0,
+ d1, ..., dm
<SCALE=val> <TC1=val> <TC2=val> <M=val>
Exxx n
+ d
<SCALE=val> <TC1=val> <TC2=val>
H(s) is a rational function in the following form:
All the coefficients k0, k1, ..., d0, d1, ..., can be parameterized.
Glowpass 0 out LAPLACE in 0 1.0 / 1.0 2.0 2.0 1.0
Ehipass out 0 LAPLACE in 0 0.0,0.0,0.0,1.0 / 1.0,2.0,2.0,1.0
The Glowpass element statement describes a third-order low-pass filter with the transfer function
The Ehipass element statement describes a third-order high-pass filter with the transfer function
Gxxx n+ n- POLE in+ in- a
z1, fz1, ...,
zn, fzn / b,
+
p1, fp1, ...,
pm, fpm <SCALE=val> <TC1=val>
+ <TC2=val> <M=val>
Exxx n
+
p1, fp1, ...,
pm, fpm <SCALE=val> <TC1=val>
+ <TC2=val>
H(s) in terms of poles and zeros is defined by:
Notice the complex poles or zeros are in conjugate pairs. In the element description, only one of them is specified, and the program includes the conjugate. The a, b, , and f values can be parameterized.
Ghigh_pass 0 out POLE in 0 1.0 0.0,0.0 / 1.0 0.001,0.0
Elow_pass out 0 POLE in 0 1.0 / 1.0, 1.0,0.0 0.5,0.1379
The Ghigh_pass statement describes a high-pass filter with transfer function
The Elow_pass statement describes a low-pass filter with transfer function
Gxxx n+ n- FREQ in+ in- f
+ <DELF=val> <MAXF=val> <SCALE=val> <TC1=val>
+ <TC2=val> <M=val> <LEVEL=val>
+ <INTERPOLATION=val> <EXTRAPOLATION=val>
Exxx n+ n- FREQ in+ in- f
+ <DELF=val> <MAXF=val> <SCALE=val> <TC1=val>
+ <TC2=val>
Each f
Eftable output 0 FREQ input 0
+ 1.0k -3.97m 293.7
+ 2.0k -2.00m 211.0
+ 3.0k 17.80m 82.45
+ ... ... ...
+ 10.0k -53.20 -1125.5
The first column is frequency in hertz, the second is magnitude in dB, and third is phase in degrees. The LEVEL must be set to 1 for a high-pass filter, and the last frequency point must be the highest frequency response value that is a real number with zero phase. The frequency, magnitude, and phase in the table can be parameterized.
These keywords are common to the three forms, Laplace, pole-zero, and frequency response table described above.
ACCURACY Used only in G element with frequency response table.
0: default. The most accurate control voltage at each time point is achieved by linear interpolation of closest 2 time points
1: faster mode. The control voltage at each time point is determined from the simulated time point just before the target. The smaller the time step is set, the closer the result will be to the most accurate mode.
2: method used in release 2000.4 and prior.
DELF, DELTA Frequency resolution f. The inverse of DELF is the time window over which h(t) is calculated from H(s). The smaller DELF is, the more accurate the transient analysis, and the longer the CPU time. The number of points, N, used in the conversion of H(s) to h(t) is N=2·MAXF/DELF. Since N must be a power of 2, the DELF is adjusted. The default is 1/TSTOP. In G element with FREQ and ACCURACY = 0 or 1, circular convolution for periodic input will be done by limiting the period by setting DELF = 1/T :T < TSTOP.
EXTRAPOLATION Extrapolation scheme used only in G element with frequency response table.
0: default. Linear interpolation using the last two boundary points
1: the last boundary point is used
FREQ Keyword to indicate that the transfer function is described by a frequency response table. Do not use FREQ as a node name in a G or E Element.
INTERPOLATION Interpolation scheme used only in G element with frequency response table.
LAPLACE Keyword to indicate the transfer function is described by a Laplace transform function. Do not use LAPLACE as a node name on a G or E Element.
LEVEL Used only in elements with frequency response table. This parameter must be set to 1 if the element represents a high-pass filter.
M G Element multiplier. This parameter is used to represent M G Elements in parallel. Default is 1.
MAXF, MAX Maximum or the Nyquist critical frequency. The larger the MAXF the more accurate the transient results and the longer is the CPU time. The default is . Thee parameters are applicable only when the FREQ parameter is also used.
POLE Keyword to indicate the transfer function is described by the pole and zero location. Do not use POLE as a node name on a G or E Element.
SCALE Element value multiplier
This example models an active band-reject filter
BandstopL.sp band_reject filter
.OPTIONS PROBE POST=2
.AC DEC 50 10 5k
.PROBE AC VM(out_low) VM(out_high) VM(out)
.PROBE AC VP(out_low) VP(out_high) VP(out)
.TRAN .01m 12m
.PROBE V(out_low) V(out_high) V(out)
.GRAPH v(in) V(out)
Vin in 0 AC 1 SIN(0,1,250)
Elp3 out_low3 0 LAPLACE in 0
+ 1 / 1 6.729m 15.62988u 27.7976n
Elp out_low 0 LAPLACE out_low3 0
+ 1 / 1 0.364m 2.7482u
Ehp3 out_high3 0 LAPLACE in 0
+ 0,0,0,9.261282467p /
+ 1,356.608u,98.33419352n,9.261282467p
Eph out_high 0 LAPLACE out_high3 0
+ 0 0 144.03675n / 1 83.58u 144.03675n
Eadd out 0 VOL='-V(out_low) - V(out_high)'
Rl out 0 1e6
.END
This example simulates a third-order low-pass filter with a Butterworth transfer function, comparing the results of the actual circuit and the functional G Element with third-order Butterworth transfer function for AC and transient analysis.
The third-order Butterworth transfer function that describes the above circuit is:
The following is the input listing of the above filter. Notice the pole locations are parameterized on the G Element. Also, only one of the complex poles is specified. The conjugate pole is derived by the program. The output of the circuit is node "out" and the output of the functional element is "outg".
This is an example of a third-order low-pass Butterworth filter:
Low_Pass.sp 3rd order low-pass Butterworth
.OPTIONS POST=2 PROBE INTERP=1 DCSTEP=1e8
.PARAM a=1.0 b=1.0 ap1=1.0 fp1=0.0 ap2=0.5 fp2=0.1379
.AC DEC 25 0.01 10
.PROBE AC VDB(out) VDB(outg) VP(out) VP(outg)
.TRAN .5 200
.PROBE V(in) V(outg) V(out)
.GRAPH V(outg) V(out)
VIN in 0 AC 1 PULSE(0,1,0,1,1,48,100)
* 3rd order low-pass described by G Element
Glow_pass 0 outg POLE in 0 a / b ap1,fp1 ap2,fp2
Rg outg 0 1
R1 in 2 1
R2 2 3 1
R3 3 4 1
C1 2 0 1.392
C2 4 0 0.2024
C3 3 out 3.546
Eopamp out 0 OPAMP 4 out
.END
This example simulates a 30 degree phase shift filter using circular convolution. By setting DELF = 10MHz, the period of time domain response of the G element which will be obtained by IFFT based on input frequency table will be set to 100n seconds. FREQ G element performs convolution integral from t - T to t assuming that all the control voltage at t<0 is zero. Here, t is the target time point and T is the period of time domain response of the G element.
In this example, during time point is from 0 to 100n seconds, higher than 10MHz harmonics components due to input transition at t=0 is taken. So the circuit does not behave as a phase shift filter. After one period (t>100n seconds), circular convolution based on 100n seconds period will be performed and the transient result represents 30 degree phase shift for continuous periodic control voltage.
This example illustrates a 30 degree phase shift filter.
.options post=2 ingold=2 accurate
Iexpected gnd 3 sin (0 1 10e6 0 0 30)