Cover all cases of comparing two values in functional coverage

Is there a better way to implement a covergroup to cover these cases?


module tb;
  bit[1:0] x, y;
  covergroup cg;
    x_ls_y : coverpoint x iff (x <  y);
    x_eq_y : coverpoint x iff (x == y);
    x_lg_y : coverpoint x iff (x >  y);
  endgroup : cg
  cg cg_i0 = new();
  initial begin
    for (int i = 0; i < 16; i++) begin
      #1 {x, y} = i;
      cg_i0.sample();
    end
  end
endmodule : tb

In reply to Taher Anaya:

What you wrote does not work because there is no way to get 100% coverage. Each coverpoint creates four bins for x equals 0,1,2,3 for a total of 12 bins. But you cannot hit the bin x = 3 for coverpoint x_ls_y, nor can you hit the bin x=0 for coverpoint x_lg_y. The highest coverage you can get is 10/12 = 83.33%.

If you want all permutations of x and y you can concatenate them together or use a cross

 covergroup cg;
    x_concat_y : coverpoint {x,y};
    x_cross_y : cross x,y; // same as above
 endgroup : cg

If your intent is really to cover just three distinct cases, then you would write
covergroup cg;
x_ls_y : coverpoint x < y { bins true = {1}; }
x_eq_y : coverpoint x == y { bins true = {1}; }
x_lg_y : coverpoint x > y { bins true = {1}; }
endgroup : cg