Accessing Text files

Joined
Aug 28, 2006
Messages
3
Reaction score
0
Hi All,

I am trying to access text files with binary data in it using the TEXTIO package, but i get errors saying cant access files or file does not exist...below is the copy of the program i am using, please correct me if i am doing anything wrong:

USE WORK.TEXTIO.ALL;
ENTITY square IS
PORT( go : IN std_logic);
END square;
ARCHITECTURE simple OF square IS
BEGIN
PROCESS(go)
FILE infile : TEXT IS IN "/1.txt";
FILE outfile : TEXT IS OUT "/2.txt";
VARIABLE out_line, my_line : LINE;
VARIABLE int_val : INTEGER;
BEGIN
WHILE NOT( ENDFILE(infile)) LOOP
-- read a line from the input file
READLINE( infile, my_line);
-- read a value from the line
READ( my_line, int_val);
if(int_val='0')
THEN int_val := '1';
elsif(int_val='1')
THEN int_val := '0';
else
int_val := '0';

end if;
-- write the changed value to the line
WRITE( out_line, int_val);
-- write the line to the output file
WRITELINE( outfile, out_line);
END LOOP;
END PROCESS;
END simple;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top