Jump to content

Recommended Posts

Posted

Hi

I have a class like this

     class A ;
           int a;
           a dist {1:=10,2:=5,3:=6}
      endclass
which type of randomization would give best distribution of the random values

Type 1:

    A rand_obj;
    for(int count = 0;count <100;count++) begin
        rand_obj = new()
        rand_obj.randomize();
    end        
Type2:

    A rand_obj,rand_obj2;
    rand_obj = new();
    for(int count = 0;count <100;count++) begin
        rand_obj.randomize();
        rand_obj2 = rand_obj.deep_copy();
    end        
My understanding is as follows

Type 2 would give better constraint coverage(meaning distribution) but overriding is a pain

I have two questions

1.Which one is better ?

2.What does the macro `uvm_do implements (Is is the anyone above or some thing else) ?

cheers

Prabhu.G

Posted

If you have a cyclic randc variable (btw you forgot to declare a as rand), only type 2 will work. As far as distributions are concerned, it should not matter. Solutions are produced based on probabilities without considering previous results. Type 2 is also good if you have non-rand state variables that are used in your constraints.

If you mean type 2 is harder to do factory overrides dynamically, yes that is true.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...