next up previous contents
Next: 3.5 Type and Field Up: 3. Data Types Previous: 3.3 Access Types

3.4 File Types

In the package TEXTIO the data types text and line are declared. These types and some additional functions provide access to text files similarly to other programming languages. This can be useful during simulation, for example, for reading stimuli data from a text file or for storing the output data of the unit under test (UUT).

Example:
use std.textio.all;
  - read data from file-1 (test.dat)
  - write data to file-2 (out.dat )
entity COPY4 is                        
without ports
end COPY4;

architecture FIRST of COPY4 is
begin
  process (go)
    - file with the input data:
    file INSTUFF: text is in "\path\test.dat";
    - file for the output data:
    file OUTFILE: text is out "\path\out.dat";
    variable L1, L2: line;
    variable VECT: bit_vector(3 downto 0);
    
    begin
      while not (endfile(INSTUFF)) loop   
until the end of file
        readline (INSTUFF, L1);        
read one line
        read (L1, VECT);   
copy the input data to VECT
        write (L2, VECT);   
copy VECT under a pointer to string
        writeline (OUTFILE, L2);   
write one line to OUTFILE
      end loop;
    end process;
end FIRST;

The package TEXTIO consists mainly of the following declarations and definitions:

All declarations found in the package TEXTIO are itemized in Appendix A.


next up previous contents
Next: 3.5 Type and Field Up: 3. Data Types Previous: 3.3 Access Types
Richard Geissler
1998-10-07