read_write : process(clk, rst)
...
....
variable str1 : string(1 to 9) := "data0.txt"; --for file number 0-9
variable str2 : string(1 to 10) := "data10.txt"; --for file number 10-99
variable str3 : string(1 to 11) := "data100.txt"; ----for file number 100-999
variable str4 : string(1 to 12) := "data1000.txt";
variable str5 : string(1 to 13) := "data10000.txt";
variable str6 : string(1 to 14) := "data100000.txt";
variable i : integer := 0;
...
begin
...
..
if(rd_file_process = '1') then
if(inline = NULL) then
if(i<10) then
file_open(infile, str1, read_mode);
elsif(i>= 10 and i<100) then
file_open(infile, str2, read_mode);
elsif(i>= 100 and i<1000) then
file_open(infile, str3, read_mode);
elsif(i>=1000 and i<10000) then
file_open(infile, str4, read_mode);
elsif(i>=1000 and i<10000) then
file_open(infile, str5, read_mode);
end if;
...
...i := i +1;
end process read_write;