Contents: screen output, files, simulation report, exercises
Text is read and written by using textio functions (read and write) and a variable of the type line. Since variables are used for textio, input and output is must be done in processes. The output information is first placed in text form into the variable of type line and then sent to outpu via an additional function called writeline. This is shown in the following example.
The writeline function outputs the current value of a line to the screen, and empties the line for re-use. The first argument of the writeline function just indicates that the text should be output to the screen. Given that the maxval is initialized to 100, the message sent to the screan is:
overflow : 800
The following procedure uses an input file to read a string of characters and assigns them to a bit type.
The problem with the above procedure is that each time it is executed the lecture of the file starts from the beginning. The re-use of the same procedure several times without the reading initialization requires the file declaration to be placed outside the procedure. This can take place in a process statement or in the statement part of an architecture.
report_p: process (ph1,ph2) file sortie: text is out "phases.rep"; variable fill: string (1 to 3):=" .."; variable tampon: line; begin
see the content of io_utils package