主要内容

HDL Test Bench Generation

R2026b
Generate a test bench that verifies generated HDL code against test vectors from MATLAB® or Simulink®

When you generate HDL code, you can optionally generate an HDL test bench that verifies the generated HDL DUT against test vectors saved from your Simulink model or from the MATLAB code. You can also collect code coverage information from the tests run by the generated test bench. For more information on how to select and run a test bench, see Generate Test Bench and Enable Code Coverage Using the HDL Workflow Advisor (HDL Coder).

Functions

makehdltbGenerate HDL test bench from model or subsystem

Model Settings

expand all

Simulation toolSimulator to use to run generated test benches
HDL code coverageEnable HDL code coverage flags in generated simulator scripts
HDL test benchEnable HDL test bench generation
Cosimulation modelGenerate cosimulation model
SystemVerilog DPI test benchEnable SystemVerilog DPI test bench generation
Test bench name postfixSuffix to append to test bench name
Force clockWhether test bench forces clock input signals
Clock high time (ns)Period during which test bench drives clock input signals high
Clock low time (ns)Period during which test bench drives clock input signals low
Hold time (ns)Hold time for input signals and forced reset input signals
Force clock enableWhether test bench forces clock enable input signals
Clock enable delay (in clock cycles)Elapsed time between deassertion of reset and assertion of clock enable
Force resetWhether test bench forces reset input signals
Reset length (in clock cycles)Length of time during which reset is asserted
Hold input data between samplesHold data values for subrate signals for number of base-rate clock cycles in subrate sample period
Initialize test bench inputsSpecify initial value driven on test bench inputs before data is asserted to DUT
Multi-file test benchDivide generated test bench into helper functions, data, and HDL test bench code files
Test bench data file name postfixSuffix to append to test bench data file name when generating multi-file test bench
Test bench reference postfixSuffix to append to names of reference signals generated in test bench code
Use file I/O to read/write test bench dataCreate data files for reading and writing test bench input and output data
Ignore output data checking (number of samples)Number of samples during which output data checking is suppressed
Floating point tolerance check based onCheck for errors in floating-point library based on relative or ULP errors
Tolerance ValueFloating-point tolerance value
Simulation library pathPath of compiled Altera or AMD simulation libraries

Topics

Verification Basics

HDL Test Bench for MATLAB Code

HDL Test Bench for Simulink Model

Troubleshooting

Resolve Index Errors During HDL Simulation (HDL Coder)

Troubleshoot index errors during HDL code simulation.

Featured Examples