function to_string(
a : data_bit_vector
) return string is
variable result : string(1 to a'length) := (others => '-');
begin
return result;
end function to_string;
and here is how it gets formatted
function to_string(
a : data_bit_vector
) return string is
variable result : string(1 to a'length) := (others => ' - ');
begin
return result;
end function to_string;
The issue is that (others => '-') gets formatted to (others => ' - '). As you can see there is a pair of spaces around the - sign. This is not correct and it throws an error as the compiler expects only one character. The same occurs with +, *, etc. So the fix would be to not apply formatting for single characters in between single quotes.
Here is the original code
and here is how it gets formatted
The issue is that
(others => '-')
gets formatted to(others => ' - ')
. As you can see there is a pair of spaces around the - sign. This is not correct and it throws an error as the compiler expects only one character. The same occurs with +, *, etc. So the fix would be to not apply formatting for single characters in between single quotes.