F
Frank van Eijkelenburg
Guest
Hi,
I have a std_logic_vector with size 2 and I want to use it in a function call
(which requires two unsigned parameters) like this:
signal offset : std_logic_vector(1 downto 0);
signal base : std_logic_vector(31 downto 0);
bus_write(unsigned(base) + unsigned(offset) * 4, write_data);
I see it's not working in simulation. It looks like the multiply of 4 is not
working. I assume the temporary result of 4 * unsigned(offset) is stored in an
unsigned with size 2 and than added to base?
I also get a warning about truncation. Do I have to store the result of the
operation in a larger unsigned explicitly or is there another way to do this?
TIA,
Frank
I have a std_logic_vector with size 2 and I want to use it in a function call
(which requires two unsigned parameters) like this:
signal offset : std_logic_vector(1 downto 0);
signal base : std_logic_vector(31 downto 0);
bus_write(unsigned(base) + unsigned(offset) * 4, write_data);
I see it's not working in simulation. It looks like the multiply of 4 is not
working. I assume the temporary result of 4 * unsigned(offset) is stored in an
unsigned with size 2 and than added to base?
I also get a warning about truncation. Do I have to store the result of the
operation in a larger unsigned explicitly or is there another way to do this?
TIA,
Frank