filterBuilder - Generated Test Function

2 visualizzazioni (ultimi 30 giorni)
Anastasios
Anastasios il 4 Ott 2023
Utilizing the filterBuilder Gui I generated a FIR Single Rate LP Filter.
The GUI offers the option of generating a DOFILTER function that generates a scripted base instance of the filter and you can test the output
of the designed filter with a certain input.
For my case I designed the filter for the data generated by an ADC which are 24bit signed integers.
In my case as an input signal I set the option for "Fixed Point" Arithmeticm the input signal word length to 24 bits.
I also used 26 bit coefficients and a result that will be provided in full scale.
Below is a rudimentary script that feeds integer numbers from 0-255 in the filter in order to check its output by comparing this with the data generated by the simulation HDL IDE.
I have two questions.
How I can feed actually 24 bit signed (2's complement) values and how I can get as an output the actual y (52-bit width) binary values?
% Define the range from 0 to 255
startValue = 0;
endValue = 255;
% Create a column vector with values from 0 to 255
x = int32(startValue:endValue)';
% Display the resulting matrix
%disp(x);
y = doFilter(x);

Risposte (1)

Bharath Venkataraman
Bharath Venkataraman il 5 Ott 2023
For the input and output, you want to use the fixed point object (fi). Change the code assingning to x to:
x = fi(startValue:endvalue,1,24,0); % signed 24 bit input with no fractional bits
y = doFilter(x) should return a fixed point output of the approproiate type.
If you have access to Filter Design HDL Coder, you can generate HDL code and an HDL testbench for the FIR Filter. The Code Generation tab has an option to generate HDL code. You can provide the stimulus (x) in the HDL UI as the input for the testbench to use.

Categorie

Scopri di più su Optimization in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by