Variable 'variable lengths'

T

Taras_96

Hi

I'm writing some code for simulation only (not synthesis). Is there
someway of declaring a unsigned variable's length in the body of a
function? So far I haven't had any success because you need to declare
the variable and its length before the body of the function, and you
can't declare an unconstrained variable.

Thanks

Taras
 
M

Mike Treseler

Taras_96 said:
Is there
someway of declaring a unsigned variable's length in the body of a
function?

reference the length of the actual
argument right in the variable declaration
-- ...
)
return unsigned is
variable reg_v : unsigned(vec_arg'range);
begin
-- ...
So far I haven't had any success because you need to declare
the variable and its length before the body of the function, and you
can't declare an unconstrained variable.

No, but you can use an unconstrained parameter.

-- Mike Treseler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top