How to solve "For MATLAB Function block generation, structure inputs to the top-level design function are not supported"

Hello, I come across a problem during using vision HDL coder. I coded as pixel-based processing, and try to stream the image frames. However, as for the control output, I just simply make it equal to ctrlIn. Below is my code, which differentiates the successive two frames:
function [pixOut,ctrlOut] = frame_difference(pixIn,ctrlIn,pixel_index)
persistent frame_buffer;
if isempty(frame_buffer)
frame_buffer = zeros(307200,1);
end
last_time_value = frame_buffer(pixel_index);
frame_buffer(pixel_index) = pixIn;
difference = abs(pixIn - last_time_value);
if (difference > 12)
pixvalue = 255;
else
pixvalue = 0;
end
pixOut = pixvalue;
ctrlOut = ctrlIn;
And the testbench is the same as example. However, when I tried to convert the block to verilog, I encountered the error: For MATLAB Function block generation, structure inputs to the top-level design function are not supported. Actually, in the document (https://www.mathworks.com/help/hdlcoder/ug/variables-and-constants.html), the structures are said to be supported (I am not using Turnkey or IP generation ).
How can I solve this problem? Can I just simply omit the control signal for both input and output? Thanks very much!

4 Comments

Structure support in HDL Coder has evolved over several releases. What version of MATLAB are you using?
Actually, I have read the document thoroughly, but there's no document about how to deal with pixel control signal (ctrlIn and ctrlOut) in the HDL coder with matlab. However, this control signal is important for video synchronization.

Sign in to comment.

Answers (1)

This is not something that I have experience with, but the two questions that come to mind are:
  • is it necessary to embed this in a subsystem and generate for the subsystem?
  • can a structure cross the HDL boundary, or does it need to be serialized or broken out into distinct pins? There are constructs that can be used inside the HDL but which cannot cross the boundaries intact.

Asked:

on 21 Nov 2016

Commented:

on 23 Nov 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!