File |
LRM §4.3.1.4. |
A file declaration declares a file of the specified type.
type new_name is file of type_name; file new_name: data_type [ [ open file_kind ] is file_name ]; file_kind = read_mode | write_mode | append_mode file new_name: data_type is [ mode ] file_name; -- VHDL'87 only mode = in | out -- VHDL'87 only file_name = string_expression
The file declaration creates one or more file objects of the specified type. Such a declaration can be included in any declarative part in which the objects can be created, that is within architecture bodies, processes, blocks, packages or subprograms.
The optional open file_kind allows specifying how the physical file associated with the file object should be opened. The expression must have the predefined type file_open_kind value, which is declared in the Standard package.
The file_name must be an expression of predefined type String. The file_name identifies an external file in the host file system that is associated with the file object. This association provides a mechanism for either importing data contained in an external file into the design during simulation or exporting data generated during simulation to an external file.
The following procedures and functions are defined for all file types:
procedure file_open (file F: FT; external_name: in string; open_kind: in file_open_kind := read_mode); procedure file_open (status: out file_open_status; file F: FT; external_name: in string; open_kind: in file_open_kind := read_mode); procedure file_close (file F: FT); procedure read (file F: FT; value: out TM); procedure write (file F: FT; value: in TM); function endfile (file F: FT) return BOOLEAN;
type DataFile is file of string; file F: DataFile open write_mode is "FileName"; -- VHDL'93 file F: DataFile is out "filename"; -- VHDL'87