In reply to sasi_8985:
In reply to Desam:
class a;
parameter N = 10; //no of slaves
parameter width = 4;
int slaves_width[N];
rand int unsigned add[N],end_[N];
constraint unique_add { unique{add};}
constraint size { foreach(end_[i])
end_[i] == add[i] + this.slaves_width[i]; }
function void pre_randomize( int slaves_width[N] );
// this is to take width of slaves before
//hand
foreach(slaves_width[i])
this.slaves_width[i] = slaves_width[i];
endfunction
endclass
module tb;
a a1;
int aa[10] = '{10{4}};
initial
begin
a1 = new;
a1.pre_randomize(aa);
a1.randomize;
$display("%p *** %p",a1.add,a1.end_);
end
endmodule
BUT I am sure there is an other way which i am not aware of. lets wait and see.
and one more thing i would like to generate 10 address according to my restriction means i have some restricted address list how to perfom this this.
for exaple i would like to generate 10 random slave slave address from 40 to 50