How to switch off assertions (selectively) present inside generate block instances?

There are some assertions present inside a generate block.
top_tb.dut.inst1.chkr_gen[0].assert1/2/3
top_tb.dut.inst1.chkr_gen[1].assert1/2/3

top_tb.dut.inst1.chkr_gen[7].assert1/2/3

For a certain scenario I intend to switch off only one assertions (say assert1) present in all the generate instances.
i.e., top_tb.dut.inst1.chkr_gen[0].assert1, top_tb.dut.inst1.chkr_gen[1].assert1 and so on.

When I do a assertoff independently with the complete path, it is working fine. But when I try to do that using a ‘for’ loop to simplify the code, compilation error is reported. How can I resolve this issue?

        
string asrt_hier;
for(int i=0; i<7; i++) begin
   asrt_hier = $sformatf("top_tb.dut.inst1.chkr_gen[%0d].assert1",i);
   $display("asrt_hier is: %0s", asrt_hier);
   $assertoff(0, $sformatf("top_tb.dut.inst1.chkr_gen[%0d].assert1",i)); //Option-1
   $assertoff(0, asrt_hier);  // Option-2 
end

Same error is reported for both the options:
Error-[WRONGARGCNTRLTASK] Illegal argument of control task
Argument of SVA control task should be module, hierarchical instance or assertion for the 2nd argument.

In reply to S.P.Rajkumar.V:

You are trying to use a string where a hierarchical path is expected. This is not legal.

Try using a generate loop.

In reply to cgales:
Hi cgales,

Thanks for the quick reply. I have also tried with generate:


generate
  initial begin 
    for(int i=0; i<3; i++) begin
        $assertoff(0, top_tb.dut.inst1.chkr_gen*.assert1);
    end
  end
endgenerate

and this is the error that gets reported with generate. But please note that, when I use an explicit path with chkr_gen[0]/[1]…[7] it is working perfectly fine. So, I believe it is not a cross-module reference resolution error.

[i]Error-[XMRE] Cross-module reference resolution error
*…/filname.sv, 376
Error found while trying to resolve cross-module reference.
token ‘chkr_gen’. Originating module ‘top_tb’, first module hit ‘top_tb’.
Source info: $assertoff(0, top_tb.dut.inst1.chkr_gen[i].assert1);

In reply to S.P.Rajkumar.V:

This would seem to be a tool issue. I recommend contacting your tool vendor to see if they can provide a solution for the Cross-module reference resolution error.

In reply to cgales:

Thanks for the update. I also tried the following and it seems like $assertoff doesn’t understand the usage of the wild cards in the hierarchical path.

$assertoff(0, top_tb.dut.inst1.chkr_gen*.assert1);

Could you let me know if this is a valid usage? I didn’t see any similar usage/examples in LRM.

In reply to S.P.Rajkumar.V:

You can specify a list of assertions, but wildcards are not permissible.