Computed maximum size of the output of function 'reshape' is not bounded.
2 views (last 30 days)
Show older comments
Hi, could someone help me resolve the error while converting a simple reshape code via HDL Coder? I'm a first time user so it may be redundant, but I'm unable to find anything similar online.
The error message is in the HDL Code Generation step: "Computed maximum size of the output of function 'reshape' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [:? x :1048575]. Please consider enabling dynamic memory allocation to allow unbounded sizes."
0 Comments
Answers (1)
Walter Roberson
on 16 Nov 2017
Edited: Walter Roberson
on 18 Nov 2017
HDL cannot deal with dynamic memory or unbounded array sizes. You must indicate a maximum array size, and HDL will have to always use enough memory cells to account for the maximum array size you indicate -- although if you are careful to use for loops instead of vectorizing, you can reduce the need for temporary arrays and so might be able to use the data as passed in instead of ending up making copies the same size.
The simplest way to indicate a maximum array size in a routine that would be translated into HDL is to add an assert() against the size() of the array. For example,
assert(size(YourArray,1) <= 702)
would allow the first dimension to be at most 702. The HDL coder knows about those kinds of asserts() and will actively use the information it can deduce from them.
Otherwise you should be using coder.varsize to specify a maximum array dimension. See also https://www.mathworks.com/help/fixedpoint/ug/variable-size-data-when-dynamic-memory-allocation-is-disabled.html and https://www.mathworks.com/help/fixedpoint/ug/what-is-variable-size-data.html
5 Comments
Walter Roberson
on 17 Nov 2017
I would suggest doing without the Recvd_Serial_To_Parallel_Block function and just doing the reshape in the original code. But if you do not want to do that, then you need to add the size asserts in Recvd_Serial_To_Parallel_Block
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!