Forum Discussion
Altera_Forum
Honored Contributor
16 years agovhdl addition result size
Hello, maybe a dummy question: I am using arith package. If I need to add 2 signed std_logic_vector of 3 bits, The output should be a std_logic_vector of 4 bits, 3+3=6 ----->...
Altera_Forum
Honored Contributor
16 years agoHello
I was doing the addition between two 22 bits std_logic_vector. And I had to store the result in a 29 bits std_logic_vector, So I was doing this data_1_2005_29bits <= (data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(21) & data_1_2005(20 downto 0) ); I was repeating the sign 6 times, but with the function sign_extend my code will be more legible. Thank you. DABG