MATLAB: Failed Generated HDL code, testbench.

HDL Codertestbench

Hi guys.
I tried to generate my project using HDL coder. However, it failed to generate the testbench. The error is "Cannot Generate test bench code for the entire model. Please specify a simulatable subsystem in your model"
Do you know what the problem? Thanks in advance.

Best Answer

HDL Coder supports generating code from a Simulink design in a few different ways. It can either generate code for a specified subsystem or for an entire model. This error message indicates that you have generated code for an entire model, and that testbench generation cannot be performed because of this.
The parts of the Simulink model outside the HDL design are referred to as the testbench; a Simulink testbench is required in order to generate a HDL testbench. Since you have no Simulink testbench, a HDL testbench cannot be created.
HDL Coder generates a testbench by running the Simulink model and capturing the inputs and outputs of the HDL subsystem that had HDL code generated for it. The HDL testbench is created using these signal values; it feeds the stored inputs to the design and verifies that the generated outputs precisely match Simulink's outputs. With no Simulink testbench to capture data from, no HDL testbench can be created.
Related Question