Assertions control from OVM

Is there any way to use ovm’s report handler’s features (error count, methods etc) and assertion together.

My requirement is :

  1. control the assertion warning/errors from test cases which are dynamic (random) in nature (not fixed @ 0 time).
  2. Get assertion error counted in the total ovm error count.
  3. Bypass error in case of certain conditions (errorneous scenario).

As OVM is using SV, and SV has power of assertion, we can’t separate out assertion from methodology. I refer OVM refernce and User Guide but not able to find any good material on this.

Right now, I have impletented control as (top.xyz_if.assert_1_disable = 1) way from test case, which is of course the weird way, and there is no methodology used (I don’t know!!) .

Your inputs are highly appreciated.

Regards,
Kinjal Shah

Hi Kinjal,

Are you hoping to issue immediate assertions with the OVM report handler? Something like the following should work OK and will allow you to use the +OVM_SEVERITY and +OVM_VERBOSITY run time options to control the messages/actions:

task run();
  ...
  asset (tx.addr > 100) else
    ovm_report_warning("DRIVER","Address is not greater than 100");
  ...
endtask

Hope that answers your question.

Regards,
Dave

Thanks Dave.

I analyzed your solution.

First of all, We have protocol checkers with Concurrent Assertions.

Even for Immediate assertions, if I go ahead with suggested solution to check for all then I need to have all those assertions in the fork-join with “forever” which suggests as no. of fork as no. of assertions required in the run() with “forever”!

Clearly, its difficult to adopt this implementation as SV LRM already gives better solution to implement assertion in the Interface, modules without any fork-join and task complexity.

Also, implementing all protocol level assertions in the task will surely decrease the performance which is again the major set back.

Regards,
Kinjal Shah

Hi Krinjal,

If you want to use the OVM reporting mechanism to manage the messages from concurrent assertions, that is also possible - just include the ovm_pkg in the module/interface where your assertions are written, e.g.

module chip(chip_if.chip dut_if);

import ovm_pkg::*;

property P1;
 ...
endproperty

assert property (@(posedge dut_if.clk) P1) else
  ovm_top.ovm_report_warning("DUT","Property P1 failed");

...
endmodule

Regards,
Dave

I got the hint from this and it works.

Thanks,
Kinjal

  1. Get assertion error counted in the total ovm error count.

Were you able to do this? I can get the messaging to work as Dave described, but can’t figure out how to increment the severity counts

Thanks,
Stefan

I am using very similar structure to the xbus example in OVM library using Questsim. I tried following above example and for some reason, that import statement instantiates new ovm library on top of the one that is used (amazingly keeping the same class names too!). Due to difference in the ovm_top (one from your original code and the new one generated by ovm_pkg) the severity count does update but not on the correct module (updates new ovm_pkg’s severity count).

I was able to solve this problem by including the interfaces later than mymodule.svh which loads ovm.svh in the top file. For example in xbus case, following is snippnet of xbus_if_top.sv.

include "dut_dummy.v" include “xbus_if.sv”

module xbus_tb_top;

include "xbus.svh" include “test_lib.sv”

changing above to following fixed the problem for me. Merely moving if down to the bottom of the include list.

`include “dut_dummy.v”

module xbus_tb_top;

include "xbus.svh" include “test_lib.sv”
`include “xbus_if.sv”

Then import ovm_pkg is not necessary. Also it does not instantiate new ovm library which will consume extra memories in your simulation. And the severity count works!

I can’t say this will work for everyone but wanted to share what I found out today.

Regards,
Hong

How to control the enable/disable the assertions from the ovm testcases?