Turn of all the members from randomization except few which i'm interested?

Guys,

An object has 100s of members, I wanted to turn of all the members from randomization except few which i’m interested in?

Is that any inbuilt mechanism to do ?

Otherwise I have to manually turn them off… using rand_mode (0)

John

In reply to John Verif:

we can use constraints for that members in an object and randomize it.

In reply to John Verif:

You can call randomize() with an explicit list of member variables you want randomized, ignoring the current rand_mode() settings.

See section 18.11 In-line random variable control

In reply to John Verif:

John,
You could use rand_mode(0) on entire object and then turn the select few ON via rand_mode(1).

Pseudo-code below;

HTH
Srini
http://www.verifworks.com


class c;
  rand bit [3:0] b1, b1, b..100;
endclass : c

module m;
  c c_0;

  initial begin : test
    c_0 = new();
    c_0.rand_mode(0); // TURN OFF all
    c_0.b1.rand_mode(1);
    if !(c_0.randomize()...

  end : test
endmodule : m