Probability on Constraint in SystemVerilog

In reply to Moein75:

Hi, I guess it’s happening because the range is not constant inside that constraint. Again I am not sure. It’s my assumption. I tried to change a few things and it’s working now properly. Please go through it.


class TransactionIn ;
  
//-------------------The random variables
    rand int rl[256];
//--------------------------------------
  
	constraint num_FAS {
      
        foreach(rl[i])        
			rl[i] inside {[0:1]};
      
        foreach(rl[i])
          i<220 -> rl[i] -> rl[i+1]==1 && rl[i+2]==1 &&rl[i+3]==1; 
		  
        rl[254]==0;
      
        rl.sum() < 32;
                      }
endclass 

module example2;
TransactionIn a;
    initial begin
        a = new();
        assert(a.randomize());
      $display("%0p",a.rl);
    end
endmodule