Use the print command to print the value(s) of a variable or expression from the command window. Use the display command to display the value(s). The display command prints the value(s) of the variable or expression immediately, and creates a display event so that the values are updated automatically whenever the program stops.
The commands have this format:
[where (expression)] command variable[, variable ...]
The optional where (expression) syntax sets the context for printing the variable or expression; see below.
In the syntax, command is either print or display, and variable is the variable or expression to be displayed or printed.
Redirection of output to a window via the on window syntax works slightly differently for display and print from the way it works for other commands; see " Redirecting Output" for a discussion of redirection. Separate windows are created for each variable or expression that you print or display. Thus, the commands
display x on dedicated display y/4 on dedicated display [0:128:2]z on dedicated
create three windows, each of which is updated separately.
To print or display the contents of a register, precede the register's name with a dollar sign. For example,
print $pc
prints the program counter register. See " Displaying the Contents of Registers" for a list of register names supported by Prism.
You can precede the print or display command with a where statement that can make elements of a variable or array inactive. Inactive elements are not printed in the command window; " Overview of Data Visualization" describes how they are treated in visualizers. Making elements inactive is referred to as setting the context.
To set the context, follow the where keyword with an expression in parentheses. The expression must evaluate to true or false for every element of the variable or array being printed.
For example,
where (i .gt. 0) print i
prints (in the command window) only the values of i that are greater than 0.
You can use certain Fortran intrinsics in the where statement. For example,
where (a .eq. maxval(a)) print a
prints the element of a that has the largest value. (This is equivalent to the MAXLOC intrinsic function.) See " Writing Expressions in Prism" for more information on writing expressions in Prism.
Note that setting the context affects only the printing or displaying of the variable. It does not affect the actual context of the program as it executes.
You can specify the radix to be used in printing or displaying values by adding a suffix of the form /radix to the print or display command. radix can be b (binary), d (decimal), x (hexadecimal), or o (octal). For example,
print/b pvar1
prints the binary representation of pvar1 in the command window.
display/x pvar2 on dedicated
displays the hexadecimal values of pvar2 in a dedicated window.
The default radix is decimal, unless you have used the set $radix command to change it; see " Changing the Default Radix".