![]() |
|
|
|||||||
![]() |
VHDL - Passing file name to procedure. |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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* 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 |
|
|
|
|
#2 |
|
Posts: n/a
|
I've sorted it myself already, so no need to reply,
Thanks anyway. Niv |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |