main content

high-凯发k8网页登录

this example shows how to implement a high-throughput, gigasamples-per-second (gsps), channelizer for hardware by using a polyphase filter bank.

high speed signal processing is a requirement for applications such as radar, broadband wireless, and backhaul communication. modern adcs can sample signals at sample rates up to several gsps, but the clock speeds for the fastest fpga fall short of this sample rate. fpgas typically run at hundreds of mhz. to perform gsps processing on an fpga, you can move from scalar processing to vector processing and process multiple samples in parallel at a much lower clock rate. many modern fpgas support the jesd204b standard interface, which accepts scalar input at a ghz clock rate and produces a vector of samples at a lower clock rate.

this example shows how to design a signal processing application that supports gsps throughput. these simulink® models assume that the input data is vectorized by using a jesd204b interface, and is available at a lower clock rate in the fpga. the algorithm processes four samples at a time. both models have a polyphase filter bank that consists of a filter and an fft. the polyphase filter bank technique minimizes leakage and scalloping loss from the fft. for more information about polyphase filter banks, see .

the first part of the example uses the block from the dsp hdl toolbox™ library, configured for a 12-tap filter. the channelizer block uses the polyphase filter bank technique and automatically chooses data types, applies pipelining, and uses other optimizations for hardware performance and resource use. with this block, you can easily explore variations on your design.

the second part of the example implements a polyphase filter bank that has a 4-tap filter. this second part uses basic simulink blocks. it shows the polyphase filter bank architecture, and the challenges of filter design for hardware, such as choosing data types and inserting pipeline stages.

implement channelizer with 12-tap filter

this model uses the channelizer block, configured with a 12-tap filter, that results in good spectrum performance. using the channelizer block from the dsp hdl toolbox library makes it easy to change design parameters such as coefficients, vector size, and fft length. the block also automatically shares multipliers, calculates fixed-point data types, and pipelines the filter.

the model uses these workspace variables to configure the fft and filter. the input vector size for this model is 4 samples. the model uses a 512-point fft and a 12-tap filter for each band. the number of coefficients for the channelizer is 512 frequency bands times 12 taps per frequency band. generate all the coefficients by using the tf(h) function.

fftlength = 512;
invect = 4;
hc = dsp.channelizer;
hc.numtapsperband = 12;
hc.numfrequencybands = fftlength;
hc.stopbandattenuation = 60;
coef12tap = tf(hc);

the input data consists of two sine waves, 200 khz and 206.5 khz. the frequencies are close to each other to illustrate the spectrum resolution of the channelizer.

the channelizer hdl optimized subsystem contains the channelizer block and a synchronous (hdl coder) block that generates hardware-optimized code for the enable logic within the channelizer.

the block implements pipeline stages around the multipliers so that the logic fits into fpga dsp blocks, and implements the coefficient banks inside the channelizer with rom blocks. these hardware-friendly options are the default behavior for the dsp hdl toolbox blocks.

modelname = 'polyphasefilterbankhdlexample_hdlchannelizer';
open_system(modelname);
set_param(modelname,'simulationcommand','update');

this model diagram shows the channelizer block inside the subsystem.

open_system([modelname,'/channelizer hdl optimized'])

the block has parameters to configure the filter coefficients, fft length, and other settings that enable you to explore different hardware implementations of the algorithm.

view simulation results

to visualize the spectrum result, open the spectrum viewer and run the model.

open_system([modelname,'/spectrum viewer/power spectrum viewer (channelizer_12tap)']);
sim(modelname);

the spectrum viewer shows that the 12-tap filter separates the spectrum of the two signals. zoom in between 100 khz and 300 khz to see where the channelizer detects two peaks. two peaks is the expected result because the input signal has two frequency components.

generate hdl code

you must have the hdl coder™ product to generate hdl code for this example model. use this command to generate hdl code.

makehdl([modelname,'/channelizer hdl optimized']);

use this command to generate a test bench that compares the results of an hdl simulation against the simulink simulation behavior.

makehdltb([modelname,'/channelizer hdl optimized']);

the design was synthesized for xilinx virtex 7 (xc7vx550t-ffg1158, speed grade 2). the design achieves a clock frequency of 361 mhz. at 4 samples per clock, this frequency results in 1.4 gsps throughput.

the minimize clock enable hdl code generation option is on in this model. the clock enable signal is a global signal, which is not recommended for high speed designs. in the model configuration parameters, choose hdl code generation, global settings, ports, and then select minimize clock enable. this option is supported when the model is single rate.

the fft block uses 56 dsp blocks on the fpga, and the filter uses 48 dsp blocks.

 t = table(...
    categorical({'lut'; 'lut ram'; 'ff'; 'bram'; 'dsp'}), ...
    [26641; 14585; 24816; 2; 104], ...
    'variablenames',{'resource','usage'});
disp(t);
    resource    usage
    ________    _____
    lut         26641
    lut ram     14585
    ff          24816
    bram            2
    dsp           104

implement 4-tap polyphase filter bank

to show the internal implementation of a polyphase filter bank, the second example model implements a 512-point fft by using the dsp hdl toolbox fft block and a 4-tap filter for each band by using basic simulink blocks. the 4-tap filter has lower frequency resolution than the 12-tap filter in the first model, but it is easier to see the structure of the filter. these matlab variables configure the blocks in the model. use the system object™ to generate the coefficients. the polyphase method of the channelizer object generates a 512-by-4 matrix. each row represents the coefficients for one band. cast the coefficients to fixed-point types that have the same word length as the input signal.

h = dsp.channelizer;
h.numtapsperband = 4;
h.numfrequencybands = fftlength;
h.stopbandattenuation = 60;
coef4tap = fi(polyphase(h),1,15,14,'roundingmethod','convergent');

the algorithm requires 512 filters (one filter for each band). for a vector input of 4 samples, the model implements four parallel 4-tap filters. each filter applies 128 sets of coefficients.

reusefactor = fftlength/invect;

these variables configure the model to pipeline the multipliers and the coefficient bank to fit the logic into dsp blocks on the fpga. using the dsp blocks enables synthesis to a higher clock rate.

multiplication_pipeline = 2;
coefbank_pipeline       = 1;

the input data consists of two sine waves, 200 khz and 250 khz. these two frequencies are farther apart than the previous model because the smaller filter has lower spectrum performance. the input and output of the polyphasefilterbank subsystem are 4-by-1 vectors.

modelname = 'polyphasefilterbankhdlexample_4tap';
open_system(modelname);
set_param(modelname,'simulationcommand','update');

the polyphasefilterbank subsystem contains the coefficient bank subsystem that rotates over the coefficient sets. the filter bank subsystem accepts vectors of coefficients and data and returns a vector of filtered data. the fft block also accepts and returns a vector of 4 samples, and implements a hardware-optimized architecture.

open_system([modelname,'/polyphasefilterbank'])

this model diagram shows the pipelined 4-tap filter implementation.

open_system([modelname,'/polyphasefilterbank/filter bank'])

view simulation results

to visualize the result of the simulation, open the spectrum viewers and run the model.

open_system([modelname,'/fft spectrum viewer/power spectrum viewer (fft)']);
open_system([modelname,'/pfb spectrum viewer/power spectrum viewer (pfb)']);
sim(modelname);

the polyphase filter bank spectrum viewer shows the improvement in the power spectrum and minimization of frequency leakage and scalloping compared with using only an fft. by comparing the two spectrums, and zooming in between 100 khz and 300 khz, you can see that the polyphase filter bank has fewer peaks over –40 db than the classic fft.

considerations for optimized hardware

data type

data word length affects both the accuracy of the result and the resources used in the hardware. this 4-tap filter uses full precision. with an input data type of fixdt(1,15,13), the output is fixdt(1,18,17). the absolute values of the filter coefficients are all smaller than 1, so the data does not grow after each multiplication operation. each addition adds one bit to the data type. to keep the accuracy in the fft, the data type grows one bit for each stage. this growth makes the twiddle factor multiplication larger at each stage. for many fpgas, a multiplication size smaller than 18-by-18 is desirable. because a 512-point fft has 9 stages, the input of the fft cannot be more than 11 bits. the first 8 binary digits of the maximum coefficient in this case are zero. therefore, this example casts the coefficients to fixdt(1,7,14) instead of fixdt(1,15,14). also, the maximum value of the datatype block output inside the polyphase filter bank has 7 leading zeros after the binary point, so the model casts the filter output to fixdt(1,11,17). these adjustments keep the fft internal multiplier size smaller than 18-by-18 and save hardware resources.

design for speed

the model uses these settings to enable the generated hdl code to synthesize to a faster clock rate.

  1. synchronous state control block — implements hardware-friendly enable logic for delay blocks.

  2. minimize clock enable — avoids implementing a global clock enable signal that could decrease the synthesized clock rate.

  3. use dsp block in fpga — maps multipliers into dsp blocks in the fpga by including 2 delays before each multiplier and 2 delays after. these pipeline registers cannot have a reset signal. set the reset type to none for each pipeline by right-clicking the delay block and selecting hdl code > hdl block properties, then setting reset type to none.

  4. use rom in fpga — map the combinatorial logic inside the coefficient matlab function block (inside the coefficient bank subsystem) to a rom by adding a register after the block. the delay length is set by coefbank_pipeline. set the reset type for these delays to none.

generate hdl code

you must have the hdl coder™ product to generate hdl code for this example model. use this command to generate hdl code.

makehdl([modelname,'polyphasefilterbank']);

use this command to generate a test bench that compares the results of an hdl simulation against the simulink simulation behavior.

makehdltb([modelname,'polyphasefilterbank']);

when the design is synthesized for xilinx® virtex 7 (xc7vx550t-ffg1158, speed grade 2), the design achieves a clock frequency of 324 mhz (before place and route). at 4 samples per clock, this frequency results in 1.3 gsps throughput.

the fft block uses 56 dsp blocks in the fpga, and the filter uses 16 dsp blocks.

 t = table(...
    categorical({'lut'; 'lut ram'; 'ff'; 'bram'; 'dsp'}), ...
    [14713; 3570; 21514; 2; 72], ...
    'variablenames',{'resource','usage'});
disp(t);
    resource    usage
    ________    _____
    lut         14713
    lut ram      3570
    ff          21514
    bram            2
    dsp            72

conclusion

the first part of the example shows how the channelizer block from the dsp hdl toolbox library makes it easy to implement an algorithm for hardware, and provides quick exploration of design options.

the second part of the example shows design considerations when implementing filters for hardware without using a hardware-optimized library block, such as choosing data types and inserting pipeline stages. when you use the library blocks from dsp hdl toolbox, you do not have to consider these factors yourself. the blocks implement hardware-optimized algorithms that are ready for hdl code generation and deployment to fpgas or asics.

see also

| | |

related examples

more about

网站地图