Sep 14, 2015 #1 M milan.km Member level 3 Joined Sep 14, 2015 Messages 55 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 435 hi... I have this line in my testbench : Code: file_open(LPFIn_file,"E:H.txt",read_mode); but the simulation can not pass this line,and the following lines repeated until I break the simulation: ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900500 ns Iteration: 0 Instance: /H1_tb # ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900505 ns Iteration: 0 Instance: /H1_tb # ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900510 ns Iteration: 0 Instance: /H1_tb Click to expand... can anybody tell me how to fix this? thanks
hi... I have this line in my testbench : Code: file_open(LPFIn_file,"E:H.txt",read_mode); but the simulation can not pass this line,and the following lines repeated until I break the simulation: ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900500 ns Iteration: 0 Instance: /H1_tb # ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900505 ns Iteration: 0 Instance: /H1_tb # ** Error: (vsim-3341) Cannot open file "E:H.txt"; it is already open. # Time: 5900510 ns Iteration: 0 Instance: /H1_tb Click to expand... can anybody tell me how to fix this? thanks
Sep 14, 2015 #2 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,048 Trophy points 1,393 Activity points 39,769 I think the error is fairly self explanitory - you're trying to open the same file multiple times without closing it. Why not post the actual code, not just a single line, so we can understand the context.
I think the error is fairly self explanitory - you're trying to open the same file multiple times without closing it. Why not post the actual code, not just a single line, so we can understand the context.
Sep 14, 2015 #3 M milan.km Member level 3 Joined Sep 14, 2015 Messages 55 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 435 thanks TrickyDicky. this is part of the code of the testbench,the whole code is long. clk=30 ns Code VHDL - [expand]1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process file In1:text ; variable fstatus:File_open_status; variable line_input:line; variable PixelIn1:integer; begin file_open(In1,"E:H.txt",read_mode); wait for 4 ns; while not endfile( In1 ) loop readline( In1, line_input ); read( line_input, PixelIn1 ); p_in <=to_unsigned(PixelIn1,8); wait for 30 ns; end loop; Last edited by a moderator: Sep 14, 2015
thanks TrickyDicky. this is part of the code of the testbench,the whole code is long. clk=30 ns Code VHDL - [expand]1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process file In1:text ; variable fstatus:File_open_status; variable line_input:line; variable PixelIn1:integer; begin file_open(In1,"E:H.txt",read_mode); wait for 4 ns; while not endfile( In1 ) loop readline( In1, line_input ); read( line_input, PixelIn1 ); p_in <=to_unsigned(PixelIn1,8); wait for 30 ns; end loop;
Sep 14, 2015 #4 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,048 Trophy points 1,393 Activity points 39,769 well, according to your code, when the while loop completes, you try and open the file again. there is no call to file_close(in1);
well, according to your code, when the while loop completes, you try and open the file again. there is no call to file_close(in1);
Sep 14, 2015 #5 M milan.km Member level 3 Joined Sep 14, 2015 Messages 55 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 435 why this is happening? I thought the process without sensivity list is executed one time,but according to your answer,it is repeating?? I have another problem with my testbench should I wrote it here or i another topic?
why this is happening? I thought the process without sensivity list is executed one time,but according to your answer,it is repeating?? I have another problem with my testbench should I wrote it here or i another topic?
Sep 14, 2015 #6 K K-J Advanced Member level 2 Joined Jan 26, 2012 Messages 657 Helped 308 Reputation 620 Reaction score 301 Trophy points 1,343 Activity points 7,053 milan.km said: why this is happening? I thought the process without sensivity list is executed one time,but according to your answer,it is repeating?? Click to expand... No. If you want a process to run only once, then the last statement in the process should be 'wait;' which will cause the process to wait forever. I have another problem with my testbench should I wrote it here or i another topic? Click to expand... Sound like it is another topic to me. Kevin
milan.km said: why this is happening? I thought the process without sensivity list is executed one time,but according to your answer,it is repeating?? Click to expand... No. If you want a process to run only once, then the last statement in the process should be 'wait;' which will cause the process to wait forever. I have another problem with my testbench should I wrote it here or i another topic? Click to expand... Sound like it is another topic to me. Kevin