The IntelliGen Gen Debugger is a powerful Specman tool that can debug any generation problem that you might face. The most obvious and common generation problem is a contradiction, but the Gen Debugger can handle various other problems, such as user errors, performance problems and unexpected generation results.
In this post, we will focus on one of the most extreme cases of unexpected generation: a constraint which is not enforced. This can happen due to problems with your code, even in a simple example such as the following:
Let’s explore a situation where the above code fails with a DUT error, and examine the full debug process – from detecting and identifying the problem to tracing its root cause.
Because the above code does a check that p.x == 100, we must conclude that if this check failed, it must be that p.x is not 100, and the constraint we gave was not enforced. Now our task is to identify the cause of failure.
We can do this by performing the following steps:
1. Open the Gen Debugger at the generation of the field. We do this as follows:
a. Issue the following command: ‘config gen –collect = ALL’. This activates the Gen Debugger, and ensures that it keeps all information. (Note: In Specman versions prior to version 11.1, the command is: ‘br gen err; config gen –del_old_dbg_info = FALSE’)
b. Issue the following command: ‘br on error’. This ensures that the Gen Debugger stops at the dut_error, so that we can determine what failed.
c. After the Gen Debugger stops, issue the following command: ‘show gen –instance p.x’ (you can specify any legal path to the relevant variable). This opens the Gen Debugger at the generation of the problematic field. This command is particularly useful when using the Gen Debugger in ‘offline’ mode, after the generation has finished. If you stop during generation (for example, on an error), the ‘gtree’ command will open the gen debugger in its current state.
In our example, the following figure illustrates the result.
Interestingly, the generated value (highlighted by the Gen Debugger in blue) shows us that the constraint was enforced.
This means that for an error to have occurred, that generated value had to have been changed later on during processing. But where? How do we find the procedural location of the change?
The good news is that we can use the Gen Debugger to help us as we try to pinpoint the location of the problem. But first we need to perform a rerun, stopping immediately after the generation.
2. Ascertain the needed values and then rerun the test as follows:
a. In the Gen Debugger, look for the Gen-Action and Connect Field Set (CFS) values. In our example (see the following figures), the Gen Action value is 2, and the CFS value is 20.
b. Reload the code and issue ‘br on gen action # cfs #’ (in our example, ‘br on gen action 2 cfs 20’), so that the test reruns and stops immediately after the generation.
c. After the run is completed, issue ‘gfinish’, which will advance to the completion of this CFS, and check the results (see the following figure). Notice that p.x. has the correct value.
At this point, the role of the Gen Debugger is over, and we need to use the source debugger. Since the problem is not in generation, we need to find out where in the procedural code this value was changed.
3. Issue the source-debugger command ‘br on change sys.p.x’ and continue. This will stop at the code which is responsible for the discrepancy (see the following figure).
Through this example, we saw that what might seem to be an ignored constraint can actually be caused by a problem elsewhere (that is, that the constraint has not been ignored.)
And in the process, we learned how to use the Gen Debugger to help locate the actual source of the problem, and we saw several aspects of the Gen Debugger, including:
· its offline and online debug capabilities (Steps 1 & 2, respectively)
· its connection to the source debugger (Step 3)
In the next post, we will see additional possible causes for the “ignored constraint” behavior, and in the process we will further examine Gen Debugger functionality.