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

UNIVERSAL TECHNIQUES

There are some universal debugging techniques that work no matter what you are debugging. These techniques are looking at values, and seeing what is active. These are universal techniques since they work with Verilog, software, and even oscilloscopes.

Printing Out Messages

The easiest way to find out what is going on inside your models is to print out messages. There are two basic types of messages to print out: messages that indicate when code is running, and messages that report on values that are received or generated.

"I am here."

The simplest type of message to print out is a message that indicates where a block of code is running. You can add a $display statement inside an always block to indicate when certain tests are about to start, or to indicate the completion of a test.

Adding a $display statement to an always block can tell you when that block was triggered. Even a function can have $display statements in it. Knowing what is running gives you some insight into the functionality of the design. Knowing whether or not a critical test or event takes place can greatly narrow down the search for bugs.

Values

Adding statements to print out the values received and generated by a function or always block allows you to check visually for proper behavior of a block of code. You can then determine if an error is caused by values passed in, or by...

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: Barcode Software
Finish!
Privacy Policy

This is embarrasing...

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