System Verilog : Rand & Randc

There are two type-modifier keywords available in system Verilog to declare class variable as random.

Variables declared with the rand keyword are standard random variables. Their values are uniformly distributed over their range.

Variables declared with the randc keyword are random-cyclic variables that cycle through all the values in a random permutation of their declared range.

In the above code all names are declared as rand (students_r) and randc (students_rc).

Randomization result for students_r and students_rc are shown above. In this we can see that students_rc (randc) cycle through all the values in a permutation.

Another example to show that randc cycle through all the values in a permutation.

Leave a Reply

Your email address will not be published. Required fields are marked *