L
Luis Cupido
Guest
Hello.
I got a perfectly working code of a component (an accumulating RAM)
with some generic defenition of bus sizes.
As it has the content add operations and some address offsetting all
goes with
straightforward code using integers for both memory (an array of integers)
and pointers. Integer ranges are simply from 0 to 2**BUS_SIZES -1
being the output data bus wider than input data bus (as one would expect).
So far so good, all works.
But if I have a 16bit data bus and want to accumulate 2**18 times
range is 0 to 2**(16+18)-1 which is a 34bit wide data_out bus
and I have a value overflow on the range calculation.
Question:
Is there any clever way to get this simple range calculation working
past the
integer range problem ? (I know that explicit I can have whatever I need
but a I need a calculated value from generic clause and calculating ranges
overflows at 2**32 bit).
I can' t even have a 32bit bus defined range 0 to 2**32-1...
Should I forget integers, and rewrite it all to use unsigned instead ?
Any hints ?
Thanks.
Luis C.
I got a perfectly working code of a component (an accumulating RAM)
with some generic defenition of bus sizes.
As it has the content add operations and some address offsetting all
goes with
straightforward code using integers for both memory (an array of integers)
and pointers. Integer ranges are simply from 0 to 2**BUS_SIZES -1
being the output data bus wider than input data bus (as one would expect).
So far so good, all works.
But if I have a 16bit data bus and want to accumulate 2**18 times
range is 0 to 2**(16+18)-1 which is a 34bit wide data_out bus
and I have a value overflow on the range calculation.
Question:
Is there any clever way to get this simple range calculation working
past the
integer range problem ? (I know that explicit I can have whatever I need
but a I need a calculated value from generic clause and calculating ranges
overflows at 2**32 bit).
I can' t even have a 32bit bus defined range 0 to 2**32-1...
Should I forget integers, and rewrite it all to use unsigned instead ?
Any hints ?
Thanks.
Luis C.