Constraint

Example:

class packet;
  rand bit [3:0] addr;
 
  constraint addr_range { addr dist { [1:7] := 0,[8:15] := 1 }; }
endclass
 
module constr_dist;
  initial begin
    packet pkt;
    pkt = new();
    $display("------------------------------------");
    repeat(10) begin
      pkt.randomize();
      $display("\taddr = %0d",pkt.addr);
    end
    $display("------------------------------------");
  end
endmodule

when I randomizing I don’t want to 1 to 7 values i.e. the weight of “1” to “7” is set to “zero” I want only 8 to 15 in cyclic order. i.e. the weight set to “one”

but output get I am not expecting. Please suggest me correct way.