nabla101
Junior Member level 3
Hi, I don't understand what is the benefit of using unsigned or signed types from IEEE.numeric_std library over std_logic_vector from IEEE.std_logic_ 1164, since you cannot assign integer values to either of these types, but still have to define individual elements of an array. For example:
variable u_int : unsigned(3 to 0) := "0000";
is legal, while:
variable u_int : unsigned(3 to 0) := 0;
is illegal. I thought the whole point of these types was to allow you to c onvert from std_logic_vector, easily perform arithmetic on them as integers, and then convert back to std_logic_vector...wouldn't it be better if the compiler determined the upper and lower values the signed or unsigned integrs could have based on the natural range they are given, then allow you to make straight-foward integer assignments (such as in the second case above), and then determine if the integer you try to assign is in range or not, instead of complaining that it is not in the format "xxxx".
variable u_int : unsigned(3 to 0) := "0000";
is legal, while:
variable u_int : unsigned(3 to 0) := 0;
is illegal. I thought the whole point of these types was to allow you to c onvert from std_logic_vector, easily perform arithmetic on them as integers, and then convert back to std_logic_vector...wouldn't it be better if the compiler determined the upper and lower values the signed or unsigned integrs could have based on the natural range they are given, then allow you to make straight-foward integer assignments (such as in the second case above), and then determine if the integer you try to assign is in range or not, instead of complaining that it is not in the format "xxxx".