Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.HDLChannelizer System object

Polyphase filter bank and fast Fourier transform—optimized for HDL code generation

Description

The dsp.HDLChannelizer System object™ separates a broadband input signal into multiple narrowband output signals. It provides hardware speed and area optimization for streaming data applications. The object accepts scalar or vector input of real or complex data, provides hardware-friendly control signals, and has optional output frame control signals. You can achieve giga-sample-per-second (GSPS) throughput by using vector input. The object implements a polyphase filter, with one subfilter per input vector element. The hardware implementation interleaves the subfilters, which results in sharing each filter multiplier (FFT Length / Input Size) times. The object implements the same pipelined Radix 2^2 FFT algorithm as the dsp.HDLFFT System object.

To channelize input data:

  1. Create the dsp.HDLChannelizer object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

Creation

Syntax

channelizer = dsp.HDLChannelizer
channelizer = dsp.HDLChannelizer(Name,Value)

Description

channelizer = dsp.HDLChannelizer returns a System object, channelizer, that implements a raised-cosine filter and an 8-point FFT.

example

channelizer = dsp.HDLChannelizer(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in single quotes.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

FFT length, specified as an integer power of two. For HDL code generation, the FFT length must be between 23 and 216, inclusive.

Polyphase filter coefficients, specified as a vector of numeric values. If the number of coefficients is not a multiple of NumFrequencyBands, the object pads this vector with zeros. The default filter specification is a raised-cosine FIR filter, rcosdesign(0.25,2,4,'sqrt'). You can specify a vector of coefficients or a call to a filter design function that returns the coefficient values. Complex coefficients are not supported. By default, the object casts the coefficients to the same data type as the input.

HDL implementation of complex multipliers, specified as either 'Use 4 multipliers and 2 adders' or 'Use 3 multipliers and 5 adders'. Depending on your synthesis tool and target device, one option may be faster or smaller.

Dependencies

This option applies only if you use the Radix 2^2 architecture.

Size and order of output data, specified as:

  • 'Same as number of frequency bands' — Output data is a 1-by-M vector, where M is the FFT length. The output order is bit natural.

  • 'Same as input size' — Output data is an M-by-1 vector, where M is the input vector size. The output order is bit reversed.

FFT output scaling, specified as either:

  • true — The FFT implements an overall 1/N scale factor by scaling the result of each pipeline stage by 2. This adjustment keeps the output of the FFT in the same amplitude range as its input.

  • false — The FFT avoids overflow by increasing the word length by one bit at each stage.

Rounding mode used for fixed-point operations. The object uses fixed-point arithmetic for internal calculations when the input is any integer or fixed-point data type. This option does not apply when the input is single or double. Each FFT stage rounds after the twiddle factor multiplication but before the butterflies. Rounding can also occur when casting the coefficients and the output of the polyphase filter to the data types you specify.

Overflow Handling used for fixed-point operations. The object uses fixed-point arithmetic for internal calculations when the input is any integer or fixed-point data type. This option does not apply when the input is single or double. This option applies to casting the coefficients and the output of the polyphase filter to the data types you specify.

The FFT algorithm avoids overflow by either scaling the output of each stage (Normalize enabled), or by increasing the word length by 1 bit at each stage (Normalize disabled).

The object casts the polyphase filter coefficients to this data type, using the rounding and overflow settings you specify. When you select Inherit: Same word length as input (default), the object selects the binary point using fi() best-precision rules.

Data type of the output of the polyphase filter, specified as 'Same word length as input'' or a numerictype object.The object casts the output of the polyphase filter (the input to the FFT) to this data type, using the rounding and overflow settings you specify. When you specify 'Same word length as input', the object selects a best-precision binary point by considering the values of your filter coefficients and the range of your input data type.

By default, the FFT logic does not change the data type. When you disable Normalize, the FFT algorithm avoids overflow by increasing the word length by 1 bit at each stage.

Enable reset input argument to the object. When reset is 1 (true), the object stops calculation and clears all internal state.

Enable startOut output argument of the object. When enabled, the object returns an additional output signal that is 1 (true) on the first cycle of each valid output frame.

Enable endOut output argument of the object. When enabled, the object returns an additional output signal that is 1 (true) on the first cycle of each valid output frame.

Usage

Syntax

[dataOut,validOut] = channelizer(dataIn,validIn)
[dataOut,validOut] = channelizer(dataIn,validIn,reset)
[dataOut,startOut,endOut,validOut] = channelizer(___)

Description

example

[dataOut,validOut] = channelizer(dataIn,validIn) filters and computes a fast Fourier transform, and returns the frequency channels, dataOut, detected in the input signal, dataIn, when validIn is 1 (true). The validIn and validOut arguments are logical scalars that indicate the validity of the input and output signals, respectively.

[dataOut,validOut] = channelizer(dataIn,validIn,reset) returns the frequency channels, dataOut, detected in the input signal, dataIn, when validIn is 1 (true) and reset is 0 (false). When reset is 1 (true), the object stops the current calculation and clears all internal state.

To use this syntax, set the ResetInputPort property to true. For example:

channelizer = dsp.HDLChannelizer(...,'ResetInputPort',true);
...
[dataOut,validOut] = channelizer(dataIn,validIn,reset)

[dataOut,startOut,endOut,validOut] = channelizer(___) returns the frequency channels, dataOut, computed from the input arguments of any of the previous syntaxes. startOut is 1 (true) for the first sample of a frame of output data. endOut is 1 (true) for the last sample of a frame of output data.

To use this syntax, set the StartOutputPort and EndOutputPort properties to true. For example:

channelizer = dsp.HDLChannelizer(...,'StartOutputPort',true,'EndOutputPort',true);
...
[dataOut,startOut,endOut,validOut] = channelizer(dataIn,validIn)

Input Arguments

expand all

Input data, specified as a scalar or column vector of real or complex values. The vector size must be a power of 2 between 1 and 64 that is not greater than the number of channels (FFT length). double and single are allowed for simulation but not for HDL code generation.

The object does not accept uint64 data.

Data Types: fi | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | single | double
Complex Number Support: Yes

Validity of input data, specified as a logical scalar. When validIn is 1 (true), the object captures the value on dataIn.

Data Types: logical

Reset internal state, specified as a logical scalar. When reset is 1 (true), the object stops the current calculation and clears internal state.

Dependencies

To enable this argument, set ResetInputPort to true.

Data Types: logical

Output Arguments

expand all

Frequency channel output data, returned as a row vector.

  • If you set OutputSize to 'Same as number of frequency bands' (default), the output data is a 1-by-M vector, where M is the FFT length. The output order is bit natural.

  • If you set OutputSize to 'Same as input size', the output data is an M-by-1 vector, where M is the input vector size. The output order is bit reversed.

The data type is a result of the FilterOutputDataType and the FFT bit growth necessary to avoid overflow.

Validity of output data, returned as a logical scalar. The object sets validOut to 1 (true) with each valid sample on dataOut.

Data Types: logical

First sample of output frame, returned as a logical scalar. The object sets startOut to 1 (true) during the first valid sample on dataOut.

Dependencies

To enable this argument, set StartOutputPort to true.

Data Types: logical

Last sample of output frame, returned as a logical scalar. The object sets endOut to 1 (true) during the last valid sample on dataOut.

Dependencies

To enable this argument, set EndOutputPort to true.

Data Types: logical

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)
getLatencyLatency of FFT or channelizer calculation
stepRun System object algorithm
cloneCreate duplicate System object
getNumInputsNumber of inputs required to call the System object
getNumOutputsNumber of outputs from calling the System object
isLockedDetermine if System object is locked
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

expand all

Create a function that contains a channelizer object and supports HDL code generation.

Create the specifications and input signal. The signal has 8 frequency channels.

N = 8;
loopCount = 1024;
offsets = [-40 -30 -20 10 15 25 35 -15];
sinewave = dsp.SineWave('ComplexOutput',true,'Frequency', ...
     offsets+(-375:125:500),'SamplesPerFrame',loopCount);
spectrumAnalyzer = dsp.SpectrumAnalyzer('ShowLegend',true, ...
     'SampleRate',sinewave.SampleRate/N);

Write a function that creates and calls the channelizer System object™. You can generate HDL from this function.

function [yOut,validOut] = HDLChannelizer8(yIn,validIn)
%HDLChannelizer8 
% Process one sample of data using the dsp.HDLChannelizer System object
% yIn is a fixed-point scalar or column vector. 
% validIn is a logical scalar value.
% You can generate HDL code from this function.

  persistent channelize8;
  if isempty(channelize8)
    % Use filter coeffs from non-HDL channelizer, or supply your own.  
    channelizer = dsp.Channelizer('NumFrequencyBands',8);
    channelize8 = dsp.HDLChannelizer('NumFrequencyBands',8,'FilterCoefficients',tf(channelizer));
  end    
  [yOut,validOut] = channelize8(yIn,validIn);
end


Channelize the input data by calling the object for each data sample.

y = zeros(loopCount/N,N);
validOut = false(loopCount/N,1);
yValid = zeros(loopCount/(N*N),N);
for reps=1:20
   x = sum(sinewave(),2);
   for loop=1:length(x)
      [y(loop,:),validOut(loop)]= HDLChannelizer8(complex(x(loop)),true);
   end
   yValid = y(validOut == 1,:);
   spectrumAnalyzer(yValid);
end

The latency of the dsp.HDLChannelizer object varies with the FFT length and the vector size. Use the getLatency function to find the latency of a particular configuration. The latency is measured as the number of cycles between the first valid input and the first valid output, assuming that the input is contiguous. The number of filter coefficients does not affect the latency. Setting the output size equal to the input size reduces the latency because the samples are not saved and reordered.

Create a dsp.HDLChannelizer object and request the latency.

channelize = dsp.HDLChannelizer('NumFrequencyBands',512);
L512 = getLatency(channelize)
L512 = 1118

Request hypothetical latency information about a similar object with a different number of frequency bands (FFT length). The properties of the original object do not change.

L256 = getLatency(channelize,256)
L256 = 592
N = channelize.NumFrequencyBands
N = 512

Request hypothetical latency information of a similar object that accepts eight-sample vector input.

L256v8 = getLatency(channelize,256,8)
L256v8 = 132

Enable scaling at each stage of the FFT. The latency does not change.

channelize.Normalize = true;
L512n = getLatency(channelize)
L512n = 1118

Request the same output size and order as the input data. The latency decreases because the object does not need to store and reorder the data before output. The default input size is scalar.

channelize.OutputSize = 'Same as input size';
L512r = getLatency(channelize)
L512r = 605

Check the latency of a vector input implementation where the input and output are the same size. Specify the current value of the FFT length and a vector size of 8 samples. The latency decreases because the object computes results in parallel when the input is a vector.

L256rv8 = getLatency(channelize,channelize.NumFrequencyBands,8)
L256rv8 = 145

Algorithms

expand all

This object implements the algorithm described on the Channelizer HDL Optimized block reference page.

Introduced in R2017a

Was this topic helpful?