XOR in assertion property

In reply to Junior:

working as expected for me


module test();
 bit clk;
 bit en;
 bit [3:0] a[8];
 bit [3:0] b, exp_b[8];
 bit [2:0] idx, idx_xor;

  initial begin
    forever #5 clk = !clk;
  end

  assign idx_xor = idx^b;
  
  initial begin
    a['b000^'b000] = 'b000;  //a[0]=0
    a['b001^'b010] = 'b010;  //a[1]=2
    a['b011^'b001] = 'b001;  //a[2]=1
    a['b100^'b011] = 'b011;  //a[7]=3
 // a['b101^'b010] = 'b010;  //a[7]=2

    //a['b000^'b000] = 'b000;  //a[0]=0
    @(posedge clk);
    en  <= 1;
    idx <= 'b000;
    b   <= 'b000;
    
    //a['b001^'b010] = 'b010;  //a[1]=2
    repeat(2)@(posedge clk);
    idx <= 'b001;
    b   <= 'b010;
    
    //a['b011^'b001] = 'b001;  //a[2]=1
    repeat(2)@(posedge clk);
    idx <= 'b011;
    b   <= 'b001;

    //Assertion failure expected
    repeat(2)@(posedge clk); 
    idx <= 'b011;
    b   <= 'b110;
    $display("Assertion failure expected : idx='b011, b='b110");
    
    //a['b100^'b011] = 'b011;  //a[7]=3
    repeat(2)@(posedge clk);
    idx <= 'b100;
    b   <= 'b011;
    
    repeat(2)@(posedge clk);
    en <= 0;
    #50 $finish;
  end

  ap: assert property(checker(clk,en,a,b,idx));

  property checker(clk,enable,a,b,idx);
     @(posedge clk) 
     (enable, $display("%t idx=0x%x, b=0x%x, a[idx^b]=0x%x",$time, $sampled(idx), $sampled(b), a[$sampled(idx)^$sampled(b)])) 
     |-> a[idx^b] == b;
  endproperty:checker

endmodule

/*
OUTPUT:
                  15 idx=0x0, b=0x0, a[idx^b]=0x0
                  25 idx=0x0, b=0x0, a[idx^b]=0x0
                  35 idx=0x1, b=0x2, a[idx^b]=0x2
                  45 idx=0x1, b=0x2, a[idx^b]=0x2
                  55 idx=0x3, b=0x1, a[idx^b]=0x1
Assertion failure expected : idx='b011, b='b110
                  65 idx=0x3, b=0x1, a[idx^b]=0x1
                  75 idx=0x3, b=0x6, a[idx^b]=0x0
"testbench.sv", 53: test.ap: started at 75ns failed at 75ns
	Offending '(a[(idx ^ b)] == b)'
                  85 idx=0x3, b=0x6, a[idx^b]=0x0
"testbench.sv", 53: test.ap: started at 85ns failed at 85ns
	Offending '(a[(idx ^ b)] == b)'
                  95 idx=0x4, b=0x3, a[idx^b]=0x3
                 105 idx=0x4, b=0x3, a[idx^b]=0x3
*/