VHDL Programming

(C. Jardin) #1

Data Types 103


WRITE(file, data)Procedure

ENDFILE(file)Function, returns boolean

Procedure READreads an object from the file and returns the object in
argument data. Procedure WRITEwrites argument data to the file specified
by the file argument. Finally, function ENDFILEreturns true when the file
is currently at the end-of-file mark.
Using these procedures and functions requires a file type declaration
and a file object declaration.

FILE TYPE DECLARATION A file type declaration specifies the
name of the file type and the base type of the file. Following is an example
of a file type declaration:

TYPE integer_file IS FILE OF INTEGER;

This declaration specifies a file type whose name is integer_fileand
is of type INTEGER. This declaration corresponds to the file in Figure 4-10.

FILE OBJECT DECLARATION A file object makes use of a file type
and declares an object of type FILE. The file object declaration specifies
the name of the file object, the mode of the file, and the physical disk path
name. The file mode can be INor OUT. If the mode is IN, then the file can
be read with the READprocedure. If the mode is OUT, then the file can be
written with the WRITEprocedure. Here is an example:

FILE myfile : integer_file IS IN
“/doug/test/examples/data_file”;

This declaration declares a file object called myfilethat is an input file
of type integer_file. The last argument is the path name on the physical

Figure 4-10 Integer 1 Integer 2 ............ Integer N End of File
Pictorial Representa-
tion of Integer File.

OPCODE
ADDRMODE

SRC
DST

OPCODE
ADDRMODE

SRC

DST

OPCODE
ADDRMODE

SRC
DST

...........

...........
...........

...........

END

OF
FILE

MARK

Figure 4-11
Pictorial Representa-
tion of Complex File.
Free download pdf