
The write statement is used to display the current values of variables and nets. For example, the following statement causes the current value of the net "outputa" and the variable "xyz" to be displayed on the standard output.
write 0,xyz,outputa
Windows Format:
write @FileName,xyz,outputa
Or:
write |DLLName,xyz,outputa
In the second format, the first character is the vertical mark, the shift of the back-slash.
The first operand of a write statement is a file number. Just as in a read statement, the file number must be or evaluate to a number from zero through 10 inclusive. The number zero is used to specify the standard output of the UNIX command used to invoke the simulator. The numbers from 1 through 10 refer to the operands of the UNIX command used to invoke the simulator. If the number 5, say, is used as a file number, the fifth operand of the command will be treated as a file name. The file will be opened for output and the data from the write command will be written on the file.
Each write statement produces one line of output. The values of the specified nets and variables are written in hexadecimal with no leading or trailing spaces, and separated by commas. All hexadecimal values for a particular net or variable will have the same number of digits, with leading zeros if necessary. Variations of the write command can be used to specify data in different formats.
The writed statement can be used to write values in decimal rather than hexadecimal. The format of the writed statement is identical to that of the write statement. When data is written in decimal, leading zeros are omitted. In all other respects, the output format is identical to that of the write statement.
The writex statement can be used to include the variable or net name in the output. When writex is used, the variable or net name is prepended to the the value, and separated from the value by an equal sign. The writex statement outputs values in hexadecimal, with leading zeros to maintain a constant width.
The writexd statement can be used to output named data in decimal. The decimal output will not contain leading zeros.
The display statement can be used as shorthand for writing named hexadecimal data on the standard output. The following two statements are identical.
write 0,xyz,outputa
display xyz,outputa
In the Windows version of FHDL, the display command accepts a file name or a DLL name as the first operand. File names start with the @ character, while DLL names start with the | character, the vertical mark.
The displayd statement can be used to display named decimal data on the standard output. It is equivalent to using a writexd statement with file zero.