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.

VHDL - ModelSim - "Read past end of file" problem

Status
Not open for further replies.

vtomic85

Newbie level 1
Joined
Sep 22, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
Hi!

I want to read two integer values from a .txt file named "entry.txt", which is located in the project folder, with all of the .vhd files.

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- ...
variable inline : line;
file inputFile : text open read_mode is "entry.txt";
variable mynum: integer;
variable stdmynum: std_logic_vector (N-1 downto 0);
-- ...
readline(inputFile,inline);
read(inline,mynum);
stdmynum:= std_logic_vector(to_signed(mynum, stdmynum'length));
mem(0) := stdbroj;
readline(inputFile,inline);
read(inline,mynum);
stdmynum:= std_logic_vector(to_signed(mynum, stdmynum'length));
mem(1) := stdbroj;
-- ...


When I start the simulation, I get a fatal error: "TEXTIO: Read past end of file "entry.txt"", in the line with the first readline command. My file contains two integers (one in the first line and the other one in the second line), and in the code you can see that I try to read two integers and nothing else.
What could be the problem?
 
Last edited:

Do you have the "end of line" sequence (hex 0a for unix/linux, hex 0d 0a for Windows) after the second number?
Some editors allow you to create files with "end of line" missing from the last line.
Unix/linux editor "vi" does not allow that.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top