ljepson74 Posted April 28, 2019 Report Share Posted April 28, 2019 *, How can I randomize with a dist and specify a weight for values not being inside a range? class randclass; rand logic [3:0] randvalue; function void post_randomize(); $display("value: %0d",randvalue); endfunction constraint inside_practice { randvalue dist { [3:4] :/ 50, !(inside {[3:4]}) :/ 50 //<--- I try to have a sort of 'others' category here }; } endclass module top; randclass randclass; initial begin randclass = new(); repeat (10) begin randclass.randomize(); end $finish(); end endmodule Reference: https://www.edaplayground.com/x/cV5 shaking off the rust after a SystemVerilog hiatus, thanks Quote Link to comment Share on other sites More sharing options...
dave_59 Posted April 29, 2019 Report Share Posted April 29, 2019 https://verificationacademy.com/forums/systemverilog/distributed-weightage-constraint#reply-46525 Quote Link to comment Share on other sites More sharing options...
lbodrozic Posted October 9, 2019 Report Share Posted October 9, 2019 @dave_59 The link you posted as an answer here points to a question about distributed weighting. I think maybe the link is for the wrong post? Anyway, I am quite interested if there is a way to do what the OP is asking about. Quote Link to comment Share on other sites More sharing options...
dave_59 Posted October 11, 2019 Report Share Posted October 11, 2019 The link answers the question on how to apply a distribution to any set of constraints. The dist construct only works with explicit values. 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.