generatetb - Generate HDL test bench for quantized filter

Syntax

generatetb(Hd, 'TbType')
generatetb(Hd 'TbType', 'PropertyName', 'PropertyValue',...)
generatetb(Hd)
generatetb(Hd, 'PropertyName', 'PropertyValue',...)

Description

generatetb(Hd, 'TbType') generates a HDL test bench of a specified type to verify the HDL code generated for the quantized filter identified by Hd. The argument Hd must be a handle to a filter object. The value that you specify for 'TbType' identifies the type of test bench to be generated and can be one of the values shown in the following table (or a cell array that contains one or more of these values).

If you do not specify the 'TbType' argument, the test bench type defaults to the current setting of the TargetLanguage property ('VHDL' or 'Verilog').

Specify...To Generate a Test Bench Consisting of...
'Verilog'Verilog code
'VHDL'VHDL code
'ModelSim'The'Modelsim' test bench type argument is deprecated in the current release and will not be supported in future releases. If you specify this option, a warning message is displayed. If your scripts use the 'Modelsim' option, you should remove it. It is recommended that you use the default test bench type instead.

The generated test bench applies input stimuli based on the setting of the properties TestBenchStimulus and TestBenchUserStimulus. By default, TestBenchStimulus specifies impulse, step, ramp, chirp, and noise stimuli for FIR, FIRT, Symmetric FIR, and Antisymmetric FIR filters and step, ramp, and chirp stimuli for all other filters.

The function uses default settings for other properties that determine test bench characteristics. By default the function does the following.

Default Settings for the Test Bench

Default Settings for Files

Default Settings for Register Resets

Default Settings for General HDL Code
Default Settings for Code Optimizations

generatetb(Hd 'TbType', 'PropertyName', 'PropertyValue',...) generates a HDL test bench of a specified type to verify the HDL code generated for the quantized filter identified by Hd, using the specified property name and property value pair settings. You can specify the function with one or more of the property name and property value pairs described in Properties Reference and Properties — Alphabetical List.

generatetb(Hd) generates a HDL test bench to verify the HDL code generated for the quantized filter identified by Hd. . The 'TbType' argument is omitted, and the test bench type defaults to the current setting of the TargetLanguage property ('VHDL' or 'Verilog').

generatetb(Hd, 'PropertyName', 'PropertyValue',...) generates a HDL test bench to verify the HDL code generated for the quantized filter identified by Hd, using the specified property name and property value pair settings. The 'TbType' argument is omitted, and the test bench type defaults to the current setting of the TargetLanguage property ('VHDL' or 'Verilog').

You can specify the function with one or more of the property name and property value pairs described in Properties Reference and Properties — Alphabetical List.

Example

  1. Design a filter. The call to fdesign in the following command line sequence designs a minimum order lowpass filter with a normalized passband frequency of 0.2, a stopband frequency of 0.22, a passband ripple of 1 dB, and a stopband attenuation of 60 dB.

  2. Construct a filter object. The call to design constructs the FIR equiripple filter object Hd.

  3. Set the filter arithmetic. The arithmetic assignment statement sets the filter arithmetic to fixed-point arithmetic.

  4. Generate VHDL code for the filter. The call to generatehdl generates VHDL code for the filter Hd. The function names the file MyFilter.vhd and places it in the default target directory hdlsrc.

  5. Generate a test bench for the filter. The call to generatetb generates a VHDL test bench for the filter Hd named MyFilterTB.vhd and places the generated test bench file in the default target directory hdlsrc.

d = fdesign.lowpass('Fp,Fst,Ap,Ast',0.2, 0.22, 1, 60);
Hd = design(d, 'equiripple');      % Create  FIR equiripple filter
Hd.arithmetic='fixed'; %Quantized filter with default settings
generatehdl(Hd, 'Name', 'MyFilter'); %Generate filter's VHDL code
generatetb(Hd, 'VHDL', 'TestBenchName', 'MyFilterTB');

See Also

generatetbstimulus, generatehdl

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS