Upsample, filter, and downsample—optimized for HDL code generation
The dsp.HDLFIRRateConverter
System object™ upsamples, filters, and downsamples input signals. It is optimized for HDL code
generation and operates on one sample of each channel at a time. The object implements an
efficient polyphase architecture to avoid unnecessary arithmetic operations and high
intermediate sample rates.
The object upsamples by an integer factor of L, applies an FIR filter, and downsamples by an integer factor of M. The object accepts and returns control signal arguments for pacing the flow of samples. For detail of the flow control interface, see Flow Control.
To resample and filter input data:
Create the dsp.HDLFIRRateConverter
object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
returns a
System object, HDLFIRRC
= dsp.HDLFIRRateConverterHDLFIRRC
, that resamples each channel of the input.
The object upsamples by an integer factor of L, applies an FIR filter,
and downsamples by an integer factor of M. The default
L/M is 3/2.
sets the HDLFIRRC
= dsp.HDLFIRRateConverter(L
,M
,num
)InterpolationFactor
property to L
, the
DecimationFactor
property to M
, and the
Numerator
property to num
.
sets properties using one or more name-value pairs. Enclose each property name in single
quotes. For
example:HDLFIRRC
= dsp.HDLFIRRateConverter(___,Name,Value
)
HDLFIRRC = dsp.HDLFIRRateConverter(L,M,Num,'ReadyPort',true,'RequestPort',true);
[
resamples dataOut
,validOut
]
= HDLFIRRC(dataIn
,validIn
)dataIn
according to the InterpolationFactor (L) and DecimationFactor
(M) properties. To avoid dropped samples when using this syntax,
apply new valid input samples, with validIn
set to
true
, only every ceil(L/M)
calls to the object.
The object sets validOut
to true
when
dataOut
is a new valid sample.
[
resamples the input data and returns dataOut
,ready
,validOut
]
= HDLFIRRC(dataIn
,validIn
)ready
to indicate whether the
object can accept a new sample on the next call.
This syntax applies when you set the ReadyPort
property to true
. For example:
HDLFIRRC = dsp.HDLFIRRateConverter(...,'ReadyPort',true); ... [dataOut,validOut,ready] = rateConverter(dataIn,validIn);
[
resamples the input data, indicates whether the object can accept a new sample, and, if
dataOut
,ready
,validOut
]
= HDLFIRRC(dataIn
,validIn
,request
)request
is true
, returns the next available
sample.
This syntax applies when you set the RequestPort
property to true
. For example:
HDLFIRRC = dsp.HDLFIRRateConverter(...,'RequestPort',true); ... [dataOut,validOut] = rateConverter(dataIn,validIn,request);
You can connect the ready
output of a downstream object to the
request
input of an upstream object.
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)