www.gusucode.com > hdlfilter 案例代码 matlab源码程序 > hdlfilter/GenerateHDLFromTheCommandPromptExample.m

    %% Generate HDL From the Command Prompt
%%
% Design a filter. 
d = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2,0.22,1,60)
Hd = design(d,'equiripple','filterstructure','dfsymfir','Systemobject',true)
%%
% To generate HDL code for the filter and its test bench from the command line,
% use the |generatehdl| function. When you call the |generatehdl| function,
% specify the filter name and (optionally) desired property name and property
% value pairs. When the filter is a System object(TM), you must specify the
% input data type property.
% 
% As code generation proceeds, a sequence of messages appears in the MATLAB
% Command Window. The messages include hyperlinks to the generated code and
% test bench files. Click these hyperlinks to open the code files in the MATLAB Editor.
generatehdl(Hd,'InputDataType',numerictype(1,16,15),'Name','MyFilter',...
               'TargetLanguage','Verilog','GenerateHDLTestbench', 'on')