General

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.

1 Comment

1 Comment

  1. kishore

    December 24, 2017 at 11:04 pm

    Superb Explanation.
    I tried to learn System verilog long before.
    I had lot of doubts.
    Even after searching several web, my doubts never cleared.
    If i have seen your post several years before, i would have benefited a lot.
    There would have been a change in my career.

    All Post super………………….

Leave a Reply

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

Most Popular

VLSI Pro is a professional network of VLSI engineers. Here you can find latest news, helpful articles and more on VLSI technology.

Copyright © 2016 VLSI Pro

To Top