Main Content

Configure the Simulink Environment for HDL Video Processing

About Simulink Model Templates

Simulink® model templates provide common configuration settings and best practices for new models. Instead of the default canvas of a new model, select a template model to help you get started.

For more information on Simulink model templates, see Build and Edit a Model Interactively (Simulink).

Create Model Using Vision HDL Toolbox Model Template

To use the Vision HDL Toolbox™ model template:

  1. Click the Simulink button, , or type simulink at the MATLAB® command prompt.

  2. On the Simulink start page, find the Vision HDL Toolbox section, and click the Basic Model template.

A new model, with the template contents and settings, opens in the Simulink Editor. Click Save to save the model.

You can also create a new model from the template on the command line.

new_system my_visionhdl_model FromTemplate visionhdl_basic.sltx
open_system my_visionhdl_model

Vision HDL Toolbox Model Template

Basic Model Template

The Vision HDL Toolbox Basic Model template includes the following features:

  • Blocks to convert framed video data to a pixel stream, and to convert the output pixel stream back to full-frame video

  • An empty behavioral model subsystem

  • An empty HDL-targeted subsystem

  • Display blocks to compare the results of the two subsystems

  • Delay blocks on the input and behavioral model data paths. These delays match the one-frame delay introduced by the Pixels To Frame conversion on the HDL model data path.

This template also configures the model for HDL code generation.

This template uses the Video Source and Video Viewer blocks from Computer Vision Toolbox™.

Due to serial processing, Vision HDL Toolbox simulation can be time-consuming for large images. You can work around this limitation by designing and debugging with a small image, and then increasing the size before final testing and HDL code generation. The pixel stream control signals allow most blocks, except for those for frame and pixel conversion, to be independent of image size. To change image size, modify the Frame To Pixels and Pixels To Frame block parameters only. To simplify a size change, use variables for custom-size image dimensions. This template uses the standard 240p format and also provides image dimension variables in the callback function, InitFcn. These variables control the sample time on the Video Source and the simulation stop time. To view or edit this function, on the Modeling tab, expand Model Settings and click Model Properties, select the Callbacks tab, and then click InitFcn*.

This template includes the following features that assist with HDL code generation:

  • Configures Solver and HDL Code Generation settings equivalent to calling visionhdlsetup

  • Displays data rates and data types in the Model Editor

  • Creates an instance of pixelcontrolbus in the workspace (in InitFcn)

  • Enables fileIO mode when generating an HDL test bench

Related Topics