From 24a0873f6d9a518a11ea3d250f88f44d9e6fd3e0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 5 Oct 2018 06:47:18 -0400 Subject: [PATCH] Commentary --- bin/verilator | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/bin/verilator b/bin/verilator index 85d5b2144..e27da8378 100755 --- a/bin/verilator +++ b/bin/verilator @@ -3983,17 +3983,30 @@ For example: will toggle forever and thus the executable will give the didn't converge error to prevent an infinite loop. -To debug this, run Verilator with --prof-cfuncs. Run make on the -generated files with "OPT=-DVL_DEBUG". Then call Verilated::debug(1) in -your main.cpp. +To debug this, first is to review any UNOPTFLAT warnings that were ignored, +though typically these can be ignored (at a performance cost), convergence +issues can also be flagged with this warning as Verilator didn't know if +they would eventually converge. + +Next, run Verilator with --prof-cfuncs. Run make on the generated +files with "OPT=-DVL_DEBUG". Then call Verilated::debug(1) in your +main.cpp. This will cause each change in a variable to print a message. Near the -bottom you'll see the code and variable that causes the problem. For the -program above: +bottom you'll see the variables that causes the problem. For the program +above: CHANGE: filename.v:1: b CHANGE: filename.v:2: a +If many signals are getting printed then most likely each are oscillating +(or there is a bug). It may also be that e.g. "a" may be oscillating, then +"a" feeds signal "c" which then is also reported as oscillating. + +Finally, rare more difficult cases can be debugged like a "C" program; +either enter GDB and use its tracing facilities, or edit the generated C++ +code to add appropriate prints to see what is going on. + =back