Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Variable 'variable lengths'

Reply
Thread Tools

Variable 'variable lengths'

 
 
Taras_96
Guest
Posts: n/a
 
      05-08-2005
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

 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      05-08-2005
Taras_96 wrote:

> 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
 
Reply With Quote
 
 
 
 
Taras_96
Guest
Posts: n/a
 
      05-09-2005
Thanks Mike

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
how to implement variable ports with variable width? weijun VHDL 4 12-19-2005 05:16 PM
Convert Character Variable to Integer Variable Brad Smallridge VHDL 2 11-18-2004 01:56 AM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM
Datalist - how (if) to use a sub variable or session variable in the footer? KathyB ASP .Net 1 07-17-2003 01:35 AM



Advertisments