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

Reply

VHDL - Passing file name to procedure.

 
Thread Tools Search this Thread
Old 09-20-2005, 01:20 PM   #1
Default Passing file name to procedure.


Hi all,

I want to pass a file name to a procedure so the
procedure reads all the header blurb and discards it,
terminating when it reaches a defined text sequence,
e.g. "END_OF_HEADER"

This is because I have lots of data tables to read in,
all with different header blurb describing the table
data contents.

Code snippets a follows:

-- Test bench Arcitecture declarative region:

FILE lut_data : TEXT OPEN read_mode IS "D:/lut_data.txt";
FILE tx_data : TEXT OPEN read_mode IS "D:/tx_data.txt";

--------------------------------------------------------
-- Turn this bit into a procedure, calling lut_data file
--------------------------------------------------------
dummy_string := "XXXXXXXXXXXXX";
WHILE (dummy_string /= "END_OF_HEADER") LOOP
readline(lut_data, my_input_line);
read(my_input_line, dummy_string);
END LOOP; -- dummy string.
---------------------------------------------------------
-- This bit extracts the data from the file.
---------------------------------------------------------
WHILE NOT endfile(lut_data) LOOP
FOR lut_index IN 0 TO 5 LOOP
readline(lut_data, my_input_line);
FOR i IN 15 DOWNTO 0 LOOP
hread(my_input_line, read_lut_data); -- hex read.
read_lut(lut_index)(i*8+7 DOWNTO i* <= read_lut_data;
END LOOP;
END LOOP;
END LOOP;
--------------------------------------------------------
-- Turn this bit same procedure, but calling tx_data file
--------------------------------------------------------
dummy_string := "XXXXXXXXXXXXX";
WHILE (dummy_string /= "END_OF_HEADER") LOOP
readline(tx_data, my_input_line);
read(my_input_line, dummy_string);
END LOOP; -- dummy string.
---------------------------------------------------------
-- Similarly, read the tx_data file.
---------------------------------------------------------

-- And more files later on, etc, etc.

I've tried to write a PROCEDURE header_discard, that passes lut_data or
tx_data as a variable string, but doesn't compile.

Any ideas please?



Niv
  Reply With Quote
Old 09-20-2005, 03:04 PM   #2
Niv
 
Posts: n/a
Default Re: Passing file name to procedure.
I've sorted it myself already, so no need to reply,
Thanks anyway.



Niv
  Reply With Quote
Old 09-20-2005, 03:04 PM   #3
john Doef
 
Posts: n/a
Default Re: Passing file name to procedure.

Niv a écrit :

> Hi all,
>
> I want to pass a file name to a procedure so the
> procedure reads all the header blurb and discards it,
> terminating when it reaches a defined text sequence,
> e.g. "END_OF_HEADER"
>
> This is because I have lots of data tables to read in,
> all with different header blurb describing the table
> data contents.
>
> Code snippets a follows:

[...]

> I've tried to write a PROCEDURE header_discard, that passes lut_data or
> tx_data as a variable string, but doesn't compile.

lu_data and tx_data are not strings but files!

Try something like:
procedure filter (file f:text)
is
....

JD.



john Doef
  Reply With Quote
Old 09-20-2005, 06:13 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: Passing file name to procedure.
Niv wrote:
> I've sorted it myself already, so no need to reply,


Are you going to share the solution
or leave us suspended?

-- Mike Treseler


Mike Treseler
  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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SONY DVD RW DW-G120A SOMETIMES FAILS...... atlantic965 DVD Video 0 06-18-2006 10:36 PM
problems backing up dvds Lawrence Traub DVD Video 11 09-27-2005 07:34 PM
Re: Ripping DVDs. Please answer the attached question. - Question.txt Stan Brown DVD Video 19 02-09-2005 11:19 PM
Burn process failed - help! Log file posted for help troubleshooting Michael Mason DVD Video 1 08-16-2004 09:24 PM
Pioneer A05 Problems Bill Stock DVD Video 8 11-28-2003 05:03 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46