I am loading text data into a VHDL test bench and I want to convert input strings into integer values.
eg: "123" => 123
Can someone recommend a "best" way of converting strings to integers in VHDL?
readline and read functions should achieve what you are looking for.
Basically:
Code Snippet:
library STD;
use std.textio.all;
...
variable File_Name : string;
file my_file : text;
variable lineptr : line;
variable temp : integer;
...
file_open(my_file, File_Name, read_mode); -- open the file
readline(my_file, lineptr); -- put the next line of the file into a buffer
read(lineptr, temp); -- "parse" the line buffer to an integer
-- temp now contains the integer from the line in the file
...