yes, there's a reason.
I use this generic to indicate the highest address of memory stack...I want it to overflow to (others => '0') when a value reaches this address.
For example: if it's "1111" and '1' is added it will overflow to "0000".
So while "1111" + '1' = "0000" the integer equivalent won't apply because 15 + 1 /= 0
I don't understand what "y" is. Is it a std_logic_vector that defines how many bits "x" will have?constant x: std_logic_vector( (conv_integer- 1 downto 0) ) := (others => '1');
-- y is a std_logic_vector defined in the entity generics
shaiko said:Are you saying that if y is defined as an unsigned integer it would wrap like a vector?
signal x: unsigned(3 downto 0);
x <= x + 1;
No, "unsigned" in numeric_std is not an unsigned integer. It is a std_logic_vector interpreted as an unsigned number.
Sorry - saw this an felt the urge to do a pedant post.
An unsigned/signed type is NOT a std_logic_vector. They are their own types. Because they are all arrays of std_logic, they are "similar" type and you can do simple type conversions between them, but an unsigned is NOT a std_logic_vector. it can also be treated as an unsigned integer (which is what it is intended as). it is the non-standard std_logic_unsigned library that allows you to interpret std_logic_vectors as unsigned integers.
Comparing an integer against unsigned or signed works without additional prerequisites, at least in Altera Quartus and ModelSim. I'm using it since ever.it wont work as it is, because it is ambiguous - the compile wont know if the string is a signed or unsigned type. You will need to either convert the integer or qualify the string.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?