EmbDev.net

Forum: FPGA, VHDL & Verilog function "to_integer"


von Mira M. (Company: LERICA) (ramiss)


Rate this post
useful
not useful
I have a problem when using this function and i have this message : 
"Argument of 'to_integer' function must have size less than 32"

from what I understand, the to_integer function from numeric_std works 
with 32 bits vectors max!!!
is there a way to make it accept 64 bits vectors? ou more?
or is there some other function i should use?

Thank you a lot,
Regards,

von Peter K. (Guest)


Rate this post
useful
not useful
What programming language do you use?
Maybe the function name is to_long, or you could transform the 64Bit 
vector to 32bit, this truncates the information in the lower 32Bit but 
maybe the precision is enough for your purpose.

Why would you transform to integer datatype, if your datatype is double 
just round it and keep the double datatype

von Mira M. (Company: LERICA) (ramiss)


Rate this post
useful
not useful
Peter Kremsner wrote:
> What programming language do you use?
> Maybe the function name is to_long, or you could transform the 64Bit
> vector to 32bit, this truncates the information in the lower 32Bit but
> maybe the precision is enough for your purpose.
>
> Why would you transform to integer datatype, if your datatype is double
> just round it and keep the double datatype


Thanks for your quickly response,

I use VHDL language (xilinx ISE),
The program concerns manipulation of image block data in order to
achieve a motion estimation, I use a register (32bits) for saving (or
delaying) the data, thus the program works when data size is less than
32-bits but in my case I need 64-bits, so how can I do this?

Thank you,

von Peter K. (Guest)


Rate this post
useful
not useful
Truncate the 64 Bit to 32 Bit or use 2 32Bit Register for saving the 
data.
1 for the low 32Bit the other for the high 32Bit and perform the 
operation with two registers.

von -gb- (Guest)


Rate this post
useful
not useful
You could use unsigned/signed. They are not limited in length.

von Mira M. (Company: LERICA) (ramiss)


Rate this post
useful
not useful
Peter Kremsner wrote:
> Truncate the 64 Bit to 32 Bit or use 2 32Bit Register for saving the
> data.
> 1 for the low 32Bit the other for the high 32Bit and perform the
> operation with two registers.


Thank you again for your valuable comments,
I did as you mentioned, I split my data into two parts, once using 
32-bit registers, and the second part another 32-bit registers, only I 
hope it wont be a blend of data :)

Thank you all,
Best regards,

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Mira Miyou wrote:
> I did as you mentioned, I split my data into two parts
And what do you do with that segmented value afterwards?

My way would be to use a unsigned(63 downto 0) vector and the 
numeric_std for the calculations with it...

von Mira M. (Company: LERICA) (ramiss)


Rate this post
useful
not useful
Lothar Miller wrote:
> And what do you do with that segmented value afterwards?
>
> My way would be to use a unsigned(63 downto 0) vector and the
> numeric_std for the calculations with it...

Actually I reduced the size of register at 32bits and I changed the way 
in which the data are presented in my program so that it goes with the 
32bits, since anyway I can't go beyond.

concerning the function unsigned, I don't use it because before storing 
the value in the register I use an absolute value like this:
abs (to_integer (signed (data)))
thank you again for the time you spent to write me,

von berndl (Guest)


Rate this post
useful
not useful
Mira Miyou wrote:
> abs (to_integer (signed (data)))

you should accept the fact that VHDL has integers (that's signed by the 
way!) of only 32 bits. For anything beyond this, you might follow 
Lothars advice and go to 'signed' and 'unsigned' (which are unlimited in 
bit-width)...

von Mira M. (Company: LERICA) (ramiss)


Rate this post
useful
not useful
berndl wrote:
> Mira Miyou wrote:
>> abs (to_integer (signed (data)))
>
> you should accept the fact that VHDL has integers (that's signed by the
> way!) of only 32 bits. For anything beyond this, you might follow
> Lothars advice and go to 'signed' and 'unsigned' (which are unlimited in
> bit-width)...

Ok, thank's for your advice :)
Regards,

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.