To check the functionality of the kernel code, we use aie_iir_1a.jl
to generate the coefficients for one second-order section, and the impulse response. The script also generates a unit sample function as an input to the kernel.
Some of the user-settable parameters in the Julia script are as follows:
# --- begin user parameters
fp = 10.0e6 # passband frequency
fs = 100.0e6 # sampling frequency
p = 2 # no. of poles
rp = 0.1 # passband ripple (dB)
rs = 80.0 # stopband attenuation (dB)
N = 256 # no. of samples for impulse response
show_plots = true # display plots?
write_cmatrix = true # write C matrix to files?
write_impulse = true # write impulse response?
# --- end user parameters
To run the script, start Julia, and run the following commands at the prompt.
julia> cd("path_to_aie_iir_1a.jl")
julia> include("aie_iir_1a.jl")
Notes:
Replace
path_to_aie_iir_1a.jl
with the actual path to theaie_iir_1a.jl
script.The path must be enclosed in double quotes.
The initial startup may seem slow as it loads several packages.
This generates five plots:
original filter’s frequency response.
original filter’s impulse response.
SOS frequency response.
SOS impulse response.
impulse response error.
The following files are also generated:
C1.h
- an array of coefficients to be passed to the kernel.input.dat
- unit sample function to be used as an input signal for the kernel.impresponse.dat
- calculated impulse response for comparison with AI Engine result.
Copy
C1.h
to thesrc
directory andinput.dat
andimpresponse.dat
to thedata
directory of the AI Engine project.