Error with HDL Coder ( size array )

1 view (last 30 days)
thang
thang on 27 Nov 2014
Commented: thang on 2 Dec 2014
Hi all, I tried the matlab about HDL Code generation from matlab code. And i met error. here, this is my function code ( about qpsk function ):
When i convert it to vhdl code, this error about size of array was appeared :
So, i am trying repair but it's just not done! please, help me !!! thanks.

Accepted Answer

Tim McBrayer
Tim McBrayer on 1 Dec 2014
You have declared y, y_in, and y_qd as being 0x0 arrays. You are then assigning them arrays with different dimensions. This is not supported for HDL Coder. Each variable must have a single fixed size that does not change during the evaluation of the function. These sizes must be statically determinable at compile time. These requirements exist because the MATLAB code is being turned into hardware; you can't dynamically change the size of hardware!
Examining your code, the three arrays in question grow with each loop execution. This also is not supported. You need to figure out what your final size of the arrays is, most likely in relation to length(data) from the look of the code. Declare your three arrays to be this size at the start, and use array indexing to store the data calculated in each loop into the correct index. In addition to being supported for HDL code generation, this style of array creation will execute faster in MATLAB, as the MATLAB execution engine doesn't have to keep reallocating the array each time the loop executes. This is pointed out to you by the Mlint warnings in your source code.
  1 Comment
thang
thang on 2 Dec 2014
Thanks for your answer. According to your intimation, i am rewriting my code. Hope it will be done.

Sign in to comment.

More Answers (0)

Categories

Find more on Code Generation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!