Computed maximum size of the output of function 'reshape' is not bounded.

2 views (last 30 days)
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."

Answers (1)

Walter Roberson
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.
  5 Comments
Walter Roberson
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
Shagun Kapur
Shagun Kapur on 18 Nov 2017
Hey, I tried to run my code as
function recvd_signal_paralleled = Recvd_Serial_To_Parallel_Block(recvd_signal, rows_prefix_added,
cols_prefix_added)
recvd_signal_paralleled = complex( zeros(rows_prefix_added, cols_prefix_added), zeros(rows_prefix_added, cols_prefix_added));
recvd_signal_paralleled = reshape(recvd_signal, rows_prefix_added, cols_prefix_added);
end
and
function recvd_signal_paralleled = Recvd_Serial_To_Parallel_Block(recvd_signal, rows_prefix_added, cols_prefix_added)
recvd_signal_paralleled = complex( zeros(rows_prefix_added, cols_prefix_added), zeros(rows_prefix_added, cols_prefix_added));
coder.varsize('recvd_signal_paralleled', [20, 4], [1 1]);
recvd_signal_paralleled = reshape(recvd_signal, rows_prefix_added, cols_prefix_added);
end
As you can see, the 'type' of the variable recvd_signal_paralleled in the first one is :inf x :inf while that has been fixed in the second code. The issue couldn't get resolved by that, though I saw in another forum that this was indeed what was causing the issue.
Also, I couldn't understand what you meant by the 'original code'.

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!