Constraining address for the memory making sure the Offset is not within the previous memory regions

In reply to prashanthiyer90:
You will need to build a database of used addresses and make sure that each address in not withing the new range you want add.

module top;
  class A;
    rand int unsigned start,size;
    int used[$];
    constraint c{0<size;size<5;start<20;
       foreach(used[addr])!(used[addr] inside {[start:start+size-1]});}
    function void post_randomize();
       for(int addr = start; addr<(start+size); addr++)
         used.push_back(addr);
       used.sort(); // makes display easier to read
    endfunction
  endclass
  A h = new;
  initial repeat(15) begin
    if (!h.randomize) $error("no more space to write");
    $display("%p",h);
  end
endmodule : top