为什么不将行型字符串复制到固定的字符串变量或信号?
signal inputline:string(0到80);
...
输入线以下为原文
Hi Hezi,
why aren't you copying the line-type string to a fixed string variable or signal?
signal inputline : string (0 to 80);
...
inputline <= a(0 to 80);
This works only if your a-object is at least 81 chars wide.
Otherwise you have to loop from char 1 to EOL, with a stop at char 80. longer lines will be truncated.
You can have arrays of input lines and once they are filled you can access each char at random easily.
Make your data sizes static, and life is easier with VHDL. ;-)
-- update:
if you want to work with dynamic data types, copying pointers is not the solution.
instead you have to make a new instance:
eg:
signal b : line;
...
b <= new string(<>); -- hope this works as expected otherwise : (0 to 80) or something
i:=0;
while a(i) /= EOF loop
b(i) <= ai);
end loop;
something like that... syntax not checked, just meant to show the principle.
don't forget to use deallocate(b) at some time to prevent memory leaks.
-- end update
Have a nice simulation.
Eilert