Verilog Quickstart: A Practical Guide to Simulation and Synthesis in Verilog, 3rd Edition

Chapter 5: System Tasks for Displaying Results

OVERVIEW

The hello simulation and the previous chapter's examples gave you a preview of one way to print out information: The $display system task. All of the commands to print out results are relatives of the $display system task.

What Is a System Task?

As you learn the Verilog language, you will see that Verilog is a flexible language for modeling. There are some special built-in commands for system functions such as printing messages or reading and writing files. The special commands are called system tasks and they all begin with the "$" symbol. The "$" symbol is also used to indicate system functions.

$display and Its Relatives

Using the $display system task is the basic way to print out results. The simplest form of $display is shown in the hello simulation in Chapter 2 and is repeated in Example 5-1.

Example 5-1: Displaying a String
<a name="156"></a><a name="page48"></a>$display ("Hello Verilog");

This simple form of $display simply prints the string between the quotation marks, followed by a new line.

Example 5-2: Displaying a Single Value
$display (a);

The form of $display shown in Example 5-2 prints out the value of a in the default radix, which is decimal. This is a common way to debug a simulation interactively. You can use the $display command in your source code or as an interactive command.

Example 5-3: Displaying Multiple Values
$display (a, b);$display (a, , b);

The two lines...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Notebook and Laptop Computers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.