On Jul 3, 12:04 am, Mike Treseler <(E-Mail Removed)> wrote:

> Kevin Neilson wrote:

> > Signed types (using numeric_std) can have widths bigger than 32, but the

> > to_signed() function only takes integers as an argument, so it seems to

> > be very difficult to assign values to large signed constants.

>

> 32 bit ints are annoying but vector

> hex constants work for any value.

> my_vec_v := x"123456789abc" ;

>

> I use python to do the conversions

>

> >>> int(0x123456789abc)

> 20015998343868L

> >>> hex(2001599834386

> '0x123456789abcL'

> >>>

>

> -- Mike Treseler
A few other random thoughts... you could extend Mike's idea to express

a decimal number directly using a string, writing a conversion

function yourself. Then you don't need to leave the VHDL world at all.

function str_to_signed ( s : string; width : integer) return signed;

....

constant x := str_to_signed("1000000000", 64);

But you still need to manually evaluate "2**x - 1" which means you

still lose the ability to make your input argument dependent on a

generic. Perhaps just writing an integer exponentiation of signed

would help? Easy and fast when you have the binary representation of

the exponent, using the "signed" multiply.

function "**" ( x : signed; y : integer) return signed; -- compute x

** y

....

constant round_const: signed(c'range) := (to_signed(2,c'range))**x-1;

For your example (2^n) you might be able to use just a simple shift to

begin with. But your point is well taken - bignums in the LRM would be

nice

- Kenn