AhmedIbrahim
Newbie level 5
Dear All,
I was asked today in an interview this question, Why do we need to have the same operand sizes for addition in VHDL, while in multiplication we don't? however we expect that both the result of addition and multiplication be of a bigger size than the operands!
Meaning that if a is std_logic_vector(3 downto 0) and b is std_logic_vector(3 downto 0) and c is std_logic_vector(4 downto 0) and d is std_logic_vector(7 downto 0)
so c <= a+ b; -- This gives an error for size mismatch
while d <= a*b; -- This goes OK with the VHDL compiler.
Regards
I was asked today in an interview this question, Why do we need to have the same operand sizes for addition in VHDL, while in multiplication we don't? however we expect that both the result of addition and multiplication be of a bigger size than the operands!
Meaning that if a is std_logic_vector(3 downto 0) and b is std_logic_vector(3 downto 0) and c is std_logic_vector(4 downto 0) and d is std_logic_vector(7 downto 0)
so c <= a+ b; -- This gives an error for size mismatch
while d <= a*b; -- This goes OK with the VHDL compiler.
Regards