Forum Discussion
Altera_Forum
Honored Contributor
9 years ago --- Quote Start --- The string type is not suitable for synthesis - it doesnt really have much meaning in hardware, it would be used more for debugging in simulation. What are you doing with the string? do you have some driver that can covert the characters in the string to some form of pixel matrix? --- Quote End --- Yes, I do. I have a font ROM that I use to tell me if a pixel should be on for any given character in a string. The only step remaining is to convert ints to strings. I went at it from every direction and finally found that I had to make a giant case block to get it to work. Now I can finally display rapidly changing variables that are really helpful for debugging. It's unfortunate that the solution had to be so retarded though.. (I already have a ROM for displaying text that the resulting string is sent to.)
function int_to_str(int : integer) return string is
variable a : natural := 0;
variable r : string(1 to 11);
begin
a := abs (int);
case a is
when 0 => r := "0 ";
when 1 => r := "1 ";
when 2 => r := "2 ";
when 3 => r := "3 ";
.
.
.
when 1000 => r := "1000 ";
when others => r := "???????????";
end case;
if (int < 0) then
r := '-' & r(1 to 10);
end if;
return r;
end int_to_str;