A
ALuPin@web.de
Guest
Hi,
in the following process I write some data into a file:
WRITEFILE: PROCESS(clk)
FILE G: TEXT;
VARIABLE L: LINE;
VARIABLE P3 : string(1 TO 2) := "P3";
VARIABLE homepage : string(1 TO 32):= "# Test";
VARIABLE four : string(1 TO 3) := "4 4";
VARIABLE space : string(1 TO 1) := " ";
BEGIN
IF falling_edge(clk) THEN
IF rst_cnt=0 THEN
FILE_OPEN(G, "test4x4readback.ppm", WRITE_MODE);
WRITE(L, P3);
WRITELINE(G, L);
WRITE(L, homepage);
WRITELINE(G, L);
WRITE(L, four);
WRITELINE(G, L);
WRITE(L, 255);
--WRITELINE(G, L);
rst_cnt <= 1;
ELSE
IF ls_wr='1' THEN
row_cnt <= row_cnt + 3;
IF row_cnt MOD 24 = 0 OR row_cnt=0 THEN
WRITELINE(G, L);
END IF;
WRITE(L, red); WRITE(L, space);
WRITE(L, green); WRITE(L, space);
WRITE(L, blue); WRITE(L, space);
END IF;
END IF;
END IF;
END PROCESS WRITEFILE;
Now I want to close the corresponding file when some trigger occurs, at
the same
time I want to create a new file and begin to write to it.
for example :
#1 trigger
If trigger='1' THEN
close (file1);
open(file2);
end if;
#2 trigger
if trigger='1' THEN
close(file2);
open(file3);
end if;
....
How can I do that ? Do I have to declare the number of files I want to
write to and
how do I handle them?
Thank you for your opinion.
Rgds
André
in the following process I write some data into a file:
WRITEFILE: PROCESS(clk)
FILE G: TEXT;
VARIABLE L: LINE;
VARIABLE P3 : string(1 TO 2) := "P3";
VARIABLE homepage : string(1 TO 32):= "# Test";
VARIABLE four : string(1 TO 3) := "4 4";
VARIABLE space : string(1 TO 1) := " ";
BEGIN
IF falling_edge(clk) THEN
IF rst_cnt=0 THEN
FILE_OPEN(G, "test4x4readback.ppm", WRITE_MODE);
WRITE(L, P3);
WRITELINE(G, L);
WRITE(L, homepage);
WRITELINE(G, L);
WRITE(L, four);
WRITELINE(G, L);
WRITE(L, 255);
--WRITELINE(G, L);
rst_cnt <= 1;
ELSE
IF ls_wr='1' THEN
row_cnt <= row_cnt + 3;
IF row_cnt MOD 24 = 0 OR row_cnt=0 THEN
WRITELINE(G, L);
END IF;
WRITE(L, red); WRITE(L, space);
WRITE(L, green); WRITE(L, space);
WRITE(L, blue); WRITE(L, space);
END IF;
END IF;
END IF;
END PROCESS WRITEFILE;
Now I want to close the corresponding file when some trigger occurs, at
the same
time I want to create a new file and begin to write to it.
for example :
#1 trigger
If trigger='1' THEN
close (file1);
open(file2);
end if;
#2 trigger
if trigger='1' THEN
close(file2);
open(file3);
end if;
....
How can I do that ? Do I have to declare the number of files I want to
write to and
how do I handle them?
Thank you for your opinion.
Rgds
André