The Test Bench pane lets you set options that determine characteristics of generated test bench code.
The Generate Test Bench button initiates
test bench generation for the system selected in the Generate
HDL for menu. See also makehdltb
.
Enable or disable HDL test bench generation.
Tar
This check box enables the options in the Configuration section of the Test Bench pane.
Property: GenerateHDLTestBench |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Generate a model containing HDL Cosimulation block(s) for use in testing the DUT.
Default: Off
When you select this option, HDL Coder™ generates and opens a model that contains one or more HDL Cosimulation blocks. The coder generates cosimulation blocks if your installation includes one or more of the following:
HDL Verifier™ for use with Mentor Graphics® ModelSim®
HDL Verifier for use with Cadence Incisive®
The coder configures the generated HDL Cosimulation blocks to conform to the port and data type interface of the DUT selected for code generation. By connecting an HDL Cosimulation block to your model in place of the DUT, you can cosimulate your design with the desired simulator.
Do not generate HDL Cosimulation blocks.
This check box enables the other options in the Configuration section of the Test Bench pane.
Property: GenerateCoSimBlock |
Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify the HDL cosimulator for use with the generated HDL Cosimulation block and model
Default: Mentor
Graphics ModelSim
Select one of the following options from the dropdown menu:
Mentor Graphics ModelSim
:
This option is the default. HDL Coder generates and opens a Simulink® model
that contains an HDL Cosimulation block specifically
for use with Mentor Graphics ModelSim.
Cadence Incisive
: The coder
generates and opens a Simulink model that contains an HDL
Cosimulation block specifically for use with Cadence Incisive.
Property: GenerateCosimModel |
Type: character vector |
Value: 'ModelSim' | 'Incisive' |None |
Default: 'ModelSim' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify a suffix appended to the test bench name.
Default: _tb
For example, if the name of your DUT is my_test
, HDL Coder adds
the default postfix _tb
to form the name my_test_tb
.
Property: TestBenchPostFix |
Type: character vector |
Default: '_tb' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify whether the test bench forces clock input signals.
Default: On
The test bench forces the clock input signals. When this option is selected, the clock high and low time settings control the clock waveform.
A user-defined external source forces the clock input signals.
This property enables the Clock high time and Clock high time options.
Property: ForceClock |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify the period, in nanoseconds, during which the test bench drives clock input signals high (1).
Default: 5
The Clock high time and Clock low time properties define the period and duty cycle for the clock signal. Using the defaults, the clock signal is a square wave (50% duty cycle) with a period of 10 ns.
This parameter is enabled when Force clock is selected.
Property: ClockHighTime |
Type: integer |
Value: positive integer |
Default: 5 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify the period, in nanoseconds, during which the test bench drives clock input signals low (0).
Default: 5
The Clock high time and Clock low time properties define the period and duty cycle for the clock signal. Using the defaults, the clock signal is a square wave (50% duty cycle) with a period of 10 ns.
This parameter is enabled when Force clock is selected.
Property: ClockLowTime |
Type: integer |
Value: positive integer |
Default: 5 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify a hold time, in nanoseconds, for input signals and forced reset input signals.
Default: 2 (given the default clock period of 10 ns)
The hold time defines the number of nanoseconds that reset input signals and input data are held past the clock rising edge. The hold time is expressed as a positive integer or double (with a maximum of 6 significant digits after the decimal point).
The specified hold time must be less than the clock period (specified by the Clock high time and Clock low time properties).
This option applies to reset input signals only if Force reset is selected.
Property: HoldTime |
Type: integer |
Value: positive integer |
Default: 2 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Display setup time for data input signals.
Default: None
This is a display-only field, showing a value computed as (clock
period - HoldTime
) in nanoseconds.
The value displayed in this field depends on the clock rate and the values of the Hold time property.
Because this is a display-only field, a corresponding command-line property does not exist.
Specify whether the test bench forces clock enable input signals.
Default: On
The test bench forces the clock enable input signals to active-high (1) or active-low (0), depending on the setting of the clock enable input value.
A user-defined external source forces the clock enable input signals.
This property enables the Clock enable delay (in clock cycles) option.
Property: ForceClockEnable |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Define elapsed time (in clock cycles) between deassertion of reset and assertion of clock enable.
Default: 1
The Clock enable delay (in clock cycles) property defines the number of clock cycles elapsed between the time the reset signal is deasserted and the time the clock enable signal is first asserted. In the figure below, the reset signal (active-high) deasserts after 2 clock cycles and the clock enable asserts after a clock enable delay of 1 cycle (the default).
This parameter is enabled when Force clock enable is selected.
Property: TestBenchClockEnableDelay |
Type: integer |
Default: 1 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify whether the test bench forces reset input signals.
Default: On
The test bench forces the reset input signals.
A user-defined external source forces the reset input signals.
If you select this option, you can use the Hold time option to control the timing of a reset.
Property: ForceReset |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Define length of time (in clock cycles) during which reset is asserted.
Default: 2
The Reset length (in clock cycles) property defines the number of clock cycles during which reset is asserted. Reset length (in clock cycles) must be an integer greater than or equal to 0. The following figure illustrates the default case, in which the reset signal (active-high) is asserted for 2 clock cycles.
This parameter is enabled when Force reset is selected.
Property: Resetlength |
Type: integer |
Default: 2 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify how long subrate signal values are held in valid state.
Default: On
Data values for subrate signals are held in a valid state across N base-rate clock cycles, where N is the number of base-rate clock cycles that elapse per subrate sample period. (N >= 2.)
Data values for subrate signals are held in a valid state for
only one base-rate clock cycle. For the subsequent base-rate cycles,
data is in an unknown state (expressed as 'X'
)
until leading edge of the next subrate sample period.
In most cases, the default (On) is the best setting for Hold input data between samples. This setting matches the behavior of a Simulink simulation, in which subrate signals are held valid through each base-rate clock period.
In some cases (for example modeling memory or memory interfaces),
it is desirable to clear Hold input data between samples.
In this way you can obtain diagnostic information about when data
is in an invalid ('X'
) state.
Property: HoldInputDataBetweenSamples |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify initial value driven on test bench inputs before data is asserted to DUT.
Default: Off
Initial value driven on test bench inputs is'0'
.
Initial value driven on test bench inputs is 'X'
(unknown).
Property: InitializeTestBenchInputs |
Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Divide generated test bench into helper functions, data, and HDL test bench code files.
Default: Off
Write separate files for test bench code, helper functions, and test bench data. The file names are derived from the name of the DUT, the Test bench name postfix property, and the Test bench data file name postfix property as follows:
DUTname
_TestBenchPostfix
_TestBenchDataPostfix
For example, if the DUT name is symmetric_fir
,
and the target language is VHDL®, the default test bench file
names are:
symmetric_fir_tb.vhd
: test bench
code
symmetric_fir_tb_pkg.vhd
: helper
functions package
symmetric_fir_tb_data.vhd
: data
package
If the DUT name is symmetric_fir
and the
target language is Verilog®, the default test bench file names
are:
symmetric_fir_tb.v
: test bench
code
symmetric_fir_tb_pkg.v
: helper
functions package
symmetric_fir_tb_data.v
: test bench
data
Write a single test bench file containing the HDL test bench code, helper functions, and test bench data.
When this property is selected, Test bench data file name postfix is enabled.
Property: MultifileTestBench |
Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify a character vector to be appended to names of reference signals generated in test bench code.
Default: '_ref'
Reference signal data is represented as arrays in the generated test bench code. The character vector specified by Test bench reference postfix is appended to the generated signal names.
Parameter: TestBenchReferencePostFix |
Type: character vector |
Default: '_ref' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify suffix added to test bench data file name when generating multi-file test bench.
Default:'_data'
HDL Coder applies the Test bench data file name postfix character vector only when generating a multi-file test bench (i.e., when Multi-file test bench is selected).
For example, if the name of your DUT is my_test
,
and Test bench name postfix has the default value _tb
,
the coder adds the postfix _data
to form the test
bench data file name my_test_tb_data
.
This parameter is enabled by Multi-file test bench.
Property: TestBenchDataPostFix |
Type: character vector |
Default: '_data' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Create and use data files for reading and writing test bench input and output data.
Default: On
Create and use data files for reading and writing test bench input and output data.
Use constants in the test bench for DUT stimulus and reference data.
Property: UseFileIOInTestBench |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify number of samples during which output data checking is suppressed.
Default: 0
The value must be a positive integer.
When the value of Ignore output data checking (number
of samples), N, is greater than zero, the test bench suppresses
output data checking for the first N
output samples
after the clock enable output (ce_out
) is asserted.
When using pipelined block implementations, output data may be in an invalid state for some number of samples. To avoid spurious test bench errors, determine this number and set Ignore output data checking (number of samples) accordingly.
Be careful to specify N as a number of samples, not as a number of clock cycles. For a single-rate model, these are equivalent, but they are not equivalent for a multirate model.
You should use Ignore output data checking (number of samples) in cases where there is a state (register) initial condition in the HDL code that does not match the Simulink state, including the following specific cases:
When you set the DistributedPipelining
property
to 'on'
for the MATLAB Function block
(see Distributed Pipeline Insertion for MATLAB Function Blocks)
When you set the ResetType
property
to 'None'
for the following
blocks:
commcnvintrlv2/Convolutional Deinterleaver
commcnvintrlv2/Convolutional Interleaver
commcnvintrlv2/General Multiplexed Deinterleaver
commcnvintrlv2/General Multiplexed Interleaver
dspsigops/Delay
simulink/Additional Math & Discrete/Additional Discrete/Unit Delay Enabled
simulink/Commonly Used Blocks/Unit Delay
simulink/Discrete/Delay
simulink/Discrete/Memory
simulink/Discrete/Tapped Delay
simulink/User-Defined Functions/MATLAB Function
sflib/Chart
sflib/Truth Table
When generating a black box interface to existing manually written HDL code
Property: IgnoreDataChecking |
Type: integer |
Default: 0 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
When you map your design to the native floating-point libraries or the floating-point target libraries, specify the floating-point tolerance check option.
Default: relative
error
Select one of these options from the dropdown menu:
relative error
: This is
the default option. When you verify the generated code by using HDL
Testbench, HDL Coder checks for the floating-point tolerance of
the native floating-point library or the floating-point target library
that your design mapped to based on the relative error.
ulp error
: When you verify
the generated code by using HDL Testbench, HDL Coder checks for
the floating-point tolerance of the native floating-point library
or the floating-point target library that your design mapped to based
on the ULP error.
Property: FPToleranceStrategy |
Type: character vector |
Value: 'relative' | 'ULP' |
Default: 'relative' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Enter the tolerance value based on the floating-point tolerance check setting that you specify.
Default: 1e-07
The value must be a positive integer or a double data type.
The default tolerance value depends on the floating-point tolerance check setting that you specify. When you set the Floating point tolerance check based on to:
relative error
, the default
is a Tolerance Value of 1e-07
.
When you use this floating-point tolerance check setting, specify
the tolerance value as a double data type. You can specify a Tolerance
Value, N, that is less than or equal to 1e-07
.
ulp error
, the default
is a Tolerance Value of 0
.
When you use this floating-point tolerance check setting, specify
the tolerance value as an integer. You can specify a Tolerance
Value, N, that is greater than or equal to 0
.
Property: FPToleranceValue |
Type: double | integer |
Default: 1e-07 |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.
Specify the path to your compiled Altera® or Xilinx® simulation libraries.
Default:''
Specify the path to the compiled Altera or Xilinx simulation libraries. Altera provides the simulation model files in \quartus\eda\sim_lib folder.
Property: SimulationLibPath |
Type: character vector |
Default: '' |
To set this property, use hdlset_param
or makehdl
. To view the property value, use hdlget_param
.