Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - reading files help

 
Thread Tools Search this Thread
Old 11-16-2006, 06:08 PM   #1
Default reading files help


hello,

i have written code to read in a file, being pgm format, it copies the first 4 lines as they just identifies the file properties, and then i want it to read integer values one by one and output to a file. the expected result should be same as the input file. can anyone tell me whats wrong with my code? any other suggestions how to go about it? and finally i have also been asked to create a memory array to store the information, is there any links or do you know howi would do this?

thank you in advance,

scott

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_textio.all;
use STD.textio.all;

entity file_io is
end file_io;

architecture sim of file_io is
file infile : text open READ_MODE is "input.txt";
file outfile : text open WRITE_MODE is "output.txt";
begin
fcopy : process
variable l: line;
variable number: integer;
variable h: line;
begin -- fcopy process
for i in 1 to 4 loop
readline(infile,l);
writeline(outfile,l);
end loop;
while not endfile(infile) loop
readline(infile,l);
read(l,number);
write(h,number);
writeline(outfile,h);
end loop;
file_close(infile);
file_close(outfile);
wait;
end process fcopy;
end sim;


Scott_uoa
Scott_uoa is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump