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.

A question about VHDL TEXTIO

Status
Not open for further replies.

bigdog

Junior Member level 2
Joined
Jul 18, 2005
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,452
vhdl textio

Hello,
I'm trying to read some stimulus form a file, but an error always occur, would you like to help me to solve it, thanks.


Source code:

library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;


entity FILE_READ is
generic (
stim_file: string := "sim.dat"
);
port(
CLK : in std_logic;
RST : in std_logic;
Y : out std_logic_vector(5 downto 1);
EOG : out std_logic
);
end FILE_READ;


-- I/O Dictionary
--
-- Inputs:
--
-- CLK: new cell needed
-- RST: reset signal, wait with reading till reset seq complete
--
-- Outputs:
--
-- Y: Output vector
-- EOG: End Of Generation, all lines have been read from the file
--


architecture read_from_file of FILE_READ is


file stimulus: TEXT open read_mode is stim_file;

begin



-- read data and control information from a file

receive_data: process

variable l: line;
variable s: string(y'range);

begin

EOG <= '0';

-- wait for Reset to complete
wait until RST='1';
wait until RST='0';


while not endfile(stimulus) loop

-- read digital data from input file
readline(stimulus,l);
read(l,s); -- ******
Y <= to_std_logic_vector(s);

wait until CLK = '1';

end loop;

print("I@FILE_READ: reached end of "& stim_file);
EOG <= '1';

wait;

end process receive_data;


end read_from_file;


Simulator: NC Tools

ERROR Information:

Error! TEXTIO error
LINE of length 0 on READ of type STRING

File: ./file_read.vhd, line = 62, pos = 8 -- the line marked ******
Scope: :input_stim:receive_data
Time: 210 NS + 0
 

textio vhdl

bigdog said:
Hello,


Error! TEXTIO error
LINE of length 0 on READ of type STRING

File: ./file_read.vhd, line = 62, pos = 8 -- the line marked ******
Scope: :input_stim:receive_data
Time: 210 NS + 0

How does your sim.dat look like, I don't see much of an issue in your code. Looks like your sim.dat was empty?

Also, try using the GOOD argument of READ procedure. (3rd argument to READ procedure, returns boolean status flag).

HTH
Ajeetha, CVC
www.noveldv.com
 

vhdl textio read

Dear aji_vlsi,

You are right, I have modifid my stimulus file(the bottom line of the file is empty),
and the simulation is successful now.

Thank you!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top