Documentation

Generate HDL from Filter System Objects

You can generate HDL code from the following System objects:

After you design a filter System object™, use generatehdl or fdhdltool to set HDL code generation options and generate code. When you input a System object into either function, you must also specify the input data type for the object. The HDL code generation tool quantizes the input signal to this data type. The data type argument is an object of numerictype class. Create this object by calling numerictype(s,w,f), where s is 1 for signed and 0 for unsigned, w is the word length in bits, and f is the number of fractional bits.

For instance, if filt is a dsp.BiquadFilter object, as in the HDL Butterworth Filter example, call generatehdl to generate HDL code for the filter.

generatehdl(filt,'Name','hdlbutter',...
               'TargetLanguage','VHDL',...
               'TargetDirectory',workingdir,...
               'GenerateHDLTestbench','on',...
               'TestBenchUserStimulus',userstim,...
               'InputDataType',numerictype(1,8,7));
The call to numerictype(1,8,7) specifies a signed 8-bit number with 7 fractional bits.

Alternatively, call fdhdltool to open a UI which enables you to set code generation options and generate HDL code.

fdhdltool(filt,numerictype(1,8,7));

You can also create a filter System object and generate HDL code from it, by calling filterBuilder and then setting these options.

  • On the Main tab, select Use a System object to implement filter.

  • On the Data Types tab, set Arithmetic to Fixed point and select the internal fixed-point data types.

  • On the Code Generation tab, click Generate HDL to set HDL code generation options and generate code.

Functions for exploring filter architectures, and generating test bench stimulus also take an input data type argument when you call them with a System object. See hdlfilterserialinfo, hdlfilterdainfo, and generatetbstimulus.

See Also

| |

Related Topics

Was this topic helpful?