I'm adjusting some vhdl code an am getting the following error:
Error (10327): VHDL error at myfile.vhd(87): can't determine
definition of operator ""&"" — found 0 possible definitions
The abbreviated code is:
port(
input1: in std_logic_vector(1 to 1);
...)
signal temp : signed1x13;
-- defined elsewhere: type signed1x13 is array (1 to 1) of signed(12 downto 0);
begin
...
variable slice : signed(12 downto 0);
slice := temp(0);
temp <= slice(11 downto 0) & input1;
As I understand it, the &
operator should append a bit onto the end of the bit array slice(11 downto 0)
.
I've been toying with changing the data types but haven't got it working yet.
Is there something obvious I'm doing wrong?
Best Answer
With a couple of fixes and creating a Minimal, Complete and Verifiable Example:
Your code snippet was converted to a complete entity and architecture pair and the creation of a process where a variable can be declared.
The two fixes are the assignment to variable slice in the process where the index (0) is out of bounds for the type declaration used for temp, corrected to (1) and a type conversion from std_logic_vector to signed in the assignment to temp.
This expanded code example analyzes.
The original issue being there is no concatenation operator for a left operand of signed and a right operand of std_logic_vector. Fixing that with the type conversion to signed revealed the static bounds violation (
temp(0)
).