Generate HDL Code for Filter System Objects
You can generate HDL code for a supported filter System object™ by using theFilter Builderapp, the Generate HDL dialog box, or by calling thegeneratehdl
function. You can also explore filter architectures and generate test bench stimulus for a filter System object by using thehdlfilterserialinfo
,hdlfilterdainfo
, andgeneratetbstimulus
functions. In either cases, you must specify a fixed-point data type for the System object. The HDL code generation tool quantizes the input signal to this data type.
Using Filter Builder
Open theFilter Builderapp by calling thefilterBuilder
function, then set the following options.
On theMaintab, selectUse a System object to implement filter.
On theData Typestab, setArithmeticto
Fixed point
and select the internal fixed-point data types.On theCode Generationtab, clickGenerate HDLto set HDL code generation options and generate code.
Using Generate HDL Dialog Box
Open the Generate HDL dialog box by calling thefdhdltool
function. When calling the function with a System object, specify the input data type as anumerictype
对象。Create this object by callingnumerictype(s,w,f)
, wheres
is 1 for signed and 0 for unsigned,w
is the word length in bits, andf
is the number of fractional bits. In the following example, the call tonumerictype(1,8,7)
specifies a signed 8-bit number with 7 fractional bits.
filt = dsp.BiquadFilter; fdhdltool(filt,numerictype(1,8,7));
At the Command Line
When calling thegeneratehdl
function with a System object, specify the input data type as aName,Value
pair argument using theInputDataType
property. Specify the property value as anumerictype
对象。例如:
filt = dsp.BiquadFilter; generatehdl(filt,'Name','HDLButter',...'InputDataType',numerictype(1,8,7));
generatehdl
, you can set additional HDL code generation properties usingName,Value
pair arguments. For example:
coeffs = fir1(22,0.45); firfilt = dsp.FIRFilter(“Numerator',coeffs,...'Structure','Direct form antisymmetric'); generatehdl(firfilt,'InputDataType',numerictype(1,16,15),...'SerialPartition',[7 4],'CoefficientMemory','DualPortRAMs',...'CoefficientSource','ProcessorInterface');
See Also
generatehdl
|fdhdltool
|numerictype
|filterBuilder