Peter
2009-04-27 07:43:25 UTC
I was surprised by how the resize function works. My intention was to
substract two 32-bit signals (std_logic_vectors, but representing 2-
complement numbers) and decrease the signal width from 32 bits to 14.
The code below does not work:
daout <= std_logic_vector( resize((signed(tx_mix_i) - signed
(tx_mix_q)),14) );
But this code does:
idaout <= std_logic_vector( signed(tx_mix_i) - signed(tx_mix_q) );
daout <= idaout(31 downto 18);
I seems as the rezise function selects the 14 lowest bits in the
argument instead of the 14 highest.
Any comments?
/Peter
substract two 32-bit signals (std_logic_vectors, but representing 2-
complement numbers) and decrease the signal width from 32 bits to 14.
The code below does not work:
daout <= std_logic_vector( resize((signed(tx_mix_i) - signed
(tx_mix_q)),14) );
But this code does:
idaout <= std_logic_vector( signed(tx_mix_i) - signed(tx_mix_q) );
daout <= idaout(31 downto 18);
I seems as the rezise function selects the 14 lowest bits in the
argument instead of the 14 highest.
Any comments?
/Peter