Quantcast
Channel: Cadence Functional Verification
Viewing all articles
Browse latest Browse all 652

User Extensions to DUT Error

$
0
0

A question was raised to stackoverflow about how can one extend the dut_error() for printing more information. The capability to provide the test runners and debuggers more information upon an error can be a great enhancement to the quality and usability of the verification environment, so I decided to extend here a bit the answer given in the stackoverflow.

The request was worded: Can we extend the dut_error() method to print additional information such as the name of the package from which the error is reported.

Actually, although it looks like a method, dut_error() is not a method so it cannot be extended. But what you can do is to use the dut_error_struct. This struct contains two methods that you can extend, pre_error() and write(), and multiple methods that you can call.

  • The pre_error() is a hook method called when dut_error() is called.
  • The write() method is the method that writes the error message, and you can extend it to add information and/or modify the message format.

In your code you can use the dut_error_struct API for getting information such as which struct issued the error.  

For example, the following code increases a counter whenever there is an error during post_generate(), and reduces the check effect to IGNORE:

extend dut_error_struct {
    pre_error()
 is also {
        if source_method_name() == "post_generate" {
            out("\nProblem in generation, ",
                 source_location());
            sys.gen_errors_counter += 1;

            set_check_effect
(IGNORE);
        };
    };
};

To get the package name, as was requested in the original request, we have to know which struct reported this error, and then query it using the reflection API:

extend dut_error_struct {
   write() is first {
        // Special output for errors coming from the 
        // ahb package:
        var reporter_rf : rf_struct = 

          rf_manager.get_struct_of_instance(source_struct()
);
        if reporter_rf.get_package().get_name() == "ahb" {
            out(append("xxxxxx another bug in AHB package, ",
                           "\nreported ", source_location()));
        }; 
    };

These are just two examples of ways to extend the dut_error_struct, for implementing advanced verification utilities.

Additional examples can be downloaded from github-spmn-dut_error. Please try it out, and see if it cannot help you adjust and improve your verification methodology and requirements.

Efrat Shneydor,

Specman team


Viewing all articles
Browse latest Browse all 652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>