gbbrown Posted May 20, 2013 Report Share Posted May 20, 2013 Is there a way to make the randomization of variables via randomize() use one of the different RNGs listed in 20.15 of the IEEE Std 1800 (such as $dist_normal or others)? Or does the use of one of the alternative RNGs require manually doing randomization via direct calls to those utility functions ($dist_normal, etc) in the post_ or pre_randomize() functions? Greg Quote Link to comment Share on other sites More sharing options...
dave_59 Posted May 21, 2013 Report Share Posted May 21, 2013 Try putting the dist_normal in a function used by a constraint. class A; int seed = $urandom; int tmp; rand int ii; rand int mean; constraint c{ii == normal(mean);} function int normal(int mean); return $dist_normal(seed, mean,10); endfunction constraint mn {mean inside {[200:400]};}endclass : A A a = new; initial repeat(10) begin int tmp; a.randomize(); tmp = a.seed; $display("%p %d",a, $dist_normal(tmp,a.mean, 10)); endendmodule : top Dave Rich Mentor Graphics Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.