Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

simulation can not read the text file?

Status
Not open for further replies.

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

can anybody tell me how to fix this?
thanks
 

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.
 
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:

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);
 
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??
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?
Sound like it is another topic to me.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top