Ask for help on randomization constraint

We have a requirement like below.
If we have a 5K memory space and every time we can randomly select a successively space with the size = 100. But we can not allocate the overlap memory space. May I know what’s the best way to implement it in constraint ?

In reply to zz8318:



//We have a requirement like below.
//If we have a 5K memory space and every time we can randomly select a successively space with the size = 100. But we can not allocate the overlap memory space. May I know what's the best way to implement it in constraint ?


class goalie;
  
  rand int start_addr;
  rand int end_addr;
  rand int mem_block[500];
  rand int block;
  rand int block_start;
  rand int block_end;
  
  
  int  mem_track[500];
  
  constraint ab {
  block == 100;
  start_addr ==0;
  end_addr ==500;  
    block_start inside {[0:499]}; 
  block_end < end_addr;
  block_start > start_addr;
  block_end == block_start+block-1; 
    foreach (mem_track[i]) {
      if (mem_track[i]==i) block_start !=i; 
      if (mem_track[i]==i) block_end !=i;
    }
    
  }
  
  
  function void post_randomize();

    for (int i=block_start;i<=block_end;i++) begin
    mem_track[i] = i; 
    end
      
  endfunction
  
endclass
                    
                    
 module tb;
   
   goalie g1;
   
   initial
     begin
       g1 = new;
       repeat (3) begin
       if (!g1.randomize()) $display ("Erorr");
       $display ("block_start %d, block_end %d",g1.block_start,g1.block_end);
         $display ("start_addr %d, end_addr %d",g1.start_addr,g1.end_addr);
       end
       
     end
   
 endmodule