How to disable immediate assertions inside class?

In reply to MayurKubavat:
You’re correct, I don’t know why this is tool dependent.
The following worked on another tool
$assertoff(0, test.checkB.BB.CHECKB); // 34

On the immediate assertion in a class, I believe that the $assertcontrol $assertoff) is not supported, and that makes sense for the following reasons:

  • Concurrent assertions are not allowed in classes
  • The simulator creates a database for each assertion to manage its status and state; that includes things like started, pass/fail, success/fail count, strong/weak, etc.
  • That database is done at elaboration time.
  • Adding to that database the immediate assertions that are created dynamically (i.e., from class instances) is complicated.

Adding a switch seem to be only possible solution for this.

correct.


class A;
	bit a = 0, assertion_enb;

	task checkA;
		//begin : cc // not needed
			#10ns;
			if (assertion_enb && !a) // CHECK: assert(a == 1) 
			//		$display($time, "Check on A passed"); 
			//	else
					$display($time, "Check on A failed");
		//end
	endtask
endclass
 

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr