sas73 Posted January 22, 2019 Report Share Posted January 22, 2019 What is the preferred way to verify that a verification component calls uvm_error when it's supposed to without that error causing an error for my test? I know about SVUnit and its mocking capabilities but is it a way to do this within UVM? Quote Link to comment Share on other sites More sharing options...
David Black Posted January 22, 2019 Report Share Posted January 22, 2019 I would do something I've previously done with SystemC (where uvm_error hails from). Basically, replaced the report handler with my own intercept to recategorize errors. Then added a mechanism to register "expected" errors, warnings, fatals. Prior to a point where an error was going to be injected, I would issue something like: begin_expect_error( "packet failure", 2 ); inject_error( ... ); wait_for_appropriate_time_or_event(); end_expect_error( "packet failure" ); If the report handler sees up to two errors, I would change the message severity to INFO and count off the expected error. At the end_expect_error call, I would check that exactly the number of expected errors occurred or consider it an error. Also, have to consider the possibility of the end_ call never happening. Quote Link to comment Share on other sites More sharing options...
sas73 Posted January 23, 2019 Author Report Share Posted January 23, 2019 Thanks for the reply David. This is similar do what has been done in SVUnit. They provide their own UVM reporter and redefine `uvm_error to call that instead. I was hoping that UVM already had a more built-in mechanism for intercepting messages. If so, I could simply put the intercepted messages in a queue, verify that the queue contains the messages I expect and then pass/fail the test accordingly. I have to dig deeper and learn more but I was hoping that there would be a UVM action I can use or maybe uvm_report_catcher which by the name of it sounds related. Maybe these concepts can't be used for what I'm trying to do? Quote Link to comment Share on other sites More sharing options...
kirloy369 Posted January 24, 2019 Report Share Posted January 24, 2019 maybe uvm_report_catcher is what you need http://www.vlsiencyclopedia.com/2016/10/build-smart-tests-using-uvm-report-catcher.html David Black 1 Quote Link to comment Share on other sites More sharing options...
sas73 Posted January 24, 2019 Author Report Share Posted January 24, 2019 Thanks @kirloy369! Looks more UVM idiomatic. Doesn't necessarily make it a better solution that what has been proposed before but I wanted to start by trying out how it was intended to be done. Quote Link to comment Share on other sites More sharing options...
dave_59 Posted January 24, 2019 Report Share Posted January 24, 2019 Give your error message a unique ID. Use set_report_severity_id_override to change the severity of that ID from UVM_ERROR to UVM_INFO. Then call get_id_count at the end of your test to make sure it's non-zero. Quote Link to comment Share on other sites More sharing options...
sas73 Posted January 24, 2019 Author Report Share Posted January 24, 2019 Thanks @dave_59. That would be the easiest way but in my case I want to verify that the message fields are what I expect, not only that a report has been produced. I ended up pushing the report message to a queue and then pop it in my test to verify the fields. Quote Link to comment Share on other sites More sharing options...
David Black Posted January 26, 2019 Report Share Posted January 26, 2019 @kilroy369 I had forgotten that one. Much better suggestion. Same basic idea. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.