aaa a
aaa a
aaa
aaa a
aaa a
aaa Symbolic Computation in aaa aaa aaa System Simulation and Design aaa aaa aaa
aaa a
aaa a
aa
Brian L. Evans
Dept. of Electrical Engineering and Computer Sciences University of California, Berkeley, CA 94720-1770
[email protected]
Ptolemy Mini-Conference, March 10, 1995 University of California, Berkeley, CA
1
| Introduction |
Role of Symbolic Computation INPUT Numeric Signal
Symbolic Description
OUTPUT Simulation
-
Numeric Signal
- Symbolic Description
Transformation
2
| System Simulation |
Symbolic Parameter Calculation Truncated Fourier Series Computation
x^(t) m
N X
Cm = T1
j mT t C e ,N m 2
=
T
Z2
, T2
x(t) ej mT t dt 2
Fixed Fourier Coecient Formula Approximate a Square Wave by a Finite Number of Sinusoids parameter_map: gain = 4/(PI*(2*instance_number-1))
singen
Gain collect
bus
distribute
collect
bus Add
XMgraph
etc.
etc. MapGr SrcGr
parameter_map: frequency = 2*PI*(2*instance_number-1)/period
Compute Fourier Coecient Formula From x(t) 3
| System Simulation |
Numeric Parameter Optimization Optimization of an Existing Filter Design Deviation from an ideal magnitude response Linear phase response in the passband Quality factors of second-order sections Peak overshoot in the step response
The Optimization Problem Sequential Quadratic Programming Dierentiable objective functions Filter speci cations to dierentiable constraints
4
| System Simulation |
Numeric Parameter Optimization Code generation De ne the objective function and constraints Compute gradients of both symbolically Generate source code (C, Fortran, or Matlab) Generate main program (Matlab)
5
| System Simulation |
Numeric Parameter Optimization Example: Fourth-Order All-Pole Filter Speci cations:
at wp = 20 rad/sec, p = 0:21 at ws = 30 rad/sec, s = 0:31
Initial lter is Butterworth Pole locations initial: ,8:415 20:315 ,20:315 8:415 nal: ,7:792 22:898 ,19:562 0:626 Objective function
reduced from 1:17 to 4:7 10,5
Final gradients of objective function 3:1 10,5, 4:2 10,5, ,2:3 10,5, and ,5:5 10,6
6
| System Simulation |
Numeric Parameter Optimization Example: Fourth-Order All-Pole Filter Phase Response 5
10
15
20
ω
-0.5 -1 -1.5 -2 -2.5
- - - dashed lines represent the initial Butterworth lter | solid lines represent the lter optimized for linear phase
response in the passband and for overshoot of the step response 7
| System Simulation |
Numeric Parameter Optimization Example: Fourth-Order All-Pole Filter Step Response 1 0.8 0.6 0.4 0.2
0.2
0.4
0.6
0.8
- - - dashed lines represent the initial Butterworth lter | solid lines represent the lter optimized for linear phase
1
t
response in the passband and for overshoot of the step response 8
| System Simulation |
Numeric Parameter Optimization Example: Fourth-Order All-Pole Filter Magnitude Response (dB) 20
40
60
80
ω
-10 -20 -30 -40 -50
- - - dashed lines represent the initial Butterworth lter | solid lines represent the lter optimized for linear phase
response in the passband and for overshoot of the step response 9
| System Design |
Non-Uniform Filter Bank x[n]
- "n 2 - h0[n] - #n 3
- "n 3 - g0[n] - #n 2
?x -n 6 +
- h1[n] - #n 3
- "n 3 - g1[n]
Flow graph of a two-channel non-uniform lter bank upperchannel = Downsample[2,n][ Convolve[n][ g0[n], Upsample[3,n][ Downsample[3,n][ Convolve[n][h0[n], Upsample[2,n][x[n]]]]]]] lowerchannel = Convolve[n][ g1[n], Upsample[3,n][ Downsample[3,n][ Convolve[n][h1[n], x[n]]]]]
Algebraic description of the lter bank 10
^[ ]
| System Design |
Non-Uniform Filter Bank X^(z ) = 16 (G0(,pz)H0(,pz) + G0(pz )H0(pz) + 2G1(z )H1(z ))X (z ) + pz )H (e pz ) + G (pz)H (e pz ) + 2G (z )H (e z ) X (e z ) + 1 G ( , 0 0 0 0 1 1 6 p p p p 1 z ) + G0(, z)H0(e z ) + 2G1(z )H1(e z ) X (e z ) 6 G0 ( z )H0 (e 4i 3
i
3
2i 3
5i 3
2i 3
4i 3
2i 3
4i 3
Symbolic analysis of input-output relationship h0[n] = FIR[n, Hold[ReadList["ptolemy/h0", Number]]]; h1[n] = FIR[n, Hold[ReadList["ptolemy/h1", Number]]]; g0[n] = FIR[n, Hold[ReadList["ptolemy/g0", Number]]]; g1[n] = FIR[n, Hold[ReadList["ptolemy/g1", Number]]]; x[n] = Cos[2 Pi n / 3] Sinc[Pi n / 6] / 3; PtolemySimulation[ upperchannel + lowerchannel, {n, 1, 100} ] >> "!ptcl"
Transformation of algebraic description to Ptcl
11
| System Design |
Evaluating Alternate Implementations Rearrangement Rules Rules based on interaction between operators Based on properties of signals and systems
Cost Functions Based on implementation costs Require feedback from synthesis tools
Heuristic Searches Search through space of alternate implementations
12
| System Design |
Multidimensional Signal Processing Multidimensional Signals De ned On Grid of Points Multidimensional Periodic Signals n] = x[n + N r]
x[
General Multidimensional DFT X[
k] = Xn x[n]e,j 2 kT N, n 1
Smith Form Decompositions N = U V =) N,1 = V,1 ,1 U,1 T , , , X X [k] = x[n]e,j 2 (k V ) (U n) n X ^] = x[U n^]e,j 2 ^kT , n^ X [k n^ 1
1
1
13
1
| System Design |
Multidimensional Rearrangement Rules - # UM - # M - # VM
- " VL - " L - " UL
-
Cascade in Smith Form - # UM - # M
- " L - " UL
-
Simpli ed cascade if VM = VL - # UM - " L
- # M - " UL
-
Reversing order of operations if M and L are coprime - " LUM,1
- # M UL,1
-
Combining operations
Four Equivalent Forms of a Downsampler and Upsampler in Cascade 14
| System Design |
Multidimensional Rearrangement Rules
s
"S
s
z n0
s
#S
s
0
()
Up/downsampling by S when the shift vector n0 62 sublattice(S); i.e., S ,1n0 is not an integer vector
s
"S
s
z n0
s
#S
s
()
s
S,1 n0
z
s
Up/downsampling by S when the shift vector n0 2 sublattice(S); i.e., S ,1n0 is an integer vector
s
"L
s
z n0
s
#M
s
()
s
z nL
s
"L
s
#M
s
z nM
s
For any L and M , n0 can be rewritten as n0 = LnL + M nM
Interaction between Upsamplers, Shifters, and Downsamplers in Cascade 15
Conclusion System Simulation Symbolic parameter calculation Numeric parameter optimization
System Design Symbolic analysis and transformation Evaluating alternative implementations
Future Work Allow parameters to calculated symbolically Explore optimization of other behavioral models Encode Synchronous Data ow (SDF) system rewriting in the
Design Methodology Management (DMM) Domain Implement Multidimensional SDF system rewriting in DMM Domain, esp. non-separable resampling operations
16