Reputation: 61
I've had an issue converting a vectors inputs to integers in my code. I am new to VHDL but the below code works with the integer RANGE commented out code but there is an error when I try to convert the vector values to an integers. Here is a copy of my code and error:
Update1: I've tried your fix and it takes care of one of the errors but the new error message and code looks like this:
Upvotes: 1
Views: 2142
Reputation: 385
In according to your declaration in follow line type mem is array (...) of std_logic_vector(...)
your memory waits for std_logic_vector
type rather than unsigned
like in your assignment RAMArray(unsigned(addr)) <= unsigned(din)
.
Here it is not sufficient to only use a type conversion to unsigned
, but you have to add type conversion function to_integer
in the argument. In other words
RAMArray(to_integer(unsigned(addr))) <= din
The second error is in the follow line qout <= RAMArray(addr)
. Here you should also use both the type conversion to unsigned
as well as the type conversion function to_integer
. The location parameter would be of the integer type. Example:
qout <= RAMArray(to_integer(unsigned(addr)))
Try to fix your code with my suggestions and I think it will work.
Upvotes: 1